The SentinelOne Annual Threat Report - A Defenders Guide from the FrontlinesThe SentinelOne Annual Threat ReportGet the Report
Experiencing a Breach?Blog
Get StartedContact Us
SentinelOne
  • Platform
    Platform Overview
    • Singularity Platform
      Welcome to Integrated Enterprise Security
    • AI for Security
      Leading the Way in AI-Powered Security Solutions
    • Securing AI
      Accelerate AI Adoption with Secure AI Tools, Apps, and Agents.
    • How It Works
      The Singularity XDR Difference
    • Singularity Marketplace
      One-Click Integrations to Unlock the Power of XDR
    • Pricing & Packaging
      Comparisons and Guidance at a Glance
    Data & AI
    • Purple AI
      Accelerate SecOps with Generative AI
    • Singularity Hyperautomation
      Easily Automate Security Processes
    • AI-SIEM
      The AI SIEM for the Autonomous SOC
    • Singularity Data Lake
      AI-Powered, Unified Data Lake
    • Singularity Data Lake for Log Analytics
      Seamlessly Ingest Data from On-Prem, Cloud or Hybrid Environments
    Endpoint Security
    • Singularity Endpoint
      Autonomous Prevention, Detection, and Response
    • Singularity XDR
      Native & Open Protection, Detection, and Response
    • Singularity RemoteOps Forensics
      Orchestrate Forensics at Scale
    • Singularity Threat Intelligence
      Comprehensive Adversary Intelligence
    • Singularity Vulnerability Management
      Application & OS Vulnerability Management
    • Singularity Identity
      Identity Threat Detection and Response
    Cloud Security
    • Singularity Cloud Security
      Block Attacks with an AI-Powered CNAPP
    • Singularity Cloud Native Security
      Secure Cloud and Development Resources
    • Singularity Cloud Workload Security
      Real-Time Cloud Workload Protection Platform
    • Singularity Cloud Data Security
      AI-Powered Threat Detection for Cloud Storage
    • Singularity Cloud Security Posture Management
      Detect and Remediate Cloud Misconfigurations
    Securing AI
    • Prompt Security
      Secure AI Tools Across Your Enterprise
  • Why SentinelOne?
    Why SentinelOne?
    • Why SentinelOne?
      Cybersecurity Built for What’s Next
    • Our Customers
      Trusted by the World’s Leading Enterprises
    • Industry Recognition
      Tested and Proven by the Experts
    • About Us
      The Industry Leader in Autonomous Cybersecurity
    Compare SentinelOne
    • Arctic Wolf
    • Broadcom
    • CrowdStrike
    • Cybereason
    • Microsoft
    • Palo Alto Networks
    • Sophos
    • Splunk
    • Trellix
    • Trend Micro
    • Wiz
    Verticals
    • Energy
    • Federal Government
    • Finance
    • Healthcare
    • Higher Education
    • K-12 Education
    • Manufacturing
    • Retail
    • State and Local Government
  • Services
    Managed Services
    • Managed Services Overview
      Wayfinder Threat Detection & Response
    • Threat Hunting
      World-Class Expertise and Threat Intelligence
    • Managed Detection & Response
      24/7/365 Expert MDR Across Your Entire Environment
    • Incident Readiness & Response
      DFIR, Breach Readiness, & Compromise Assessments
    Support, Deployment, & Health
    • Technical Account Management
      Customer Success with Personalized Service
    • SentinelOne GO
      Guided Onboarding & Deployment Advisory
    • SentinelOne University
      Live and On-Demand Training
    • Services Overview
      Comprehensive Solutions for Seamless Security Operations
    • SentinelOne Community
      Community Login
  • Partners
    Our Network
    • MSSP Partners
      Succeed Faster with SentinelOne
    • Singularity Marketplace
      Extend the Power of S1 Technology
    • Cyber Risk Partners
      Enlist Pro Response and Advisory Teams
    • Technology Alliances
      Integrated, Enterprise-Scale Solutions
    • SentinelOne for AWS
      Hosted in AWS Regions Around the World
    • Channel Partners
      Deliver the Right Solutions, Together
    • SentinelOne for Google Cloud
      Unified, Autonomous Security Giving Defenders the Advantage at Global Scale
    • Partner Locator
      Your Go-to Source for Our Top Partners in Your Region
    Partner Portal→
  • Resources
    Resource Center
    • Case Studies
    • Data Sheets
    • eBooks
    • Reports
    • Videos
    • Webinars
    • Whitepapers
    • Events
    View All Resources→
    Blog
    • Feature Spotlight
    • For CISO/CIO
    • From the Front Lines
    • Identity
    • Cloud
    • macOS
    • SentinelOne Blog
    Blog→
    Tech Resources
    • SentinelLABS
    • Ransomware Anthology
    • Cybersecurity 101
  • About
    About SentinelOne
    • About SentinelOne
      The Industry Leader in Cybersecurity
    • Investor Relations
      Financial Information & Events
    • SentinelLABS
      Threat Research for the Modern Threat Hunter
    • Careers
      The Latest Job Opportunities
    • Press & News
      Company Announcements
    • Cybersecurity Blog
      The Latest Cybersecurity Threats, News, & More
    • FAQ
      Get Answers to Our Most Frequently Asked Questions
    • DataSet
      The Live Data Platform
    • S Foundation
      Securing a Safer Future for All
    • S Ventures
      Investing in the Next Generation of Security, Data and AI
  • Pricing
Get StartedContact Us
CVE Vulnerability Database
Vulnerability Database/CVE-2026-25797

CVE-2026-25797: ImageMagick RCE Vulnerability

CVE-2026-25797 is a remote code execution vulnerability in ImageMagick that allows attackers to inject PostScript or HTML code through malicious files. This article covers technical details, affected versions, and mitigation.

Published: February 27, 2026

CVE-2026-25797 Overview

CVE-2026-25797 is a code injection vulnerability affecting ImageMagick, a widely-used open-source software suite for editing and manipulating digital images. The vulnerability exists in the PostScript (PS) coders and HTML encoder components, which fail to properly sanitize input before writing to PostScript headers and HTML documents respectively. This allows attackers to inject arbitrary PostScript or HTML code through malicious image files, which is then executed when the output is processed by printers, viewers like Ghostscript, or web browsers.

Critical Impact

Attackers can inject and execute arbitrary PostScript code when malicious files are processed by printers or viewers, and inject arbitrary HTML code into generated HTML documents, potentially leading to cross-site scripting attacks or further code execution.

Affected Products

  • ImageMagick versions prior to 7.1.2-15
  • ImageMagick versions prior to 6.9.13-40

Discovery Timeline

  • 2026-02-24 - CVE CVE-2026-25797 published to NVD
  • 2026-02-25 - Last updated in NVD database

Technical Details for CVE-2026-25797

Vulnerability Analysis

This vulnerability is classified as CWE-94 (Improper Control of Generation of Code - Code Injection). The flaw stems from insufficient input sanitization in two separate ImageMagick components: the PostScript coders and the HTML encoder.

When ImageMagick processes images and generates PostScript output, the PS coders write data directly into PostScript headers without properly escaping or sanitizing the input. Similarly, the HTML encoder fails to properly escape strings when writing to HTML documents. This lack of sanitization creates injection points where attacker-controlled data can be interpreted as executable code rather than data.

The local attack vector requires an attacker to craft a malicious image file containing specially formatted data. When this file is processed by ImageMagick and the output is subsequently rendered by a PostScript interpreter (such as Ghostscript) or displayed in a web browser, the injected code executes with the privileges of the rendering application.

Root Cause

The root cause is improper input validation and missing output encoding in the PostScript coders and HTML encoder modules. These components fail to sanitize user-controlled input before incorporating it into generated PostScript headers and HTML documents, violating the principle of treating all input as untrusted.

Attack Vector

The attack requires local access and involves providing a maliciously crafted image file to ImageMagick for processing. The attacker embeds specially formatted data within the image metadata or content that, when processed by the vulnerable PS coders or HTML encoder, results in arbitrary code being written to the output file. The injected PostScript code executes when the generated file is opened by Ghostscript or sent to a printer, while injected HTML code executes when the HTML output is viewed in a web browser.

The vulnerability mechanism involves insufficient sanitization in the PostScript header generation and HTML string escaping routines. When ImageMagick converts images to PostScript format, attacker-controlled strings are written directly into the PostScript header without proper escaping, allowing PostScript commands to be injected. Similarly, the HTML encoder writes strings to HTML output without proper entity encoding, enabling HTML and JavaScript injection. For complete technical details, refer to the GitHub Security Advisory.

Detection Methods for CVE-2026-25797

Indicators of Compromise

  • Unusual PostScript commands or syntax appearing in ImageMagick-generated .ps or .eps files
  • Unexpected HTML or JavaScript content in ImageMagick-generated HTML output
  • Image files with suspicious metadata containing PostScript or HTML syntax
  • Ghostscript or printer processes executing unexpected system commands

Detection Strategies

  • Monitor ImageMagick processes for unusual input file patterns or suspicious metadata content
  • Implement file integrity monitoring on directories where ImageMagick generates output files
  • Deploy application-layer firewalls to inspect file uploads for malicious payloads
  • Review ImageMagick policy.xml configurations for appropriate coder restrictions

Monitoring Recommendations

  • Log all ImageMagick conversion operations with input/output file details
  • Monitor Ghostscript and printer spooler processes for anomalous behavior
  • Implement content security policies for web applications displaying ImageMagick-generated HTML
  • Alert on ImageMagick processes spawning unexpected child processes

How to Mitigate CVE-2026-25797

Immediate Actions Required

  • Upgrade ImageMagick to version 7.1.2-15 or later (for 7.x branch)
  • Upgrade ImageMagick to version 6.9.13-40 or later (for 6.x branch)
  • Review and restrict ImageMagick policy.xml to disable PS and HTML coders if not required
  • Audit systems for potentially compromised PostScript or HTML output files

Patch Information

ImageMagick has released patched versions that address this vulnerability. Version 7.1.2-15 and version 6.9.13-40 contain fixes that properly sanitize input before writing to PostScript headers and HTML documents. Users should upgrade to these versions or later. For additional details, see the GitHub Security Advisory.

Workarounds

  • Disable the PostScript and HTML coders in ImageMagick's policy.xml configuration if not required for operations
  • Run ImageMagick in a sandboxed environment with restricted system access
  • Validate and sanitize all input files before processing with ImageMagick
  • Avoid opening ImageMagick-generated PostScript files with Ghostscript until patches are applied
bash
# Configuration example - Disable PS and HTML coders in policy.xml
# Add the following lines to /etc/ImageMagick-7/policy.xml or equivalent

<policy domain="coder" rights="none" pattern="PS" />
<policy domain="coder" rights="none" pattern="EPS" />
<policy domain="coder" rights="none" pattern="PDF" />
<policy domain="coder" rights="none" pattern="XPS" />
<policy domain="coder" rights="none" pattern="HTML" />

Disclaimer: This content was generated using AI. While we strive for accuracy, please verify critical information with official sources.

  • Vulnerability Details
  • TypeRCE

  • Vendor/TechImagemagick

  • SeverityMEDIUM

  • CVSS Score5.3

  • EPSS Probability0.02%

  • Known ExploitedNo
  • CVSS Vector
  • CVSS:3.1/AV:L/AC:L/PR:L/UI:N/S:U/C:L/I:L/A:L
  • Impact Assessment
  • ConfidentialityLow
  • IntegrityNone
  • AvailabilityLow
  • CWE References
  • CWE-94
  • Technical References
  • GitHub Security Advisory
  • Related CVEs
  • CVE-2024-41817: ImageMagick AppImage RCE Vulnerability

  • CVE-2023-34152: ImageMagick RCE Vulnerability via OpenBlob

  • CVE-2023-34153: ImageMagick RCE Vulnerability

  • CVE-2020-29599: ImageMagick RCE Vulnerability
Experience the World’s Most Advanced Cybersecurity Platform

Experience the World’s Most Advanced Cybersecurity Platform

See how our intelligent, autonomous cybersecurity platform can protect your organization now and into the future.

Try SentinelOne
  • Get Started
  • Get a Demo
  • Product Tour
  • Why SentinelOne
  • Pricing & Packaging
  • FAQ
  • Contact
  • Contact Us
  • Customer Support
  • SentinelOne Status
  • Language
  • Platform
  • Singularity Platform
  • Singularity Endpoint
  • Singularity Cloud
  • Singularity AI-SIEM
  • Singularity Identity
  • Singularity Marketplace
  • Purple AI
  • Services
  • Wayfinder TDR
  • SentinelOne GO
  • Technical Account Management
  • Support Services
  • Verticals
  • Energy
  • Federal Government
  • Finance
  • Healthcare
  • Higher Education
  • K-12 Education
  • Manufacturing
  • Retail
  • State and Local Government
  • Cybersecurity for SMB
  • Resources
  • Blog
  • Labs
  • Case Studies
  • Videos
  • Product Tours
  • Events
  • Cybersecurity 101
  • eBooks
  • Webinars
  • Whitepapers
  • Press
  • News
  • Ransomware Anthology
  • Company
  • About Us
  • Our Customers
  • Careers
  • Partners
  • Legal & Compliance
  • Security & Compliance
  • Investor Relations
  • S Foundation
  • S Ventures

©2026 SentinelOne, All Rights Reserved.

Privacy Notice Terms of Use

English