Join the Cyber Forum: Threat Intel on May 12, 2026 to learn how AI is reshaping threat defense.Join the Virtual Cyber Forum: Threat IntelRegister Now
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
    • AI Data Pipelines
      Security Data Pipeline for AI SIEM and Data Optimization
    • 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-40310

CVE-2026-40310: ImageMagick Buffer Overflow Vulnerability

CVE-2026-40310 is a heap buffer overflow flaw in ImageMagick's JP2 encoder that occurs when users specify an invalid sampling index. This article covers the technical details, affected versions, and mitigation strategies.

Published: April 17, 2026

CVE-2026-40310 Overview

CVE-2026-40310 is a heap out-of-bounds write vulnerability affecting ImageMagick, the popular open-source software suite for editing and manipulating digital images. The vulnerability exists in the JP2 (JPEG 2000) encoder component and can be triggered when a user specifies an invalid sampling index during image processing operations. This memory corruption issue could allow an attacker to cause a denial of service condition by crashing the application.

Critical Impact

A heap out-of-bounds write in ImageMagick's JP2 encoder could lead to application crashes and denial of service when processing maliciously crafted images with invalid sampling parameters.

Affected Products

  • ImageMagick versions below 7.1.2-19
  • ImageMagick versions below 6.9.13-44
  • Magick.NET versions below 14.12.0

Discovery Timeline

  • 2026-04-13 - CVE-2026-40310 published to NVD
  • 2026-04-13 - Last updated in NVD database

Technical Details for CVE-2026-40310

Vulnerability Analysis

This vulnerability is classified as CWE-122 (Heap-based Buffer Overflow), a memory corruption issue that occurs when data is written beyond the allocated heap buffer boundaries. The flaw resides in the JP2 encoder within the coders/jp2.c file of ImageMagick.

When processing images with user-supplied sampling factors for JPEG 2000 encoding, the vulnerable code fails to properly validate the sampling index values. Specifically, the subsampling_dx and subsampling_dy parameters derived from user input could be set to invalid values (including zero or negative values), leading to heap memory corruption during subsequent encoding operations.

The vulnerability requires local access and user interaction—an attacker would need to convince a victim to process a maliciously crafted image or use specific command-line parameters when converting images to JP2 format.

Root Cause

The root cause is improper input validation in the JP2 encoder when parsing geometry information for subsampling parameters. The original code directly assigned user-supplied values to the subsampling_dx and subsampling_dy parameters without enforcing minimum bounds, allowing invalid values to corrupt heap memory during encoding operations.

Attack Vector

The attack vector requires local access with user interaction. An attacker could exploit this vulnerability by:

  1. Crafting a malicious image processing command with invalid sampling factor parameters
  2. Convincing a victim to process the image using ImageMagick with specific JP2 encoding options
  3. Triggering the heap overflow when the invalid sampling index is processed

The vulnerability primarily results in denial of service through application crashes, as the heap corruption disrupts normal memory operations.

c
// Security patch in coders/jp2.c
// Source: https://github.com/ImageMagick/ImageMagick/commit/3d653bea2df085c728a1c8f775808e1e9249dff9

 
       flags=ParseGeometry(image_info->sampling_factor,&geometry_info);
       if ((flags & RhoValue) != 0)
-        parameters->subsampling_dx=(int) geometry_info.rho;
+        parameters->subsampling_dx=(int) MagickMax(
+          geometry_info.rho,1.0);
       parameters->subsampling_dy=parameters->subsampling_dx;
       if ((flags & SigmaValue) != 0)
-        parameters->subsampling_dy=(int) geometry_info.sigma;
+        parameters->subsampling_dy=(int) MagickMax(
+          geometry_info.sigma,1.0);
     }   
   property=GetImageProperty(image,"comment",exception);
   if (property != (const char *) NULL)

The patch adds MagickMax() calls to ensure that subsampling values are never less than 1.0, preventing the heap overflow condition.

Detection Methods for CVE-2026-40310

Indicators of Compromise

  • Unexpected crashes of ImageMagick processes during JP2/JPEG 2000 encoding operations
  • Core dumps or segmentation faults associated with convert, mogrify, or other ImageMagick utilities
  • Unusual command-line parameters specifying abnormal sampling factors (e.g., -sampling-factor 0x0)
  • Application logs showing heap corruption or memory allocation errors in JP2 encoder operations

Detection Strategies

  • Monitor for ImageMagick process crashes with heap corruption signatures in crash dumps
  • Implement file integrity monitoring on ImageMagick binaries to detect unauthorized modifications
  • Review application logs for abnormal image processing errors related to JP2 encoding
  • Deploy memory protection tools (ASan, Valgrind) in development environments to detect out-of-bounds writes

Monitoring Recommendations

  • Enable verbose logging for ImageMagick operations in production environments
  • Configure crash monitoring systems to alert on ImageMagick process terminations
  • Implement input validation at the application layer before passing parameters to ImageMagick
  • Set up automated vulnerability scanning to identify outdated ImageMagick installations

How to Mitigate CVE-2026-40310

Immediate Actions Required

  • Upgrade ImageMagick to version 7.1.2-19 or later for the 7.x branch
  • Upgrade ImageMagick to version 6.9.13-44 or later for the 6.x branch
  • Update Magick.NET to version 14.12.0 or later if using the .NET wrapper
  • Restrict ImageMagick's execution to trusted users and validated inputs

Patch Information

ImageMagick has released security patches addressing this vulnerability. The fix ensures that subsampling parameters are validated to have a minimum value of 1.0, preventing the heap overflow condition. Patches are available through the official GitHub repository:

  • ImageMagick 7.1.2-19 Release
  • Security Commit 3d653bea2df085c728a1c8f775808e1e9249dff9
  • GitHub Security Advisory GHSA-pwg5-6jfc-crvh
  • Magick.NET 14.12.0 Release

Workarounds

  • Disable JP2/JPEG 2000 encoding in ImageMagick policy configuration if not required
  • Implement strict input validation to reject invalid sampling factor parameters before processing
  • Run ImageMagick in a sandboxed environment with restricted memory access
  • Use ImageMagick's policy.xml to restrict coders and limit resource usage
bash
# Configuration example - Disable JP2 coder in ImageMagick policy.xml
# Add the following to /etc/ImageMagick-7/policy.xml or /etc/ImageMagick-6/policy.xml

<policy domain="coder" rights="none" pattern="JP2" />
<policy domain="coder" rights="none" pattern="JPC" />
<policy domain="coder" rights="none" pattern="JPX" />

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

  • Vulnerability Details
  • TypeBuffer Overflow

  • Vendor/TechImagemagick

  • SeverityMEDIUM

  • CVSS Score5.5

  • EPSS Probability0.01%

  • Known ExploitedNo
  • CVSS Vector
  • CVSS:3.1/AV:L/AC:L/PR:N/UI:R/S:U/C:N/I:N/A:H
  • Impact Assessment
  • ConfidentialityLow
  • IntegrityNone
  • AvailabilityHigh
  • CWE References
  • CWE-122
  • Technical References
  • GitHub Commit Update

  • GitHub Release 7.1.2-19

  • GitHub Security Advisory GHSA-pwg5-6jfc-crvh

  • GitHub Magick.NET Release 14.12.0
  • Related CVEs
  • CVE-2026-40183: ImageMagick Buffer Overflow Vulnerability

  • CVE-2026-40169: ImageMagick Buffer Overflow Vulnerability

  • CVE-2026-34238: ImageMagick Buffer Overflow Vulnerability

  • CVE-2026-33905: ImageMagick Buffer Overflow Vulnerability
Default Legacy - Prefooter | 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