Why compression insecure over HTTPS

Tanul 1,251 Reputation points
2021-01-20T17:32:41.217+00:00

Team,

I have made an API in .net core 3.1 and in the startup.cs, I have added brotli compression. It is working fine but in docs, I found this note saying that compression over HTTPS is insecure

Can anyone please explain the reason behind that. Unable to understand details of CRIME and BREACH.

The network latency is reduced with compression due to which it is difficult for me to avoid it. Any suggestions please

Thank you

.NET Runtime
.NET Runtime
.NET: Microsoft Technologies based on the .NET software framework.Runtime: An environment required to run apps that aren't compiled to machine language.
1,135 questions
0 comments No comments
{count} votes

Accepted answer
  1. Andriy Bilous 10,996 Reputation points MVP
    2021-01-20T20:57:49.077+00:00

    Hello @Tanul
    You are right, using compression with dynamically generated pages can lead to security problems such as the CRIME and BREACH attacks.

    Description of CRIME
    -The TLS protocol 1.2 and earlier, as used in Mozilla Firefox, Google Chrome, Qt, and other products, can encrypt compressed data without properly obfuscating the length of the unencrypted data, which allows man-in-the-middle attackers to obtain plaintext HTTP headers by observing length differences during a series of guesses in which a string in an HTTP request potentially matches an unknown string in an HTTP header.

    -It relies on the attacker being able to observe the size of the ciphertext sent by the browser while at the same time inducing the browser to make multiple carefully crafted web connections to the target site. The attacker then observes the change in size of the compressed request payload, which contains both the secret cookie that is sent by the browser only to the target site, and variable content created by the attacker, as the variable content is altered. When the size of the compressed content is reduced, it can be inferred that it is probable that some part of the injected content matches some part of the source, which includes the secret content that the attacker desires to discover. Divide and conquer techniques can then be used to home in on the true secret content in a relatively small number of probe attempts that is a small multiple of the number of secret bytes to be recovered.
    https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2012-4929

    Description of BREACH
    -It is an instance of the CRIME attack against HTTP compression—the use of gzip or DEFLATE data compression algorithms via the content-encoding option within HTTP by many web browsers and servers.
    -The HTTPS protocol, as used in unspecified web applications, can encrypt compressed data without properly obfuscating the length of the unencrypted data, which makes it easier for man-in-the-middle attackers to obtain plaintext secret values by observing length differences during a series of guesses in which a string in an HTTP request URL potentially matches an unknown string in an HTTP response body.
    https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2013-3587

    1 person found this answer helpful.

0 additional answers

Sort by: Most helpful