Skip to main content
Vulnerability Database/CVE-2026-87721

CVE-2026-87721: Gerrit Code Review DOS Vulnerability

CVE-2026-87721 is a denial of service vulnerability in Gerrit Code Review that allows attackers to exhaust CPU resources via crafted search queries. This article covers the technical details, affected versions, and mitigation.

Published:

Disclaimer: This content was generated using AI. While we strive for accuracy, please verify critical information with official sources.

Sources: National Vulnerability Database, CISA KEV, Exploit-DB

CVE-2026-87721 Overview

CVE-2026-87721 is an uncontrolled resource consumption vulnerability [CWE-400] in the ANTLR 3 search query parser (QueryParser / Query.g) used by Gerrit Code Review. The flaw affects Gerrit Code Review versions 2.0.19 through 3.12.9, 3.13.0 through 3.13.8, and 3.14.0 through 3.14.2. An unauthenticated remote attacker, or an authenticated user when anonymous read access is disabled, can send crafted search queries containing deeply nested parentheses to query evaluation endpoints. The parser recurses without memoization, exhausting CPU and starving the HTTP worker thread pool. A small number of requests can pin all workers until the server is restarted.

Critical Impact

As few as 25 crafted requests matching the default httpd.maxThreads can permanently exhaust the HTTP worker pool, causing a persistent denial of service that requires an administrative restart to recover.

Affected Products

  • Gerrit Code Review 2.0.19 through 3.12.9
  • Gerrit Code Review 3.13.0 through 3.13.8
  • Gerrit Code Review 3.14.0 through 3.14.2

Discovery Timeline

  • 2026-09-24 - CVE-2026-87721 published to NVD
  • 2026-09-25 - Last updated in NVD database

Technical Details for CVE-2026-87721

Vulnerability Analysis

The vulnerability resides in Gerrit's ANTLR 3 generated search query grammar (Query.g), which compiles into QueryParser. The grammar defines conditionOr and conditionAnd rules that use syntactic predicates to disambiguate alternatives. These predicates recurse through conditionBase without memoization enabled.

When a query contains deeply nested parentheses, the parser explores exponentially many parse paths before accepting or rejecting the input. The parsing work runs on HTTP worker threads before any capability or visibility check gates execution. Worker threads also fail to abort when the client disconnects, so cancelling the TCP connection does not reclaim the thread.

Because query evaluation runs before authentication checks on anonymous-readable instances, no credentials are required to trigger the condition. The result is CPU exhaustion and permanent thread pool starvation lasting until an operator restarts the Gerrit process.

Root Cause

The root cause is the combination of two parser design choices in Query.g: syntactic predicates in conditionOr and conditionAnd that recurse into conditionBase without ANTLR 3 memoization, and the absence of parse-time limits on expression depth or runtime. Compounding this, Gerrit's HTTP request handler does not propagate client disconnects to the parsing thread, so the work continues after the attacker has terminated the connection.

Attack Vector

An attacker sends HTTP GET requests to any Gerrit query endpoint, including /changes/?q=, /accounts/?q=, /groups/?query=, /projects/?query=, /Documentation/?q=, and /changes/{id}/query?expression=. The equivalent gerrit query command over SSH is also exploitable for authenticated users. The query string contains deeply nested parenthesized subexpressions that force exponential backtracking in the ANTLR parser.

The vulnerability is described in prose only; no public proof-of-concept payload is linked from the advisory. See the Gerrit Code Review Issue #541287630 for the maintainer discussion.

Detection Methods for CVE-2026-87721

Indicators of Compromise

  • HTTP access log entries targeting /changes/, /accounts/, /groups/, /projects/, /Documentation/, or /changes/{id}/query endpoints with query strings containing large counts of nested ( and ) characters.
  • Sustained HTTP 503 responses or client timeouts from the Gerrit frontend after only a handful of inbound requests from a single source.
  • JVM thread dumps showing multiple HTTP worker threads blocked inside org.antlr.runtime or Gerrit QueryParser frames.
  • SSH gerrit query sessions with abnormally long execution times originating from a single account or key.

Detection Strategies

  • Parse HTTP access logs for query parameters whose parenthesis depth exceeds a reasonable threshold (for example, more than 10 nested levels) and alert on repeated matches.
  • Correlate spikes in Gerrit JVM CPU utilization with low request volume, which indicates algorithmic complexity abuse rather than normal load.
  • Monitor the Gerrit httpd thread pool queue depth and alert when active workers approach httpd.maxThreads without a corresponding increase in request rate.

Monitoring Recommendations

  • Export JVM metrics (thread count, CPU time per thread, GC pressure) from the Gerrit process to a centralized monitoring platform.
  • Enable Gerrit audit logging for SSH gerrit query invocations and track per-user query latency.
  • Deploy a reverse proxy or WAF rule that counts parenthesis characters in query parameters and blocks requests exceeding a safe depth before they reach Gerrit.

How to Mitigate CVE-2026-87721

Immediate Actions Required

  • Upgrade Gerrit Code Review to version 3.12.10, 3.13.9, or 3.14.3, which contain the parser fix.
  • If an immediate upgrade is not possible, disable anonymous read access to require authentication before query evaluation reaches the parser.
  • Place a reverse proxy in front of Gerrit that enforces maximum query parameter length and rejects queries with excessive nested parentheses.
  • Restart the Gerrit service to recover any workers already pinned by exploitation attempts.

Patch Information

The Gerrit maintainers resolved CVE-2026-87721 in Gerrit Code Review 3.12.10, 3.13.9, and 3.14.3. The fix addresses the ANTLR 3 parser recursion in conditionOr and conditionAnd and gates expensive parsing behind proper limits. Patch details and discussion are available at Gerrit Code Review Issue #541287630.

Workarounds

  • Restrict access to Gerrit query endpoints at the network edge, allowing only trusted CIDRs until patches are deployed.
  • Lower httpd.maxThreads temporarily is not advised; instead, add a reverse-proxy filter that rejects query strings whose parenthesis depth exceeds a safe bound.
  • Monitor and automatically restart the Gerrit JVM when thread pool starvation is detected, as a stopgap recovery mechanism.
bash
# Example nginx rule to block queries with deeply nested parentheses
# Adjust the depth threshold to match operational tolerance
location ~ ^/(changes|accounts|groups|projects|Documentation)/ {
    if ($args ~* "(\({10,})") {
        return 400;
    }
    proxy_pass http://gerrit_backend;
}

Disclaimer: This content was generated using AI. While we strive for accuracy, please verify critical information with official sources.

Sources: National Vulnerability Database, CISA KEV, Exploit-DB

Experience the Most Advanced Cybersecurity Platform

See how the world’s most intelligent, autonomous cybersecurity platform can protect your organization today and into the future.