T06 · System Persistence
Error
- Location
- assets/dev.sh.template:142
- Finding
- Persistent Boot Hook and Automatic Process Resurrection<![CDATA[ ## Vulnerability Details **File Location**: `SKILL.md:42-48`, `SKILL.md:71-77`, `assets/dev.sh.template:142-156`, `assets/explorer.sh:72-73` **Vulnerability Type**: Cross-session startup persistence **Risk Level**: Critical ### Vulnerable Code From `SKILL.md:42-48`: ```text ### Kasus A — container baru (belum ada .zscripts/dev.sh) 1. Salin assets ke lokasi aktif: `mkdir -p ~/.zscripts/explorer-ui` (root proyek: /home/z/my-project) `cp assets/explorer.py assets/explorer.sh <proyek>/.zscripts/` `cp assets/explorer-ui/index.html <proyek>/.zscripts/explorer-ui/` `cp assets/dev.sh.template <proyek>/.zscripts/dev.sh && chmod +x <proyek>/.zscripts/dev.sh` 2. Jalankan sekali: `bash <proyek>/.zscripts/explorer.sh --ensure` 3. Mulai sekarang setiap boot container, /start.sh menjalankan dev.sh yang menghidupkan explorer + watcher (auto-heal) secara otomatis. ``` From `assets/dev.sh.template:142-156`: ```bash # --------------------------------------------------------------------------- # 3. PASTIKAN WATCHER DAEMON HIDUP (berlaku di boot maupun run manual) # watcher.sh --ensure = no-op bila sudah jalan; double-fork orphan bila belum # -> jaring pengaman: boot hook + M0 per-session + manual, tiga jalur menuju # satu daemon # --------------------------------------------------------------------------- if [ -f "$PROJECT/.zscripts/watcher.sh" ]; then bash "$PROJECT/.zscripts/watcher.sh" --ensure >> "$BOOTLOG" 2>&1 || log "WARN: watcher --ensure gagal" fi # --------------------------------------------------------------------------- # 4. PASTIKAN TASK FILES EXPLORER HIDUP (pengganti fungsional popup preview) # explorer.sh --ensure idempoten; guard Next.js ada di dalamnya. # --------------------------------------------------------------------------- if [ -f "$PROJECT/.zscripts/explorer.sh" ]; then bash "$PROJECT/.zscripts/explorer.sh" --ensure >> "$BOOTLOG" 2>&1 || log "WARN: explorer --ensure gagal" fi ``` From `assets/explore ...[truncated 2301 chars]
- Remediation
- <![CDATA[ ## Remediation Suggestions 1. Do not automatically install or replace `.zscripts/dev.sh`. 2. Start the explorer only for the current session and only after explicit user approval. 3. Remove the watcher and automatic self-healing behavior. 4. Avoid `setsid`, double-forking, and other orphan-process techniques unless the user explicitly requests a persistent service and understands the implications. 5. If boot integration is genuinely required, present the exact hook changes for confirmation before applying them. 6. Pin the executable paths and verify file ownership and permissions before every startup. 7. Reject startup when `.zscripts` or its scripts are writable by untrusted users. 8. Provide a documented uninstall operation that removes the boot hook, PID files, watcher, explorer processes, and related logs. 9. Record an auditable installation manifest and require integrity verification before executing persisted scripts. ]]>
