CVE-2026-138781: Gimp: gimp: out-of-bounds read in psd alpha channel arrays in add_merged_image
A flaw was found in the file-psd plugin in GIMP. In addmergedimage(), bounds checks for alpha channel names, IDs, and display info used "<=" instead of "<", allowing an off-by-one out-of-bounds read past alphanames or alphadisplayinfo when parsing a crafted PSD. The out-of-bounds pointer-sized value is then used (for example via gimpchannelnew()/strlen() or as a PSDchanneldata pointer passed to geglcolorduplicate()), which can crash the file-psd plug-in and may allow further memory corruption. Fixed upstream in commit 7a5814cf73a6cde176d1ed9c104504fa18b9c5a3 (Resolves #17021). The fix is on master only; GIMP 3.2.8 and earlier release lines still contain the defective checks.
Other sources
A flaw was found in the file-psd plugin in GIMP. Incorrect bounds checks when loading PSD alpha channel metadata can cause an out-of-bounds read. Opening a crafted PSD file can crash the application and may allow arbitrary code execution.
— MITRE
Affected Software
Remediation
Recommended actions to resolve this vulnerability, in priority order.
- Upgrade
Upgrade to a fixed release to a version that resolves this vulnerability.
Patch 7a5814cf73a6cde176d1ed9c104504fa18b9c5a3
Event History
Frequently Asked Questions
Who is exposed to this issue?
Users of GIMP who open PSD files are exposed, particularly when files originate from untrusted or uncontrolled sources. The affected code is in the file-psd plug-in and is reached while parsing PSD alpha-channel metadata.
What does an attacker need to exploit it?
An attacker needs to provide a crafted PSD file and have a user open it in GIMP. The vector is local with no privileges required, but user interaction is required.
Which versions are known to contain the vulnerable checks?
GIMP 3.2.8 and earlier release lines still contain the defective bounds checks. The upstream fix is currently on the master branch in commit 7a5814cf73a6cde176d1ed9c104504fa18b9c5a3.
What can happen when a crafted PSD is opened?
The file-psd plug-in can read past alpha-channel metadata arrays, causing a crash. The out-of-bounds value may also be used as a pointer, potentially leading to further memory corruption or arbitrary code execution.
What is the practical mitigation if an updated build is not available?
Do not open PSD files from untrusted sources in affected GIMP versions. Treat externally supplied PSD files as potentially malicious until a build containing the upstream fix is available.