T07 · Tool Hijacking and Spoofing
Warning
- Location
- scripts/full-backup.sh:4
- Finding
- Unverified External Backup Script Can Be Hijacked<![CDATA[ ## Vulnerability Details **File Location**: `scripts/full-backup.sh`, lines 4–11 **Vulnerability Type**: Untrusted external executable invocation **Risk Level**: Medium ### Vulnerable Code ```bash BACKUP_SCRIPT="/root/.openclaw/workspace/scripts/backup-local.sh" if [ ! -x "$BACKUP_SCRIPT" ]; then echo "Error: backup script not found or not executable: $BACKUP_SCRIPT" >&2 exit 1 fi "$BACKUP_SCRIPT" ``` ### Technical Analysis The bundled wrapper delegates all backup behavior to `/root/.openclaw/workspace/scripts/backup-local.sh`, which is located outside the audited Skill package. The only validation performed is the `-x` test, which confirms that the path resolves to an executable object. It does not verify: - The file's owner or group. - Whether the file or its parent directories are writable by untrusted users. - Whether the path resolves through a symbolic link. - The executable's cryptographic integrity. - Whether the target is a regular file. - Whether its behavior matches the backup safeguards claimed in `SKILL.md`. As a result, the effective behavior of this Skill can change independently of the reviewed package. If an attacker can replace the external script or redirect its path, invoking the legitimate-looking backup Skill will execute attacker-controlled commands. ### Attack Path 1. An attacker obtains write access to `/root/.openclaw/workspace/scripts/backup-local.sh` or a relevant parent directory through a separate permission weakness, compromised deployment process, or account access. 2. The attacker replaces the script or redirects the path using a symbolic link to an attacker-controlled executable. 3. The replacement is marked executable so that the `-x` check succeeds. 4. A user or Agent invokes the full-backup Skill. 5. `scripts/full-backup.sh` executes the substituted payload without ownership or integrity verification. 6. The payload runs with the same operating-system privileges and access available to the Skill proc ...[truncated 637 chars]
- Remediation
- <![CDATA[ ## Remediation Suggestions 1. Bundle the backup implementation inside the reviewed Skill package so its behavior is versioned and audited with the wrapper. 2. If an external executable is required, validate it before execution: - Require a regular file and reject symbolic links. - Verify trusted ownership and restrictive permissions. - Confirm that the script and all parent directories are not writable by untrusted users. - Validate the file against a pinned cryptographic digest or signed manifest. 3. Execute the backup process under a dedicated, least-privileged account with access limited to the required source and destination paths. 4. Ensure backup archives are created with restrictive permissions and that sensitive files are explicitly included or excluded according to a reviewed policy. 5. Fail closed if any ownership, permission, file-type, path, or integrity check does not match the expected configuration. 6. Update `SKILL.md` so claims about archive location and safe exclusions are either enforced by packaged code or clearly documented as properties of a separately trusted dependency. ]]>
