CVE-2020-8927: Brotli Library Buffer Overflow
Summary
CVE-2020-36846: A buffer overflow exists in the Brotli library versions prior to 1.0.8 where an attacker controlling the input length of a "one-shot" decompression request to a script can trigger a crash, which happens when copying over... Affects brotli versions < 1.0.8. Fixed in 1.0.8. How to fix ↓
Also tracked for
- powershell · Bitnami
- github.com/google/brotli · Go
- dotnet-sdk · Bitnami
- dotnet · Bitnami
- brotli · Bitnami
- brotli-sys · crates.io
- compu-brotli-sys · crates.io
- brotli · Alpine:v3.12
The same CVE-2020-36846 is tracked separately for each ecosystem and vendor. Its fix information is the same; the package and affected versions differ.
Check if this vulnerability affects your application
Upload a manifest or SBOM and we'll show whether you're affected, plus every other risky package in the same scan.
No signup required · Results in about 60 seconds
Background
The Brotli library is a compression algorithm developed by Google. It is widely used for compressing data in various applications and libraries. The library provides both a "one-shot" API and a "streaming" API for decompression. The vulnerability in the Brotli library versions prior to 1.0.8 allows an attacker to trigger a buffer overflow by controlling the input length of a "one-shot" decompression request. This can lead to a crash when copying over chunks of data larger than 2 GiB.
Vulnerability Detail
The buffer overflow vulnerability in the Brotli library arises due to improper handling of input length in a "one-shot" decompression request. By manipulating the input length, an attacker can cause the library to copy chunks of data larger than 2 GiB, resulting in a buffer overflow. This can lead to a crash of the application using the library. The impact of this vulnerability can vary depending on the context in which the library is used. In some cases, it may allow an attacker to execute arbitrary code or cause a denial-of-service condition.
How To Fix
Latest published version: 1.2.1 as of 22 Oct 2026
pip install --upgrade "brotli==1.2.1"
Upgrading to it may include breaking changes; the version below is the minimum fixed release for this vulnerability.
If you need the minimum change
1.0.8
This is the first release that contains the fix.
pip install --upgrade "brotli==1.0.8"
Tip — Not sure which version your app runs? Vulert can match this fix to it. Scan free →
Workaround
If updating the Brotli library is not feasible, using the "streaming" API instead of the "one-shot" API can provide a workaround. By using the "streaming" API, the decompression process can be divided into smaller chunks, reducing the risk of triggering the buffer overflow. Here is an example of using the "streaming" API in Python:
import brotli
def decompress_data(data):
decompressor = brotli.Decompressor()
output = b''
for chunk in data:
output += decompressor.process(chunk)
output += decompressor.finish()
return output
In this example, the data is decompressed in smaller chunks using the process() method of the decompressor object.
Conclusion
The buffer overflow vulnerability in the Brotli library can be mitigated by updating to version 1.0.8 or later. If updating is not possible, using the "streaming" API and imposing chunk size limits can provide a workaround. It is important to take action to protect systems and applications that use the Brotli library. For further support on vulnerability remediation, you can reach out to DevNack.com.
See every vulnerability recorded for brotli →
FAQ
The Brotli library is a compression algorithm developed by Google. It is designed to provide high compression ratios while maintaining fast decompression speeds.
The vulnerability affects Brotli library versions prior to 1.0.8.
The impact of this vulnerability can vary depending on the context in which the library is used. It may allow an attacker to execute arbitrary code or cause a denial-of-service condition.
To fix this vulnerability, it is recommended to update the Brotli library to version 1.0.8 or later. Alternatively, you can use the "streaming" API instead of the "one-shot" API and impose chunk size limits.
Yes, if updating the Brotli library is not feasible, you can use the "streaming" API instead of the "one-shot" API. This can help mitigate the risk of triggering the buffer overflow.
Related vulnerabilities
Recent vulnerabilities recorded for brotli.