T09 · Insecure Skill Coding Practices
- Location
scripts/macos_launchctl.sh:228- Finding
Persistent Code Execution Through Unescaped plist and AppleScript Input
- Content
View full analysis
Label ${label} ProgramArguments /usr/bin/open -a ${app_path} ${extra_args:+ ${extra_args}} ``` The stop-task generator similarly inserts the application name directly into AppleScript source: ```bash Label ${label} ProgramArguments /usr/bin/osascript -e tell application "${app_name}" to quit ``` ### Technical Analysis The values `label`, `app_path`, `extra_args`, and `app_name` are inserted into XML without XML escaping. Characters such as `<`, `>`, `&`, and quotes can invalidate the generated plist or alter its structure. The stop-task generator introduces an additional source-injection boundary. `app_name` is derived from the basename of a user-supplied application path and is interpolated inside a quoted AppleScript expression. An application bundle whose filename contains AppleScript syntax and quote characters can terminate the intended application string and add attacker-controlled AppleScript statements. Because the resulting plist is saved in `~/Library/LaunchAgents` and loaded through `launchctl`, successful injection can be executed repeatedly according to the configured schedule. The ordinary user confirmation reduces accidental exploitation but does not sanitize the payload, and the `--yes` option bypasses confirmation ...[truncated 1539 chars]- Remediation
View remediation
