T09 · Insecure Skill Coding Practices
- Location
SKILL.md:177- Finding
Untrusted Backup Archives Are Extracted Directly into the User Home Directory
- Content
View full analysis
if [ $? -ne 0 ]; then echo "ERROR: Backup file is corrupted" exit 1 fi # Create safety backup SAFETY_DIR=~/.soul-transfer-backup-$(date +%Y%m%d_%H%M%S) mkdir -p "$SAFETY_DIR" cp -r ~/.openclaw "$SAFETY_DIR/" 2>/dev/null cp -r ~/workspace "$SAFETY_DIR/" 2>/dev/null # Extract backup unzip -o -d ~ ``` The alternative restore documentation similarly extracts a TAR archive directly into the home directory: ```bash ### Step 5: Extract Backup ```bash tar -xzf /path/to/backup.tar.gz -C ~ ``` ``` ### Technical Analysis The restore procedure validates only whether the archive is structurally readable. `unzip -t` does not authenticate its contents, validate the expected root directories, or establish that the archive came from a trusted backup process. The archive is then extracted directly into `~` with overwrite enabled. The procedure does not independently inspect and canonicalize entry names, reject absolute paths or parent-directory components, reject unsafe symbolic or hard links, or restrict extraction to an allowlist such as `.openclaw/` and `workspace/`. The TAR-based procedure has the same trust-boundary problem: an externally supplied archive is unpacked into the user's home directory without application-level entry validation. ### Attack Path 1. An attacker creates or modifies a backup archive containing unexpected paths, link entries, or files outside the documented `.openclaw/` and `workspace/` roots. 2. The attacker convinces the user to restore that archive, for example by presenting it as a migration backup. 3. The structural archive test succeeds because the archive itself is well-formed. 4. The restore procedure extracts the entries directly into the us ...[truncated 887 chars]- Remediation
View remediation
