Repository navigation
[Aikido] Fix date-prefix route normalization bypass in build_route_from_url - #742
Closed
aikido-autofix[bot] wants to merge 1 commit into
Closed
aikido-autofix[bot] wants to merge 1 commit into
aikido-autofix[bot] wants to merge 1 commit into
Conversation
…n bypass with date-prefixed...
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This patch addresses a route normalization bypass vulnerability in the
build_route_from_urlhelper where URL segments with date prefixes followed by additional characters (e.g., "2024-01-01-export") were incorrectly normalized to:dateparameters, allowing attackers to bypass exact endpoint policies. The fix properly anchors the DATE_REGEX pattern with word boundaries to match only complete date segments, ensuring that only pure date formats are normalized. The changes were made toaikido_zen/helpers/build_route_from_url.pyand validated with additional test cases inaikido_zen/helpers/build_route_from_url_test.py.✅ 1 issue fixed by this PR
build_route_from_url()classifies URL segments withDATE_REGEX.match(). The first alternative inDATE_REGEXis anchored only at the beginning, so a segment beginning with an ISO date and containing a suffix is classified as a date and replaced with:date. The normalized route is then used as the endpoint-policy lookup key. For an exact policy configured for/internal/2024-01-01-export, a request to that path is normalized to/internal/:date, so the exact endpoint is not selected. When no applicable wildcard endpoint matches,ip_allowed_to_access_route()allows the request because its endpoint list is empty, andshould_block_request()does not select endpoint-specific rate limiting because it likewise requires a non-empty match. The primary defect is the lossy date classification; failing closed on an unexpected policy miss would be useful defense in depth.