0

HTTPS is supposedly a secure protocol for data exchange.

I'm wondering upon a page request, if I outputted data to the client at a different gzip compression level (over the HTTP protocol) each time, would that still be as secure as HTTPS since the raw compressed data (which to humans is garbage) actually being fed to the client is different each time, yet the browser will decompress it perfectly.

Here's an example of what I mean in code. Assume this code forms index.php and the client enters in the same URL every time to access index.php. Here's the code:

<?php
$output="<p>This is a test HTML page to be encoded at a different compression level every time</p>";
$compressed=gzencode($output,rand(1,9));
echo $compressed;
?>

I mean If its feasible and won't wreck my time-to-first-byte too much, I'd rather take this method than to force users to install certificates just to run my site over HTTPS.

1
  • This is the worst security proposal I've heard in some time. Steffen's answer is spot on. Random gzip compression level will in no way increase security, it will just slow down your server. Commented Jul 9, 2016 at 9:53

1 Answer 1

3

Data compressed with gzip contain all the information needed to decompress the data. This means an attacker can simply decompress the data, same as the browser. So this is no more secure than plain text. And the compression level in gzip is actually irrelevant for decompression since it only says how much efforts will be done in finding common pattern in the input to get the best compression ratio.

raw compressed data (which to humans is garbage)

It does not matter if it looks like garbage for most humans. A technical person looking at the traffic will easily see that these are compressed data because the HTTP response actually says this ("Content-Encoding: gzip", without this header the browser will not decompress it) and the data contain the typical gzip header.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.