T09 · Insecure Skill Coding Practices
Warning
- Location
- references/SETUP_GUIDE.md:175
- Finding
- Sensitive backup directory is configured with overly permissive access<![CDATA[ ## Vulnerability Details **File Location**: `references/SETUP_GUIDE.md:175-180`; related directory creation logic at `scripts/backup.py:18-19` **Vulnerability Type**: Insecure filesystem permissions for sensitive backup storage **Risk Level**: Medium ### Vulnerable Code `references/SETUP_GUIDE.md:175-180`: ```bash ### "Permission denied" on backup directory Create the directory: ```bash mkdir -p ~/openclaw_backups chmod 755 ~/openclaw_backups ``` ``` Related code in `scripts/backup.py:18-19`: ```python def ensure_backup_dir(): os.makedirs(get_backup_dir(), exist_ok=True) ``` ### Technical Analysis The backup archives are documented as containing configuration, credentials, session history, workspace files, skills, and settings. Despite the sensitivity of this data, the setup guide recommends permission mode `0755` for the backup directory. Mode `0755` allows every local user to traverse and list the directory. This exposes archive names, timestamps, and other filesystem metadata. If the OpenClaw CLI creates archives using a permissive process umask or permissive explicit file mode, other local users may also be able to read the archive contents. The Python code creates the directory without explicitly enforcing a private mode or verifying its ownership and effective permissions. For an existing directory, `os.makedirs(..., exist_ok=True)` does not correct insecure permissions. It also does not verify that the configured path is not a symbolic link. ### Attack Path 1. A user follows the setup guide and configures `~/openclaw_backups` with mode `0755`. 2. The backup script creates archives containing sensitive OpenClaw state in that directory. 3. Another local account lists or traverses the directory and obtains archive names and metadata. 4. If an archive is group- or world-readable because of the OpenClaw CLI's output mode or the invoking process's umask, the local account copies and inspects it. 5. The attacker gains access to any unpr ...[truncated 762 chars]
- Remediation
- <![CDATA[ ## Remediation Suggestions 1. Replace the documented `chmod 755` command with private permissions: ```bash mkdir -p ~/openclaw_backups chmod 700 ~/openclaw_backups ``` 2. Enforce secure permissions in `backup.py`, including for existing directories: ```python def ensure_backup_dir(): backup_dir = get_backup_dir() os.makedirs(backup_dir, mode=0o700, exist_ok=True) os.chmod(backup_dir, 0o700) ``` 3. Before use, validate that the directory: - Is owned by the current user. - Is an actual directory rather than a symbolic link. - Has no group or world permissions. - Resolves to the intended location. 4. After backup creation, verify that each archive is a regular file owned by the current user and set its mode to `0600`. 5. Run the backup process with a restrictive umask such as `077`. 6. Document that backup archives contain sensitive information and must not be placed in shared, network-mounted, or world-accessible directories without appropriate encryption and access controls. ]]>
