@grpc/grpc-js: safe_regex incorrectly applies partial string matching for patterns with alternation
CVE-2026-126367
Summary The StringMatcher/PathMatcher for saferegex builds its RE2 as ^${regex}$ with no surrounding group. Because alternation has the lowest precedence, a pattern "a|b|c" compiles to /^a|b|c$/ -- "starts with a" OR "contains b" OR "ends with c" instead of a full match of the whole value. Configurations with saferegex matchers that use a regex alternation (a natural way to list methods or service identities) therefore apply partial string matches. This impacts route selection, xDS credentials, and RBAC. Details src/matcher.ts: SafeRegexValueMatcher and PathSafeRegexValueMatcher both do ts this.targetRegexImpl = new RE2(^${targetRegex}$, 'u'); and apply() returns targetRegexImpl.test(value). With a top-level alternation the anchors bind only to the first/last branch. https://github.com/grpc/grpc-node/blob/e742b11bd8039f3dbea4cd29afdf5d95a8ba6b92/packages/grpc-js-xds/src/matcher.ts#L59 https://github.com/grpc/grpc-node/blob/e742b11bd8039f3dbea4cd29afdf5d95a8ba6b92/packages/grpc-js-xds/src/matcher.ts#L232 src/route.ts (getPredicateForStringMatcher / getPredicateForHeaderMatcher) builds these for every saferegex StringMatcher/HeaderMatcher, and src/rbac.ts uses them for RBAC urlpath…
Assessment
- CVSS
- 4.8 (v3.1)
- Severity
- Medium
- EPSS
- 0% chance of exploitation in the next 30 days
- Known exploited
- Not listed in CISA KEV
- Exploit availability
- Nothing found in Exploit-DB, Metasploit, Nuclei or public PoC repositories
- Published
- 12 November 2026
- Last updated
- 12 November 2026
- Affected
- grpc · grpc-node · @grpc/grpc-js-xds
- Weakness
- CWE-625, CWE-863
- Assigner
- GitHub_M
CVSS vectorCVSS:3.1/AV:N/AC:H/PR:N/UI:N/S:U/C:L/I:L/A:N
At the source
References
- https://github.com/grpc/grpc-node/security/advisories/GHSA-r7hq-q2xm-6c5m
- https://github.com/grpc/grpc-node/commit/3fc3b0ebf7a89d64843a73679951142d33b40cb1
- https://github.com/grpc/grpc-node/commit/57a67e96babcb29b6eabc1833221ccf2fa152d43
- https://github.com/grpc/grpc-node/releases/tag/@grpc/grpc-js-xds@1.13.2
- https://github.com/grpc/grpc-node/releases/tag/@grpc/grpc-js-xds@1.14.2
- https://github.com/advisories/GHSA-r7hq-q2xm-6c5m
Community proofs of concept
No community proof of concept yet. If you have one for a published vulnerability and the right to share it, add it below — it will appear here once reviewed.
Submit a proof of concept
Only for publicly disclosed vulnerabilities, and only material from testing you were authorised to perform. This platform does not buy, sell, or broker exploits — see earning from vulnerability research for legitimate bounty programs. Submissions are reviewed before they appear. Text only; do not include live credentials, personal data, or anything targeting systems you are not permitted to test.
Query this programmatically
Agents can read this through the MCP endpoint, or over HTTP:
curl https://cve.zerocrew.in/api/cve/CVE-2026-126367