T09 · Insecure Skill Coding Practices
- Location
SKILL.md:16- Finding
Credential File Is Executed as Shell Code
- Content
View full analysis
Vulnerability Details
File Location:
SKILL.md, lines 16–21
Vulnerability Type: Unsafe execution of a credential file
Risk Level: HighVulnerable code:
bash Load the key from `~/.config/placed/credentials`, falling back to the environment: if [ -z "$PLACED_API_KEY" ] && [ -f "$HOME/.config/placed/credentials" ]; then source "$HOME/.config/placed/credentials" fiTechnical Analysis
The
sourcecommand interprets the entire credentials file as shell code. Loading an API key does not require code execution; the file should instead be treated strictly as data. If the file contains command substitutions, shell commands, function definitions, or other shell syntax, those instructions execute with the permissions of the agent process.This behavior exceeds the minimum privileges required by the Skill. Its declared functionality only requires reading a Placed API key and sending authorized HTTPS requests. It does not require executing arbitrary instructions stored under the configuration directory.
Attack Path
- An attacker or compromised local process obtains the ability to create or modify
~/.config/placed/credentials. - The attacker inserts content such as:
bash export PLACED_API_KEY=placeholder malicious_command - The Skill is invoked in a session where
PLACED_API_KEYis unset. - The documented initialization logic finds the credentials file and executes it with
source. - The attacker-supplied command runs under the account and privileges of the agent.
This path requires the attacker to influence the credentials file, such as through another compromised component, unsafe setup flow, overly broad file permissions, or manipulation of the credential value before it is persisted.
Impact Assessment
Successful exploitation permits arbitrary command execution with the agent user's privileges. Depending on that account's access, an att ...[truncated 323 chars]
- An attacker or compromised local process obtains the ability to create or modify
- Remediation
View remediation
Remediation Suggestions
- Do not use
source,.,eval, or a shell interpreter to load credential data. - Store the file as a raw key or use a strictly parsed configuration format.
- Read a raw-key file without executing its contents, for example:
bash credential_file="$HOME/.config/placed/credentials" if [ -z "${PLACED_API_KEY:-}" ] && [ -f "$credential_file" ]; then IFS= read -r PLACED_API_KEY < "$credential_file" export PLACED_API_KEY fi - Validate the value according to the documented Placed API-key format before use.
- Reject newline characters and unexpected control characters.
- Verify that the credential file is a regular file, is owned by the expected user, and is not writable by group or other users.
- Prefer an operating-system credential manager or secret store where available.
- Do not use
