CVE-2024-32036 Overview
CVE-2024-32036 is an information disclosure vulnerability in ImageSharp, a widely used .NET 2D graphics API developed by Six Labors. The flaw resides in the JPEG and TGA image decoders, where uninitialized memory buffers can leak sensitive process data into decoded image output. An attacker who submits a specially crafted JPEG or TGA file to an application using ImageSharp can trigger disclosure of memory contents from other parts of the host process. The issue is tracked under [CWE-226] (Sensitive Information in Resource Not Removed Before Reuse) and [CWE-212] (Improper Removal of Sensitive Information Before Storage or Transfer). Six Labors patched the flaw in ImageSharp v3.1.4 and v2.1.8.
Critical Impact
A remote attacker can exfiltrate residual memory contents from a target application's process by uploading a crafted JPEG or TGA image, potentially exposing secrets, tokens, or user data.
Affected Products
- Six Labors ImageSharp versions prior to 2.1.8 (v2.x branch)
- Six Labors ImageSharp versions prior to 3.1.4 (v3.x branch)
- .NET applications and services that ingest untrusted JPEG or TGA images through ImageSharp
Discovery Timeline
- 2024-04-15 - CVE-2024-32036 published to the National Vulnerability Database (NVD)
- 2026-06-17 - Last updated in NVD database
Technical Details for CVE-2024-32036
Vulnerability Analysis
The vulnerability stems from ImageSharp allocating pixel buffers with Image.CreateUninitialized<TPixel>() during JPEG and TGA decoding. This factory method returns memory that has not been zeroed, meaning any prior contents of the heap region remain visible to the caller. When the decoder does not fully populate every pixel of the output image, the uninitialized regions expose leftover process memory to the returned image buffer. An attacker who supplies a crafted JPEG or TGA file, particularly one that leaves regions of the output unwritten, receives an image whose pixels reveal residual data from the target process.
Root Cause
The root cause is unsafe reuse of memory without sanitization prior to being handed to decoder logic that does not guarantee full-coverage writes. Combined with malformed image headers or truncated payloads, this creates a direct read primitive into the process heap of the application consuming the image.
Attack Vector
Exploitation is network-based and requires user interaction such as file upload or automated image ingestion. Any web service, image processing pipeline, or content management system that decodes attacker-controlled JPEG or TGA data with a vulnerable ImageSharp version can leak memory contents in the resulting output image, which the attacker later retrieves and analyzes.
// Patch applied to src/ImageSharp/Formats/Tga/TgaDecoderCore.cs (v3.x branch)
throw new UnknownImageFormatException("Width or height cannot be 0");
}
- var image = Image.CreateUninitialized<TPixel>(this.Configuration, this.fileHeader.Width, this.fileHeader.Height, this.metadata);
+ Image<TPixel> image = new(this.Configuration, this.fileHeader.Width, this.fileHeader.Height, this.metadata);
Buffer2D<TPixel> pixels = image.GetRootFramePixelBuffer();
if (this.fileHeader.ColorMapType == 1)
// Source: https://github.com/SixLabors/ImageSharp/commit/8f0b4d3e680e78d479a88e7b1472bccd8f096d68
The fix replaces Image.CreateUninitialized<TPixel>() with the standard Image<TPixel> constructor, which initializes pixel memory to zero, eliminating the leakage of prior heap contents. An equivalent change was applied in the v2.x branch in commit da5f09a.
Detection Methods for CVE-2024-32036
Indicators of Compromise
- Inbound HTTP requests containing JPEG or TGA payloads with malformed headers, truncated pixel data, or unusual dimensions submitted to image upload endpoints.
- Outbound HTTP responses containing decoded images whose non-image regions carry high-entropy data resembling strings, tokens, or serialized objects.
- Application logs from ImageSharp reporting decoder warnings or exceptions correlated with client-supplied image files.
Detection Strategies
- Inventory .NET applications and enumerate loaded ImageSharp assembly versions to identify installations of SixLabors.ImageSharp prior to 2.1.8 or 3.1.4.
- Deploy software composition analysis (SCA) rules that flag vulnerable SixLabors.ImageSharp NuGet package versions in build pipelines and container images.
- Instrument image processing endpoints to log source IP, filename, MIME type, and decoded dimensions of uploaded JPEG and TGA files for retrospective hunting.
Monitoring Recommendations
- Monitor image upload endpoints for anomalous volumes of JPEG or TGA submissions from single sources, which may indicate scripted exfiltration attempts.
- Alert on user-uploaded images that are subsequently downloaded or served back to the same or related client sessions, a pattern consistent with memory disclosure workflows.
- Correlate ImageSharp decoder exceptions with authentication and session data to identify probing activity against multi-tenant image processing services.
How to Mitigate CVE-2024-32036
Immediate Actions Required
- Upgrade SixLabors.ImageSharp to version 3.1.4 if running the v3.x branch, or to 2.1.8 if running the v2.x branch.
- Audit all first- and third-party .NET applications and container images to identify transitive dependencies on vulnerable ImageSharp versions.
- Rotate any secrets, API keys, or session tokens that may have been loaded in the memory space of exposed image processing services during the vulnerable period.
Patch Information
Six Labors released fixes in commits 8f0b4d3 and da5f09a, replacing uninitialized buffer allocations with zero-initialized pixel buffers. Full advisory details are available in GitHub Security Advisory GHSA-5x7m-6737-26cr.
Workarounds
- If immediate patching is not feasible, restrict accepted image MIME types at the application layer to formats not affected by this flaw and reject JPEG and TGA uploads.
- Place a validating image proxy or normalization service in front of ImageSharp that re-encodes untrusted input through a hardened decoder before passing pixel data downstream.
- Isolate image processing workloads in dedicated processes or containers with minimal secrets in memory to reduce the sensitivity of any disclosed buffer contents.
# Upgrade the vulnerable NuGet package to a patched version
dotnet add package SixLabors.ImageSharp --version 3.1.4
# Or for applications pinned to the v2.x branch
dotnet add package SixLabors.ImageSharp --version 2.1.8
# Verify the resolved version
dotnet list package --include-transitive | grep -i imagesharp
Disclaimer: This content was generated using AI. While we strive for accuracy, please verify critical information with official sources.

