Fix shell injection vulnerability in DarkGate CAB unpacker#7
Open
MichaelMVS wants to merge 1 commit intotelekom-security:mainfrom
Open
Fix shell injection vulnerability in DarkGate CAB unpacker#7MichaelMVS wants to merge 1 commit intotelekom-security:mainfrom
MichaelMVS wants to merge 1 commit intotelekom-security:mainfrom
Conversation
Replace shell=True in subprocess.check_output call with list-based argument format. The f.name temp file path was being interpolated into a shell command string, allowing arbitrary command execution if a malicious filename was present (CVE-class issue for a malware analysis tool that processes untrusted files). Also refactored 7z command to use list format consistently with the MSI unpacker for consistency.
There was a problem hiding this comment.
Pull request overview
This PR hardens the DarkGate CAB unpacking path by removing shell=True from the 7z extraction subprocess call, preventing potential shell command injection during CAB-to-AU3 extraction.
Changes:
- Replace string-based
subprocess.check_output(..., shell=True)invocation with an argument-list invocation for CAB extraction. - Align CAB unpacking subprocess usage with the existing MSI unpacking pattern in the same module.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
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.
Replace shell=True with list-based subprocess arguments to prevent command injection.
The DarkGateCABUnpacker was using shell=True when calling 7z to extract .au3 files from CAB archives. The temp file path (f.name) was interpolated directly into a shell command string, which could allow arbitrary command execution if a malicious filename was present.
Changes:
shell=Truewith f-string to list-based[bin_7z, 'e', '-so', f.name, '*.au3']Before:
After: