MEDIUM 5.5

CVE-2026-47770: jq Stack Exhaustion DoS via Deeply Nested Array Comparison

jq, a widely-used command-line tool for processing and querying JSON data, contains a denial-of-service vulnerability in versions before 1.8.2. When comparing two deeply nested JSON arrays using the == operator, jq crashes due to stack exhaustion. An attacker can trigger this crash by supplying specially crafted nested JSON structures, either directly via command-line input or through embedded jq usage in applications. The crash leaves no data corruption or security breach—just service unavailability. This is a local or user-interaction vulnerability, not remotely exploitable on its own, but it can disrupt any workflow or service relying on jq to process untrusted JSON.

Source data · NVD / CISA · public domain

CVSS
3.1 · 5.5 MEDIUM · CVSS:3.1/AV:L/AC:L/PR:N/UI:R/S:U/C:N/I:N/A:H
Weaknesses (CWE)
CWE-674
Affected products
1 configuration(s)
Published / Modified
2026-06-25 / 2026-06-26

NVD description (verbatim)

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 jvp_array_equal() and jv_equal() in src/jv.c when comparing deeply nested arrays; a nearby sort comparator path through jv_cmp() in src/jv_aux.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.

1 reference(s) · View on NVD →

SEC.co analysis · AI-assisted, reviewed against source

Technical summary

The vulnerability stems from uncontrolled recursion in jq's structural comparison functions, specifically jvp_array_equal() and jv_equal() in src/jv.c. When the == operator is used to compare arrays with sufficient nesting depth, these functions recurse without a depth guard, eventually exhausting the C stack and crashing the process. A secondary code path through jv_cmp() in src/jv_aux.c used by sort operations exhibits the same flaw at larger nesting depths. The missing recursion depth limit allows an attacker to craft a JSON payload with arbitrarily deep array nesting to reliably trigger stack overflow. Versions 1.8.2 and later include recursion guards to prevent this condition.

Business impact

For organizations using jq in automated pipelines, data processing workflows, or as an embedded component, this vulnerability can cause unexpected service interruptions. If jq is invoked on user-supplied or external JSON data without input validation, an attacker can send a malicious JSON payload to crash the process. This impacts availability but not confidentiality or integrity. The severity is moderate because the attack requires either local access or the ability to influence input data reaching jq's comparison logic, and does not grant elevated privileges or data exfiltration.

Affected systems

jqlang jq versions prior to 1.8.2 are affected. This includes jq embedded in applications, used in shell scripts and automation, and deployed in data pipelines. Any system or service that processes JSON data with jq and accepts untrusted or adversarial input is at risk. This spans development environments, CI/CD systems, data processing clusters, and standalone command-line usage where jq processes external JSON sources.

Exploitability

Exploitability is straightforward but requires user interaction or control over input data. An attacker must either (1) trick a user into running jq on a malicious JSON file, or (2) place malicious JSON in a data stream processed by a jq-dependent service. The attack does not require special privileges, network access, or complex techniques—a single deeply nested JSON array is sufficient. The CVSS score of 5.5 reflects the local/user-interaction requirement and the availability-only impact.

Remediation

Upgrade jq to version 1.8.2 or later. Verify the upgrade by checking jq --version. For systems where immediate upgrade is not feasible, restrict jq's input to trusted, validated JSON sources and implement input size or nesting depth limits upstream of jq. However, patching is the definitive fix and should be prioritized.

Patch guidance

Patch jq to version 1.8.2 or later. Download from the official jqlang jq repository or your distribution's package manager (apt, brew, yum, etc.). After patching, verify the version: `jq --version` should report 1.8.2 or higher. For embedded jq libraries, update the jq library dependency in your build configuration and rebuild your application. Test your workflows to ensure compatibility with the patched version before full deployment.

Detection guidance

Monitor for jq process crashes or high CPU/memory usage during JSON processing. Log and alert on jq exit codes indicating segmentation faults (exit code 139 on Linux/Unix). Review logs for unexpected termination of jq processes, particularly in automated pipelines. If feasible, add logging around jq invocations to capture input size and nesting depth metrics. Intrusion detection systems should flag attempts to process exceptionally deeply nested JSON structures through jq, though this requires visibility into application data flows.

Why prioritize this

This vulnerability merits prompt patching because jq is commonly embedded in DevOps toolchains, CI/CD pipelines, and data processing workflows. A malicious JSON payload can reliably disrupt service availability. While not in the CISA KEV catalog, the ease of exploitation and prevalence of jq in automation make it a solid medium priority. Organizations using jq on untrusted input should patch within the standard vulnerability window (30–60 days). Lower priority for environments where jq only processes internal, curated data.

Risk score, explained

CVSS 5.5 (Medium) reflects moderate risk: uncontrolled recursion causes denial of service (high impact on availability), but exploitation requires local access or control over input, and the attack surface is limited to systems actively processing untrusted JSON with jq. There is no privilege escalation, data leakage, or system compromise, only temporary service unavailability. The score correctly aligns with typical medium-severity availability issues.

Frequently asked questions

Can this vulnerability be exploited remotely?

Not directly, unless jq is running as a web service or backend processor that accepts untrusted JSON input. If a web application uses jq to parse user-uploaded JSON files without input validation, a remote attacker could upload a malicious file to trigger the crash. In most command-line scenarios, the attacker must have local access or ability to influence input data.

What does a 'deeply nested' JSON array mean in this context?

It refers to arrays within arrays within arrays, to a considerable depth. For example: [[[[...]]]] with hundreds or thousands of levels of nesting. The exact nesting threshold depends on the system's stack size, but researchers typically demonstrate the issue with nesting depths in the hundreds to low thousands. A typical legitimate JSON payload will not approach such depths.

Does this affect jq's functionality for legitimate use cases?

No. The patched version 1.8.2 continues to support all normal jq operations, including array comparisons and sorting. The fix simply adds recursion depth guards to prevent stack exhaustion. Well-formed JSON and reasonable nesting levels are unaffected.

How do I check if my jq version is vulnerable?

Run `jq --version` from the command line. If the output is 1.8.2 or higher, you are patched. If it is 1.8.1 or earlier, you are vulnerable and should upgrade immediately. You can also check your application's dependency manifests (package.json, requirements.txt, go.mod, etc.) for the jq library version.

This analysis is based on published CVE data and vendor advisories as of the publication date. CVSS scores are provided by NIST and reflect point-in-time assessments. Patch availability, affected versions, and remediation steps should be verified against the official jqlang jq repository and vendor security announcements. This document does not constitute legal or professional security advice; consult your organization's security team or a qualified professional for guidance specific to your environment. Source: NVD (public-domain), retrieved 2026-08-03. Analysis generated by SEC.co (claude-haiku-4-5).