Skip to main content
COSMICBYTEZLABS
NewsSecurityHOWTOsToolsStudyTraining
ProjectsNewsletterHire MeAbout
Subscribe

Press Enter to search or Esc to close

News
Security
HOWTOs
Tools
Study
Training
Projects
Newsletter
Hire Me
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.

1310+ Articles
157+ Guides

CONTENT

  • Latest News
  • Security Alerts
  • HOWTOs
  • Checklists
  • 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
CVE-2026-40493: SAIL PSD Codec Buffer Overflow via channels

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

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

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

Related Reading

  • CVE-2026-40492: SAIL XWD Codec Heap Buffer Overflow (CVSS
  • CVE-2026-40494: SAIL TGA Codec RLE Decoder Asymmetric
  • CVE-2015-20115: RealtyScript 4.0.2 Stored XSS via File
#CVE#Vulnerability#Image Processing#Buffer Overflow#SAIL#PSD

Related Articles

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

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

3 min read

CVE-2026-40494: SAIL TGA Codec RLE Decoder Asymmetric

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

3 min read

CVE-2018-25427: Arm Whois 3.11 Stack-Based Buffer Overflow RCE

A critical stack-based buffer overflow vulnerability in Arm Whois 3.11 (CVSS 9.8) allows remote attackers to execute arbitrary code by supplying oversized input, overwriting the structured exception handler with shellcode.

4 min read
Back to all Security Alerts