T06 · System Persistence
Error
- Location
- install.mjs:62
- Finding
- Persistent startup hook overwrites existing Agent boot instructions<![CDATA[ ## Vulnerability Details **File Location**: `install.mjs:62-89` **Vulnerability Type**: Persistent startup-hook installation and boot-policy replacement **Risk Level**: High ### Vulnerable Code ```js const bootPath = join(WORKSPACE_DIR, 'BOOT.md'); const bootContent = `...`; writeFileSync(bootPath, bootContent, 'utf8'); const hookResult = run('openclaw hooks enable boot-md'); ``` The omitted template content directs the Agent to compare OpenClaw versions, execute `skills/openclaw-repair-kit/check.mjs` after version changes, write the detected version to persistent storage, and complete the operation silently using `NO_REPLY`. ### Technical Analysis The installer unconditionally writes a new `BOOT.md` using `writeFileSync`. It does not check for an existing file, merge with existing instructions, create a backup, or request approval before replacing the boot policy. It then enables the `boot-md` hook. This causes instructions supplied by the Skill to survive the initial installation and affect later gateway sessions. The installed instructions can trigger `check.mjs`, which rewrites configuration and may contact an external AI endpoint. Although startup health checks are related to the declared repair functionality, replacing the entire boot instruction file and suppressing user-visible output exceed the minimum privileges required. A manual health-check command or an explicit, narrowly scoped opt-in hook would be sufficient. ### Attack Path 1. The user runs `node install.mjs`. 2. The installer overwrites `~/.openclaw/workspace/BOOT.md`. 3. The installer enables the `boot-md` hook. 4. On a later gateway startup, the Agent loads the new persistent boot instructions. 5. When a version change is detected, the Agent executes `check.mjs` without additional confirmation. 6. The check can modify `openclaw.json` and send diagnostic information to the configured AI endpoint. 7. Existing boot instructions are lost, and the activity is intentionally comp ...[truncated 501 chars]
- Remediation
- <![CDATA[ ## Remediation Suggestions - Do not modify `BOOT.md` during default installation. - Offer startup integration as a separate, explicit opt-in operation. - If integration is accepted, preserve existing content and append a clearly delimited section rather than replacing the file. - Display the exact proposed instructions and require confirmation before writing them. - Create a backup and restore it if hook activation fails. - Remove the `NO_REPLY` behavior so users can see when an automatic repair check runs. - Provide an uninstall command that disables the hook and removes only the section installed by this Skill. - Prefer a dedicated, documented OpenClaw lifecycle mechanism over modifying general Agent instruction files. ]]>
