{"id":"CVE-2026-46689","aliases":["CVE-2026-46689","GHSA-r5fr-9gmv-jggh"],"related":[],"kind":"vulnerability","state":"published","title":"Kanidm: Unauthenticated process abort via SCIM filter stack exhaustion","summary":"Kanidm is an identity management platform. Prior to version 1.9.3, a single unauthenticated GET to any /scim/v1/... endpoint with a ?filter= query string of a few thousand nested parentheses (≈ 4–12 KB) drives the recursive-descent PEG parser past the worker thread's stack guard page. Rust responds to stack overflow with std::process::abort() — the entire kanidmd process exits. The parse runs inside axum's Query<ScimEntryGetQuery> extractor, before any handler body and therefore before any ACL check. This issue has been patched in version 1.9.3.","summarySource":"cvelist","descriptions":[{"lang":"en","text":"Kanidm is an identity management platform. Prior to version 1.9.3, a single unauthenticated GET to any /scim/v1/... endpoint with a ?filter= query string of a few thousand nested parentheses (≈ 4–12 KB) drives the recursive-descent PEG parser past the worker thread's stack guard page. Rust responds to stack overflow with std::process::abort() — the entire kanidmd process exits. The parse runs inside axum's Query<ScimEntryGetQuery> extractor, before any handler body and therefore before any ACL check. This issue has been patched in version 1.9.3.","source":"cvelist"},{"lang":"en","text":"### Summary\n\nA single unauthenticated `GET` to any `/scim/v1/...` endpoint with a `?filter=` query string of a few thousand nested parentheses (≈ 4–12 KB) drives the recursive-descent PEG parser past the worker thread's stack guard page. Rust responds to stack overflow with `std::process::abort()` — the entire `kanidmd` process exits. The parse runs inside axum's `Query<ScimEntryGetQuery>` extractor, before any handler body and therefore before any ACL check.\n\n### Details\n\nThe SCIM filter grammar recurses on `(` and `not (` with no depth bound.\n\n**`proto/src/scim_v1/mod.rs:263-433`** — `peg::parser! { grammar scimfilter() ... }`:\n\n```rust\n// line 281\n\"not\" separator()+ \"(\" e:parse() \")\" { ScimFilter::Not(Box::new(e)) }\n// line 293\n\"(\" e:parse() \")\" { e }\n```\n\nBoth rules re-enter `parse()` without a depth counter.\n\n**`proto/src/scim_v1/mod.rs:442-447`** — `impl FromStr for ScimFilter` calls `scimfilter::parse(input)` directly on the raw string with no length or depth pre-check.\n\n**`proto/src/scim_v1/mod.rs:80-81`** — `ScimEntryGetQuery.filter` is `#[serde_as(as = \"Option<DisplayFromStr>\")]`, so deserialising the query struct invokes `ScimFilter::from_str` on attacker bytes.\n\n**Unauthenticated reachability** — nine handlers in `server/core/src/https/v1_scim.rs` (route table at lines 865-1029) take `Query<ScimEntryGetQuery>` as an argument: `/scim/v1/Entry`, `/scim/v1/Entry/{id}`, `/scim/v1/Person/{id}`, `/scim/v1/Application`, `/scim/v1/Application/{id}`, `/scim/v1/Class`, `/scim/v1/Attribute`, `/scim/v1/Message`, `/scim/v1/Message/{id}`. The SCIM router is merged unconditionally for every server role (`server/core/src/https/mod.rs:312`).\n\nAxum extracts handler arguments before the handler body runs. The preceding `VerifiedClientInformation` extractor (`server/core/src/https/extractors/mod.rs:16-91`) always returns `Ok` (line 89) regardless of credentials; authorization is deferred to the handler body, which is never reached.\n\nThe existing semantic depth limit (`DEFAULT_LIMIT_FILTER_DEPTH_MAX = 12`, `server/lib/src/constants/mod.rs:212`) is enforced in `Filter::from_scim_ro` (`server/lib/src/filter.rs:786`) **after** the PEG parse has already produced an AST, so it cannot prevent the parser itself from blowing the stack.\n\nThe production daemon (`server/daemon/src/main.rs:735-744`) uses `new_multi_thread()` with default 2 MiB worker stacks; hyper's `max_buf_size` (~400 KiB) is not lowered (`server/core/src/https/mod.rs:708-727`), so a 12 KB URI is accepted.\n\nAn identical unbounded grammar exists in `libs/scim_proto/src/filter.rs:112-276` (not network-reachable, but should be fixed in the same patch).\n\n### PoC\n\n```sh\ncurl -sk \"https://idm.example.com/scim/v1/Application?filter=$(python3 -c 'print(\"(\"*3000+\"a+pr\"+\")\"*3000)')\"\n# → curl: (52) Empty reply from server\n# → server journal: \"fatal runtime error: stack overflow, aborting\", SIGABRT\n```\n\nRelease-build threshold measured at ~2 000 nesting levels / ~4 KB:\n\n```\n$ cargo test --release -p kanidm_proto --test scim_filter_depth -- --nocapture\nparens depth=1500 len=3004\n  -> survived\nparens depth=2000 len=4004\n\nthread 'audit_scim_filter_nested_parens' has overflowed its stack\nfatal runtime error: stack overflow, aborting\n  (signal: 6, SIGABRT: process abort signal)\n```\n\nEnd-to-end against an in-process server via `kanidmd_testkit` (no authentication performed):\n\n```\nTestkit server setup complete - http://localhost:18080/\naudit_scim_dos: sending unauthenticated GET, url len = 12056\n\nthread '...' has overflowed its stack\nfatal runtime error: stack overflow, aborting\n  (signal: 6, SIGABRT: process abort signal)\n```\n\n### Impact\n\nProcess-wide availability loss; no confidentiality or integrity impact.\n\n- **Unauthenticated**, default install, no feature flag required.\n- **Process abort, not task panic.** Stack overflow triggers libstd's guard-page handler, which calls `std::process::abort()`. tokio's per-task `catch_unwind` isolation does not apply to aborts. All in-flight HTTP requests, OAuth2/OIDC sessions, LDAP binds, and the web UI are terminated.\n- **Repeatable.** One ~12 KB GET per crash; a `while true; do curl ...; done` loop holds the service down indefinitely across supervisor restarts.\n- The 6 011-byte variant (`depth=3000`) fits under the nginx default `large_client_header_buffers` limit of 8 KB, so a typical reverse proxy does not mitigate.\n\n**Affected**: v1.7.0 through `master` @ edf50b9da.","format":"markdown","source":"ghsa"},{"lang":"es","text":"Kanidm es una plataforma de gestión de identidades. Antes de la versión 1.9.3, una única solicitud GET no autenticada a cualquier endpoint /scim/v1/... con una cadena de consulta ?filter= de unos pocos miles de paréntesis anidados (? 4-12 KB) lleva al analizador PEG de descenso recursivo más allá de la página de protección de pila del hilo de trabajo. Rust responde al desbordamiento de pila con std::process::abort() - el proceso kanidmd completo termina. El análisis se ejecuta dentro del extractor Query<ScimEntryGetQuery> de axum, antes de cualquier cuerpo del gestor y, por lo tanto, antes de cualquier comprobación de ACL. Este problema ha sido parcheado en la versión 1.9.3.","source":"nvd"}],"published":"2026-05-06T23:38:49.000Z","modified":"2026-07-23T09:10:00.113Z","severity":{"scorer":"GitHub_M","scheme":"CVSS:4.0","vector":"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","score":8.7,"rating":"HIGH"},"severities":[{"scorer":"GitHub_M","scheme":"CVSS:4.0","vector":"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","score":8.7,"rating":"HIGH"},{"scorer":"GitHub","scheme":"CVSS:4.0","vector":"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","rating":"HIGH"}],"cwes":["CWE-248","CWE-400","CWE-674"],"affected":[{"ranges":[{"version":"< 1.9.3","status":"affected"}],"vendor":"kanidm","product":"kanidm","source":"cvelist"},{"ranges":[{"type":"semver","introduced":"0","status":"affected","fixed":"1.9.3"}],"ecosystem":"crates.io","package":"scim_proto","purl":"pkg:cargo/scim_proto","source":"ghsa"},{"ranges":[{"type":"semver","introduced":"0","status":"affected","fixed":"1.9.3"}],"ecosystem":"crates.io","package":"kanidm_proto","purl":"pkg:cargo/kanidm_proto","source":"ghsa"}],"references":[{"url":"https://github.com/kanidm/kanidm/security/advisories/GHSA-r5fr-9gmv-jggh","tags":["exploit","web","x-refsource-confirm"],"sources":["cvelist","ghsa","nvd"]},{"url":"https://github.com/kanidm/kanidm/releases/tag/v1.9.3","tags":["web","x-refsource-misc"],"sources":["cvelist","ghsa","nvd"]},{"url":"https://nvd.nist.gov/vuln/detail/CVE-2026-46689","tags":["advisory"],"sources":["ghsa"]},{"url":"https://github.com/kanidm/kanidm","tags":["package"],"sources":["ghsa"]}],"credits":[],"assigner":"GitHub_M","ssvc":{"scorer":"CISA-ADP","exploitation":"poc","automatable":"yes","technicalImpact":"partial","date":"2026-06-11T12:55:52.379Z"},"sources":[{"source":"cvelist","name":"CVE List","id":"CVE-2026-46689","url":"https://www.cve.org/CVERecord?id=CVE-2026-46689","licence":"CVE Terms of Use","modified":"2026-06-11T12:55:59.122Z"},{"source":"ghsa","name":"GitHub Advisory Database","id":"GHSA-r5fr-9gmv-jggh","url":"https://github.com/advisories/GHSA-r5fr-9gmv-jggh","licence":"CC-BY-4.0","modified":"2026-06-29T15:46:31.311Z"},{"source":"nvd","name":"NVD","id":"CVE-2026-46689","url":"https://nvd.nist.gov/vuln/detail/CVE-2026-46689","licence":"Public domain","modified":"2026-07-23T09:10:00.113Z"}],"updatedAt":"2026-11-25T22:59:24.382Z","epss":{"score":0.00317,"percentile":0.26563,"date":"2026-12-01T12:00:22.000Z"}}