T09 · Insecure Skill Coding Practices
- Location
scripts/apollo-config.sh:7- Finding
Executable Configuration File Allows Arbitrary Shell Command Execution
- Content
View full analysis
Vulnerability Details
File Location:
scripts/apollo-config.sh, lines 7–12
Vulnerability Type: Unsafe shell configuration loading
Risk Level: HighVulnerable Code:
bash CONFIG_FILE="/Users/jhumanj/clawd/config/apollo.env" if [ -f "$CONFIG_FILE" ]; then # shellcheck disable=SC1090 source "$CONFIG_FILE" fiTechnical Analysis
The script loads
apollo.envwith Bash'ssourcebuilt-in. Although the file is presented as an environment configuration file,sourceinterprets its entire contents as executable shell code. Command substitutions, function declarations, commands, redirections, and other shell constructs in the file therefore execute with the privileges of the user invoking any Apollo helper.The configuration path is also a fixed, developer-specific absolute path. This conflicts with the documentation in
SKILL.md, which tells users to createconfig/apollo.env, and may cause the script to load an unexpected file outside the project directory.Attack Path
- An attacker obtains write access to
/Users/jhumanj/clawd/config/apollo.env, replaces it, or causes a malicious file to exist at that fixed path. - The attacker inserts executable shell content, such as a command substitution or an ordinary shell command.
- The user invokes
apollo-get.shorapollo-post.sh. - The helper sources
apollo-config.sh. apollo-config.shsources the attacker-controlled environment file.- The injected commands execute as the invoking user before the Apollo request is made.
Impact Assessment
Successful exploitation provides arbitrary command execution under the invoking user's account. The attacker could read or modify files accessible to that user, steal environment variables and API credentials, alter project content, or execute additional local programs. This code does not itself elevate privileges, so the scope remains bounded by the user's existing permissions ...[truncated 1 chars]
- An attacker obtains write access to
- Remediation
View remediation
Remediation Suggestions
- Do not use
sourceto parse a data-only configuration file. - Resolve the configuration file relative to the project directory, or accept an explicit path from a trusted invocation parameter.
- Parse only an allowlist of keys, such as
APOLLO_BASE_URLandAPOLLO_API_KEY, using a non-executing parser. - Reject shell metacharacters, command substitutions, unknown keys, malformed records, duplicate keys, and multiline values.
- Verify that the file is a regular file, is owned by the expected user, and is not group- or world-writable.
- Recommend restrictive permissions such as
0600. - Prefer process environment variables or a dedicated secrets manager where available.
- Do not use
