CVE-2025-68618
C# vulnerability analysis and mitigation

Overview

CVE-2025-68618 is a Denial of Service vulnerability in ImageMagick caused by uncontrolled recursion during SVG file parsing. When processing a maliciously crafted SVG file, ImageMagick fails to limit the depth of recursive calls in the SVGStartElement function, leading to a stack overflow and application crash. All versions of ImageMagick prior to 7.1.2-12 are affected, as are Magick.NET NuGet packages prior to version 14.10.1. The vulnerability was disclosed on December 30, 2025, with a CVSS v3.1 base score of 5.3 (Moderate) per the official advisory (GitHub Advisory, ImageMagick Advisory).

Technical details

The root cause is CWE-674 (Uncontrolled Recursion): ImageMagick's SVG coder (coders/svg.c) did not enforce a maximum recursion depth when processing nested SVG elements via the SVGStartElement callback. Each nested XML element (e.g., deeply nested <g> tags) triggers a call to ResizeQuantumMemory to expand the scale array, and without a depth limit, deeply nested SVG structures exhaust the program stack, causing a stack overflow. The fix in commit 6f431d4 adds a check against MagickMaxRecursionDepth in both coders/svg.c and coders/msl.c, stopping the parser and throwing a DrawError when the limit is exceeded. The attack requires no authentication or user interaction — only the ability to supply a malicious SVG file to an ImageMagick-enabled application (ImageMagick Advisory, Fix Commit).

Impact

Successful exploitation causes a stack overflow crash in the ImageMagick process, resulting in a denial of service condition. There is no impact on confidentiality or data integrity — the vulnerability is limited to availability. Any application or service that processes user-supplied SVG files through ImageMagick (e.g., web image upload pipelines, document converters, thumbnail generators) is at risk of service disruption or repeated crashes if an attacker can submit malicious SVG input (GitHub Advisory, ImageMagick Advisory).

Exploitation steps

  1. Craft a malicious SVG file: Create an SVG file with an extremely deep nesting of XML elements (e.g., thousands of nested <g> tags) that exceeds the program's stack capacity when parsed recursively.
  2. Deliver the SVG to the target: Submit the malicious SVG file to any service or application that processes SVG images using ImageMagick (e.g., upload it via a web form, API endpoint, or pass it directly on the command line).
  3. Trigger parsing: The application invokes ImageMagick to read or convert the SVG. The SVGStartElement callback in coders/svg.c is called for each nested element, incrementing the recursion counter and calling ResizeQuantumMemory without a depth limit.
  4. Stack overflow occurs: The uncontrolled recursion exhausts the process stack, causing a crash (stack overflow). On Windows, this manifests as exit code -1073741571; on Linux, it results in a segmentation fault or similar crash.
  5. Denial of service achieved: The ImageMagick process (or the hosting application) crashes, causing service unavailability. If the service auto-restarts, repeated submission of the malicious file can maintain the DoS condition (ImageMagick Advisory).

Indicators of compromise

  • Logs: Application or system logs showing repeated crashes or abnormal termination of the ImageMagick process (magick, convert, or embedded library calls); error messages containing VectorGraphicsNestedTooDeeply or DrawError in ImageMagick logs (post-patch behavior that may indicate attempted exploitation).
  • File System: Presence of unusually structured SVG files in upload directories or temporary processing folders containing deeply nested XML elements (e.g., thousands of <g> tags).
  • Process: Unexpected termination of ImageMagick worker processes with exit code -1073741571 (Windows stack overflow) or SIGSEGV/SIGABRT signals on Linux; high memory consumption followed by sudden process death during SVG processing.
  • Network: Repeated upload requests containing SVG files from the same source IP, particularly if followed by service restarts or error responses (ImageMagick Advisory).

Mitigation and workarounds

Upgrade ImageMagick to version 7.1.2-12 or later, which enforces a maximum recursion depth (MagickMaxRecursionDepth) in the SVG and MSL coders. For Magick.NET users, upgrade to version 14.10.1 or later. As a workaround where upgrading is not immediately possible, disable SVG file processing in ImageMagick's policy configuration (/etc/ImageMagick-7/policy.xml) by setting <policy domain="coder" rights="none" pattern="SVG" />, or implement input validation to reject SVG files before they reach ImageMagick. Debian LTS, Ubuntu, SUSE, openSUSE, and Amazon Linux 2 have all issued updated packages addressing this vulnerability (GitHub Advisory, Debian LTS, Ubuntu Advisory).

Community reactions

The vulnerability was reported by researcher ylwango613 and published by ImageMagick maintainer dlemstra on December 30, 2025. Multiple Linux distributions — including Debian, Ubuntu, SUSE, openSUSE, and Amazon Linux 2 — issued security advisories and updated packages shortly after disclosure. Security scanning vendors including Tenable (Nessus) and Qualys added detection plugins for the vulnerability. Community coverage was primarily technical and focused on patch availability rather than active exploitation concerns (Debian LTS, Ubuntu Advisory).

Additional resources


SourceThis report was generated using AI

Related C# vulnerabilities:

CVE ID

Severity

Score

Technologies

Component name

CISA KEV exploit

Has fix

Published date

GHSA-p5rm-jg5c-8c77MEDIUM6.1
  • C# logoC#
  • Microsoft.OpenApi.Kiota
NoYesJul 24, 2026
CVE-2026-62946MEDIUM5.1
  • C# logoC#
  • Magick.NET-Q16-AnyCPU
NoYesJul 24, 2026
CVE-2026-62363MEDIUM5
  • C# logoC#
  • Magick.NET-Q16-HDRI-OpenMP-arm64
NoYesJul 24, 2026
CVE-2026-62343MEDIUM4.7
  • C# logoC#
  • Magick.NET-Q16-OpenMP-arm64
NoYesJul 24, 2026
GHSA-464c-974j-9xm6LOW3.3
  • JavaScript logoJavaScript
  • @aws-cdk/aws-codebuild
NoYesJul 24, 2026

Free Vulnerability Assessment

Benchmark your Cloud Security Posture

Evaluate your cloud security practices across 9 security domains to benchmark your risk level and identify gaps in your defenses.

Request assessment

Get a personalized demo

Ready to see Wiz in action?

"Best User Experience I have ever seen, provides full visibility to cloud workloads."
David EstlickCISO
"Wiz provides a single pane of glass to see what is going on in our cloud environments."
Adam FletcherChief Security Officer
"We know that if Wiz identifies something as critical, it actually is."
Greg PoniatowskiHead of Threat and Vulnerability Management