The vulnerability is a stack exhaustion flaw in the SCIM filter parsing logic of the kanidm identity management system. The root cause is an uncontrolled recursion in the PEG (Parsing Expression Grammar) parser, which is used to process SCIM filter strings from incoming HTTP requests. The parser, defined using the peg::parser! macro in Rust, had rules for nested expressions that could be called recursively without any depth limit.
An unauthenticated attacker can exploit this by sending a GET request to a SCIM endpoint with a filter query parameter containing a deeply nested expression (e.g., thousands of nested parentheses). This forces the parser into a deep recursion, which quickly exhausts the thread's stack space. In Rust, a stack overflow is a fatal condition that leads to an immediate process abort, not just a panic that could be caught. This results in a denial of service for the entire kanidmd process, terminating all active sessions and requests.
The vulnerability exists in two separate but nearly identical parser implementations within the scim_proto and kanidm_proto crates. The patch addresses the issue by introducing a maximum recursion depth (SCIM_FILTER_MAX_DEPTH) and modifying the parser rules to enforce this limit, preventing the stack from being exhausted.