fix: prevent command injection in technique execution and malware retrieval#31
Open
tranquac wants to merge 1 commit intoKrook9d:mainfrom
Open
fix: prevent command injection in technique execution and malware retrieval#31tranquac wants to merge 1 commit intoKrook9d:mainfrom
tranquac wants to merge 1 commit intoKrook9d:mainfrom
Conversation
…rieval Signed-off-by: tranquac <tranquac@users.noreply.github.com>
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.
Summary
Prevent command injection in technique execution and malware retrieval endpoints by validating user input.
Problem
1. Technique ID injection (line ~142-147)
The
technique_idparameter fromrequest.args.get('technique_id')is directly interpolated into a PowerShell command:An attacker can inject arbitrary PowerShell commands:
?technique_id=T1059; Remove-Item -Recurse C:\2. Malware family injection (line ~168-176)
The
malwareFamilyfromrequest.jsonis passed tosubprocess.Popenwithshell=Trueafter incomplete sanitization:A
malware_familycontaining'; rm -rf / #breaks out of the single quotes.Fix
^T\d{4}(\.\d{3})?$shlex.quote()for proper shell escapingImpact