Skip to main content

Sail CVE-2026-40492

| EUVDEUVD-2026-23644 CRITICAL
Out-of-bounds Write (CWE-787)
2026-04-18 GitHub_M
9.8
CVSS 3.1 · Vendor: GitHub_M
View

Attack ChainAIDerived

Hypothetical attack flow derived from CVE metadata – not a confirmed exploit chain

  1. Recon
    Deliver crafted XWD file
  2. Delivery
    SAIL parses headers (pixmap_depth=8, bits_per_pixel=32)
  3. Exploit
    Allocate 1-byte/pixel buffer
  4. Install
    Byte-swap loop accesses as uint32_t*
  5. C2
    Write 4x beyond buffer
  6. Execute
    Corrupt heap metadata
  7. Impact
    Execute 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.

Act Now Prioritize within 24-48h. Why: CRITICAL severity.
Patch available 0.0% exploitation probability (EPSS)

Get an e-mail when this CVE is exploited, patched or re-scored. Free account.

Alert me

AnalysisAIv2 – 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)
v1 Apr 18, 2026 - 02:41 CVSS 9.8

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

sail < 36aa5c7ec8a2bb35f6fb867a1177a6f141156b02

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

Vendor (GitHub_M) PRIMARY 9.8 CRITICAL
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

Attack Vector
Network
Attack Complexity
Low
Privileges Required
None
User Interaction
None
Scope
Unchanged
Confidentiality
High
Integrity
High
Availability
High

Lifecycle Timeline

4
Patch released
Apr 20, 2026 - 18:55 nvd
Patch available
Analysis Updated
Apr 18, 2026 - 03:29 vuln.today
v2 - CVSS changed
Patch available
Apr 18, 2026 - 03:01 EUVD
CVE Published
Apr 18, 2026 - 01:39 nvd
CRITICAL 9.8

DescriptionCVE.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

Why It Matters

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.

Business Impact: Severe
Compensating Controls

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

EPSS Score
0.0%
Top 87% exploitable
Social Media
3
Sightings
Data Quality
7 sources
Confidence: High
EUVD NVD CVE.org EPSS Vulnrichment CIRCL GitHub VulDB

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.

SignalValue
Severity CRITICAL
CISA KEV No
Public POC No
EPSS 0.0%
Patch available Yes
Active threat No
Deciding rule
CRITICAL severity
What every action level means
Emergency Immediate action required. Criteria: CRITICAL + in CISA KEV (actively exploited) without patch, OR CRITICAL + EPSS > 30% without patch, OR CRITICAL + active threat signals without patch.
Act Now Prioritize within 24-48h. Criteria: in KEV with patch available, OR CRITICAL + public POC, OR HIGH + EPSS > 10%, OR CRITICAL + active threat, OR any CRITICAL severity.
This Week Schedule remediation this week. Criteria: HIGH severity (CVSS 7.0-8.9). Patch within normal change window.
This Month Plan within 30 days. Criteria: MEDIUM severity (CVSS 4.0-6.9), lower exploitation probability. Include in regular patch cycle.
Monitor Track and reassess. Criteria: LOW severity (CVSS 0.1-3.9), minimal exploitation risk. No immediate action needed.

SSVC AssessmentENISA

SSVC Decision
Out-of-Cycle
Exploitation
Poc
System Exposure· derived
Open
Automatable
Yes
Human Impact
Very High
Technical Impact
Total

Priority Score

49
Low Medium High Critical
KEV: 0
EPSS: 0
CVSS: +49
PoC: 0
Weaponized: 0
Threat intel: 0
Gov advisory: 0

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 3

More in Sail

View all
CVE-2026-27168 HIGH POC
8.8 Feb 21

The SAIL image library contains a heap buffer overflow in its XWD file parser that fails to validate the bytes_per_line

CVE-2026-59959 MEDIUM
4.8 Oct 28

Denial of service in SAIL 1.0.1 and earlier: the built-in WebP decoder performs a divide-by-zero during loader initializ

CVE-2025-53510 HIGH POC
8.8 Aug 25

A memory corruption vulnerability exists in the PSD Image Decoding functionality of the SAIL Image Decoding Library v0.9

CVE-2025-53085 HIGH POC
8.8 Aug 25

A memory corruption vulnerability exists in the PSD RLE Decoding functionality of the SAIL Image Decoding Library v0.9.8

CVE-2025-52930 HIGH POC
8.8 Aug 25

A memory corruption vulnerability exists in the BMPv3 RLE Decoding functionality of the SAIL Image Decoding Library v0.9

CVE-2025-52456 HIGH POC
8.8 Aug 25

A memory corruption vulnerability exists in the WebP Image Decoding functionality of the SAIL Image Decoding Library v0.

CVE-2025-50129 HIGH POC
8.8 Aug 25

A memory corruption vulnerability exists in the PCX Image Decoding functionality of the SAIL Image Decoding Library v0.9

CVE-2025-46407 HIGH POC
8.8 Aug 25

A memory corruption vulnerability exists in the BMPv3 Palette Decoding functionality of the SAIL Image Decoding Library

CVE-2025-35984 HIGH POC
8.8 Aug 25

A memory corruption vulnerability exists in the PCX Image Decoding functionality of the SAIL Image Decoding Library v0.9

CVE-2025-32468 HIGH POC
8.8 Aug 25

A memory corruption vulnerability exists in the BMPv3 Image Decoding functionality of the SAIL Image Decoding Library v0

This site uses cookies essential for authentication and security. No tracking or analytics cookies are used. Privacy Policy