Summary
- Target: ImageMagick (commit
ecc9a5eb456747374bae8e07038ba10b3d8821b3) - Type: Undefined Behavior (function-type-mismatch) in splay tree cloning callback
- Impact: Deterministic abort under UBSan (DoS in sanitizer builds). No crash in a non-sanitized build; likely low security impact.
- Trigger: Minimal 2-byte input parsed via MagickWand, then coalescing.
Environment
OS: macOS (Apple Silicon/arm64)
Homebrew clang version 20.1.8
Target: arm64-apple-darwin24.5.0
Thread model: posix
InstalledDir: /opt/homebrew/Cellar/llvm/20.1.8/bin
Configuration file: /opt/homebrew/etc/clang/arm64-apple-darwin24.cfg
Homebrew ImageMagick: magick -version → ImageMagick 7.1.2-0 Q16-HDRI aarch64
pkg-config: MagickWand-7.Q16HDRI version 7.1.2
Library configure flags (capsule build):
./configure --disable-shared --enable-static --without-modules --without-magick-plus-plus --disable-openmp --without-perl --without-x --with-png=yes --without-jpeg --without-tiff --without-xml --without-lqr --without-gslib
Harness compile flags:
-fsanitize=fuzzer,address,undefined -fno-omit-frame-pointer
pkg-config cflags/libs supplied:
-I<...>/include/ImageMagick-7
-DMAGICKCORE_HDRI_ENABLE=1 -DMAGICKCORE_QUANTUM_DEPTH=16 -DMAGICKCORE_CHANNEL_MASK_DEPTH=32
and linked against MagickWand-7.Q16HDRI and MagickCore-7.Q16HDRI
Sanitizer runtime:
ASan+UBSan defaults. Repro also with UBSAN_OPTIONS=print_stacktrace=1:halt_on_error=1
PoC
- Bytes (hex):
1c 02 - Base64:
HAI= - sha256 (optional):
Reproduction
Create PoC:
printf '\x1c\x02' > poc.bin
Option A: libFuzzer harness
- Run once:
./harness_ImageMagick_... -runs=1 ./poc.bin - Expected: UBSan aborts with function-type-mismatch at
MagickCore/splay-tree.c:372:43.
Option B: standalone reproducer (C)
- Compile (ensure
PKG_CONFIG_PATHpoints to your ImageMagick if needed):
/opt/homebrew/opt/llvm/bin/clang -g -O1 -fsanitize=address,undefined $(/opt/homebrew/bin/pkg-config --cflags MagickWand-7.Q16HDRI) repro.c -o repro $(/opt/homebrew/bin/pkg-config --libs MagickWand-7.Q16HDRI)
- Run:
UBSAN_OPTIONS=print_stacktrace=1:halt_on_error=1 ./repro ./poc.bin
Observed output (excerpt)
MagickCore/splay-tree.c:372:43: runtime error: call to function ConstantString through pointer to incorrect function type 'void ()(void *)'
string.c:680: note: ConstantString defined here
#0 CloneSplayTree splay-tree.c:372
#1 CloneImageProfiles profile.c:159
#2 CloneImage image.c:832
#3 CoalesceImages layer.c:269
#4 MagickCoalesceImages magick-image.c:1665
#5 main repro.c:XX
Root cause
The splay tree clone callback expects a function pointer of type void *(*)(void *). ConstantString has a different signature (char *ConstantString(const char *)). Calling through the mismatched function type is undefined behavior in C and triggers UBSan’s function-type-mismatch.
The path is exercised during coalescing: CloneImage → CloneImageProfiles → CloneSplayTree.
Scope
Reproduces with a minimal, sanitizer-instrumented, PNG-enabled build and delegates disabled (policy.xml), suggesting the issue is in MagickCore rather than external delegates.
Suggested fix (sketch)
Use a wrapper that matches the expected callback prototype, or adjust the splay-tree callback typedef for const-correctness. For example:
static void *CloneStringShim(const void *p) {
return (void *) ConstantString((const char *) p);
}
/* When setting splay-tree clone_value, use CloneStringShim instead of ConstantString. */
Alternatively, update the clone callback typedefs to use const void* consistently (and return void*) and ensure callers pass a correctly typed wrapper.
Artifacts
Minimised PoC: attached (poc.bin, 2 bytes; base64 HAI=)
Harness source and exact build command (attached)
Full UBSan trace (attached)
Commit SHA and configure flags (above)
Credits
Discovered by: Lumina Mescuwa
Method: libFuzzer + UBSan
Verification
- UBSan build: Reproduces with
halt_on_error=1; aborts atMagickCore/splay-tree.c:372. - Non-sanitized Homebrew build (macOS arm64, clang 20.1.8): No crash; repro completes silently.
Impact
CVE-2025-55160 has a CVSS score of 6.1 (Medium). The vector is requires local access, no privileges required, and user interaction required. A CVSS score reflects the worst-case severity of the vulnerability, not your specific exposure. Whether this affects your application depends on whether the vulnerable code is present and reachable in your environment. A fixed version is available (14.8.0); upgrading removes the vulnerable code path.
Affected versions
Security releases
Kodem intelligence
Severity tells you how bad this could be in the worst case. It does not tell you whether you are exposed. Exploitability and impact are functions of runtime truth: whether the vulnerable code is present, reachable, and actually executes in your application. A vulnerable package can sit in your dependency tree and never run.
Kodem, an Intelligent Application Security platform, uses runtime intelligence to reveal which vulnerabilities actually execute in production, so teams prioritize the ones that genuinely matter. Kodem's runtime-powered SCA identifies whether this CVE is reachable in your applications.
Remediation advice
Magick.NET-Q16-AnyCPU to 14.8.0 or later; Magick.NET-Q16-HDRI-AnyCPU to 14.8.0 or later; Magick.NET-Q16-HDRI-OpenMP-arm64 to 14.8.0 or later; Magick.NET-Q16-HDRI-OpenMP-x64 to 14.8.0 or later; Magick.NET-Q16-HDRI-arm64 to 14.8.0 or later; Magick.NET-Q16-HDRI-x64 to 14.8.0 or later; Magick.NET-Q16-HDRI-x86 to 14.8.0 or later; Magick.NET-Q16-OpenMP-arm64 to 14.8.0 or later; Magick.NET-Q16-OpenMP-x64 to 14.8.0 or later; Magick.NET-Q16-arm64 to 14.8.0 or later; Magick.NET-Q16-x64 to 14.8.0 or later; Magick.NET-Q16-x86 to 14.8.0 or later; Magick.NET-Q8-AnyCPU to 14.8.0 or later; Magick.NET-Q8-OpenMP-arm64 to 14.8.0 or later; Magick.NET-Q8-OpenMP-x64 to 14.8.0 or later; Magick.NET-Q8-arm64 to 14.8.0 or later; Magick.NET-Q8-x64 to 14.8.0 or later; Magick.NET-Q8-x86 to 14.8.0 or later
Kodem Kai can prioritize this vulnerability in your dependency tree and generate a fix recommendation.
Frequently Asked Questions
- What is CVE-2025-55160? CVE-2025-55160 is a medium-severity security vulnerability in Magick.NET-Q16-AnyCPU (nuget), affecting versions < 14.8.0. It is fixed in 14.8.0.
- How severe is CVE-2025-55160? CVE-2025-55160 has a CVSS score of 6.1 (Medium). This score reflects the worst-case severity of the vulnerability, not your specific exposure. Whether it represents real risk in your environment depends on whether the vulnerable code is present and reachable.
- Which packages are affected by CVE-2025-55160?
Magick.NET-Q16-AnyCPU(nuget) (versions < 14.8.0)Magick.NET-Q16-HDRI-AnyCPU(nuget) (versions < 14.8.0)Magick.NET-Q16-HDRI-OpenMP-arm64(nuget) (versions < 14.8.0)Magick.NET-Q16-HDRI-OpenMP-x64(nuget) (versions < 14.8.0)Magick.NET-Q16-HDRI-arm64(nuget) (versions < 14.8.0)Magick.NET-Q16-HDRI-x64(nuget) (versions < 14.8.0)Magick.NET-Q16-HDRI-x86(nuget) (versions < 14.8.0)Magick.NET-Q16-OpenMP-arm64(nuget) (versions < 14.8.0)Magick.NET-Q16-OpenMP-x64(nuget) (versions < 14.8.0)Magick.NET-Q16-arm64(nuget) (versions < 14.8.0)Magick.NET-Q16-x64(nuget) (versions < 14.8.0)Magick.NET-Q16-x86(nuget) (versions < 14.8.0)Magick.NET-Q8-AnyCPU(nuget) (versions < 14.8.0)Magick.NET-Q8-OpenMP-arm64(nuget) (versions < 14.8.0)Magick.NET-Q8-OpenMP-x64(nuget) (versions < 14.8.0)Magick.NET-Q8-arm64(nuget) (versions < 14.8.0)Magick.NET-Q8-x64(nuget) (versions < 14.8.0)Magick.NET-Q8-x86(nuget) (versions < 14.8.0)
- Is there a fix for CVE-2025-55160? Yes. CVE-2025-55160 is fixed in 14.8.0. Upgrade to this version or later.
- Is CVE-2025-55160 exploitable, and should I be worried? Whether CVE-2025-55160 is exploitable in your environment depends on whether the vulnerable code is present and reachable. A CVSS score is a worst-case rating; it does not account for your specific deployment, configuration, or usage patterns. Kodem, an Intelligent Application Security platform, uses runtime intelligence to show which vulnerabilities actually execute in production, so you can focus on the ones that represent real risk. Get a demo
- What actually determines whether CVE-2025-55160 is exploitable, and how bad it is? Exploitability and impact are not fixed properties of a CVE. They depend on runtime truth: whether the vulnerable code is present, reachable, and actually executes in your application. A high CVSS score on a dependency that never runs is not the same as real risk. Kodem, an Intelligent Application Security platform, uses runtime intelligence to reveal which vulnerabilities actually execute in production, so teams prioritize the ones that genuinely matter.
- How do I fix CVE-2025-55160?
- Upgrade
Magick.NET-Q16-AnyCPUto 14.8.0 or later - Upgrade
Magick.NET-Q16-HDRI-AnyCPUto 14.8.0 or later - Upgrade
Magick.NET-Q16-HDRI-OpenMP-arm64to 14.8.0 or later - Upgrade
Magick.NET-Q16-HDRI-OpenMP-x64to 14.8.0 or later - Upgrade
Magick.NET-Q16-HDRI-arm64to 14.8.0 or later - Upgrade
Magick.NET-Q16-HDRI-x64to 14.8.0 or later - Upgrade
Magick.NET-Q16-HDRI-x86to 14.8.0 or later - Upgrade
Magick.NET-Q16-OpenMP-arm64to 14.8.0 or later - Upgrade
Magick.NET-Q16-OpenMP-x64to 14.8.0 or later - Upgrade
Magick.NET-Q16-arm64to 14.8.0 or later - Upgrade
Magick.NET-Q16-x64to 14.8.0 or later - Upgrade
Magick.NET-Q16-x86to 14.8.0 or later - Upgrade
Magick.NET-Q8-AnyCPUto 14.8.0 or later - Upgrade
Magick.NET-Q8-OpenMP-arm64to 14.8.0 or later - Upgrade
Magick.NET-Q8-OpenMP-x64to 14.8.0 or later - Upgrade
Magick.NET-Q8-arm64to 14.8.0 or later - Upgrade
Magick.NET-Q8-x64to 14.8.0 or later - Upgrade
Magick.NET-Q8-x86to 14.8.0 or later
- Upgrade