ANT-2026-EBDTPNVH · jqlang/jq

oob-write medium

CVE-2026-32316 GHSA-q3h9-m34w-h76f

Severity Claude medium · Security research firm medium · Maintainer -

Discovered by Claude Mythos Preview

REPORT

Anthropic's analysis, sealed at approval. Disclosure to the maintainer was performed by Trail of Bits.

ANT-2026-EBDTPNVH: Integer overflow in string concatenation leading to 1 GB memcpy heap buffer overflow

An integer overflow during string concatenation leads to a 1 GB memcpy heap buffer overflow.

Target

Project: jqlang/jq
Discovery: static analysis — not yet dynamically reproduced

Technical Details

The root cause is an integer overflow in the string-concatenation size calculation; the resulting undersized buffer is then overflowed by a ~1 GB memcpy.

Reproduction

This finding was identified by static analysis and has not yet been dynamically reproduced. The Technical Details section above describes the code path; a trigger input is not included.

[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-EBDTPNVH.


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

SECURITY RESEARCH FIRM ANALYSIS

Triage and disclosure were performed by Trail of Bits.

Verdict
true positive
Severity
medium
UPSTREAM FIX

The change that resolved this finding.

diff --git a/src/jv.c b/src/jv.c
index 722a539391..2a62b48419 100644
--- a/src/jv.c
+++ b/src/jv.c
@@ -1114,7 +1114,12 @@ static jv jvp_string_copy_replace_bad(const char* data, uint32_t length) {
   const char* end = data + length;
   const char* i = data;
 
-  uint32_t maxlength = length * 3 + 1; // worst case: all bad bytes, each becomes a 3-byte U+FFFD
+  // worst case: all bad bytes, each becomes a 3-byte U+FFFD
+  uint64_t maxlength = (uint64_t)length * 3 + 1;
+  if (maxlength >= INT_MAX) {
+    return jv_invalid_with_msg(jv_string("String too long"));
+  }
+
   jvp_string* s = jvp_string_alloc(maxlength);
   char* out = s->data;
   int c = 0;
@@ -1174,6 +1179,10 @@ static uint32_t jvp_string_remaining_space(jvp_string* s) {
 static jv jvp_string_append(jv string, const char* data, uint32_t len) {
   jvp_string* s = jvp_string_ptr(string);
   uint32_t currlen = jvp_string_length(s);
+  if ((uint64_t)currlen + len >= INT_MAX) {
+    jv_free(string);
+    return jv_invalid_with_msg(jv_string("String too long"));
+  }
 
   if (jvp_refcnt_unshared(string.u.ptr) &&
       jvp_string_remaining_space(s) >= len) {

https://github.com/jqlang/jq/commit/e47e56d226519635768e6aab2f38f0ab037c09e5

TIMELINE

Recorded dates, in order.

  1. 2026-03-29 Discovered or logged
  2. 2026-05-07 Sent to maintainer
  3. 2026-05-07 Maintainer acknowledged
  4. 2026-05-07 Patch released
  5. 2026-05-20 Publicly revealed
PROVENANCE

SHA-3-512 hash:

e58a8b9eeba1e34b6155b568522e0ed14fbaab99b1699e170f1bb129f78dd3b8ad1baf7997acbfbd05c8a10c16ffad6f5cda3bd7b6798efd06569cd55df3c1a9

Committed 2026-05-07 07:00 UTC

Revealed 2026-05-20 07:40 UTC

Verify (download preimage.json)

Show preimage JSON
{
  "ant_id": "ANT-2026-EBDTPNVH",
  "bug_class": "Heap Buffer Overflow",
  "claude_severity": "medium",
  "commit_sha": null,
  "created_at": "2026-03-29T20:43:01+00:00",
  "description": "An integer overflow during string concatenation leads to a 1 GB memcpy heap buffer overflow.",
  "discovered_at": null,
  "location": null,
  "poc_sha256": null,
  "preimage_version": 1,
  "project": "jq",
  "reproduction": null,
  "technical_details": "The root cause is an integer overflow in the string-concatenation size calculation; the resulting undersized buffer is then overflowed by a ~1 GB memcpy.",
  "title": "Integer overflow in string concatenation leading to 1 GB memcpy heap buffer overflow",
  "vendor_severity": "medium"
}