Back to skill

Security audit

Cron Scheduler

Security checks for vulnerabilities and agentic risk

Overview

This is a disclosed cron manager, but it needs Review because it can change persistent scheduled tasks and system cron service state, and one removal path can execute unintended local commands.

Install only if you trust this skill to edit your crontab and potentially affect the cron service. Before use, prefer reviewing exact crontab changes, avoid broad pattern removals, avoid service start/stop unless you intentionally want system-level changes, and consider fixing numeric validation, confirmation prompts, and backup permissions first.

Vulnerability Patterns
  • Insecure Skill Coding PracticesFinds exploitable flaws such as hardcoded secrets or command injection
  • Skill Instruction HijackingAlters the agent's session goals or safety constraints when the skill loads
  • Agent Memory PoisoningWrites attacker-controlled rules into memory that affect later sessions
  • Remote Payload Retrieval and ExecutionFetches external code whose behavior can change after review
  • Embedded Malicious CodeShips malicious scripts inside the skill and executes them locally
Findings (3)

T09 · Insecure Skill Coding Practices

Error
Location
scripts/cron-helper.sh:145
Finding

GNU sed Program Injection Through Unvalidated Line Number

Content
View full analysis
/dev/null) || true if [[ -z "$current_crontab" ]]; then log_error "No cron jobs to remove" rm -f "$temp_file" exit 1 fi if [[ "$mode" == "line" ]]; then # Remove by line number echo "$current_crontab" | sed -n "H;1h;\$!d;x;s/^[0-9]*[ \t]*//;${value}d" > "$temp_file" log_success "Removed job at line $value" elif [[ "$mode" == "pattern" ]]; then # Remove by pattern echo "$current_crontab" | grep -v "$value" > "$temp_file" log_success "Removed jobs matching pattern: $value" else log_error "Invalid mode. Use 'line' or 'pattern'" rm -f "$temp_file" exit 1 fi crontab "$temp_file" rm -f "$temp_file" log_success "Cron job(s) removed" } ``` ### Technical Analysis The `remove` argument is expected to be a positive line number, but the script performs no numeric validation before interpolating it into a sed program: ```bash sed -n "...;${value}d" ``` Shell quoting prevents shell expansion of the value at this stage, but it does not prevent injection into sed's command language. On GNU sed, an attacker can include additional sed commands, including the GNU-specific `e` command, which executes a shell command. For example, a crafted value structured like `1e #` can cause the generated sed program to execute the supplied shell command when processing the first line. The appended `d` can be neutralized as part of a sed comment. This exploitation method is GNU sed-specific, m ...[truncated 1176 chars]
Remediation
View remediation
"$temp_file" ``` Additional hardening should include: - Verify that the requested line exists before replacing the crontab. - Preview the exact entry to be removed and request confirmation. - Install the modified crontab only after the transformation succeeds. - Use an exit trap to remove temporary files on errors or interruption. - Add regression tests containing sed metacharacters and GNU sed `e` syntax. ]]>

T09 · Insecure Skill Coding Practices

Warning
Location
scripts/cron-helper.sh:17
Finding

Crontab Backups May Be Created with Excessively Permissive File Permissions

Content
View full analysis
/dev/null) || true if [[ -z "$crontab_output" ]]; then log_warn "No crontab to backup" return fi echo "$crontab_output" > "$backup_file" log_success "Backed up crontab to: $backup_file" } ``` ### Technical Analysis The script neither sets a restrictive `umask` nor explicitly assigns permissions to the backup directory and files. Their permissions therefore depend on the invoking process's environment. With a common `umask` of `022`, a newly created directory may receive mode `755` and a backup file may receive mode `644`. Whether another local user can reach the backup also depends on permissions of the user's home directory, but the backup mechanism itself does not enforce confidentiality. Crontab entries may expose internal paths, service endpoints, operational schedules, tokens embedded in command arguments, or other sensitive configuration. Copying these entries into broadly readable files can therefore create an additional disclosure surface. ### Attack Path 1. A user invokes the `backup` command under a permissive umask. 2. The script creates `~/.cron-backups` without an explicit restrictive mode. 3. The script writes the complete crontab to a new backup without setting mode `600`. 4. If parent-directory permissions permit traversal, another local account reads the backup. 5. Sensitive commands, paths, URLs, ...[truncated 560 chars]
Remediation
View remediation
"$backup_file") chmod 600 -- "$backup_file" ``` Further hardening should include: - Verify that `BACKUP_DIR` is a real directory owned by the invoking user. - Refuse to use an unexpected symbolic link as the backup directory. - Use collision-resistant or securely created backup files. - Warn users not to place credentials directly in crontab command lines. - Consider applying a retention policy to limit the lifetime of sensitive backups. ]]>

T09 · Insecure Skill Coding Practices

Note
Location
scripts/cron-helper.sh:170
Finding

grep Option Injection and Unsafe Regular-Expression Matching in Pattern Removal

Content
View full analysis
"$temp_file" log_success "Removed jobs matching pattern: $value" ``` The filtered result is subsequently installed: ```bash crontab "$temp_file" rm -f "$temp_file" log_success "Cron job(s) removed" ``` ### Technical Analysis The attacker-controlled pattern is supplied to grep without a `--` end-of-options marker: ```bash grep -v "$value" ``` Quoting preserves the argument as a single string but does not stop grep from interpreting a leading hyphen as an option. A crafted argument such as a long-form grep option can therefore alter how grep obtains or interprets its patterns. The script also uses grep's default regular-expression semantics. A pattern containing metacharacters may match substantially more entries than a user expects from the documentation's description of matching a “pattern.” Because the filtered output is installed directly as the new crontab, unexpectedly broad matching can remove unrelated scheduled jobs. ### Attack Path 1. An attacker controls or influences the argument passed to `removep`. 2. The attacker supplies a leading-hyphen grep option or a broad regular expression. 3. grep interprets the argument as configuration or regex syntax rather than a literal search string. 4. grep produces an unexpectedly filtered version of the current crontab. 5. The script installs that result with `crontab "$temp_file"`. 6. Unrelated cron jobs may be deleted or the removal operation may behave differently from the user's intent. ### Impact Assessment Exploitation can alter or remove cron entries belonging to the invoking user. This may disable backups, monitoring, synchronization, maintenance, or other schedu ...[truncated 256 chars]
Remediation
View remediation
"$temp_file" || { status=$? if [[ $status -ne 1 ]]; then log_error "Failed to filter crontab" rm -f "$temp_file" exit 1 fi } ``` Also: - Show all matching entries before removal. - Require confirmation when multiple entries match. - Clearly document whether patterns are literal strings or regular expressions. - If regex support is intentional, still use `grep -v -- "$value"` and validate potentially dangerous or unexpectedly broad expressions. - Confirm that at least one intended entry matched before installing the replacement crontab. ]]>
Vulnerability Patterns
  • Privilege EscalationExcessive Permissions, Sudo/Root Execution, Credential Access
  • Excessive AgencyUnrestricted Tool Access, Autonomous Decision Making, Scope Creep
  • Tool MisuseTool Parameter Abuse, Chaining Abuse, Unsafe Defaults
  • Rogue AgentSelf-Modification, Session Persistence
  • Trigger AbuseOverly Broad Trigger, Shadow Command Trigger, Keyword Baiting Trigger
Findings (35)

Tp4

High
Category
MCP Tool Poisoning
Confidence
95% confidence
Finding

The skill is described as a cron job manager, but it also advertises starting, stopping, and checking the cron service via launchctl/systemctl, which expands its capability into privileged system administration. That mismatch matters because users or orchestrators may invoke it expecting per-user crontab management, while the skill can influence system task scheduling availability and may trigger sudo-backed operations.

Content

No source excerpt is available for this finding.

Missing User Warnings

High
Category
Not specified by scanner
Confidence
95% confidence
Finding

Job removal performs destructive modification of the user's crontab with no confirmation or preview, and the pattern-removal mode can delete multiple entries at once. This can cause loss of legitimate scheduled tasks or be abused to disable backups, monitoring, or other defenses that rely on cron.

Content

No source excerpt is available for this finding.

Chaining Abuse

High
Category
Tool Misuse
Confidence
75% confidence
Finding

Tool calls are chained to bypass individual safety checks or escalate capabilities beyond what any single tool call would allow.

Content

Scanner excerpt · scripts/cron-helper.sh (reported line 329)May include surrounding context.

sh
linux)
            case "$action" in
                start)
                    sudo systemctl start cron 2>/dev/null || sudo systemctl start crond 2>/dev/null || \
                    log_error "Failed to start cron service"
                    ;;
                stop)

Chaining Abuse

High
Category
Tool Misuse
Confidence
75% confidence
Finding

Tool calls are chained to bypass individual safety checks or escalate capabilities beyond what any single tool call would allow.

Content

Scanner excerpt · scripts/cron-helper.sh (reported line 333)May include surrounding context.

sh
linux)
            case "$action" in
                start)
                    sudo systemctl start cron 2>/dev/null || sudo systemctl start crond 2>/dev/null || \
                    log_error "Failed to start cron service"
                    ;;
                stop)

Chaining Abuse

High
Category
Tool Misuse
Confidence
75% confidence
Finding

Tool calls are chained to bypass individual safety checks or escalate capabilities beyond what any single tool call would allow.

Content

Scanner excerpt · scripts/cron-helper.sh (reported line 337)May include surrounding context.

sh
linux)
            case "$action" in
                start)
                    sudo systemctl start cron 2>/dev/null || sudo systemctl start crond 2>/dev/null || \
                    log_error "Failed to start cron service"
                    ;;
                stop)

Session Persistence

Medium
Category
Rogue Agent
Confidence
60% confidence
Finding

Skill establishes unauthorized persistence across sessions via cron jobs, startup scripts, or state files. Session persistence allows an attacker to maintain access beyond the current interaction.

Content

Scanner excerpt · README.md (reported line 57)May include surrounding context.

Then use: cron-helper.sh <command>

Option 3: Create an alias

bash
alias cron='~/.openclaw/workspace/skills/cron-scheduler/scripts/cron-helper.sh'

Missing User Warnings

Medium
Category
Not specified by scanner
Confidence
88% confidence
Finding

This markdown file documents commands that add, remove, edit, backup, and restore crontab entries, which can directly change system task scheduling and potentially overwrite existing cron configuration. The README presents these operations as ordinary commands but does not include any caution about their impact on user data, system behavior, or the risk of replacing the current crontab during restore.

Content

No source excerpt is available for this finding.

Session Persistence

Medium
Category
Rogue Agent
Confidence
88% confidence
Finding

The skill's core purpose is to create recurring tasks, which is a persistence mechanism: commands added to crontab will execute automatically in future sessions without further user interaction. In a security context, any agent capability that can establish scheduled execution materially increases abuse potential if invoked by mistake or under prompt injection.

Content

Scanner excerpt · SKILL.md (reported line 3)May include surrounding context.

md
---
name: cron-scheduler
description: Manage cron jobs on macOS/Linux - list, add, remove, backup, and schedule recurring tasks
triggers:
  - "cron"
  - "cron job"

Vague Triggers

Medium
Category
Not specified by scanner
Confidence
95% confidence
Finding

The trigger phrase "cron" is extremely broad and likely to appear in normal discussion, documentation, or troubleshooting contexts without the user intending to execute this skill. In agent environments, such ambiguous activation increases the risk of accidental invocation of commands that modify persistent scheduled tasks.

Content

No source excerpt is available for this finding.

Vague Triggers

Medium
Category
Not specified by scanner
Confidence
94% confidence
Finding

Phrases like "schedule task" and "recurring task" are common natural-language expressions and are not specific to cron administration. This creates a collision risk where the skill may activate in unrelated contexts, potentially causing unintended persistence changes or confusing the agent's tool selection.

Content

No source excerpt is available for this finding.

Session Persistence

Medium
Category
Rogue Agent
Confidence
86% confidence
Finding

The feature "Create new cron jobs" confirms that the skill can establish persistent execution on the host. Even though this is expected for a cron management tool, it remains security-relevant because persistence is a common post-compromise technique and can survive beyond the current agent session.

Content

Scanner excerpt · SKILL.md (reported line 50)May include surrounding context.

md
## Features

1. **List Jobs** - View all cron jobs for the current user
2. **Add Job** - Create new cron jobs with schedule validation
3. **Remove Job** - Delete jobs by line number or pattern
4. **Edit Crontab** - Open crontab in your default editor
5. **Next Runs** - See when each job will execute next

Session Persistence

Medium
Category
Rogue Agent
Confidence
85% confidence
Finding

Skill establishes unauthorized persistence across sessions via cron jobs, startup scripts, or state files. Session persistence allows an attacker to maintain access beyond the current interaction.

Content

Scanner excerpt · scripts/cron-helper.sh (reported line 43)May include surrounding context.

sh
}

check_crontab() {
    if ! command -v crontab &> /dev/null; then
        log_error "crontab command not found. Please install cron."
        exit 1
    fi

Session Persistence

Medium
Category
Rogue Agent
Confidence
85% confidence
Finding

Skill establishes unauthorized persistence across sessions via cron jobs, startup scripts, or state files. Session persistence allows an attacker to maintain access beyond the current interaction.

Content

Scanner excerpt · scripts/cron-helper.sh (reported line 65)May include surrounding context.

sh
check_crontab
    
    local crontab_output
    crontab_output=$(crontab -l 2>/dev/null) || true
    
    if [[ -z "$crontab_output" ]]; then
        log_warn "No cron jobs found for user $(whoami)"

Session Persistence

Medium
Category
Rogue Agent
Confidence
85% confidence
Finding

Skill establishes unauthorized persistence across sessions via cron jobs, startup scripts, or state files. Session persistence allows an attacker to maintain access beyond the current interaction.

Content

Scanner excerpt · scripts/cron-helper.sh (reported line 203)May include surrounding context.

sh
check_crontab
    
    local crontab_output
    crontab_output=$(crontab -l 2>/dev/null) || true
    
    if [[ -z "$crontab_output" ]]; then
        log_warn "No cron jobs found for user $(whoami)"

Session Persistence

Medium
Category
Rogue Agent
Confidence
85% confidence
Finding

Skill establishes unauthorized persistence across sessions via cron jobs, startup scripts, or state files. Session persistence allows an attacker to maintain access beyond the current interaction.

Content

Scanner excerpt · scripts/cron-helper.sh (reported line 249)May include surrounding context.

sh
check_crontab
    
    local crontab_output
    crontab_output=$(crontab -l 2>/dev/null) || true
    
    if [[ -z "$crontab_output" ]]; then
        log_warn "No cron jobs found for user $(whoami)"

Missing User Warnings

Medium
Category
Not specified by scanner
Confidence
90% confidence
Finding

Adding a cron job writes persistence into the user's crontab immediately after minimal validation and without an approval prompt. In an agent setting, this can create unintended recurring execution of attacker-influenced commands, making the skill more dangerous than a simple one-shot shell helper.

Content

No source excerpt is available for this finding.

Session Persistence

Medium
Category
Rogue Agent
Confidence
93% confidence
Finding

This code preserves the current crontab in a temp file as part of a workflow that appends and installs a new cron entry, thereby enabling recurring execution. In the context of an agent skill, cron creation is inherently persistence-establishing and deserves elevated scrutiny even if it is nominally intended functionality.

Content

Scanner excerpt · scripts/cron-helper.sh (reported line 130)May include surrounding context.

sh
local temp_file
    temp_file=$(mktemp)
    
    # Preserve existing crontab
    crontab -l 2>/dev/null >> "$temp_file" || true
    
    # Add new job

Session Persistence

Medium
Category
Rogue Agent
Confidence
85% confidence
Finding

Skill establishes unauthorized persistence across sessions via cron jobs, startup scripts, or state files. Session persistence allows an attacker to maintain access beyond the current interaction.

Content

Scanner excerpt · scripts/cron-helper.sh (reported line 157)May include surrounding context.

sh
temp_file=$(mktemp)
    
    # Get current crontab
    local current_crontab
    current_crontab=$(crontab -l 2>/dev/null) || true
    
    if [[ -z "$current_crontab" ]]; then

Session Persistence

Medium
Category
Rogue Agent
Confidence
85% confidence
Finding

Skill establishes unauthorized persistence across sessions via cron jobs, startup scripts, or state files. Session persistence allows an attacker to maintain access beyond the current interaction.

Content

Scanner excerpt · scripts/cron-helper.sh (reported line 191)May include surrounding context.

sh
edit_crontab() {
    check_crontab
    crontab -e
    log_success "Crontab editor closed"
}

Description-Behavior Mismatch

Medium
Category
Not specified by scanner
Confidence
96% confidence
Finding

The skill's stated purpose is managing user cron jobs, but it also includes functionality to start, stop, and inspect the system cron service via sudo. This expands scope into privileged service administration, which can affect system-wide scheduling behavior and surprise users with elevation prompts or operational changes beyond the expected task.

Content

No source excerpt is available for this finding.

Missing User Warnings

Medium
Category
Not specified by scanner
Confidence
94% confidence
Finding

Starting or stopping the cron service changes system behavior and may require privilege escalation, yet the script provides no explicit warning or confirmation before attempting it. In an agent context, this creates risk of unintended service disruption or privilege-prompt abuse from a seemingly routine scheduling request.

Content

No source excerpt is available for this finding.

Sudo/Root Execution

Medium
Category
Privilege Escalation
Confidence
91% confidence
Finding

This line attempts to run launchctl with sudo to load the cron LaunchDaemon, introducing privileged execution into a skill whose main purpose is user cron management. Even if not directly exploitable for code injection here, unnecessary elevation in an agent-integrated tool increases abuse potential and user surprise.

Content

Scanner excerpt · scripts/cron-helper.sh (reported line 306)May include surrounding context.

sh
macos)
            case "$action" in
                start)
                    sudo launchctl load -w /System/Library/LaunchDaemons/com.apple.cron.plist 2>/dev/null || \
                    log_error "Need sudo to start cron"
                    ;;
                stop)

Session Persistence

Medium
Category
Rogue Agent
Confidence
90% confidence
Finding

Loading the cron LaunchDaemon enables or restores a system scheduling service, which can facilitate persistence for scheduled tasks at the host level. In this skill context, that capability is more dangerous because it crosses from user cron management into system-wide persistence infrastructure control.

Content

Scanner excerpt · scripts/cron-helper.sh (reported line 306)May include surrounding context.

sh
macos)
            case "$action" in
                start)
                    sudo launchctl load -w /System/Library/LaunchDaemons/com.apple.cron.plist 2>/dev/null || \
                    log_error "Need sudo to start cron"
                    ;;
                stop)

Session Persistence

Medium
Category
Rogue Agent
Confidence
90% confidence
Finding

Loading the cron LaunchDaemon enables or restores a system scheduling service, which can facilitate persistence for scheduled tasks at the host level. In this skill context, that capability is more dangerous because it crosses from user cron management into system-wide persistence infrastructure control.

Content

Scanner excerpt · scripts/cron-helper.sh (reported line 306)May include surrounding context.

sh
macos)
            case "$action" in
                start)
                    sudo launchctl load -w /System/Library/LaunchDaemons/com.apple.cron.plist 2>/dev/null || \
                    log_error "Need sudo to start cron"
                    ;;
                stop)

Context-Inappropriate Capability

Medium
Category
Not specified by scanner
Confidence
97% confidence
Finding

These lines implement privileged launchctl/systemctl operations that are not necessary for ordinary per-user crontab management. In the context of an agent skill, unjustified administrative capability increases attack surface and the chance of misuse, especially if invoked indirectly by natural-language triggers about cron jobs.

Content

No source excerpt is available for this finding.

Static analysis

No suspicious patterns detected.