T09 · Insecure Skill Coding Practices
- Location
SKILL.md:95- Finding
Credential files are created without enforced restrictive permissions
- Content
View full analysis
"$HOME/.bria/credentials" echo "AUTHENTICATED" break ``` The API token is subsequently written through another temporary credential file: ```bash grep -v '^api_token=' "$HOME/.bria/credentials" > "$HOME/.bria/credentials.tmp" 2>/dev/null || true printf 'api_token=%s\n' "$BRIA_API_KEY" >> "$HOME/.bria/credentials.tmp" mv "$HOME/.bria/credentials.tmp" "$HOME/.bria/credentials" ``` ### Technical Analysis The authentication flow stores an access token, refresh token, and API token in `~/.bria/credentials`, but it does not enforce restrictive permissions on either the directory or the files. The resulting permissions depend on the caller's current `umask`. On a system with a permissive `umask`, another local user may be able to read these reusable credentials. The intermediate `credentials.tmp` file has the same issue and may temporarily expose the API token during an update. The code also does not verify that the credential directory and existing files are owned by the current user and are not symbolic links. Credential storage is necessary for the declared Bria API functionality, but storing credentials without explicit access controls exceeds the minimum safe privilege boundary. ### Attack Path 1. A user runs the documented Bria device-authentication flow under a permissive `umask`. 2. The Skill creates `~/.bria/credentials` or `~/.bria/credentials.tmp` without explicitly setting mode `0600`. 3. Another local account inspects the file while it exists. 4. The attacker extracts the access token, refresh token, or Bria API token. 5. The attacker submits requests to Bria using the victim's credentials. ### Impact Assessment A successful exploit c ...[truncated 343 chars]- Remediation
View remediation
