REDHAT-BUG-2493034: Medium severity JQ jq vulnerability
jq is a command-line JSON processor. Prior to 1.8.2, comparing two sufficiently deeply nested arrays with the == operator exhausts the C stack on jq's ordinary command-line surface, resulting in denial of service via stack exhaustion (uncontrolled recursion). The crash occurs in jq's recursive structural comparison code, with the recursion repeating through jvparrayequal() and jvequal() in src/jv.c when comparing deeply nested arrays; a nearby sort comparator path through jvcmp() in src/jvaux.c overflows the stack at a larger nesting depth from the same missing recursion guard. Anyone running jq comparisons on attacker-controlled deeply nested JSON values, or embedding jq in a context where untrusted data can reach the == comparison path, is affected. This vulnerability is fixed in 1.8.2.
Affected Software
Remediation
Recommended actions to resolve this vulnerability, in priority order.
- Upgrade
Upgrade
jqto a version that resolves this vulnerability.Fixed in 1.8.2
Event History
Frequently Asked Questions
Who is realistically exposed to this issue?
Systems are exposed when jq compares attacker-controlled, deeply nested JSON arrays using the == operator. This also applies to applications embedding jq if untrusted data can reach that comparison path.
What does an attacker need to trigger the denial of service?
The attacker needs to supply two sufficiently deeply nested JSON arrays that are compared with ==. Triggering the issue exhausts the C stack and crashes jq.
Are versions before the fixed release affected?
The issue affects jq versions prior to 1.8.2. Version 1.8.2 contains the fix.
What related operations should be considered during triage?
A nearby sort comparator path using jv_cmp() can also overflow the stack at a larger nesting depth because it lacks the same recursion guard. Review workflows that sort attacker-controlled deeply nested JSON as well as those using == comparisons.