T09 · Insecure Skill Coding Practices
Warning
- Location
- scripts/add-transactions.sh:5
- Finding
- Sensitive Financial Records Created Without Restrictive Permissions<![CDATA[ ## Vulnerability Details **File Location**: `scripts/add-transactions.sh`, lines 5–13 **Vulnerability Type**: Sensitive data exposure through insecure filesystem permissions **Risk Level**: Medium ### Vulnerable Code ```bash FINANCE_DIR="${HOME}/.openclaw/workspace/finance" STORE="${FINANCE_DIR}/transactions.json" SOURCE="${1:-manual}" mkdir -p "$FINANCE_DIR/statements" # Initialize store if doesn't exist if [ ! -f "$STORE" ]; then echo '{"transactions":[],"accounts":[]}' > "$STORE" fi ``` ### Technical Analysis The script stores transaction dates, merchant names, monetary amounts, categories, source documents, and account metadata in a local JSON file. It does not establish a restrictive `umask` or explicitly set permissions on the finance directories and transaction file. Consequently, permissions depend entirely on the invoking process's environment. With a common `umask` of `022`, directories can be created as `0755` and the transaction file as `0644`. This may permit other local users to traverse the finance directories and read the financial records. The script also does not verify that existing storage paths are owned by the current user or that they are not symbolic links. ### Attack Path 1. A user invokes `add-transactions.sh` to import financial transactions. 2. The script creates the finance directories and `transactions.json` using the caller's default `umask`. 3. The resulting file is created with permissions that may allow access by other local users. 4. Another local account or process reads `~/.openclaw/workspace/finance/transactions.json`. 5. The attacker obtains the user's transaction history and any stored account metadata. ### Impact Assessment A local attacker may disclose sensitive financial information, including spending amounts, merchants, dates, categories, statement source names, and account details. The issue does not directly grant elevated system privileges, but it compromises the confidentiality of all fin ...[truncated 190 chars]
- Remediation
- <![CDATA[ ## Remediation Suggestions 1. Set a restrictive process mask before creating any finance data: ```bash umask 077 ``` 2. Explicitly create storage directories with owner-only permissions: ```bash mkdir -p -m 700 "$FINANCE_DIR" mkdir -p -m 700 "$FINANCE_DIR/statements" ``` 3. Create the transaction file with mode `0600`, and correct permissions on existing files: ```bash if [ ! -e "$STORE" ]; then printf '%s\n' '{"transactions":[],"accounts":[]}' > "$STORE" fi chmod 600 "$STORE" ``` 4. Before reading or replacing existing paths, verify that they: - Are owned by the effective user. - Are regular files or directories of the expected type. - Are not symbolic links. - Are not writable by group or other users. 5. Fail securely if the ownership or permissions do not meet these requirements. ]]>
