Out-of-bounds WriteWeakness · CWE-787

CVE-2026-40492

CRITICAL · 9.8 CVSS v3.1 Published 2026-04-18
Patch available
A vendor patch is available. No clean upgrade release — apply the published patch.
See remediation →
100/100
Remediation priority · Urgent
Remotely reachable No privileges Zero-click Patch available

Official description Straight from the sourceThe vendor's or NVD's own wording, published unedited. Authoritative, but often terse — it says what broke, rarely what to do.

NVD · unedited
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.

Technical summary Written by usOur analysis, written from the advisory, the CVSS vector and the affected-version data. It adds context the advisory leaves out, and never invents facts that are not in the source.

dbcve analysis · high confidence

In the SAIL library's XWD codec, a heap buffer overflow occurs due to a mismatch between pixel format resolution and memory access. When `pixmap_depth=8` (1 byte per pixel) but `bits_per_pixel=32`, the byte-swap loop treats the 8-bit buffer as a 32-bit (`uint32_t*`) array, reading/writing 4x beyond the allocated buffer size. This out-of-bounds memory access allows potential arbitrary code execution.

MitigationUpgrade SAIL to version containing commit 36aa5c7ec8a2bb35f6fb867a1177a6f141156b02 or later, which ensures the byte-swap code uses the same pixel format depth as the resolved pixel format rather than an independent bits_per_pixel value.

Verify against the referenced sources before acting — the references below are authoritative for this CVE, this summary is not.

CVSS breakdown How the score is builtThe industry scoring standard. It rates how the flaw is reached, what it takes to exploit, and what an attacker gains — the score is derived from those, not the other way round.

From the vector
Attack vector
Network
Complexity
Low
Privileges
None
User interaction
None
Scope
Unchanged
Confidentiality
High
Integrity
High
Availability
High

CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:H/A:H

Am I affected? How to checkSteps we derive from the advisory and the affected-version data, so you can decide whether this CVE reaches your setup. They are a guide, not a scan — your own configuration is the authority.

dbcve checks

Work through these to decide whether this CVE applies to you.

  1. Identify if SAIL library is installed
    Search for SAIL library files (libsail.so, sail.lib, or sail.dll) in the system or application dependencies, or check package managers (e.g., dpkg -l, rpm -qa, or cargo.lock for Rust projects)
    Affected if SAIL library is present in the environment
  2. Determine the installed SAIL version
    Run version check command appropriate to the installation method (e.g., sail-config --version for installed binaries, or inspect the source version tag if building from source)
    Affected if The version cannot be determined or is earlier than the version containing commit 36aa5c7ec8a2bb35f6fb867a1177a6f141156b02
  3. Verify XWD codec support is enabled
    Check SAIL build configuration or runtime capabilities for xwd or xwindow_dump codec support (look for --enable-xwd or similar flags, or query the codec list at runtime)
    Affected if XWD codec support is compiled into SAIL and available for image processing
  4. Confirm XWD file processing can occur
    Inspect application code or configuration that handles XWD files (look for xwd extensions in file processing paths, or test by attempting to load a crafted XWD file)
    Affected if The application processes or can be tricked into processing XWD files with user-supplied or untrusted content
  5. Check for untrusted XWD file input sources
    Review file upload handling, image processing pipelines, or any code paths that accept XWD format from external or untrusted sources
    Affected if The environment accepts XWD files from users or untrusted sources without prior validation

If SAIL library with XWD support is installed and processes untrusted XWD files, and the version predates the fix commit, the environment is vulnerable to heap buffer overflow via crafted XWD files with pixmap_depth=8 and bits_per_pixel=32.

Generated from the published advisory. Verify against your own configuration.

Check your environment

Paste your version and any relevant configuration and it will be compared against the affected criteria above. Do not include secrets or credentials.

AI-assisted, checked against the advisory. Informational, not a guarantee.

Remediation Closing itWhat it takes to close this. Where a vendor fix exists we point at it; where none exists we say so plainly, and can build one. Effort estimates are scoped from the advisory, not from your codebase.

dbcve · scoped
Patch available Apply the vendor patch
Vendor patch github.com →
Interim mitigation

Upgrade SAIL to version containing commit 36aa5c7ec8a2bb35f6fb867a1177a6f141156b02 or later, which ensures the byte-swap code uses the same pixel format depth as the resolved pixel format rather than an independent bits_per_pixel value.

Recommended fix High confidence

Commit 36aa5c7ec8a2bb35f6fb867a1177a6f141156b02 or subsequent release

  1. Obtain the fixed version of SAIL that includes commit 36aa5c7ec8a2bb35f6fb867a1177a6f141156b02
  2. If building from source, ensure the XWD codec code includes the fix from commit 36aa5c7ec8a2bb35f6fb867a1177a6f141156b02 which corrects the mismatch between pixmap_depth and bits_per_pixel in the byte-swap logic
  3. Verify that the fix properly validates or aligns the buffer access based on pixmap_depth rather than using bits_per_pixel independently
  4. Recompile and test the library to confirm the out-of-bounds write vulnerability is resolved

Generated from the published advisory — verify against the referenced sources before acting.

Have this fixed Scoped from the published advisory
  • Consultation2.0 h
  • Implementation4.0 h
  • Testing6.0 h
  • Review / QA2.0 h
14.0 hours of engineering $2,380
Get the patch applied

An estimate, not a bill — we confirm scope with you before any work starts. Need it this week? Rush from $3,808.

Scan for this in your stack

Free · runs locally
dbcve dependency scanner

Check whether your project pulls in CVE-2026-40492 — or any other known-vulnerable package — straight from your lock files. Free and open source; it runs locally and uploads nothing.

References Go to the primary sourcePrimary sources — vendor advisories, patches and trackers. Where our summary and a reference disagree, the reference wins.

Primary sources

Practitioner notes

Contributed

Peer-ranked notes from engineers who’ve handled CVE-2026-40492 in production — separate from our analysis above.

No notes yet

Be the first to add a field note for this CVE — a mitigation you’ve verified, a version caveat, or a link to a working fix. Sign in above to contribute.

What this is

A place for practitioners to share what actually worked: a mitigation you’ve tested, a configuration change, a version- or environment-specific caveat, or a link to a verified patch. The most useful notes rise to the top as peers upvote them, so the signal stays high.

What belongs here
  • Verified mitigations, workarounds, and config changes
  • Version or environment caveats, and links to real fixes
  • No weaponised exploit code, or anything meant to cause harm
  • No spam, self-promotion, credentials, or personal data