T09 · Insecure Skill Coding Practices
Warning
- Location
- SKILL.md:19
- Finding
- Sensitive client-data directory is created without explicit permission hardening<![CDATA[ ## Vulnerability Details **File Location**: `SKILL.md`, lines 19-21 **Vulnerability Type**: Missing filesystem access-control hardening **Risk Level**: Medium ### Vulnerable Code ```bash export OPENCLAW_DATA_DIR="/data" which jq || sudo apt install jq mkdir -p $OPENCLAW_DATA_DIR/clients ``` ### Technical Analysis The setup creates the directory used to store client profiles, tax identifiers, contact information, financial records, GDPR records, and audit logs without explicitly setting restrictive ownership or permissions. The effective directory permissions therefore depend on the invoking user's current `umask`, the permissions of the parent directory, and existing filesystem state. If the environment has a permissive `umask` or `/data` is shared among users or services, unauthorized local accounts may be able to traverse or read the client-data hierarchy. The command also expands `OPENCLAW_DATA_DIR` without quotes or an end-of-options delimiter. Although the example assigns the fixed value `/data`, an externally supplied value containing whitespace or shell glob characters could cause unintended path handling if the setup command is reused without the preceding assignment. The use of `sudo apt install jq` additionally elevates package installation privileges during setup. This is not itself an escalation vulnerability because it requires an already authorized `sudo` user, but dependency installation should be separated from data-directory initialization. ### Attack Path 1. An operator initializes the skill on a multi-user system while using a permissive `umask`, or uses an existing shared `/data` directory. 2. `mkdir -p` creates `/data/clients` without an explicit restrictive mode. 3. A local low-privilege user or compromised service account examines the permissions on `/data` and `/data/clients`. 4. If directory traversal and read permissions are available, the attacker enumerates client subdirectories and reads JSON records, exports, met ...[truncated 1098 chars]
- Remediation
- <![CDATA[ ## Remediation Suggestions - Create the sensitive directory with an explicit restrictive mode and quote the path: ```bash : "${OPENCLAW_DATA_DIR:=/data}" case "$OPENCLAW_DATA_DIR" in /*) ;; *) printf '%s\n' "OPENCLAW_DATA_DIR must be an absolute path" >&2; exit 1 ;; esac umask 077 install -d -m 0700 -- "$OPENCLAW_DATA_DIR/clients" ``` - Verify that the destination is not a symbolic link and is owned by the intended OpenClaw service account. - Create client JSON files with mode `0600` and subdirectories with mode `0700`. - Run OpenClaw under a dedicated, unprivileged service account rather than a shared interactive account. - Keep dependency installation separate from runtime initialization. Administrators should install `jq` through an approved package-management process. - Add startup checks that reject group-readable or world-readable data directories and report incorrect ownership. - Apply similarly restrictive controls to export, backup, GDPR-export, and audit-log directories. ]]>
