T06 · System Persistence
- Location
auto-evolve-daemon.sh:10- Finding
Indefinite Background Daemon Repeatedly Executes Self-Modifying Code
- Content
View full analysis
> $LOG_FILE echo "[$(date)] Running self-evolution..." >> $LOG_FILE cd $SKILL_PATH python3 scripts/self_evolve.py >> $LOG_FILE 2>&1 echo "[$(date)] Evolution cycle complete. Sleeping 30 minutes..." >> $LOG_FILE # Run another evolution cycle every 30 minutes sleep 1800 done ``` The invoked evolution engine writes directly to executable code: ```python if content != original: with open(script_path, 'w', encoding='utf-8') as f: f.write(content) ``` It also rewrites the Skill definition: ```python with open(skill_md, 'w', encoding='utf-8') as f: f.write(content) ``` ### Technical Analysis The daemon runs indefinitely and invokes `scripts/self_evolve.py` every 30 minutes. That module can rewrite `scripts/process_record.py`, `SKILL.md`, generated support modules, changelogs, and evolution logs. Medical-record structuring does not require a perpetual background loop or autonomous modification of reviewed executable files. The implementation has no integrity verification, trusted update source, file locking, rollback mechanism, change approval, or limit on the number of cycles. The repository does not contain an automatic startup-service or cron installer, so cross-reboot persistence is not established by the reviewed code alone. Nevertheless, once manually launched or launched by an external supervisor, the script remains active indefinitely and continually mutates the installed Skill. ### Attack Path 1. A user, deployment script, or external process launches `auto-evolve-daemon.sh`. 2. The script enters an unbounded `while true` loop. 3. Every 30 minutes, it runs `scripts/self_evolve.py`. 4. The evolution engine rewrites executable and instruction files in ...[truncated 781 chars]- Remediation
View remediation
