CVE-2026-49839

jq --rawfile invalid-state reuse after String too long causes heap-buffer-overflow

Published Jun 25, 2026 CVSS 3.1 · 7.1 High EPSS < 1% KEV · Not listed
Description
jq is a command-line JSON processor. Prior to 1.8.2,` jq --rawfile` can turn a handled oversized-string error into invalid-state reuse and a real heap out-of-bounds write in assertion-disabled builds. When jv_load_file(raw=1) reads an attacker-controlled file, it repeatedly appends file chunks to the same jv string accumulator. Once jv_string_append_buf() returns jv_invalid_with_msg("String too long"), the raw-file loop does not stop. If the file contains at least one more byte, the next loop iteration appends a new chunk to an object that is already invalid. With assertions enabled this aborts in jvp_string_ptr(). With assertions disabled, the invalid object is interpreted as a string object and ASan reports heap-buffer-overflow. This vulnerability is fixed in 1.8.2.

Analysis

AI-generated

Technical impact

jq’s handling of the --rawfile option can produce a heap‑buffer‑overflow in assertion‑disabled builds when an attacker supplies a file that causes the string accumulator to exceed its limits. The error handling recycles an invalid string object, allowing subsequent appends to write past the allocated memory. This out‑of‑bounds write can corrupt process memory, potentially leading to arbitrary code execution or program crashes. The flaw is a classic heap overflow identified as CWE‑787.

Affected Systems

The vulnerability affects the jq command‑line JSON processor from jqlang. Versions before 1.8.2 are impacted; the flaw is corrected in the 1.8.2 release and later. It is triggered when jq –‑rawfile reads a file that is controlled or crafted by an attacker.

Risk and Exploitability

The CVSS score of 7.1 indicates medium‑to‑high severity. EPSS is not available, and the vulnerability is not listed in CISA’s KEV catalog. Exploitation requires the attacker to supply a file path to jq –‑rawfile, which implies a local or privileged access vector. If the program is executed with assertions disabled—as is common in production builds—the flaw can be realized, making systems that use jq in automated scripts or services at notable risk.

Remediation

No solution or workaround provided in the CVE record.

OpenCVE Recommended Actions

  • Upgrade jq to version 1.8.2 or later, which contains the necessary fix.
  • Avoid using the --rawfile option with input files that are not trusted or that may be under attacker control.
  • When jq must process external input, ensure that the input size is bounded and that jq is called in an environment that enables assertions or other runtime checks; otherwise restrict the use of --rawfile entirely to a secure context.

Generated by OpenCVE AI on June 25, 2026 at 18:20 UTC.

Tracking

Sign in to view the affected projects.

Advisories

Source ID Title
Debian DLA Debian DLA DLA-4661-1 jq security update
Debian DLA Debian DLA DLA-4662-1 jq security update
Debian DSA Debian DSA DSA-6416-1 jq security update
History
Type Values Removed Values Added
First Time appeared Redhat
Redhat hummingbird
CPEs cpe:/a:redhat:hummingbird:1
Vendors & Products Redhat
Redhat hummingbird
References
Metrics threat_severity

None

threat_severity

Moderate

Type Values Removed Values Added
First Time appeared Jqlang
Jqlang jq
Vendors & Products Jqlang
Jqlang jq
Type Values Removed Values Added
Metrics ssvc

{'options': {'Automatable': 'no', 'Exploitation': 'poc', 'Technical Impact': 'total'}, 'version': '2.0.3'}

Type Values Removed Values Added
Description jq is a command-line JSON processor. Prior to 1.8.2,` jq --rawfile` can turn a handled oversized-string error into invalid-state reuse and a real heap out-of-bounds write in assertion-disabled builds. When jv_load_file(raw=1) reads an attacker-controlled file, it repeatedly appends file chunks to the same jv string accumulator. Once jv_string_append_buf() returns jv_invalid_with_msg("String too long"), the raw-file loop does not stop. If the file contains at least one more byte, the next loop iteration appends a new chunk to an object that is already invalid. With assertions enabled this aborts in jvp_string_ptr(). With assertions disabled, the invalid object is interpreted as a string object and ASan reports heap-buffer-overflow. This vulnerability is fixed in 1.8.2.
Title jq --rawfile invalid-state reuse after String too long causes heap-buffer-overflow
Weaknesses CWE-787
References
Metrics cvssV3_1

{'score': 7.1, 'vector': 'CVSS:3.1/AV:L/AC:L/PR:N/UI:R/S:U/C:N/I:H/A:H'}

Weaknesses

Sources

Status
PUBLISHED
Assigner
GitHub_M
Published
Updated
Jun 25, 2026, 5:55 PM
Reserved
Jun 1, 2026, 6:50 PM
Status
Analyzed
Published
Jun 25, 2026, 6:16 PM
Modified
Oct 25, 2026, 10:10 PM
Severity
Moderate
Public date
Jun 25, 2026, 5:17 PM