ANT-2026-5BD488PV · graphicsmagick/graphicsmagick

stack-buffer-overflow high

Severity Claude critical · Security research firm high · Maintainer -

Discovered by Claude Mythos Preview

REPORT

Anthropic's analysis, sealed at approval. Disclosure to the maintainer was performed by Ada Logics.

ANT-2026-5BD488PV: Stack-buffer-overflow in locale.c:257

GraphicsMagick's LOCALE coder parses XML configuration files in ReadConfigureFile() (coders/locale.c). When handling a element, the value of the name attribute is copied into a fixed-size 2053-byte stack buffer message (frame offsets [4480, 6533)) without a length check. A crafted 2081-byte XML file containing a attribute of ~2053 characters overflows this buffer at line 257, producing a deterministic ASAN stack-buffer-overflow write. The overflow is reached from gm convert via ReadImage -> ReadLOCALEImage -> ReadConfigureFile, so any workflow that processes attacker-supplied files with the LOCALE coder is affected.

Target

Project: graphicsmagick
Location: locale.c:257

Technical Details

ASAN: "stack-buffer-overflow ... WRITE of size 1" past the end of the 2053-byte message stack variable at frame offset 6533 in ReadConfigureFile (coders/locale.c:257). The parser does not bound the copy of the name attribute against the fixed buffer size, so an attribute value ≥2053 bytes writes past the buffer end on the stack.

Crash trace:

The PoC (2081-byte XML file) triggers a deterministic stack-buffer-overflow in GraphicsMagick's LOCALE coder. The XML contains a `<message>` element with a `name` attribute consisting of ~2053 'A' characters, which overflows the fixed-size `message` stack buffer (2053 bytes, offsets [4480, 6533)) in `ReadConfigureFile()` at `coders/locale.c:257`.

All 3 reproduction runs in a fresh `graphicsmagick:latest` container produced identical ASAN reports:
- Error: `stack-buffer-overflow on address ... at pc ... in ReadConfigureFile coders/locale.c:257`
- Write of size 1 overflowing the `message` variable at stack offset 6533
- Exit code: 1 (ASAN abort)
- Full call chain through project code: `ReadConfigureFile` -> `ReadLOCALEImage` -> `ReadImage` -> `ConvertImageCommand` -> `main`

No OOM, timeout, or non-project crashes. The bug is a genuine stack buffer overflow in GraphicsMagick's locale configuration file parser.

Reproduction

  1. Create a ~2KB XML file containing a element whose name attribute is ≥2053 bytes (e.g. repeated 'A').
  2. Have the target run gm convert (or equivalent ReadImage entry point) on the file so the LOCALE coder is selected.
  3. ReadConfigureFile() copies the oversized attribute into the 2053-byte stack buffer message, writing past its end at locale.c:257.

[No reproducer or sanitizer output attached — request from security-cvd@anthropic.com if needed.]

Acknowledgement

This vulnerability was discovered by Claude, Anthropic's AI assistant, and triaged by the Anthropic security team in collaboration with Anthropic Research. Please direct questions to security-cvd@anthropic.com and reference ANT-2026-5BD488PV.


Reference: ANT-2026-5BD488PV
Anthropic CVD Policy: https://www.anthropic.com/coordinated-vulnerability-disclosure

SECURITY RESEARCH FIRM ANALYSIS

Triage and disclosure were performed by Ada Logics.

Verdict
true positive
Severity
high
TIMELINE

Dates from discovery through public reveal.

  1. 2026-03-24 Reported to tracker
  2. 2026-05-30 Patch released
  3. 2026-05-31 Sent to maintainer
  4. 2026-08-18 Publicly revealed
PROVENANCE

SHA-3-512 hash:

c92a0732478e6b4e0c9f5d03dc61a114f5ae155c6b46aaebcecb593ad5222b59c3051574a36a0738b5c55e921cbd0209119035c91b4a010df72bc213b132e1b2

Committed 2026-05-31 00:18 PT

Revealed 2026-08-18 03:06 PT

Verify (download preimage.json)

Show preimage JSON
{
  "ant_id": "ANT-2026-5BD488PV",
  "bug_class": "Stack-buffer-overflow",
  "claude_severity": "critical",
  "commit_sha": null,
  "created_at": "2026-03-24T18:30:54+00:00",
  "description": "GraphicsMagick's LOCALE coder parses XML configuration files in ReadConfigureFile() (coders/locale.c). When handling a <message> element, the value of the name attribute is copied into a fixed-size 2053-byte stack buffer `message` (frame offsets [4480, 6533)) without a length check. A crafted 2081-byte XML file containing a <message name=\"AAAA...\"> attribute of ~2053 characters overflows this buffer at line 257, producing a deterministic ASAN stack-buffer-overflow write. The overflow is reached from `gm convert` via ReadImage -> ReadLOCALEImage -> ReadConfigureFile, so any workflow that processes attacker-supplied files with the LOCALE coder is affected.",
  "discovered_at": null,
  "location": "locale.c:257",
  "poc_sha256": null,
  "preimage_version": 1,
  "project": "graphicsmagick",
  "reproduction": [
    "1. Create a ~2KB XML file containing a <message> element whose name attribute is ≥2053 bytes (e.g. repeated 'A').",
    "2. Have the target run `gm convert` (or equivalent ReadImage entry point) on the file so the LOCALE coder is selected.",
    "3. ReadConfigureFile() copies the oversized attribute into the 2053-byte stack buffer `message`, writing past its end at locale.c:257."
  ],
  "technical_details": "ASAN: \"stack-buffer-overflow ... WRITE of size 1\" past the end of the 2053-byte `message` stack variable at frame offset 6533 in ReadConfigureFile (coders/locale.c:257). The parser does not bound the copy of the `name` attribute against the fixed buffer size, so an attribute value ≥2053 bytes writes past the buffer end on the stack.",
  "title": "Stack-buffer-overflow in locale.c:257",
  "vendor_severity": "high"
}