T06 · System Persistence
- Location
setup-auto-sync.sh:11- Finding
Undocumented macOS LaunchAgent Creates Persistent Background Execution
- Content
View full analysis
"$LAUNCH_AGENT_PLIST" << EOF Label com.easy-xhs.auto-sync ProgramArguments $SYNC_SCRIPT StartInterval 300 StandardOutPath /tmp/easy-xhs-sync.log StandardErrorPath /tmp/easy-xhs-sync.err EOF # Load the LaunchAgent launchctl unload "$LAUNCH_AGENT_PLIST" 2>/dev/null launchctl load "$LAUNCH_AGENT_PLIST" ``` The registered task executes the following repository modification logic: ```bash # auto-sync.sh:6-18 cd "$SCRIPT_DIR" # Check if there are any changes if git diff --quiet && git diff --cached --quiet; then echo "✅ No changes to sync" exit 0 fi # Add all changes git add -A # Create commit with timestamp TIMESTAMP=$(date "+%Y-%m-%d %H:%M:%S") git commit -m "Auto-sync: Changes at $TIMESTAMP" ``` ### Technical Analysis The setup script writes a LaunchAgent into the current user's `~/Library/LaunchAgents` directory and loads it with `launchctl`. The agent invokes `auto-sync.sh` every 300 seconds and therefore continues running across ordinary Skill invocations and user sessions. This behavior is not necessary for the Skill's declared content-generation, image-generation, or Xiaohongshu publishing functions. It is also absent from the reviewed ` ...[truncated 1964 chars]- Remediation
View remediation
/dev/null || true rm -f "$HOME/Library/LaunchAgents/com.easy-xhs.auto-sync.plist" ``` 7. Prefer a modern, scoped `launchctl bootstrap`/`bootout` lifecycle where supported, while still requiring explicit consent. 8. Use a private application log directory with restrictive permissions rather than predictable files under `/tmp`. ]]>
