Security Vulnerability Report
中文
CVE-2026-40169 CVSS 6.2 MEDIUM

CVE-2026-40169

Published: 2026-04-13 22:16:29
Last Modified: 2026-04-17 20:45:28

Description

ImageMagick is free and open-source software used for editing and manipulating digital images. In versions below 7.1.2-19, a crafted image could result in an out of bounds heap write when writing a yaml or json output, resulting in a crash. This issue has been fixed in version 7.1.2-19.

CVSS Details

CVSS Score
6.2
Severity
MEDIUM
CVSS Vector
CVSS:3.1/AV:L/AC:L/PR:N/UI:N/S:U/C:N/I:N/A:H

Configurations (Affected Products)

cpe:2.3:a:imagemagick:imagemagick:*:*:*:*:*:*:*:* - VULNERABLE
ImageMagick < 7.1.2-19

PoC / Exploit Code

⚠ For Security Research Only
The following code is for security research and authorized testing only.
python
# Proof of Concept for CVE-2026-40169 # This script attempts to trigger the crash by processing an image. # Note: Requires a vulnerable ImageMagick version (< 7.1.2-19). import subprocess import os # Placeholder for a specifically crafted image payload # Real exploitation requires specific bytes to trigger the heap overflow. FILE_NAME = "test_cve_2026_40169.png" # Create a dummy file for demonstration with open(FILE_NAME, "wb") as f: f.write(b'\x89PNG\r\n\x1a\n') # PNG Header f.write(b'\x00' * 100) # Padding def trigger_vulnerability(): try: print(f"Attempting to process {FILE_NAME}...") # The vulnerability triggers when outputting to JSON or YAML # Using 'identify' or 'convert' with json: output cmd = ["convert", FILE_NAME, "json:-"] process = subprocess.Popen(cmd, stdout=subprocess.PIPE, stderr=subprocess.PIPE) stdout, stderr = process.communicate(timeout=5) if process.returncode != 0: print(f"Process exited with error code: {process.returncode}") print(f"Error: {stderr.decode()}") else: print("Process completed successfully (might be patched or payload incorrect).") except subprocess.TimeoutExpired: print("Process timed out (potential crash/hang)") except Exception as e: print(f"Exception occurred: {e}") finally: if os.path.exists(FILE_NAME): os.remove(FILE_NAME) if __name__ == "__main__": trigger_vulnerability()

References

Raw JSON Data

JSON
{"cve": {"id": "CVE-2026-40169", "sourceIdentifier": "[email protected]", "published": "2026-04-13T22:16:29.477", "lastModified": "2026-04-17T20:45:27.577", "vulnStatus": "Analyzed", "cveTags": [], "descriptions": [{"lang": "en", "value": "ImageMagick is free and open-source software used for editing and manipulating digital images. In versions below 7.1.2-19, a crafted image could result in an out of bounds heap write when writing a yaml or json output, resulting in a crash. This issue has been fixed in version 7.1.2-19."}], "metrics": {"cvssMetricV31": [{"source": "[email protected]", "type": "Secondary", "cvssData": {"version": "3.1", "vectorString": "CVSS:3.1/AV:L/AC:L/PR:N/UI:N/S:U/C:N/I:N/A:H", "baseScore": 6.2, "baseSeverity": "MEDIUM", "attackVector": "LOCAL", "attackComplexity": "LOW", "privilegesRequired": "NONE", "userInteraction": "NONE", "scope": "UNCHANGED", "confidentialityImpact": "NONE", "integrityImpact": "NONE", "availabilityImpact": "HIGH"}, "exploitabilityScore": 2.5, "impactScore": 3.6}, {"source": "[email protected]", "type": "Primary", "cvssData": {"version": "3.1", "vectorString": "CVSS:3.1/AV:L/AC:L/PR:L/UI:N/S:U/C:N/I:N/A:H", "baseScore": 5.5, "baseSeverity": "MEDIUM", "attackVector": "LOCAL", "attackComplexity": "LOW", "privilegesRequired": "LOW", "userInteraction": "NONE", "scope": "UNCHANGED", "confidentialityImpact": "NONE", "integrityImpact": "NONE", "availabilityImpact": "HIGH"}, "exploitabilityScore": 1.8, "impactScore": 3.6}]}, "weaknesses": [{"source": "[email protected]", "type": "Primary", "description": [{"lang": "en", "value": "CWE-122"}, {"lang": "en", "value": "CWE-787"}]}], "configurations": [{"nodes": [{"operator": "OR", "negate": false, "cpeMatch": [{"vulnerable": true, "criteria": "cpe:2.3:a:imagemagick:imagemagick:*:*:*:*:*:*:*:*", "versionEndExcluding": "7.1.2-19", "matchCriteriaId": "AAB93A09-7FA3-4F61-9DB8-EF5B1382E7EE"}]}]}], "references": [{"url": "https://github.com/ImageMagick/ImageMagick/commit/f86452a8aea37bf2b4bd36127f836dcc5f138b38", "source": "[email protected]", "tags": ["Patch"]}, {"url": "https://github.com/ImageMagick/ImageMagick/releases/tag/7.1.2-19", "source": "[email protected]", "tags": ["Release Notes"]}, {"url": "https://github.com/ImageMagick/ImageMagick/security/advisories/GHSA-5592-p365-24xh", "source": "[email protected]", "tags": ["Vendor Advisory"]}, {"url": "https://github.com/dlemstra/Magick.NET/releases/tag/14.12.0", "source": "[email protected]", "tags": ["Release Notes"]}]}}