T09 · Insecure Skill Coding Practices
- Location
scripts/cronctl.sh:132- Finding
Predictable shared temporary files permit maintenance-state denial of service and symlink attacks
- Content
View full analysis
/tmp/cron-paused success "Maintenance mode ENABLED — all jobs will skip on next run" ;; off) if [ -f /tmp/cron-paused ]; then rm /tmp/cron-paused success "Maintenance mode DISABLED — jobs will run normally" ``` The documented job integration also uses predictable shared paths: ```bash if [ -f /tmp/cron-paused ]; then echo "$(date -Iseconds) — $JOB_NAME skipped (maintenance mode)" >> /tmp/cron-skipped.log exit 0 fi ``` ### Technical Analysis The maintenance marker and skip log are stored directly under the globally writable `/tmp` directory using fixed names. The implementation does not create a private directory, verify file ownership, reject symbolic links, or enforce restrictive permissions. Any local user may create `/tmp/cron-paused` while it is absent. Integrated jobs only test whether this path exists, so they will treat an attacker-created file as an authorized maintenance request. On systems with the normal sticky bit on `/tmp`, the legitimate non-root service account may also be unable to remove a marker owned by another user, prolonging the denial of service. The redirection used to create the marker follows symbolic links where operating-system protections do not prevent it. The documented append operation for `/tmp/cron-skipped.log` has the same issue. If an attacker can pre-position a suitable symbolic link and the executing account can write to its target, the operation may overwrite or append to an attacker-selected file. Modern operating-system settings such as protected symlink and protected regular-file handling can reduce some cross-user exploitation paths, but the code must not rely on optional host-level mitigation. ...[truncated 1587 chars]- Remediation
View remediation
