CVE-2020-8927: Buffer Overflow in Brotli Library in Bitnami .NET
Summary
CVE-2020-36846: Buffer overflow in Brotli library. Affects dotnet versions >= 5.0.0, < 5.0.15. Fixed in 5.0.15. How to fix ↓
Also tracked for
- powershell · Bitnami
- github.com/google/brotli · Go
- dotnet-sdk · Bitnami
- brotli · Bitnami
- brotli-sys · crates.io
- compu-brotli-sys · crates.io
- brotli · Alpine:v3.12
- brotli · PyPI
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
Bitnami .NET is a package that provides a development environment for building applications using the .NET framework. It includes various tools and libraries to facilitate the development process. One of the libraries included is the Brotli library, which is used for compression and decompression of data. The Brotli library versions prior to 1.0.8 are vulnerable to a buffer overflow issue.
Vulnerability Detail
The vulnerability (CVE-2020-8927) in the Brotli library allows an attacker to trigger a crash by controlling the input length of a "one-shot" decompression request to a script. This crash occurs when copying over chunks of data larger than 2 GiB. The impact of this vulnerability can lead to denial of service (DoS) attacks or potential remote code execution. It is recommended to update the Brotli library to version 1.0.8 or later. Alternatively, using the "streaming" API instead of the "one-shot" API and imposing chunk size limits can mitigate the risk.
How To Fix
Minimum fixed version
5.0.15
This is the first release that contains the fix.
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, a workaround is to switch to using the "streaming" API instead of the "one-shot" API. This can be done by modifying the code to use the appropriate API calls. Additionally, developers should impose chunk size limits to prevent the buffer overflow. Here is an example of how to use the streaming API in C#:
// Create a Brotli decompressor
var decompressor = new BrotliDecompressor();
// Create a buffer to hold the decompressed data
var buffer = new byte[4096];
// Read the compressed data from the input stream
var compressedData = ReadCompressedData();
// Create a MemoryStream to hold the decompressed data
using (var decompressedStream = new MemoryStream())
{
// Create a BrotliStream with the decompressed stream and the decompressor
using (var brotliStream = new BrotliStream(decompressedStream, CompressionMode.Decompress, true))
{
// Read the compressed data into the buffer and write it to the BrotliStream
brotliStream.Write(compressedData, 0, compressedData.Length);
}
// Get the decompressed data from the MemoryStream
var decompressedData = decompressedStream.ToArray();
}
Conclusion
The buffer overflow vulnerability in the Brotli library (CVE-2020-8927) poses a risk to applications using the Bitnami .NET package. It is crucial to update the Brotli library to version 1.0.8 or later to mitigate the vulnerability. Alternatively, switching to the "streaming" API and imposing chunk size limits can also help prevent the buffer overflow. For further assistance and support in addressing this vulnerability, please contact DevNack.com.
See every vulnerability recorded for dotnet →
FAQ
Bitnami .NET is a package that provides a development environment for building applications using the .NET framework. It includes various tools and libraries to facilitate the development process.
The Brotli library is a compression and decompression library developed by Google. It is designed to provide better compression ratios and faster decompression compared to other compression algorithms.
A buffer overflow occurs when a program writes data beyond the boundaries of a buffer, leading to memory corruption and potential security vulnerabilities. In this case, the buffer overflow can be triggered by an attacker controlling the input length of a decompression request.
The vulnerability can lead to denial of service (DoS) attacks or potential remote code execution. An attacker can trigger a crash by sending a specially crafted decompression request, potentially disrupting the availability of the affected application or gaining unauthorized access.
You can use Vulert's playground (https://vulert.com/scanner) to check if your application is affected by this vulnerability. Simply upload your manifest file (e.g., package-lock.json) and Vulert will analyze it in real-time to identify any open-source vulnerabilities, including this specific issue.
Related vulnerabilities
Recent vulnerabilities recorded for dotnet.