REDHAT-BUG-2458076: Medium severity jq vulnerability
jq is a command-line JSON processor. In commits after 69785bf77f86e2ea1b4a20ca86775916889e91c9, the strindices builtin in jq's src/builtin.c passes its arguments directly to jvstringindexes() without verifying they are strings, and jvstringindexes() in src/jv.c relies solely on assert() checks that are stripped in release builds compiled with -DNDEBUG. This allows an attacker to crash jq trivially with input like strindices(0), and by crafting a numeric value whose IEEE-754 bit pattern maps to a chosen pointer, achieve a controlled pointer dereference and limited memory read/probe primitive. Any deployment that evaluates untrusted jq filters against a release build is vulnerable. This issue has been patched in commit fdf8ef0f0810e3d365cdd5160de43db46f57ed03.
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.
Patch fdf8ef0f0810e3d365cdd5160de43db46f57ed03
Event History
Frequently Asked Questions
Which deployments are exposed to this issue?
Deployments that evaluate untrusted jq filters against a release build are vulnerable. The unsafe path depends on assertions being stripped when jq is compiled with -DNDEBUG.
What does an attacker need to provide to exploit it?
An attacker needs the ability to supply or influence a jq filter that invokes the internal _strindices builtin with a non-string argument. A filter such as _strindices(0) can trivially crash jq.
What impact is possible beyond a crash?
A crafted numeric value whose IEEE-754 bit pattern maps to a chosen pointer can cause a controlled pointer dereference. The described capability is a limited memory read or probe primitive.
How can I determine whether my jq source contains the fix?
The issue is patched by commit fdf8ef0f0810e3d365cdd5160de43db46f57ed03. The vulnerable behavior was introduced after commit 69785bf77f86e2ea1b4a20ca86775916889e91c9.