T05 · Unauthorized Access and Privilege Escalation
- Location
scripts/fix-crons.js:62- Finding
Global Crontab Replacement Exceeds the Required OpenClaw Scope
- Content
View full analysis
/dev/null | sort | uniq -d # Find near-duplicates (same script, different schedule spacing by <5 min) crontab -l 2>/dev/null | grep -i "openclaw\\|morning-push" | sort If duplicates found: 1. Show user the duplicate lines 2. Confirm which to keep (usually the first one, or the one with the correct schedule) 3. Remove duplicates: # Export, edit, reimport crontab -l > /tmp/crontab_backup.txt # Edit /tmp/crontab_backup.txt to remove duplicate lines # Review the diff: diff /tmp/crontab_backup.txt <(sort -u /tmp/crontab_backup.txt) ⚠️ PAUSE: Show the diff output to the user and ask: "I'm about to replace your crontab with the deduplicated version above. The following lines will be removed: [list duplicate lines]. Do you confirm? (yes/no)" Only proceed after the user explicitly confirms. # Apply ONLY after explicit user confirmation: crontab /tmp/crontab_backup.txt # Verify: crontab -l | grep openclaw For openclaw native cron: openclaw cron remove ``` ### Technical Analysis The declared functionality is to inspect and repair OpenClaw-related scheduled tasks. However, the generated instructions run duplicate detection against the complete user crontab and subsequently replace that complete crontab. The global command: ```sh crontab -l | sort | uniq -d ``` does not restrict inspection to OpenClaw-managed records. More importantly, importing `/tmp/crontab_backup.txt` with `crontab` replaces every scheduled task belonging to the current user. A generic sorting or deduplication operation can also alter comments, environment assignments, ordering, and unrelated duplicate entries ...[truncated 1430 chars]- Remediation
View remediation
``` 2. Modify only entries carrying a validated OpenClaw marker. Do not use broad keywords such as `skill`, `morning-push`, or arbitrary command substrings as authorization to alter an entry. 3. Preserve every unrelated line byte-for-byte, including comments, blank lines, environment assignments, and ordering. 4. Create separate original and candidate files and display an exact unified diff: ```sh diff -u "$original" "$candidate" ``` 5. Reject the candidate if the diff contains any line not associated with a verified OpenClaw record. 6. Require explicit confirmation immediately before applying the candidate. 7. Prefer the native scoped interface: ```sh openclaw cron remove ``` when it can identify and remove a specific duplicate without replacing the complete crontab. 8. After applying the change, verify both that the intended duplicate was removed and that unrelated entries remain unchanged. ]]>
