T06 · System Persistence
Error
- Location
- modules/twitter-monitor.md:55
- Finding
- Persistent Background Execution Through a macOS LaunchAgent<![CDATA[ ## Vulnerability Details **File Location**: `modules/twitter-monitor.md`, lines 55-61 and 76-81 **Vulnerability Type**: Cross-session scheduled execution **Risk Level**: High ### Vulnerable Code ```text ~/.clawdbot/scripts/ ├── twitter-monitor.sh # Fetches tweets via bird CLI └── twitter-analyze.sh # Sends to ClawdBot for analysis ~/Library/LaunchAgents/ └── com.clawdbot.twitter-monitor.plist # Runs on interval ``` ```bash # Stop auto-monitoring launchctl unload ~/Library/LaunchAgents/com.clawdbot.twitter-monitor.plist # Start auto-monitoring launchctl load ~/Library/LaunchAgents/com.clawdbot.twitter-monitor.plist ``` ### Technical Analysis The module instructs users to load a per-user macOS LaunchAgent. Once loaded, the service can execute across login sessions at the configured interval. Scheduled monitoring is related to the optional Twitter-monitoring feature, but it exceeds the privileges required for manual monitoring and introduces a persistent execution mechanism. The referenced plist and shell scripts are not included in the audited package. Consequently, their program arguments, filesystem permissions, network behavior, and integrity protections cannot be verified. Loading a plist from a user-writable location also means that subsequent modification of either the plist or its target scripts can change what is executed persistently. ### Attack Path 1. The user creates or obtains the referenced plist and monitoring scripts. 2. The user follows the documented `launchctl load` command. 3. The LaunchAgent begins executing the configured script at recurring intervals. 4. Another process, compromised update, or attacker with write access modifies the user-owned plist or scripts. 5. The altered code executes automatically under the user account during later scheduled runs or login sessions. ### Impact Assessment The mechanism does not inherently grant root privileges, but it provides recurring code execution with the full permiss ...[truncated 309 chars]
- Remediation
- <![CDATA[ ## Remediation Suggestions - Make manual, on-demand monitoring the default. - Require explicit informed consent before creating or loading any LaunchAgent. - Include the exact plist and scripts in the reviewed package rather than referring to unavailable files. - Display the complete plist and executable paths before activation. - Use absolute, canonical paths and validate ownership and permissions before every load. - Restrict plist and script permissions so they are writable only by the user. - Add integrity verification for the persistent scripts. - Provide a complete removal procedure that unloads the agent and deletes the plist, scripts, logs, and generated state. - Allow the user to configure a finite runtime or expiration rather than enabling indefinite monitoring. ]]>
