T06 · System Persistence
- Location
scripts/script.sh:456- Finding
Deployment Guidance Creates a Persistent Root Cron Task
- Content
View full analysis
Vulnerability Details
File Location:
scripts/script.sh, lines 456–458
Vulnerability Type: Root-level scheduled-task persistence
Risk Level: HighVulnerable Code
bash # 4. Set up cron echo '05 4 * * * root /usr/sbin/aide --check | mail -s "AIDE $(hostname)" admin@example.com' \ >> /etc/crontabTechnical Analysis
The
deploycommand prints instructions that append a scheduled task directly to/etc/crontab. The script does not execute this command automatically because it is contained in a quoted heredoc; nevertheless, an operator or automated agent following the deployment workflow is instructed to make a persistent, system-wide configuration change.The cron entry runs
/usr/sbin/aide --checkasrootevery day. Periodic integrity checking is consistent with the Skill's stated AIDE deployment purpose, but directly modifying the global crontab crosses a privileged and persistent system boundary. The operation is also not idempotent: executing it repeatedly appends duplicate entries, causing multiple privileged checks and emails to run at the same time.No existence check, atomic installation procedure, rollback command, explicit user confirmation, or validation of the AIDE and mail executables is provided. Because
/etc/crontabaffects system-wide scheduled execution, a malformed modification could also damage existing scheduling configuration.Attack Path
- A user or agent invokes the Skill's
deploycommand. - The Skill presents the command as part of its recommended production deployment procedure.
- The user or agent executes the command with root privileges, which are required to modify
/etc/crontab. - A permanent root cron entry is appended without checking whether an equivalent task already exists.
- The task executes daily across future sessions and system restarts.
- Repeated deployment creates duplicate privileged jobs. If a privileged actor or separate c ...[truncated 1081 chars]
- A user or agent invokes the Skill's
- Remediation
View remediation
Remediation Suggestions
- Do not recommend appending directly to
/etc/crontab. - Make scheduling an optional deployment step and require explicit operator confirmation before any persistent system modification.
- Prefer a dedicated, package-managed
/etc/cron.d/aide-checkfile or a hardened systemd service and timer. This isolates the configuration and makes auditing and removal easier. - Install the scheduling configuration atomically with root ownership and restrictive permissions, for example mode
0644for a cron definition or the appropriate systemd unit permissions. - Check for an existing AIDE schedule before installation and update it deterministically rather than appending duplicate entries.
- Use absolute paths for every executable, including the mail utility, and verify that referenced executables are root-owned and not writable by less-privileged users.
- Validate the reporting recipient through deployment configuration rather than retaining a placeholder address.
- Provide explicit rollback instructions that remove or disable the timer or cron file.
- Where possible, use a least-privileged dedicated account for reporting operations. If AIDE requires root access to inspect protected files, narrowly constrain the scheduled command and prevent user-controlled arguments or environment variables from entering it.
- Clearly state that the displayed command is an example requiring administrative review and must not be executed automatically by an agent.
- Do not recommend appending directly to
