Back to skill

Security audit

clawmerge

Security checks for vulnerabilities and agentic risk

Overview

This backup/restore skill is mostly purpose-aligned, but it handles secrets and can restore persistent executable content with weak safeguards.

Install only if you trust the publisher and will treat every backup archive as secret and executable. Prefer dry-run first, keep disaster backups encrypted and private, avoid restoring from untrusted archives, review restored memory/skills/cron/dependencies before activation, and avoid restore-task-scripts.sh unless you intentionally want it to change cron and install packages.

Vulnerability Patterns
  • Agent Memory PoisoningWrites attacker-controlled rules into memory that affect later sessions
  • System PersistenceInstalls backdoors, hooks, services, or scheduled tasks that survive the run
  • Insecure DependenciesIntroduces malicious components through unsafe dependency sources
  • 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
Findings (4)

T09 · Insecure Skill Coding Practices

Error
Location
scripts/one-click-full-backup.sh:97
Finding

Disaster backup stores authentication secrets in an unencrypted archive without restrictive permissions

Content
View full analysis
/dev/null if [ -f "$OUTPUT_FILE" ]; then SIZE=$(ls -lh "$OUTPUT_FILE" | awk '{print $5}') MD5=$(md5sum "$OUTPUT_FILE" | awk '{print $1}') fi ``` ### Technical Analysis The full-backup feature intentionally collects `openclaw.json`, `.env`, and Agent authentication configuration. The documentation confirms that these files can contain gateway tokens and other credentials. The final artifact is compressed but not encrypted. Compression provides no confidentiality. The script also does not establish a restrictive `umask`, explicitly apply mode `0600`, or verify that the destination is private. Consequently, the resulting archive can inherit permissions that make it readable by unintended local users or services. The generated MD5 value does not protect authenticity and is not a confidentiality control. It cannot prevent an attacker from reading the archive or replacing both the archive and its displayed checksum. Collecting these files is relevant to the declared disaster-recovery functionality, so the access itself doe ...[truncated 1348 chars]
Remediation
View remediation

T02 · Agent Memory Poisoning

Error
Location
scripts/one-click-restore.sh:106
Finding

Untrusted backup restoration can poison persistent Agent memory and install unverified Skills

Content
View full analysis
> "$WORKSPACE_DIR/MEMORY.md" echo " ✓ Added entry: $current_date" ((NEW_ENTRIES++)) fi fi current_date="${BASH_REMATCH[1]}" current_entry="$line" elif [ -n "$current_date" ]; then current_entry="$current_entry"$'\n'"$line" fi done < "$TEMP_DIR/MEMORY.md" ``` Backup-controlled Skills are copied into the live Skill directory: ```bash for skill_dir in "$TEMP_DIR/skills/"*/; do if [ -d "$skill_dir" ]; then skill_name=$(basename "$skill_dir") dest="$WORKSPACE_DIR/skills/$skill_name" if [ ! -d "$dest" ]; then cp -r "$skill_dir" "$dest" echo " ✓ Installed: $skill_name" ((INSTALLED++)) else echo " ○ Skipped (exists): $skill_name" ((SKIPPED++)) fi fi done ``` ### Technical Analysis Successful `tar -tzf` or `tar -xzf` processing establishes only that the archive is syntactically valid. It does not establish who created it, whether it was modified, or whether its contents are safe. The restore flow treats `MEMORY.md` as trusted and perma ...[truncated 1917 chars]
Remediation
View remediation

T08 · Insecure Dependencies

Error
Location
scripts/restore-task-scripts.sh:122
Finding

Backup-controlled requirements are installed automatically with pip

Content
View full analysis
/dev/null || \ echo -e " ${YELLOW}⚠ Some packages may need manual installation${NC}" echo -e " ${GREEN}✓ Python dependencies installed${NC}" fi ``` ### Technical Analysis The backup directory is supplied by the caller, and its `python-requirements.txt` is passed directly to pip. A pip requirements file may contain more than ordinary package names: it can specify attacker-controlled package names, direct URLs, editable installations, alternative indexes, local paths, and pip options. Installing a Python package can execute build-backend and installation-related code. The helper does not authenticate the requirements file, enforce package hashes, restrict index sources, validate entries, or isolate installation in a virtual environment. Suppressing standard error also conceals potentially important warnings. The script may print a success message even after pip reports a partial failure because the failure is converted into a successful fallback command. ### Attack Path 1. An attacker prepares a backup directory containing `05-dependencies/python-requirements.txt`. 2. The requirements file references a malicious package, dependency-confusion name, attacker-controlled index, URL, local project, or package release. 3. The victim invokes `restore-task-scripts.sh` against that backup. 4. The helper calls `pip3 install -r` without a dedicated dependency confirmation. 5. Pip resolves, downloads, builds, and installs the attacker-selected dependency. 6. Package build or installation code executes under the invoking user's account. 7. The insta ...[truncated 572 chars]
Remediation
View remediation

T06 · System Persistence

Error
Location
` operation replaces the user's complete existing crontab and immediately enables every valid entry in the supplied file. The script does not display a diff, validate commands, preserve existing entries, stage jobs in a disabled state, or request a dedicated confirmation before activation. This differs from `restore-cron-tasks.sh`, which asks the user before invoking `crontab`. Cron migration is part of the declared Skill functionality, so reading or staging cron data is reasonable. Immediate, uncondition ...[truncated 1648 chars]:81
Finding

Restore helper activates backup-controlled cron persistence without dedicated confirmation

Content
View full analysis
` operation replaces the user's complete existing crontab and immediately enables every valid entry in the supplied file. The script does not display a diff, validate commands, preserve existing entries, stage jobs in a disabled state, or request a dedicated confirmation before activation. This differs from `restore-cron-tasks.sh`, which asks the user before invoking `crontab`. Cron migration is part of the declared Skill functionality, so reading or staging cron data is reasonable. Immediate, unconditional activation is not the minimum-privilege implementation necessary for restoration. It turns an untrusted backup into a user-level cross-session execution mechanism. The file is described as a “system crontab,” but `crontab` without a user option ordinarily operates on the invoking user's crontab. Therefore, the demonstrated scope is persistent execution as that user, not automatic root-level persistence. ### Attack Path 1. An attacker creates or modifies a restore directory. 2. The attacker places cron syntax in `03-cron-configs/system-crontab.txt`, such as a periodic command invoking an attacker-controlled script. 3. The victim runs `restore-task- ...[truncated 869 chars]
Remediation
View remediation
Vulnerability Patterns
  • Privilege EscalationExcessive Permissions, Sudo/Root Execution, Credential Access
  • Tool MisuseTool Parameter Abuse, Chaining Abuse, Unsafe Defaults
  • Rogue AgentSelf-Modification, Session Persistence
  • YARA SignaturesMalware Match, Webshell Match, Cryptominer Match
  • MCP Tool PoisoningHidden Instructions, Unicode Deception, Parameter Description Injection
Findings (79)

Tp4

High
Category
MCP Tool Poisoning
Confidence
98% confidence
Finding

If the implementation really lacks session backup, system-config backup, and safe non-overwrite restore while the documentation claims those protections, users could rely on false safety guarantees during migration or disaster recovery. In a backup/restore context, misleading safety claims materially increase risk because the skill handles sensitive configs, tokens, cron state, and potentially untrusted archives.

Content

No source excerpt is available for this finding.

Tp4

High
Category
MCP Tool Poisoning
Confidence
97% confidence
Finding

If the implementation really lacks session backup, system-config backup, and safe non-overwrite restore while the documentation claims those protections, users could rely on false safety guarantees during migration or disaster recovery. In a backup/restore context, misleading safety claims materially increase risk because the skill handles sensitive configs, tokens, cron state, and potentially untrusted archives.

Content

No source excerpt is available for this finding.

Tp4

High
Category
MCP Tool Poisoning
Confidence
94% confidence
Finding

If the implementation really lacks session backup, system-config backup, and safe non-overwrite restore while the documentation claims those protections, users could rely on false safety guarantees during migration or disaster recovery. In a backup/restore context, misleading safety claims materially increase risk because the skill handles sensitive configs, tokens, cron state, and potentially untrusted archives.

Content

No source excerpt is available for this finding.

Tp4

High
Category
MCP Tool Poisoning
Confidence
96% confidence
Finding

If the implementation really lacks session backup, system-config backup, and safe non-overwrite restore while the documentation claims those protections, users could rely on false safety guarantees during migration or disaster recovery. In a backup/restore context, misleading safety claims materially increase risk because the skill handles sensitive configs, tokens, cron state, and potentially untrusted archives.

Content

No source excerpt is available for this finding.

Tp4

High
Category
MCP Tool Poisoning
Confidence
94% confidence
Finding

If the implementation really lacks session backup, system-config backup, and safe non-overwrite restore while the documentation claims those protections, users could rely on false safety guarantees during migration or disaster recovery. In a backup/restore context, misleading safety claims materially increase risk because the skill handles sensitive configs, tokens, cron state, and potentially untrusted archives.

Content

No source excerpt is available for this finding.

YARA rule 'backdoor_persistence': Backdoor persistence with malicious payloads (shell commands, SSH key injection, hidden root users) [malware]

High
Category
YARA Match
Confidence
75% confidence
Finding

YARA rule matched a known malware signature (reverse shell, backdoor, ransomware, C2 framework, or info stealer).

Content

Scanner excerpt · scripts/backup-cron-tasks.sh (reported line 61)May include surrounding context.

sh
i "s/TIMESTAMP_PLACEHOLDER/$(date -Iseconds)/" "$CRON_EXPORT_FILE"

echo -e "  ${GREEN}✓ Created: $CRON_EXPORT_FILE${NC}"

# 2. Backup system crontab (if exists)
echo -e "${YELLOW}[2/2] Backing up system crontab...${NC}"

if crontab -l &>/dev/null; then
    crontab -l > "$SYSTEM_CRONTAB_FILE"
    echo -e "  ${GREEN}✓ Created: $SYSTEM_CRONTAB_FILE${NC}"
else
    echo -e "  ${BLUE}○ No system crontab found${NC}"
    echo "# No crontab entries" > "$SYSTEM_CRONTAB_FILE"
fi

echo ""
echo -e "${GREEN}========================================${NC}"
echo -e "${GREEN}  Cron Backup Complete${NC}"
echo -e "${GREEN}========================================${NC}"
echo ""
echo -e "${YELLOW}Files created:${NC}"
ls -lh "$CRON_EXPORT_FILE" "$SYSTEM_CRONTAB_FILE"
echo ""
echo -e "${BLUE}Migration Notes:${NC}"
echo "  1. OpenClaw cron tasks are stored in Gateway config"
echo "  2. To fully migrate: backup ~/.openclaw/openclaw.json"
echo "  3. Or manually recreate cron jobs on target system"
echo ""

YARA rule 'backdoor_persistence': Backdoor persistence with malicious payloads (shell commands, SSH key injection, hidden root users) [malware]

High
Category
YARA Match
Confidence
75% confidence
Finding

YARA rule matched a known malware signature (reverse shell, backdoor, ransomware, C2 framework, or info stealer).

Content

Scanner excerpt · scripts/one-click-backup.sh (reported line 183)May include surrounding context.

sh
R/backup-cron-tasks.sh" "$CRON_EXPORT_DIR" >/dev/null 2>&1 || true
fi

# Copy cron files to workspace for inclusion in archive
cp "$CRON_EXPORT_DIR"/cron-tasks-*.json "$WORKSPACE_DIR/" 2>/dev/null && echo -e "  ${GREEN}✓ Cron tasks exported${NC}" || echo -e "  ${BLUE}○ No cron tasks${NC}"
cp "$CRON_EXPORT_DIR"/system-crontab-*.txt "$WORKSPACE_DIR/" 2>/dev/null && echo -e "  ${GREEN}✓ System crontab exported${NC}" || true
echo ""

# ============================================
# Step 3: Export session records (optional)
# ============================================
SESSIONS_EXPORT_DIR=""
if [ "$WITH_SESSIONS" = true ]; then
    SESSIONS_EXPORT_DIR=$(mktemp -d)
    trap "rm -rf $SESSIONS_EXPORT_DIR" EXIT
    
    echo -e "${YELLOW}[3/6] Exporting session records...${NC}"
    SESSIONS_DIR="$OPENCLAW_DIR/agents/main/sessions"
    
    if [ -d "$SESSIONS_DIR" ]; then
        # Copy session files
        cp -r "$SESSIONS_DIR" "$SESSIONS_EXPORT_DIR/" 2>/dev/null || true

Tool Parameter Abuse

High
Category
Tool Misuse
Confidence
95% confidence
Finding

Tool parameters are crafted to achieve unintended or unsafe behavior. Parameter abuse can bypass intended safety checks (e.g. shell=True, --force, dangerous glob patterns).

Content

Scanner excerpt · scripts/one-click-backup.sh (reported line 278)May include surrounding context.

sh
echo -e "${GREEN}Done! (no files modified)${NC}"
    
    # Cleanup temp files
    rm -f "$WORKSPACE_DIR"/cron-tasks-*.json "$WORKSPACE_DIR"/system-crontab-*.txt 2>/dev/null || true
    rm -rf "$WORKSPACE_DIR/.backup-sessions" 2>/dev/null || true
    exit 0
fi

Tool Parameter Abuse

High
Category
Tool Misuse
Confidence
95% confidence
Finding

Tool parameters are crafted to achieve unintended or unsafe behavior. Parameter abuse can bypass intended safety checks (e.g. shell=True, --force, dangerous glob patterns).

Content

Scanner excerpt · scripts/one-click-backup.sh (reported line 300)May include surrounding context.

sh
echo -e "${GREEN}Done! (no files modified)${NC}"
    
    # Cleanup temp files
    rm -f "$WORKSPACE_DIR"/cron-tasks-*.json "$WORKSPACE_DIR"/system-crontab-*.txt 2>/dev/null || true
    rm -rf "$WORKSPACE_DIR/.backup-sessions" 2>/dev/null || true
    exit 0
fi

Tool Parameter Abuse

High
Category
Tool Misuse
Confidence
95% confidence
Finding

Tool parameters are crafted to achieve unintended or unsafe behavior. Parameter abuse can bypass intended safety checks (e.g. shell=True, --force, dangerous glob patterns).

Content

Scanner excerpt · scripts/one-click-backup.sh (reported line 279)May include surrounding context.

sh
# Cleanup temp files
    rm -f "$WORKSPACE_DIR"/cron-tasks-*.json "$WORKSPACE_DIR"/system-crontab-*.txt 2>/dev/null || true
    rm -rf "$WORKSPACE_DIR/.backup-sessions" 2>/dev/null || true
    exit 0
fi

Tool Parameter Abuse

High
Category
Tool Misuse
Confidence
95% confidence
Finding

Tool parameters are crafted to achieve unintended or unsafe behavior. Parameter abuse can bypass intended safety checks (e.g. shell=True, --force, dangerous glob patterns).

Content

Scanner excerpt · scripts/one-click-backup.sh (reported line 301)May include surrounding context.

sh
# Cleanup temp files
    rm -f "$WORKSPACE_DIR"/cron-tasks-*.json "$WORKSPACE_DIR"/system-crontab-*.txt 2>/dev/null || true
    rm -rf "$WORKSPACE_DIR/.backup-sessions" 2>/dev/null || true
    exit 0
fi

Chaining Abuse

High
Category
Tool Misuse
Confidence
78% confidence
Finding

Using ls output piped into xargs rm is unsafe because filenames containing whitespace, newlines, or leading dashes can be split or interpreted as options, causing unintended deletions. In a backup directory where file names may not be strictly controlled, this can delete the wrong files during rotation.

Content

Scanner excerpt · scripts/one-click-backup.sh (reported line 332)May include surrounding context.

sh
BACKUP_COUNT=$(ls -1 clawmerge-*.tar.gz 2>/dev/null | wc -l)
    if [ "$BACKUP_COUNT" -gt 10 ]; then
        echo -e "${YELLOW}Cleaning up old backups (keeping last 10)...${NC}"
        ls -1t clawmerge-*.tar.gz | tail -n +11 | xargs -r rm -f
    fi
    
    echo -e "${BLUE}Tip:${NC} Run with --list to see all backups"

Credential Access

High
Category
Privilege Escalation
Confidence
95% confidence
Finding

This line copies the .env file into the backup archive, which commonly contains API keys, tokens, secrets, and service credentials. In the context of a disaster-backup skill, collecting credentials is expected functionality, but it remains dangerous because compromise of the backup file directly exposes those secrets.

Content

Scanner excerpt · scripts/one-click-full-backup.sh (reported line 103)May include surrounding context.

sh
echo -e "  ${RED}✗ openclaw.json not found!${NC}"
fi

# Backup .env if exists
if [ -f "$OPENCLAW_DIR/.env" ]; then
    cp "$OPENCLAW_DIR/.env" "$BACKUP_DIR/system/.env"
    echo "  ✓ .env"

Credential Access

High
Category
Privilege Escalation
Confidence
60% confidence
Finding

Code accesses credential files (SSH keys, AWS credentials, etc.). This could indicate credential theft attempts.

Content

Scanner excerpt · scripts/one-click-full-backup.sh (reported line 104)May include surrounding context.

sh
fi

# Backup .env if exists
if [ -f "$OPENCLAW_DIR/.env" ]; then
    cp "$OPENCLAW_DIR/.env" "$BACKUP_DIR/system/.env"
    echo "  ✓ .env"
fi

Credential Access

High
Category
Privilege Escalation
Confidence
60% confidence
Finding

Code accesses credential files (SSH keys, AWS credentials, etc.). This could indicate credential theft attempts.

Content

Scanner excerpt · scripts/one-click-full-backup.sh (reported line 105)May include surrounding context.

sh
fi

# Backup .env if exists
if [ -f "$OPENCLAW_DIR/.env" ]; then
    cp "$OPENCLAW_DIR/.env" "$BACKUP_DIR/system/.env"
    echo "  ✓ .env"
fi

Credential Access

High
Category
Privilege Escalation
Confidence
60% confidence
Finding

Code accesses credential files (SSH keys, AWS credentials, etc.). This could indicate credential theft attempts.

Content

Scanner excerpt · scripts/one-click-full-backup.sh (reported line 106)May include surrounding context.

sh
fi

# Backup .env if exists
if [ -f "$OPENCLAW_DIR/.env" ]; then
    cp "$OPENCLAW_DIR/.env" "$BACKUP_DIR/system/.env"
    echo "  ✓ .env"
fi

Credential Access

High
Category
Privilege Escalation
Confidence
60% confidence
Finding

Code accesses credential files (SSH keys, AWS credentials, etc.). This could indicate credential theft attempts.

Content

Scanner excerpt · scripts/one-click-full-backup.sh (reported line 237)May include surrounding context.

sh
Contents:
---------
- system/openclaw.json    : Gateway config + token
- system/.env             : Environment variables (if exists)
- agents/                 : Agent auth config
- cron/jobs.json          : Cron task definitions
- cron/jobs-state.json    : Cron state (if exists)

Self-Modification

High
Category
Rogue Agent
Confidence
85% confidence
Finding

Skill modifies its own code, configuration, or behavior at runtime. Self-modification enables an agent to escalate privileges, disable safety constraints, or install persistent backdoors.

Content

Scanner excerpt · scripts/one-click-full-restore.sh (reported line 151)May include surrounding context.

sh
if [ "$FORCE_MODE" != true ]; then
    echo -e "${YELLOW}========================================${NC}"
    if [ "$UNSAFE_OVERWRITE" = true ]; then
        echo -e "${YELLOW}  ⚠ WARNING: UNSAFE mode will overwrite existing files!${NC}"
    else
        echo -e "${YELLOW}  Safe mode: configs/sessions go to restore-candidates/archive; workspace skips existing files.${NC}"
    fi

Credential Access

High
Category
Privilege Escalation
Confidence
96% confidence
Finding

This code path handles restoration of .env, which typically contains sensitive credentials. In the context of a restore tool, automatically importing credentials from a backup broadens credential exposure and can reactivate compromised, stale, or attacker-supplied secrets without adequate validation.

Content

Scanner excerpt · scripts/one-click-full-restore.sh (reported line 228)May include surrounding context.

sh
echo -e "  ${YELLOW}⚠ openclaw.json not in backup${NC}"
fi

# Restore or stage .env if exists
if [ -f "$BACKUP_ROOT/system/.env" ]; then
    if [ "$UNSAFE_OVERWRITE" = true ]; then
        cp "$BACKUP_ROOT/system/.env" "$OPENCLAW_DIR/.env"

Credential Access

High
Category
Privilege Escalation
Confidence
95% confidence
Finding

The check for system/.env enables secret-bearing content from the archive to enter the restore flow. Because the backup archive is treated as trusted after only tar integrity checking, a malicious or tampered backup can plant credentials or configuration that affect later runtime behavior.

Content

Scanner excerpt · scripts/one-click-full-restore.sh (reported line 229)May include surrounding context.

sh
fi

# Restore or stage .env if exists
if [ -f "$BACKUP_ROOT/system/.env" ]; then
    if [ "$UNSAFE_OVERWRITE" = true ]; then
        cp "$BACKUP_ROOT/system/.env" "$OPENCLAW_DIR/.env"
        echo -e "  ${GREEN}✓ .env restored (unsafe overwrite)${NC}"

Credential Access

High
Category
Privilege Escalation
Confidence
97% confidence
Finding

Copying system/.env directly into $OPENCLAW_DIR/.env in unsafe mode can overwrite live secrets and runtime configuration. This can redirect services, replace API keys, or enable an attacker-controlled environment if the backup contents are malicious or outdated.

Content

Scanner excerpt · scripts/one-click-full-restore.sh (reported line 231)May include surrounding context.

sh
# Restore or stage .env if exists
if [ -f "$BACKUP_ROOT/system/.env" ]; then
    if [ "$UNSAFE_OVERWRITE" = true ]; then
        cp "$BACKUP_ROOT/system/.env" "$OPENCLAW_DIR/.env"
        echo -e "  ${GREEN}✓ .env restored (unsafe overwrite)${NC}"
    else
        cp "$BACKUP_ROOT/system/.env" "$RESTORE_CANDIDATE_DIR/.env"

Credential Access

High
Category
Privilege Escalation
Confidence
93% confidence
Finding

The success message normalizes live .env restoration as part of an unsafe overwrite workflow, which increases the chance an operator will apply sensitive configuration without fully understanding the impact. In a disaster-restore context, this makes accidental credential rollback or activation of unsafe settings more likely.

Content

Scanner excerpt · scripts/one-click-full-restore.sh (reported line 232)May include surrounding context.

sh
if [ -f "$BACKUP_ROOT/system/.env" ]; then
    if [ "$UNSAFE_OVERWRITE" = true ]; then
        cp "$BACKUP_ROOT/system/.env" "$OPENCLAW_DIR/.env"
        echo -e "  ${GREEN}✓ .env restored (unsafe overwrite)${NC}"
    else
        cp "$BACKUP_ROOT/system/.env" "$RESTORE_CANDIDATE_DIR/.env"
        echo -e "  ${CYAN}○ .env staged: $RESTORE_CANDIDATE_DIR/.env${NC}"

Credential Access

High
Category
Privilege Escalation
Confidence
94% confidence
Finding

Even in safe mode, staging .env into a restore-candidates directory materializes sensitive secrets on disk in another location, increasing exposure risk through backups, indexing, permissive permissions, or later accidental use. Secret duplication is still dangerous even when not immediately applied live.

Content

Scanner excerpt · scripts/one-click-full-restore.sh (reported line 234)May include surrounding context.

sh
cp "$BACKUP_ROOT/system/.env" "$OPENCLAW_DIR/.env"
        echo -e "  ${GREEN}✓ .env restored (unsafe overwrite)${NC}"
    else
        cp "$BACKUP_ROOT/system/.env" "$RESTORE_CANDIDATE_DIR/.env"
        echo -e "  ${CYAN}○ .env staged: $RESTORE_CANDIDATE_DIR/.env${NC}"
    fi
fi

Credential Access

High
Category
Privilege Escalation
Confidence
92% confidence
Finding

The staged .env path is echoed to the terminal, which encourages handling a sensitive file like an ordinary restore artifact. While the path itself is not a secret, this workflow increases the likelihood of improper storage, sharing, or later accidental inclusion in logs and backups.

Content

Scanner excerpt · scripts/one-click-full-restore.sh (reported line 235)May include surrounding context.

sh
echo -e "  ${GREEN}✓ .env restored (unsafe overwrite)${NC}"
    else
        cp "$BACKUP_ROOT/system/.env" "$RESTORE_CANDIDATE_DIR/.env"
        echo -e "  ${CYAN}○ .env staged: $RESTORE_CANDIDATE_DIR/.env${NC}"
    fi
fi

Tool Parameter Abuse

High
Category
Tool Misuse
Confidence
95% confidence
Finding

rm -rf "$OPENCLAW_DIR/agents/main/agent" deletes the current agent configuration before replacement. In a restore tool that consumes an archive with minimal provenance checks, this enables destructive replacement of authentication or agent config and can cause denial of service or install attacker-supplied configuration if the backup is malicious.

Content

Scanner excerpt · scripts/one-click-full-restore.sh (reported line 243)May include surrounding context.

sh
if [ -d "$BACKUP_ROOT/agents/agent" ]; then
    if [ "$UNSAFE_OVERWRITE" = true ]; then
        mkdir -p "$OPENCLAW_DIR/agents/main"
        rm -rf "$OPENCLAW_DIR/agents/main/agent"
        cp -r "$BACKUP_ROOT/agents/agent" "$OPENCLAW_DIR/agents/main/agent"
        echo -e "  ${GREEN}✓ agents/main/agent/ restored (unsafe overwrite)${NC}"
    else