Summary
CVE-2026-87721 is an uncontrolled resource consumption vulnerability (CWE-400/CWE-407/CWE-834) in the ANTLR 3-based search query parser (QueryParser / Query.g) used by Gerrit Code Review. A remote, unauthenticated attacker (or any authenticated user if anonymous read access is disabled) can send a small number of specially crafted search queries to cause CPU exhaustion and permanently pin the HTTP worker thread pool, resulting in a persistent denial of service that requires a server restart to recover. The issue carries a CVSS score of 8.7 (High).
Technical details
- Root cause: The syntactic predicates in the grammar’s
conditionOrandconditionAndrules recurse throughconditionBasewithout memoization, causing exponential backtracking when parsing certain query strings before any capability or visibility check is performed. - Trigger conditions: A search query containing deeply nested parentheses is submitted to any Gerrit query evaluation endpoint.
- Attack vector: Network-based; queries can be sent via HTTP endpoints (
/changes/?q=,/accounts/?q=,/groups/?query=,/projects/?query=,/Documentation/?q=,/changes/{id}/query?expression=) or via SSH (gerrit query). Worker threads do not abort when the client disconnects, so an attacker does not need to keep the connection open. - Impact: Because a default
httpd.maxThreadsconfiguration is 25, as few as ~25 concurrent malicious requests can pin all available HTTP worker threads, making the Gerrit instance unresponsive to legitimate users until it is restarted.
Affected software
- Gerrit Code Review 2.0.19 up to (but not including) 3.12.10
- Gerrit Code Review 3.13.0 up to (but not including) 3.13.9
- Gerrit Code Review 3.14.0 up to (but not including) 3.14.3
Severity
- CVSS v4.0 Base Score: 8.7 (High)
- Vector String:
CVSS:4.0/AV:N/AC:L/AT:N/PR:N/UI:N/VC:N/VI:N/VA:H/SC:N/SI:N/SA:N
Mitigation and recommended actions
- Immediate: Upgrade to Gerrit Code Review 3.12.10, 3.13.9, or 3.14.3, or later, which fix the query parser recursion issue.
- If patching is not immediately possible:
- Restrict network access to Gerrit’s HTTP and SSH query endpoints to trusted networks or IP ranges where feasible.
- Consider disabling anonymous read access to reduce the pool of unauthenticated attackers able to submit queries.
- Monitor HTTP worker thread pool utilization and application logs for spikes in CPU usage or thread exhaustion correlated with unusual/complex search query patterns, and be prepared to restart the service if it becomes unresponsive.

