The vulnerability lies in inconsistent and overly strict timestamp validation of federation peer tokens across two different modules, stigmem_node.federation.peer_token and stigmem_node.peer_auth. Both modules contain a verify_peer_token function responsible for validating tokens from peer nodes.
Before the patch, the validation logic in both functions did not properly handle timestamps, specifically the exp, iat, and nbf claims. The code did not consistently treat timestamps as millisecond-based values and lacked a tolerance for small clock skews between the systems. This resulted in a race condition where recently issued, valid tokens could be incorrectly flagged as expired or not yet valid, leading to a denial of service for federated authentication.
The patches address this by:
- Introducing a configurable leeway (
peer_token_leeway_s) to the timestamp comparisons, making the validation more resilient to clock drift.
- Ensuring all timestamp claims are parsed as integers representing milliseconds, creating a canonical validation path.
- Adding explicit checks for
iat (issued at) and nbf (not before) claims to prevent tokens from the future or too far in the past from being accepted.
The analysis of the commits between the last vulnerable version and the first patched version revealed changes in stigmem_node.federation.peer_token.verify_peer_token and stigmem_node.peer_auth.verify_peer_token. These changes directly correspond to the vulnerability description, confirming that these two functions are the vulnerable ones.