T06 · System Persistence
Error
- Location
- SKILL.md:124
- Finding
- Persistent launch agent with automatic restart<![CDATA[ ## Vulnerability Details **File Location**: `SKILL.md:124-143` **Vulnerability Type**: Persistent user-level startup service **Risk Level**: High ### Vulnerable Code ```xml **Persistent (macOS launchd):** Create `~/Library/LaunchAgents/com.elloCello.moses-coordinator.plist`: ```xml <?xml version="1.0" encoding="UTF-8"?> <!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "..."> <plist version="1.0"> <dict> <key>Label</key><string>com.elloCello.moses-coordinator</string> <key>ProgramArguments</key> <array> <string>/usr/bin/python3</string> <string>/Users/YOUR_USER/.openclaw/workspace/skills/moses-coordinator/scripts/coordinator.py</string> </array> <key>RunAtLoad</key><true/> <key>KeepAlive</key><true/> </dict> </plist> ``` Then: `launchctl load ~/Library/LaunchAgents/com.elloCello.moses-coordinator.plist` ``` ### Technical Analysis The documentation instructs the user to register the coordinator as a macOS launch agent with both `RunAtLoad` and `KeepAlive` enabled. This causes the script to start automatically when the user session loads and to be restarted whenever it exits. Persistent background operation is related to the declared monitoring function, but automatic cross-session startup and unconditional restart exceed the minimum privileges required to run the optional coordinator. Foreground execution or an explicitly bounded background process would provide the monitoring function without creating durable persistence. The launch agent executes a script from a user-writable workspace path. If that script or its imported dependencies are subsequently replaced, the modified code will be executed automatically under the affected user's account. ### Attack Path 1. A user follows the documented instructions and creates the launch-agent property list. 2. The user loads it using `launchctl`. 3. macOS executes `coordinator.py` when the user session starts. 4. `KeepAlive` causes launchd to restart the process after termination ...[truncated 652 chars]
- Remediation
- <![CDATA[ ## Remediation Suggestions - Make foreground execution the documented default. - Require explicit, informed user consent before enabling launchd persistence. - Disable `KeepAlive` by default and only enable it when uninterrupted monitoring is demonstrably required. - Document how to stop, unload, and delete the service. - Use the modern `launchctl bootstrap` and `launchctl bootout` interfaces where applicable. - Store the executable in a directory that is not writable by untrusted local processes or users. - Verify the ownership and permissions of both the property list and the coordinator script before registration. - Use an isolated, pinned Python environment and configure `ProgramArguments` to invoke its exact interpreter. - Consider an application-managed, session-scoped process instead of a permanent login service. ]]>
