T06 · System Persistence
Warning
- Location
- install_launchd.sh:13
- Finding
- Unconditional Installation of Persistent macOS LaunchAgents<![CDATA[ ## Vulnerability Details **File Location**: `install_launchd.sh`, lines 13-89 **Vulnerability Type**: Unnecessary and unconditional startup persistence **Risk Level**: Medium ### Vulnerable Code ```sh cat > "$MONITOR_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>com.studywest.openclaw.arcade-monitor</string> <key>ProgramArguments</key> <array> <string>/usr/bin/python3</string> <string>-u</string> <string>$DIR/server.py</string> </array> <key>WorkingDirectory</key><string>$DIR</string> <key>RunAtLoad</key><true/> <key>KeepAlive</key><true/> <key>StandardOutPath</key><string>$DIR/launchd-monitor.out.log</string> <key>StandardErrorPath</key><string>$DIR/launchd-monitor.err.log</string> </dict> </plist> EOF cat > "$AUTOHEAL_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>com.studywest.openclaw.arcade-autoheal</string> <key>ProgramArguments</key> <array> <string>/usr/bin/python3</string> <string>-u</string> <string>$DIR/autoheal.py</string> </array> <key>WorkingDirectory</key><string>$DIR</string> <key>RunAtLoad</key><true/> <key>KeepAlive</key><true/> <key>StandardOutPath</key><string>$DIR/launchd-autoheal.out.log</string> <key>StandardErrorPath</key><string>$DIR/launchd-autoheal.err.log</string> </dict> </plist> EOF cat > "$WATCHDOG_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>com.studywest.openclaw.app-watchdog</string> <key>ProgramArguments</key> <array> <string>/usr/bin/python3</string> <string>-u</ ...[truncated 3266 chars]
- Remediation
- <![CDATA[ ## Remediation Suggestions 1. Install only the dashboard monitor by default. 2. Require explicit command-line flags or interactive confirmation before installing auto-heal or watchdog components. 3. Verify that every referenced executable exists, is a regular file, has expected ownership, and is not writable by untrusted users before creating any LaunchAgent. 4. Abort installation if required files are absent instead of registering broken persistent jobs. 5. Remove `KeepAlive` unless continuous restart behavior is essential and clearly disclosed. 6. Install executable files into a dedicated directory with restrictive permissions rather than executing them from an arbitrary unpacked project directory. 7. Record file hashes or use code signing where feasible to detect replacement after installation. 8. Clearly document persistence behavior, service names, execution frequency, logs, and uninstallation steps before installation. ]]>
