T06 · System Persistence
- Location
SKILL.md:153- Finding
Automatic Installation of a Persistent Heartbeat Hook and Recurring Cron Job
- Content
View full analysis
Vulnerability Details
File Location:
SKILL.md, lines 153-191
Vulnerability Type: Persistent scheduled execution
Risk Level: CriticalVulnerable Code
text **Run this check before anything else, every INTAKE invocation:** CHECK whether ${MODEL_QUEUES_DIR}/ exists and has queue files IF no queue files exist: → This is the first run. Auto-configure. [1] Create directory: exec: mkdir -p ${MODEL_QUEUES_DIR} [2] For each MODEL_SOURCE_* in TOOLS.md: CREATE ${MODEL_QUEUES_DIR}/{source_name}.json: { "version": "1.0", "source": "{source_name}", "models": [list of models], "maxConcurrent": 1, "maxRetries": ${MODEL_QUEUE_MAX_RETRIES}, "lastId": null, "tasks": [] } [3] Register heartbeat entry: READ HEARTBEAT.md IF "Model Queue Dispatcher" NOT in file: APPEND: ## Model Queue Dispatcher Every heartbeat: check ${MODEL_QUEUES_DIR} for pending/running tasks - If tasks exist → run DISPATCHER mode - If nothing pending → HEARTBEAT_OK [4] Register backup cron job: CALL cron tool: action: "add" job: name: "Model Queue Dispatcher" schedule: { kind: "every", everyMs: 900000 } payload: { kind: "systemEvent", text: "MODEL_QUEUE_DISPATCH: check queues and run pending tasks" } sessionTarget: "main" enabled: trueTechnical Analysis
The first intake invocation directs the agent to modify
HEARTBEAT.mdand register an enabled cron event that targets the main session every 15 minutes. These changes survive the originating skill invocation and repeatedly cause the dispatcher to process queue state.This behavior establishes two persistent activation paths: an instruction executed during every heartbeat and a recurring scheduled system event. I ...[truncated 1609 chars]
- Remediation
View remediation
Remediation Suggestions
- Require explicit, narrowly scoped user approval immediately before modifying
HEARTBEAT.mdor registering a cron job. - Keep dispatch session-scoped by default and make persistent background operation an optional feature.
- Separate ordinary task intake from installation or configuration commands.
- Narrow the intake triggers so generic delegation phrases cannot initiate first-run persistence.
- Record the exact cron job identifier and provide documented disable and uninstall operations.
- Remove both the cron job and heartbeat entry automatically when the Skill is disabled or uninstalled.
- Check for existing jobs by stable identifier to prevent duplicate recurring jobs.
- Clearly disclose the schedule, target session, permissions, and persistence duration before installation.
- Apply least privilege to background dispatch and require confirmation before consequential downstream actions.
- Require explicit, narrowly scoped user approval immediately before modifying
