Skip to main content
COSMICBYTEZLABS
NewsSecurityHOWTOsToolsStudyTraining
ProjectsChecklistsAI RankingsNewsletterStatusTagsAbout
Subscribe

Press Enter to search or Esc to close

News
Security
HOWTOs
Tools
Study
Training
Projects
Checklists
AI Rankings
Newsletter
Status
Tags
About
RSS Feed
Reading List
Subscribe

Stay in the Loop

Get the latest security alerts, tutorials, and tech insights delivered to your inbox.

Subscribe NowFree forever. No spam.
COSMICBYTEZLABS

Your trusted source for IT intelligence, cybersecurity insights, and hands-on technical guides.

686+ Articles
118+ Guides

CONTENT

  • Latest News
  • Security Alerts
  • HOWTOs
  • Projects
  • Exam Prep

RESOURCES

  • Search
  • Browse Tags
  • Newsletter Archive
  • Reading List
  • RSS Feed

COMPANY

  • About Us
  • Contact
  • Privacy Policy
  • Terms of Service

© 2026 CosmicBytez Labs. All rights reserved.

System Status: Operational
  1. Home
  2. Security
  3. CVE-2026-40493: SAIL PSD Codec Buffer Overflow via channels * depth Miscalculation (CVSS 9.8)
CVE-2026-40493: SAIL PSD Codec Buffer Overflow via channels * depth Miscalculation (CVSS 9.8)

Critical Security Alert

This vulnerability is actively being exploited. Immediate action is recommended.

SECURITYCRITICALCVE-2026-40493

CVE-2026-40493: SAIL PSD Codec Buffer Overflow via channels * depth Miscalculation (CVSS 9.8)

A critical out-of-bounds write in SAIL's PSD codec occurs when the pixel buffer is allocated using a raw header formula that doesn't account for actual decoded size, enabling heap corruption with crafted PSD files.

Dylan H.

Security Team

April 18, 2026
3 min read

Affected Products

  • SAIL Image Library prior to commit c930284445ea3ff94451ccd7a57c999eca3bc979

Overview

CVE-2026-40493 is a critical (CVSS 9.8) out-of-bounds write vulnerability in the SAIL image processing library. The flaw lives in the PSD (Photoshop Document) codec and is caused by an undersized buffer allocation due to a miscalculation based on raw header values.

Technical Details

The PSD codec computes bytes_per_pixel (abbreviated bpp) as channels * depth directly from the file header. This calculation is used to determine the size of the pixel data buffer to allocate. However, the actual number of bytes needed during decoding can exceed this estimate when:

  • Channel or depth values are inconsistent with the encoded data stream.
  • The file contains unusual or malformed combinations of channel count and bit depth.
  • The codec writes more data than the buffer can hold during pixel reconstruction.

The result is an out-of-bounds write into heap memory adjacent to the allocated buffer.

Attack Scenario

A threat actor or malicious web server serves a specially crafted .psd file to a target application using SAIL for image processing. When the codec attempts to decode the pixel data, it writes beyond the buffer boundary, allowing:

  • Corruption of adjacent heap allocations.
  • Overwrite of function pointers or vtable entries in C++ contexts.
  • Potential for controlled code execution, depending on allocator layout.

Affected Versions

All versions of SAIL prior to commit c930284445ea3ff94451ccd7a57c999eca3bc979.

Fix

The patch corrects the buffer size calculation by accounting for the actual maximum bytes that the decoder can write, rather than relying solely on the raw channels * depth product from the header. Apply the fix by updating to a build that includes this commit.

git pull origin master
git checkout c930284445ea3ff94451ccd7a57c999eca3bc979
cmake -B build && cmake --build build

Impact Assessment

FactorDetail
CVSS Score9.8 (Critical)
Attack VectorNetwork (via crafted PSD file)
Attack ComplexityLow
Privileges RequiredNone
User InteractionRequired (open a malicious image)
ScopeUnchanged
ConfidentialityHigh
IntegrityHigh
AvailabilityHigh

Recommendations

  • Update SAIL to a version at or after commit c930284.
  • Restrict PSD file processing to trusted sources only until the patch is applied.
  • Fuzz PSD parsing with tools like AFL++ or libFuzzer to detect similar allocation logic errors in related codecs.
  • Use memory-safe build flags — compile with AddressSanitizer during development and -D_FORTIFY_SOURCE=2 in production.

References

  • NVD: CVE-2026-40493
  • SAIL GitHub Repository
#CVE#Vulnerability#Image Processing#Buffer Overflow#SAIL#PSD

Related Articles

CVE-2026-40492: SAIL XWD Codec Heap Buffer Overflow (CVSS 9.8)

A critical heap buffer overflow in the SAIL image library's XWD codec arises from a mismatch between pixel depth and bits-per-pixel, enabling arbitrary code execution via crafted image files.

3 min read

CVE-2026-40494: SAIL TGA Codec RLE Decoder Asymmetric Bounds Check (CVSS 9.8)

A critical heap write-past-end vulnerability in SAIL's TGA codec RLE decoder stems from an asymmetric bounds check that correctly validates run-packets but misses the literal-packet code path, enabling arbitrary code execution.

3 min read

CVE-2026-6518: WordPress CMP Plugin Arbitrary File Upload and Remote Code Execution (CVSS 8.8)

The CMP Coming Soon & Maintenance Plugin for WordPress contains a critical arbitrary file upload flaw that allows subscriber-level authenticated users to upload PHP shells and achieve remote code execution on affected sites.

3 min read
Back to all Security Alerts