CVE-2024-41132: SixLabors ImageSharp has Excessive Memory Allocation in Gif Decoder
5.3
CVSS Score
3.1
Basic Information
CVE ID
GHSA ID
EPSS Score
0.78772%
CWE
Published
7/22/2024
Updated
9/11/2024
KEV Status
No
Technology
C#
Technical Details
CVSS Vector
CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:N/I:N/A:L
| Package Name | Ecosystem | Vulnerable Versions | First Patched Version |
|---|---|---|---|
| SixLabors.ImageSharp | nuget | < 2.1.9 | 2.1.9 |
| SixLabors.ImageSharp | nuget | >= 3.0.0, < 3.1.5 | 3.1.5 |
Vulnerability Intelligence
Miggo AI
Root Cause Analysis
The vulnerability stems from how the GIF decoder handled LZW-compressed image data. The original implementation in GifDecoderCore.cs allocated a full Buffer2D<byte> for all pixel indices (width*height) before decoding, while LzwDecoder.cs's DecodePixels method processed the entire image in one pass. This allowed attackers to specify malicious dimensions leading to excessive allocations. The patches replaced this with row-by-row decoding (DecodePixelRow) using temporary buffers, significantly reducing peak memory usage. The CWEs (770/789) directly map to these unthrottled allocations based on unvalidated input values.