Kanidm SCIM Filter Stack Exhaustion Vulnerability
An unauthenticated GET request with deeply nested parentheses in the SCIM filter parameter can cause stack exhaustion and process termination in Kanidm, leading to denial of service.
Kanidm versions 1.7.0 through 1.9.2 are vulnerable to a stack exhaustion issue due to unbounded recursion in the SCIM filter parser. An attacker can send an unauthenticated GET request to any /scim/v1/... endpoint, including /scim/v1/Application, /scim/v1/Entry/{id}, etc., with a filter query parameter containing thousands of nested parentheses. This input drives the recursive-descent PEG parser beyond the worker thread’s stack limit. The vulnerability exists within the axum’s Query<ScimEntryGetQuery> extractor, before any authentication or authorization checks. The resulting stack overflow triggers std::process::abort(), causing the entire kanidmd process to terminate, affecting all services relying on the IDM. This can be exploited to cause a denial-of-service condition.
Attack Chain
- The attacker crafts a malicious GET request targeting a SCIM endpoint, such as
/scim/v1/Application?filter=(...(a+pr)...). - The crafted request contains a
filterquery parameter with thousands of nested parentheses, exceeding the stack limit. - The request is received by the Kanidm server.
- Axum’s
Query<ScimEntryGetQuery>extractor attempts to parse thefilterparameter using the SCIM filter parser (scimfilter::parse). - The SCIM filter parser recursively processes the nested parentheses without a depth bound, consuming stack space.
- The recursive parsing exceeds the worker thread’s stack guard page, leading to a stack overflow.
- Rust’s stack overflow handler triggers
std::process::abort(), terminating thekanidmdprocess. - The entire Kanidm service becomes unavailable, disrupting authentication, authorization, and other IDM functions.
Impact
Successful exploitation leads to a process-wide denial of service. The kanidmd process terminates, affecting all in-flight HTTP requests, OAuth2/OIDC sessions, LDAP binds, and the web UI. The vulnerability is unauthenticated and easily repeatable, allowing an attacker to hold the service down indefinitely. A single 12KB GET request is sufficient to crash the service.
Recommendation
- Apply the patch or upgrade to a version of
kanidm_protoandscim_protogreater than 1.9.2 to resolve the unbounded recursion in the SCIM filter parser. - Implement rate limiting on SCIM endpoints to mitigate the impact of repeated exploitation attempts.
- Deploy the following Sigma rule to detect potentially malicious SCIM filter requests based on URL length.
- Consider limiting the maximum size of request headers accepted by the web server to prevent large
filterparameters.
Detection coverage 2
Detect Suspiciously Long SCIM Filter Queries
mediumDetects abnormally long SCIM filter queries which may indicate a stack exhaustion attempt.
Detect Multiple SCIM Requests from Same IP in Short Period
lowDetects a high volume of requests to SCIM endpoints from the same source IP, potentially indicating a DoS attack.
Detection queries are kept inside the platform. Get full rules →