T06 · System Persistence
- Location
SKILL.md:39- Finding
Persistent Execution Through Scheduled Tasks and Post-Tool Hooks
- Content
View full analysis
Vulnerability Details
File Location:
SKILL.md, lines 39-62
Vulnerability Type: Persistent scheduled and event-triggered command execution
Risk Level: HighVulnerable Code
markdown ### Cron example ```bash # daily at 9:00 0 9 * * * /path/to/aicoo-sync.sh >> /tmp/aicoo-sync.log 2>&1Strategy 2: Event-Driven (hooks)
Claude hooks
Add to
.claude/settings.json:json { "hooks": { "PostToolUse": [ { "matcher": "Write|Edit", "hooks": [ { "type": "command", "command": "./aicoo-skills/scripts/sync-detector.sh" } ] } ] } }text ### Technical Analysis The skill directs users to establish two cross-session execution mechanisms: 1. A cron task that invokes a synchronization script every day. 2. A persistent Claude `PostToolUse` hook that invokes a command after any operation matching `Write` or `Edit`. These mechanisms continue operating after the original skill interaction ends. The hook is especially broad because ordinary file modifications unrelated to Aicoo synchronization can trigger the command automatically. The configuration does not include per-execution confirmation, content scoping, rate limiting, an expiration mechanism, or removal instructions. Although persistent automation is related to the stated synchronization purpose, the recommended implementation grants an external command recurring and event-driven execution beyond an individual invocation. ### Attack Path 1. A user follows the instructions and installs the cron entry or modifies `.claude/settings.json`. 2. The configuration persists after the current agent session. 3. The scheduled time arrives, or the agent performs any matching `Write` or `Edit` operation. 4. The configured script executes automatically without fresh user approval. 5. The script can process newly written ...[truncated 857 chars]- Remediation
View remediation
Remediation Suggestions
- Keep scheduled and hook-based synchronization disabled by default.
- Require explicit, informed consent before creating cron entries or modifying persistent Claude settings.
- Prefer an explicit synchronization command over a broad
PostToolUsehook. - If a hook is necessary, narrow its matcher and validate that the changed file belongs to an approved synchronization scope.
- Prompt for approval before each external transfer or remote modification.
- Add rate limits, execution timeouts, audit logs, and an expiration date for persistent automation.
- Document exact commands for disabling and removing both the cron entry and the hook.
- Run the synchronization process with a dedicated least-privileged account and narrowly scoped API credentials.
- Prevent concurrent executions with a securely implemented lock.
