Severity by source
AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:H/A:H
Primary rating from GitHub Advisory · only source for this CVE.
CVSS VectorGitHub Advisory
Lifecycle Timeline
6DescriptionGitHub Advisory
SAIL is a cross-platform library for loading and saving images with support for animation, metadata, and ICC profiles. Prior to commit c930284445ea3ff94451ccd7a57c999eca3bc979, the PSD codec computes bytes-per-pixel (bpp) from raw header fields channels * depth, but the pixel buffer is allocated based on the resolved pixel format. For LAB mode with channels=3, depth=16, bpp = (3*16+7)/8 = 6, but the format BPP40_CIE_LAB allocates only 5 bytes per pixel. Every pixel write overshoots, causing a deterministic heap buffer overflow on every row. Commit c930284445ea3ff94451ccd7a57c999eca3bc979 contains a patch.
AnalysisAI
Heap buffer overflow in SAIL PSD codec allows remote code execution when processing malicious LAB-mode PSD files. Affects all SAIL versions prior to commit c930284 (HappySeaFox/sail). Attackers can achieve arbitrary code execution (CVSS 9.8: AV:N/AC:L/PR:N/UI:N) by triggering a mismatch between computed bytes-per-pixel (6 bytes for 3-channel 16-bit LAB) and allocated buffer size (5 bytes for BPP40_CIE_LAB format). Every pixel write deterministically overflows the heap buffer. EPSS data not available. Not listed in CISA KEV. Patch available via GitHub commit c930284445ea3ff94451ccd7a57c999eca3bc979.
Technical ContextAI
SAIL (HappySeaFox/sail) is a cross-platform image codec library supporting formats including Adobe PSD with ICC profiles and metadata. The vulnerability (CWE-787: Out-of-bounds Write) occurs in the PSD decoder's pixel buffer allocation logic. The codec calculates bytes-per-pixel as (channels * depth + 7) / 8 from raw PSD header fields, but allocates memory based on an internally-resolved pixel format enum. For LAB colorspace images with 3 channels at 16-bit depth, the calculation yields 6 bytes per pixel, while the BPP40_CIE_LAB format enum allocates only 5 bytes per pixel (40 bits). This one-byte-per-pixel discrepancy causes every pixel write operation to overflow the heap buffer boundary. The overflow is deterministic and occurs on every row during decode, making exploitation reliable. CPE identifies the affected product as cpe:2.3:a:happyseafox:sail:*:*:*:*:*:*:*:*.
RemediationAI
Update SAIL to commit c930284445ea3ff94451ccd7a57c999eca3bc979 or later, available at https://github.com/HappySeaFox/sail/commit/c930284445ea3ff94451ccd7a57c999eca3bc979. The patch corrects the bytes-per-pixel calculation to align with actual allocated buffer sizes for LAB-mode pixel formats. If immediate patching is not feasible, disable PSD format support in SAIL configuration to eliminate the attack surface - this breaks PSD file processing but prevents exploitation. Alternatively, implement strict input validation to reject PSD files with LAB colorspace (check colormode field in PSD header equals 9) before passing to SAIL - this blocks only the vulnerable path while preserving RGB/CMYK PSD support, but requires application-layer changes and understanding of PSD structure. For network-facing services, deploy content-type filtering to reject application/x-photoshop MIME types at ingress - reduces attack surface but may impact legitimate workflows requiring PSD processing. All workarounds have operational trade-offs; vendor patch is the definitive solution.
The SAIL image library contains a heap buffer overflow in its XWD file parser that fails to validate the bytes_per_line
Heap buffer overflow in SAIL image library's TGA decoder allows remote code execution via malformed RLE-compressed TGA f
Out-of-bounds memory access in SAIL image library's XWD codec allows remote attackers to achieve arbitrary code executio
A memory corruption vulnerability exists in the PSD Image Decoding functionality of the SAIL Image Decoding Library v0.9
A memory corruption vulnerability exists in the PSD RLE Decoding functionality of the SAIL Image Decoding Library v0.9.8
A memory corruption vulnerability exists in the BMPv3 RLE Decoding functionality of the SAIL Image Decoding Library v0.9
A memory corruption vulnerability exists in the WebP Image Decoding functionality of the SAIL Image Decoding Library v0.
A memory corruption vulnerability exists in the PCX Image Decoding functionality of the SAIL Image Decoding Library v0.9
A memory corruption vulnerability exists in the BMPv3 Palette Decoding functionality of the SAIL Image Decoding Library
A memory corruption vulnerability exists in the PCX Image Decoding functionality of the SAIL Image Decoding Library v0.9
A memory corruption vulnerability exists in the BMPv3 Image Decoding functionality of the SAIL Image Decoding Library v0
Same weakness CWE-787 – Out-of-bounds Write
View allSame technique Memory Corruption
View allShare
External POC / Exploit Code
Leaving vuln.today
EUVD-2026-23646