subprocess module call
Medium
- Category
- Dangerous Code Execution
- Content
Add-Type -AssemblyName Microsoft.VisualBasic [Microsoft.VisualBasic.FileIO.FileSystem]::DeleteFile("{safe_path}", "OnlyErrorDialogs", "SendToRecycleBin") ''' result = subprocess.run( ['powershell', '-Command', ps_command], capture_output=True, text=True, timeout=30 )- Confidence
- 94% confidence
- Finding
- The Windows recycle-bin implementation builds a PowerShell script by interpolating the user-controlled filepath into `ps_command` and then passes that script to `powershell -Command`. Replacing double quotes is not sufficient to safely encode arbitrary input for PowerShell, so a crafted filename can break out of the string context or otherwise alter script behavior, leading to command/script injection in the agent's execution context.
