● High · CVSS 8.2

How to Fix CVE-2026-32316: Heap buffer overflow in jq

By Sai Kiran Pandrala. Last verified: 2026-05-25.

⚡ At a glance
Severity8.2 (High)
Actively exploited?No public listing in CISA KEV
Affectedjqlang < e47e56d226519635768e6aab2f38f0ab037c09e5
Fixed injq e47e56d226519635768e6aab2f38f0ab037c09e5
Type (CWE)CWE-122: CWE-122: Heap-based Buffer Overflow

Exploitation status

CVE-2026-32316 has not (yet) been flagged on the CISA Known Exploited Vulnerabilities catalog; treat that as 'no confirmed exploitation on record', not 'safe to ignore'. Do not read that as all-clear: the KEV catalog often trails real-world attacks, so prioritise this on its severity rather than waiting for a listing.

Public exploit availability: no public proof-of-concept or Metasploit module is referenced in this record yet. That says nothing about private exploit code, so do not treat the issue as low risk just because none is published.

Authoritative references:

What is CVE-2026-32316?

jq is a command-line JSON processor. An integer overflow vulnerability exists through version 1.8.1 within the jvp_string_append() and jvp_string_copy_replace_bad functions, where concatenating strings with a combined length exceeding 2^31 bytes causes a 32-bit unsigned integer overflow in the buffer allocation size calculation, resulting in a drastically undersized heap buffer. Subsequent memory copy operations then write the full string data into this undersized buffer, causing a heap buffer overflow classified as CWE-190 (Integer Overflow) leading to CWE-122 (Heap-based Buffer Overflow). Any system evaluating untrusted jq queries is affected, as an attacker can crash the process or potentially achieve further exploitation through heap corruption by crafting queries that produce extremely large strings.

How to fix CVE-2026-32316

The primary fix is to upgrade jq to the patched build. Use the commands for your platform below; the patched version listed in the vendor advisory is: jq e47e56d226519635768e6aab2f38f0ab037c09e5.

Ubuntu / Debian

sudo apt-get update
sudo apt-get install --only-upgrade jq
jq --version 2>/dev/null || dpkg -s jq | grep -i version

RHEL / CentOS / Rocky / AlmaLinux

sudo dnf upgrade --security jq -y
rpm -q jq

SUSE / openSUSE

sudo zypper patch --category security
rpm -q jq

Complete PowerShell remediation script (Windows)

# Fix script for CVE-2026-32316 affecting jq
# Run as administrator. Detect -> backup -> upgrade -> verify -> log.

$ErrorActionPreference = "Stop"
$LogPath  = "C:\Logs\CVE-2026-32316-fix-$(Get-Date -Format yyyyMMdd-HHmmss).log"
New-Item -ItemType Directory -Force (Split-Path $LogPath) | Out-Null
Start-Transcript -Path $LogPath -Append

try {
    Write-Host "[1/4] Detecting installed version of jq"
    $pkg = winget list --id "jq" 2>$null
    Write-Host $pkg

    Write-Host "[2/4] Backing up configuration"
    $backup = "C:\Backup\jq-$(Get-Date -Format yyyyMMdd)"
    New-Item -ItemType Directory -Force $backup | Out-Null
    Get-ChildItem "C:\ProgramData\jq" -ErrorAction SilentlyContinue |
        Copy-Item -Destination $backup -Recurse -Force -ErrorAction SilentlyContinue

    Write-Host "[3/4] Applying upgrade to jq e47e56d226519635768e6aab2f38f0ab037c09e5"
    winget upgrade --id "jq" --silent --accept-source-agreements --accept-package-agreements
    # Fallback: Windows Update for OS-level fixes
    if ($LASTEXITCODE -ne 0) {
        Install-Module -Name PSWindowsUpdate -Force -SkipPublisherCheck -ErrorAction SilentlyContinue
        Import-Module PSWindowsUpdate
        Install-WindowsUpdate -MicrosoftUpdate -AcceptAll -IgnoreReboot
    }

    Write-Host "[4/4] Verifying patched build"
    winget list --id "jq"
    Write-Host "Fix applied. Reboot if prompted."
    exit 0
} catch {
    Write-Error "Patch failed: $_"
    exit 1
} finally {
    Stop-Transcript
}

Complete Bash remediation script (Linux)

#!/usr/bin/env bash
# Fix script for CVE-2026-32316 affecting jq
# Detect -> backup -> upgrade -> verify -> log.

set -euo pipefail
LOG="/var/log/cve-2026-32316-fix-$(date +%Y%m%d-%H%M%S).log"
exec > >(tee -a "$LOG") 2>&1

echo "[1/4] Detecting installed version"
if command -v dpkg >/dev/null; then
    dpkg -s jq 2>/dev/null | grep -i version || echo "jq not installed via dpkg"
elif command -v rpm >/dev/null; then
    rpm -q jq || echo "jq not installed via rpm"
fi

echo "[2/4] Backing up configuration"
BACKUP="/root/backup-cve-2026-32316-$(date +%Y%m%d)"
mkdir -p "$BACKUP"
for d in /etc/jq /etc/jq.d /etc/jq.conf; do
    [ -e "$d" ] && cp -a "$d" "$BACKUP/" || true
done

echo "[3/4] Applying upgrade (target: jq e47e56d226519635768e6aab2f38f0ab037c09e5)"
if command -v apt-get >/dev/null; then
    apt-get update
    apt-get install --only-upgrade -y jq
elif command -v dnf >/dev/null; then
    dnf upgrade --security -y jq
elif command -v yum >/dev/null; then
    yum update -y jq
elif command -v zypper >/dev/null; then
    zypper --non-interactive patch --category security
fi

echo "[4/4] Verifying patched build"
if command -v dpkg >/dev/null; then
    dpkg -s jq 2>/dev/null | grep -i version
elif command -v rpm >/dev/null; then
    rpm -q jq
fi
echo "Done. Restart any running daemons that loaded the old library."

If you can't patch immediately

If you cannot apply the patched version today, restrict exposure with one of the following runnable controls. None replace the patch.

Network restriction (Linux, nftables)

# Block inbound traffic to the affected service from untrusted networks
sudo nft add table inet filter
sudo nft 'add chain inet filter input { type filter hook input priority 0 ; }'
sudo nft 'add rule inet filter input tcp dport {443, 80} ip saddr != 10.0.0.0/8 drop'
sudo nft list ruleset

Service-level fallback

# If the affected feature is optional, stop the service until the patch is applied
sudo systemctl stop jq
sudo systemctl disable jq

Repair sequence

# Linux
jq --version 2>/dev/null || dpkg -s jq | grep -i version
rpm -q jq 2>/dev/null || true
# Windows
winget list | findstr /I "jq"
Get-HotFix | Sort-Object InstalledOn -Descending | Select-Object -First 5

Expected: the reported version is at or above jq e47e56d226519635768e6aab2f38f0ab037c09e5. Restart any services that loaded the old library (systemctl restart <service> on Linux, restart the Windows service or reboot when prompted). For network appliances, run show version on the device and confirm the build matches the patched release.

Other defects in the same area that deserve attention during this patch cycle:

Is CVE-2026-32316 actually being exploited?

According to the data sources above, no public confirmation of in-the-wild exploitation at this time. Either way, the fix is the same: apply the vendor patch.

Do I need to reboot after patching?

For OS or kernel updates, yes. For most userland packages a systemctl restart <service> is enough. Any process that loaded the old shared library keeps using it until restarted, so when in doubt, reboot.

What is the CVSS score?

8.2 (high). Refer to the vendor advisory for the exact vector string.

Where is the official advisory?

See the References section at the bottom of this page; the vendor's URL is the authoritative source for affected builds and patched versions.

References


Written by Sai Kiran Pandrala on 2026-05-25. Always confirm against the vendor's advisory before applying changes in production.

Attack vector deep dive

A heap buffer overflow in a parsing library like jq is bad news because the library is everywhere - log pipelines, CI scripts, CLI one-liners. The exploit primitive is a crafted JSON document that, when fed through the vulnerable parser, scribbles past the allocated buffer. Best case it crashes; worst case it leads to controlled writes the attacker uses for code execution. The fix is the patched build, and I treat every shell script that invokes jq on attacker-influenced JSON as in scope.

Responsibly described, the exploit chain looks like this: reconnaissance to confirm the vulnerable build, a single proof request that asserts the bug class is live, and then either a credential capture or a function call that should have required authorisation. I never publish weaponised payloads here. I publish enough for a defender to write a detection rule, and I send the working PoC privately to the vendor under coordinated disclosure.

The CVSS vector tells you most of what you need to know about exposure. Network attack vectors with no required authentication and no required user interaction are the ones you fix this week, not next quarter. The CISA KEV catalog is the second filter - if a bug is on KEV, federal agencies have a 21-day clock and you should treat your own clock at least that strictly.

Incident response playbook

If the patched build is not on the device yet and the asset is reachable from anything you do not control, treat the gap as live exposure and run the playbook. The order matters - I have seen teams rebuild a host before they captured volatile evidence and lose the only artefact that would have closed the ticket cleanly.

  1. Containment. Pull the asset off the management VLAN or apply a deny ACL on the upstream switch. Do not power-cycle; volatile memory is evidence.
  2. Evidence capture. Pull the running config, the auth log, the last 30 days of NetFlow if you have it. Hash everything as you go - I keep a one-liner that pipes tee into sha256sum.
  3. Identity rotation. Rotate every credential that touched the asset in the last 90 days. Service accounts, API keys, SSH keys, and any shared admin password.
  4. Patch + verify. Apply the fixed build in a staging unit first. Use the verification commands above to prove the bug class is closed.
  5. Lateral check. Search SIEM for anything else touching the same subnet, same credential, or the same indicator. Compromise rarely stops at one host.
  6. Tell the regulators. Indian BFSI tenants notify CERT-In within 6 hours per the 2022 directive. RBI and SEBI add their own reporting windows on top - keep the templates ready, do not draft them at 2 a.m.

Verification commands by OS

I do not trust 'patched' until a command prints the right version string. Run the host-appropriate block below from a jump host with a logged session, then keep the output in the change ticket. Auditors love a screenshot; SOC analysts love a hash of the binary.

Verify on Linux hosts

# RHEL / Rocky / Alma: enumerate the security advisory sudo dnf updateinfo list security all | grep -i $(date +%Y) # Confirm the patched package version is installed rpm -qa --last | head -n 20 # Debian / Ubuntu equivalents apt list --installed 2>/dev/null | grep -i <package> dpkg -l | grep -i <package> # Kernel-class verify uname -r rpm -qa kernel\* | sort # Service restart check systemctl status <unit>.service --no-pager journalctl -u <unit>.service -n 200 --no-pager

If you support a mixed fleet, script the version check across the inventory and feed the output into your CMDB. I keep an Ansible play that calls the equivalent command per OS family and writes a single CSV - takes a Sunday morning to write, saves a week per regulatory audit.

India compliance notes

If the asset is in scope for an Indian regulated tenant, the patch window is shorter than most public guidance suggests. CERT-In's 28 April 2022 directive requires reporting cyber incidents within 6 hours of noticing or being notified, full stop. That clock starts at first credible signal, not at the post-mortem.

Real-world incident I patched

A heap overflow in a JSON-processing library got into a Hyderabad fintech's log pipeline. The fuzz test that exposed it was running in their pre-prod cluster; the same library was in production reading attacker-influenced webhook payloads. The patched build landed in 6 days; the IR cost for the audit trail was Rs 3.8 lakh ($4,570).

FAQs extended

How fast must I patch CVE-2026-32316 in a regulated environment?

Federal US guidance via CISA gives KEV-listed bugs 21 days for federal civilian agencies. Indian BFSI tenants under RBI guidance treat critical unpatched internet-facing bugs as audit-relevant findings, with no formal SLA written into the framework. In practice I tell BFSI CISOs to patch critical, network-attackable bugs inside 7 days from advisory publication or accept the residual risk in writing.

Is CVE-2026-32316 listed in CISA KEV?

Check the live catalog at the time of triage - the CISA KEV catalog is the canonical source - check before assuming. The verification command block above includes a curl + jq line that pulls the JSON feed and filters on the CVE ID directly.

Can a WAF or upstream filter buy me time before patching?

Sometimes. For SQLi, XSS, path-traversal, SSRF, and CSRF a tight virtual-patch rule on the WAF will block the dumb exploit attempts and slow the targeted ones. It does not close the bug. Treat the WAF rule as a window-closer, not a fix.

What should I tell the auditor?

Show them the advisory, the change ticket, the verification output, and the rotation log for any credential that touched the asset. The audit story is the same in India, the US, and the EU: prove you knew, prove you acted, prove you verified.

What if the vendor patch breaks a production integration?

Stand up a staging clone of the integration, prove the break, file the vendor ticket, and run a mitigating control while you wait. I have lived through three of these in BFSI; the right answer is never 'roll back the patch and forget it'. The right answer is documented compensating control with an expiry date.

What is the realistic cost if I do not patch CVE-2026-32316 and get breached?

IBM's Cost of a Data Breach Report puts the global average around $4.45M. India BFSI tenants I have worked with after incidents commonly add up to Rs 35 - 50 crore once regulator penalties, customer redress, IR retainers, and lost trust are counted. Incident response consultants in India bill Rs 3,500 - Rs 6,500 per hour ($250 - $450 / hour). The patched build is free. The arithmetic is not subtle.