T06 · System Persistence
- Location
scripts/install-patcher.sh:14- Finding
Persistent macOS LaunchAgent Installation
- Content
View full analysis
Vulnerability Details
File Location:
scripts/install-patcher.sh, lines 14–42
Vulnerability Type: Persistent startup service installation
Risk Level: HighVulnerable Code
bash cat > "$PATCHER_PLIST" << EOF <?xml version="1.0" encoding="UTF-8"?> <!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd"> <plist version="1.0"> <dict> <key>Label</key> <string>ai.openclaw.plist-patcher</string> <key>ProgramArguments</key> <array> <string>/bin/bash</string> <string>$PATCHER_SCRIPT</string> </array> <key>WatchPaths</key> <array> <string>$PLIST_TO_WATCH</string> </array> <key>RunAtLoad</key> <true/> <key>StandardOutPath</key> <string>$LOG_DIR/plist-patcher.log</string> <key>StandardErrorPath</key> <string>$LOG_DIR/plist-patcher.err.log</string> </dict> </plist> EOF # Load the patcher launchctl bootout "gui/$(id -u)/ai.openclaw.plist-patcher" 2>/dev/null || true launchctl bootstrap "gui/$(id -u)" "$PATCHER_PLIST"The persistent agent invokes the following modification logic from
scripts/patch-plist.sh, lines 10–25:bash [ ! -f "$PLIST" ] && exit 0 # ExitTimeOut: force-kill after 10s if shutdown hangs if ! plutil -p "$PLIST" 2>/dev/null | grep -q '"ExitTimeOut"'; then plutil -insert ExitTimeOut -integer 10 "$PLIST" 2>/dev/null && CHANGED=1 fi # ProcessType: Interactive prevents launchd from delaying restarts if ! plutil -p "$PLIST" 2>/dev/null | grep -q '"ProcessType"'; then plutil -insert ProcessType -string "Interactive" "$PLIST" 2>/dev/null && CHANGED=1 fi # LowPriorityBackgroundIO: prevent IO throttling if ! plutil -p "$PLIST" 2>/dev/null | grep -q '"LowPriorityBackgroundIO"'; then plutil -insert LowPriorityBackgroundIO -bool false "$PLIST" 2>/dev/null && CHANGED=1 fiTechnical Analysis
The installer creates
~/Library/LaunchAgents/ai.openclaw.plist-patcher.plistand registers it in ...[truncated 2244 chars]- Remediation
View remediation
Remediation Suggestions
- Do not install or activate a persistent LaunchAgent by default. Prefer an explicit, one-time plist patch where operationally possible.
- Require informed opt-in immediately before installation and clearly state that the agent survives the current Skill run and may run during future sessions.
- Copy the patcher into a dedicated, user-owned application-support directory instead of executing it from the mutable Skill source directory.
- Validate ownership and permissions for the installed script and LaunchAgent. Reject symlinks and files writable by other users.
- Use restrictive permissions, such as user-only write access, on the installed script, plist, and log directory.
- Validate the generated plist with
plutil -lintbefore bootstrapping it. - Provide and document an uninstall procedure that runs
launchctl bootoutand removes both the LaunchAgent plist and installed script. - Consider integrity validation of the installed script before execution or updates.
- Avoid continually overriding administrator or user configuration. Patch only expected files and values, and log or request approval before replacing conflicting settings.
