Repository navigation
[Aikido] Fix path-traversal bypass via terminal ".." component detection - #443
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
… components before...
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 path-traversal vulnerability where terminal ".." components could bypass detection when normalized by path functions like
File.join. The fix enhances unsafe path detection logic inlib/aikido/zen/context.rbandlib/aikido/zen/scanners/path_traversal/helpers.rbto identify standalone ".." components and paths ending with "/.." or ".." before path normalization occurs. Comprehensive test coverage has been added totest/aikido/zen/context_test.rb,test/aikido/zen/scanners/path_traversal_scanner_test.rb, andtest/aikido/zen/sinks/file_test.rbto validate detection of this bypass scenario.✅ 1 issue fixed by this PR
File.join(base_dir, params[:dir], "secret"), a request value of..produces a path containing../secret, while the associated payload remains exactly...PathTraversalScanner#attack?requiresinclude_unsafe_path_parts?to be true for both the composed filepath and the original input. BecauseDANGEROUS_PATH_PARTScontains../and..\\but not a terminal..component, the input check fails; the relative input also does not satisfy the separate absolute-path check. Blocking mode consequently does not raise an attack exception, and the protected filesystem operation proceeds with the escaped path. The concrete impact is path traversal to files reachable by the process, including unauthorized reads or mutations where the consuming application exposes a c