os.system() or os exec-family call
- Category
- Dangerous Code Execution
- Confidence
- 99% confidence
- Finding
The user-controlled --out path reaches os.system inside a PowerShell command without safe escaping; the path transformations do not prevent an apostrophe from terminating the PowerShell string and introducing additional commands. When --open is enabled on Windows or a supported WSL environment, a malicious output filename could execute commands with the agent's privileges, although trace generation and validation must first succeed.
- Content
python drive = win_path[0].upper() win_path = f"{drive}:{win_path[1:]}" exe = r"C:\Program Files\Chromas\Chromas.exe" os.system(f'powershell.exe -NoProfile -Command "Start-Process -FilePath \'{exe}\' -ArgumentList \'{win_path}\'"') def main(argv=None):
