Attack ChainAIDerived
Hypothetical attack flow derived from CVE metadata – not a confirmed exploit chain
-
ReconDeliver crafted XWD file
-
DeliverySAIL parses headers (pixmap_depth=8, bits_per_pixel=32)
-
ExploitAllocate 1-byte/pixel buffer
-
InstallByte-swap loop accesses as uint32_t*
-
C2Write 4x beyond buffer
-
ExecuteCorrupt heap metadata
-
ImpactExecute arbitrary code
Vulnerability Assessment
| Weakness |
CWE
ASVS 5.0
V15 - Secure Coding and Architecture Bounds checking, write limits
MITRE ATT&CK
2 techniques across 2 tactics: Execution, Privilege Escalation The technique list with ATT&CK links and the kill-chain view is part of the Basic plan and up. |
| Exploitation Conditions | Exploitation requires the target application to process XWD (X Window Dump) format image files using the vulnerable SAIL library. The vulnerability triggers when SAIL's XWD codec encounters a file with mismatched pixmap_depth (set to 8 or other low values) and bits_per_pixel (set to higher values like 32) header fields. No special SAIL configuration, non-default settings, or privileged application context required - the vulnerability exists in default XWD parsing logic. Exploitation is limited by whether the application accepts XWD format files; many modern applications restrict input to common formats (JPEG, PNG, GIF) which would prevent exploitation. Applications performing server-side image processing, format conversion, or thumbnail generation on user-uploaded content face highest risk if XWD support is enabled. CVSS vector AV:N/AC:L/PR:N/UI:N confirms no authentication, network access, or user interaction prerequisites beyond file delivery to a vulnerable parser. |
| Impact | Critical risk for applications parsing untrusted XWD images. CVSS 9.8 reflects network-accessible attack vector with no authentication, no user interaction, and high impact across confidentiality, integrity, and availability (AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:H/A:H). Attack complexity is low - exploitation requires only crafting an XWD file with mismatched pixmap_depth and bits_per_pixel fields. The 4x buffer overrun provides substantial space for heap layout manipulation and code execution primitives. However, real-world risk is moderated by limited XWD format usage compared to mainstream formats like JPEG/PNG. No CISA KEV listing suggests exploitation remains targeted or theoretical rather than widespread. EPSS score unavailable at time of analysis. SSVC assessment: exploitation status unclear (no public POC confirmed in references), automatable (malicious file triggers vulnerability automatically on parse), technical impact total (arbitrary code execution). Priority depends on whether the application processes XWD files from untrusted sources - web applications and image converters face elevated risk, while applications restricting input formats to common types have reduced exposure. The existence of CVE-2026-27168 in the same codec indicates the XWD parser was already under security scrutiny, increasing likelihood of researcher attention and potential POC development. |
| Exploit ScenarioDerived | Attacker crafts a malicious XWD image file with pixmap_depth=8 and bits_per_pixel=32, then delivers it via web upload, email attachment, or API endpoint to an application using SAIL for image processing. When SAIL parses the file, it allocates a 1-byte-per-pixel buffer based on pixmap_depth=8 but processes it as uint32_t (4 bytes) during byte-swapping, writing attacker-controlled data 4x beyond buffer bounds. The heap overflow enables corruption of adjacent memory structures, potentially achieving arbitrary code execution in the context of the parsing application. No authentication or user interaction required beyond file delivery. |
Get an e-mail when this CVE is exploited, patched or re-scored. Free account.
Alert meAnalysisAIv2 – Apr 18, 2026
Out-of-bounds memory access in SAIL image library's XWD codec allows remote attackers to achieve arbitrary code execution via malformed image files. The vulnerability stems from a pixel format mismatch where buffer allocation uses pixmap_depth=8 (1 byte/pixel) but byte-swap operations use bits_per_pixel=32 (4 bytes/pixel), causing 4x buffer overrun. CVSS 9.8 (AV:N/AC:L/PR:N/UI:N) indicates trivial exploitation requiring only delivery of a crafted XWD file. EPSS data unavailable; no KEV listing indicates targeted rather than widespread exploitation. Fix available in commit 36aa5c7ec8a2bb35f6fb867a1177a6f141156b02.
Earlier versions of this analysis (1)
Out-of-bounds memory access in SAIL image library's XWD codec allows remote unauthenticated attackers to achieve arbitrary code execution via malformed image files. The vulnerability stems from a type confusion where pixel format is determined by pixmap_depth (8-bit) but byte-swap operations use bits_per_pixel (32-bit), causing 4x buffer overrun when processing specially crafted XWD images. CVSS 9.8 critical severity with network attack vector and no authentication required. No active exploitation confirmed (not in CISA KEV), but publicly available patch exists in upstream commit 36aa5c7.
RemediationAI
Update SAIL library to commit 36aa5c7ec8a2bb35f6fb867a1177a6f141156b02 or later (patch details at https://github.com/HappySeaFox/sail/commit/36aa5c7ec8a2bb35f6fb867a1177a6f141156b02). The patch reconciles pixel format handling by ensuring byte-swap operations respect the buffer allocation size determined by pixmap_depth rather than blindly trusting bits_per_pixel from file headers. For environments unable to immediately update, disable XWD format support in SAIL's codec configuration if the application does not require XWD file processing - this eliminates the attack surface entirely without affecting other supported formats (JPEG, PNG, TIFF, etc.). If XWD support is required, implement input validation rejecting files where bits_per_pixel exceeds pixmap_depth by more than expected alignment padding (typically bits_per_pixel should equal or minimally exceed pixmap_depth for valid files). Deploy SAIL in sandboxed processes with restricted memory permissions to limit exploitation impact, though this adds operational complexity and performance overhead. Monitor for abnormal memory access patterns during image parsing as a detective control.
Affected VersionsENISA
Affects your stack
Find out whether the stacks and servers you run are on an affected version.
Checking this CVE against your own stacks and servers is part of the Basic plan and up.
Technical ContextAI · show details
SAIL is a cross-platform image codec library supporting multiple formats including X Window Dump (XWD). The vulnerability (CWE-787: Out-of-bounds Write) occurs in the XWD decoder's pixel format resolution logic. XWD files contain two critical fields: pixmap_depth (bits per pixel for color depth) and bits_per_pixel (actual storage size). SAIL's codec correctly allocates buffers based on pixmap_depth but performs byte-swapping operations based on bits_per_pixel. When a malicious XWD file specifies pixmap_depth=8 (triggering BPP8_INDEXED mode with 1-byte-per-pixel buffer allocation) but bits_per_pixel=32, the byte-swap routine casts the buffer pointer to uint32_t* and processes it as 4-byte units. This type confusion causes reads and writes extending 4x beyond the allocated buffer boundary. This differs from CVE-2026-27168 (GHSA-3g38-x2pj-mv55), which addressed bytes_per_line validation in the same codec. The vulnerability affects the HappySeaFox SAIL library (cpe:2.3:a:happyseafox:sail) prior to commit 36aa5c7.
Know when Sail gets its next vulnerability
- Watch products and get an email when something new is published
- Check this CVE against your own stack and servers
- Exploit and PoC references, threat intelligence from 22 sources
No credit card · 7-day full trial
Severity by source
AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:H/A:H
Primary rating from Vendor (GitHub_M) · only source for this CVE.
CVSS VectorVendor: GitHub_M
Lifecycle Timeline
4DescriptionCVE.org
SAIL is a cross-platform library for loading and saving images with support for animation, metadata, and ICC profiles. Prior to commit 36aa5c7ec8a2bb35f6fb867a1177a6f141156b02, the XWD codec resolves pixel format based on pixmap_depth but the byte-swap code uses bits_per_pixel independently. When pixmap_depth=8 (BPP8_INDEXED, 1 byte/pixel buffer) but bits_per_pixel=32, the byte-swap loop accesses memory as uint32_t*, reading/writing 4x the allocated buffer size. This is a different vulnerability from the previously reported GHSA-3g38-x2pj-mv55 (CVE-2026-27168), which addressed bytes_per_line validation. Commit 36aa5c7ec8a2bb35f6fb867a1177a6f141156b02 contains a patch.
Executive ViewAI
CVE-2026-40492 is a critical remote code execution vulnerability in the SAIL image library's XWD codec that allows unauthenticated attackers to execute arbitrary code by sending a malformed image file to any system processing XWD images. Organizations using SAIL for image processing face immediate risk of complete system compromise if the library is exposed to untrusted image sources or integrated into web services, file upload handlers, or automated image conversion pipelines.
Apply vendor patch. If immediate patching is impossible: restrict XWD file handling to isolated, non-networked systems only; implement strict file-type validation rejecting XWD files at network boundaries; disable SAIL's XWD codec module if library configuration allows; use application-level sandboxing for any image processing operations involving untrusted sources.
Threat Intelligence Overview
How this decision was reached
The engine reads each signal below and applies a fixed list of rules from top to bottom. The first rule that matches sets the recommended action – like a statement, every line is shown.
What every action level means
SSVC AssessmentENISA
Priority Score
Attack Technique
A buffer overflow occurs when a program writes more data to a memory buffer than it was allocated to hold, causing the excess data to spill into adjacent memory regions.
Memory corruption occurs when a program writes data beyond the boundaries of allocated memory regions or accesses memory in unintended ways, violating the integrity of the process's address space.
Related Vulnerabilities in SAIL Image Library Buffer Overflow
View all 3The SAIL image library contains a heap buffer overflow in its XWD file parser that fails to validate the bytes_per_line
Denial of service in SAIL 1.0.1 and earlier: the built-in WebP decoder performs a divide-by-zero during loader initializ
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
EUVD-2026-23644
NVD
CVE.org
EPSS
Vulnrichment
GitHub
VulDB
Exploit-DB