Repository navigation
[Aikido] Detect IFS variable expansion patterns in shell injection checks - #747
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
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 shell injection detection bypass vulnerabilities where attackers could use IFS (Internal Field Separator) variable expansion patterns like
${IFS}to evade detection by creating runtime command separators. The fix adds pattern detection for variable expansion constructs that can expand to shell metacharacters, preventing attackers from circumventing shell injection protections. Changes were made to the shell injection detection logic incontains_shell_syntax.pywith corresponding test coverage added tocontains_shell_syntax_test.pyanddetect_shell_injection_test.py.✅ 1 issue fixed by this PR
command = "true;${IFS}whoami"and attacker-controlleduser_input = "whoami",detect_shell_injectionreachescontains_shell_syntax; the regex match is preceded by}and ends at the string terminus, so none of the literal boundary checks succeeds. The shell expands the unquoted${IFS}and executeswhoamias the command aftertrue;.run_vulnerability_scanraises only when a detection result exists, so the false negative allows the shell sink to proceed in blocking mode. The same detector is used by both theos.systemand shell-enabledsubprocess.Popenintegrations.