T05 · Unauthorized Access and Privilege Escalation
- Location
scripts/restore.sh:78- Finding
Restore Safety Snapshot Copies API Secrets Without Explicit Opt-In
- Content
View full analysis
- Remediation
View remediation
Security audit
Security checks for vulnerabilities and agentic risk
This backup skill mostly matches its purpose, but it can copy secrets to the NAS outside the documented opt-in boundary and can follow symlinks out of approved folders.
Review and harden this skill before installing. Remove rsync --copy-links or enforce canonical symlink containment, and change restore.sh so .env is copied only with explicit opt-in and restrictive permissions. Use a dedicated low-privilege NAS user, restrict and encrypt the backup share, run dry-run first, and review cron settings before enabling automated backups.
scripts/restore.sh:78Restore Safety Snapshot Copies API Secrets Without Explicit Opt-In
scripts/backup.sh:101Symlink Dereferencing Allows Backup Paths to Escape Approved Roots
Code accesses credential files (SSH keys, AWS credentials, etc.). This could indicate credential theft attempts.
**SSH transport (recommended):** Set `"transport": "ssh"` and add `"sshUser": "your-user"`. No credentials file needed — uses SSH key auth. Requires rsync + SSH access to the Synology.
> ⚠️ **SSH host key warning:** Scripts use `StrictHostKeyChecking=yes`. Add your NAS host key to `~/.ssh/known_hosts` first by connecting manually once (`ssh user@nas-ip`) before automation.
**Sensitive files:** The `.env` file (containing API keys) is **excluded by default**. Only add it to `backupPaths` if your NAS share is restricted to a dedicated low-privilege user and encrypted at rest. When in doubt, leave it out — you can always re-enter API keys from scratch.
Code accesses credential files (SSH keys, AWS credentials, etc.). This could indicate credential theft attempts.
**SSH transport (recommended):** Set `"transport": "ssh"` and add `"sshUser": "your-user"`. No credentials file needed — uses SSH key auth. Requires rsync + SSH access to the Synology.
> ⚠️ **SSH host key warning:** Scripts use `StrictHostKeyChecking=yes`. Add your NAS host key to `~/.ssh/known_hosts` first by connecting manually once (`ssh user@nas-ip`) before automation.
**Sensitive files:** The `.env` file (containing API keys) is **excluded by default**. Only add it to `backupPaths` if your NAS share is restricted to a dedicated low-privilege user and encrypted at rest. When in doubt, leave it out — you can always re-enter API keys from scratch.
Referenced artifact was not completely inspected
scripts/backup.sh
Referenced artifact was not completely inspected
scripts/backup.sh
Referenced artifact was not completely inspected
scripts/backup.sh
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).
send_telegram "⚠️ Synology backup FAILED on $(hostname) — snapshot dir not writable: $SNAP_DIR"
exit 1
fi
rm -f -- "${SNAP_DIR}/.ping"
fi
# ---------------------------------------------------------------------------
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).
fi
# Health check: verify the NAS is actually responsive
if touch "$MOUNT/.ping" 2>/dev/null && rm -f "$MOUNT/.ping" 2>/dev/null; then
echo "Mount health check passed"
return 0
else
Tool calls are chained to bypass individual safety checks or escalate capabilities beyond what any single tool call would allow.
fi
# Health check: verify the NAS is actually responsive
if touch "$MOUNT/.ping" 2>/dev/null && rm -f "$MOUNT/.ping" 2>/dev/null; then
echo "Mount health check passed"
return 0
else
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.
exit 1
fi
echo "⚠️ This will overwrite current files with snapshot from $DATE"
echo " Source: $SNAP_DIR"
echo ""
read -r -p "Continue? [y/N] " confirm
The README promotes restore capability as 'safe' but does not prominently warn that a restore can overwrite the current workspace, configuration, and agent data. Even with pre-restore snapshots, users may trigger destructive replacement without understanding the operational risk, leading to accidental data loss or rollback to stale state.
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.
## Quick Setup
1. Install dependencies: `apt-get install -y cifs-utils rsync`
2. Create a dedicated Synology user with access to one share only
3. Create credentials file: `touch ~/.openclaw/.smb-credentials && chmod 600 ~/.openclaw/.smb-credentials`
4. Create config at `~/.openclaw/synology-backup.json` (see SKILL.md for full reference)
5. Test: `bash scripts/backup.sh --dry-run`
Commands invoke sudo or root privileges. Verify this elevated access is necessary and justified.
- rsync
- jq
- cifs-utils
notes: "SSH transport requires SSH key auth to Synology. SMB transport requires cifs-utils and a chmod 600 credentials file. Cron/session layer should own notifications explicitly."
---
# Synology Backup
Commands invoke sudo or root privileges. Verify this elevated access is necessary and justified.
- rsync
- jq
- cifs-utils
notes: "SSH transport requires SSH key auth to Synology. SMB transport requires cifs-utils and a chmod 600 credentials file. Cron/session layer should own notifications explicitly."
---
# Synology Backup
Commands invoke sudo or root privileges. Verify this elevated access is necessary and justified.
- rsync
- jq
- cifs-utils
notes: "SSH transport requires SSH key auth to Synology. SMB transport requires cifs-utils and a chmod 600 credentials file. Cron/session layer should own notifications explicitly."
---
# Synology Backup
Commands invoke sudo or root privileges. Verify this elevated access is necessary and justified.
- rsync
- jq
- cifs-utils
notes: "SSH transport requires SSH key auth to Synology. SMB transport requires cifs-utils and a chmod 600 credentials file. Cron/session layer should own notifications explicitly."
---
# Synology Backup
Commands invoke sudo or root privileges. Verify this elevated access is necessary and justified.
- rsync
- jq
- cifs-utils
notes: "SSH transport requires SSH key auth to Synology. SMB transport requires cifs-utils and a chmod 600 credentials file. Cron/session layer should own notifications explicitly."
---
# Synology Backup
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.
### 2. Synology Preparation
1. Create a dedicated user on the Synology (e.g., `openclaw-backup`) with minimal permissions
2. Create or choose a shared folder (e.g., `backups`)
3. Grant the user read/write access to **only** that folder — not admin access
Commands invoke sudo or root privileges. Verify this elevated access is necessary and justified.
touch ~/.openclaw/.smb-credentials
chmod 600 ~/.openclaw/.smb-credentials
# Add two lines:
# username=<your-synology-user>
# password=<your-synology-password>
The cron setup example enables unattended recurring backup and verification, which results in regular automated transfer of workspace and agent data to the NAS. Without an explicit warning, users may not realize they are establishing persistent scheduled exfiltration of potentially sensitive data beyond the local host.
The security notes assert that all config values are validated before use and that restore is constrained by an explicit allowlist. In the provided file, those are intent-level guarantees rather than demonstrated behavior, so the documentation overclaims safety properties the reader cannot verify here.
The comment says the function verifies the NAS is responsive 'with a write test' after a successful mount, implying a meaningful backup-target health validation. In practice, the code only does a simple touch/remove of .ping on the mounted path, which checks basic writability but not broader backup integrity or responsiveness semantics suggested by the comment.
No suspicious patterns detected.