CVE-2026-49839: jq --rawfile invalid-state reuse after String too long causes heap-buffer-overflow
jq --rawfile invalid-state reuse after String too long causes heap-buffer-overflow
Other sources
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 jvloadfile(raw=1) reads an attacker-controlled file, it repeatedly appends file chunks to the same jv string accumulator. Once jvstringappendbuf() returns jvinvalidwithmsg("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 jvpstringptr(). 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.
— MITRE
Affected Software
Remediation
Recommended actions to resolve this vulnerability, in priority order.
- Upgrade
Upgrade to a fixed release to a version that resolves this vulnerability.
Fixed in 1.7.1-7 - Upgrade
Upgrade to a fixed release to a version that resolves this vulnerability.
Fixed in 1.7.1-8 - Upgrade
Upgrade
jqto a version that resolves this vulnerability.Fixed in 1.8.2
Event History
Frequently Asked Questions
What is the severity of CVE-2026-49839?
CVE-2026-49839 has a severity score of 7.1, which is classified as high.
How does CVE-2026-49839 exploit vulnerabilities in jq?
CVE-2026-49839 exploits jq by causing heap-buffer overflow through invalid-state reuse when processing oversized strings.
How can I mitigate CVE-2026-49839?
To mitigate CVE-2026-49839, upgrade jq to version 1.8.2 or later which resolves the vulnerability.
Who is affected by CVE-2026-49839?
Users of jq prior to version 1.8.2 are at risk of CVE-2026-49839 due to improper handling of oversized strings.
What impact does CVE-2026-49839 have on system security?
CVE-2026-49839 can lead to a heap out-of-bounds write, potentially allowing an attacker to execute arbitrary code.