CVE-2020-8927: Brotli Library Buffer Overflow in Bitnami dotnet-sdk
Summary
CVE-2020-36846: Buffer overflow in Brotli library. Affects dotnet-sdk 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 · 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
The Bitnami dotnet-sdk is a software development kit (SDK) that provides tools and libraries for developing .NET applications. It includes the Brotli library, which is used for data compression and decompression. Brotli is vulnerable to a buffer overflow issue in versions prior to 1.0.8. This vulnerability allows an attacker to trigger a crash by controlling the input length of a "one-shot" decompression request to a script. The crash occurs when copying over chunks of data larger than 2 GiB.
Vulnerability Detail
The buffer overflow vulnerability in the Brotli library can be exploited by an attacker to cause a crash in the dotnet-sdk application. This can lead to a denial-of-service (DoS) condition, impacting the availability of the application. The vulnerability can be triggered by sending a specially crafted input length to a decompression script. To mitigate the risk, 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 also help mitigate the vulnerability.
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
A possible workaround for this vulnerability is to use the "streaming" API instead of the "one-shot" API and impose chunk size limits. This can be done by modifying the code that interacts with the Brotli library to use the streaming API and set appropriate chunk size limits. Here is an example of how to use the streaming API in C#:
// Create a Brotli decompressor
using (var decompressor = new BrotliStream(input, CompressionMode.Decompress))
{
// Set the chunk size limit
decompressor.SetChunkSizeLimit(chunkSizeLimit);
// Read and process the decompressed data
byte[] buffer = new byte[bufferSize];
int bytesRead;
while ((bytesRead = decompressor.Read(buffer, 0, buffer.Length)) > 0)
{
// Process the decompressed data
ProcessData(buffer, bytesRead);
}
}
Conclusion
The Brotli library in the Bitnami dotnet-sdk is vulnerable to a buffer overflow issue. To mitigate the risk, 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 help mitigate the vulnerability. For further support on vulnerability remediation, please contact DevNack.com.
See every vulnerability recorded for dotnet-sdk →
FAQ
The vulnerability allows an attacker to trigger a crash in the dotnet-sdk application, leading to a denial-of-service (DoS) condition. This can impact the availability of the application.
To mitigate the risk, 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 also help mitigate the vulnerability.
Yes, a possible workaround is to use the "streaming" API instead of the "one-shot" API and impose chunk size limits. This can help mitigate the vulnerability without updating the Brotli library.
To update the Brotli library, you need to update the dotnet-sdk package to a version that includes the updated Brotli library. Check the documentation or release notes of the dotnet-sdk package for instructions on how to update.
Yes, here is an example of how to use the streaming API in C#:
// Create a Brotli decompressor
using (var decompressor = new BrotliStream(input, CompressionMode.Decompress))
{
// Set the chunk size limit
decompressor.SetChunkSizeLimit(chunkSizeLimit);
// Read and process the decompressed data
byte[] buffer = new byte[bufferSize];
int bytesRead;
while ((bytesRead = decompressor.Read(buffer, 0, buffer.Length)) > 0)
{
// Process the decompressed data
ProcessData(buffer, bytesRead);
}
}
Related vulnerabilities
Recent vulnerabilities recorded for dotnet-sdk.