T09 · Insecure Skill Coding Practices
- Location
SKILL.md:79- Finding
Arbitrary Command Execution Through Shell-Sourced Environment File
- Content
View full analysis
Vulnerability Details
File Location:
SKILL.md, lines 79–81
Vulnerability Type: Unsafe execution of an environment file as shell code
Risk Level: HighComplete Code Snippet:
bash ( set -a; [ -f .env.local ] && . ./.env.local; set +a; curl -sS -H "Authorization: Bearer $SERVICEGRAPH_API_KEY" \ 'https://api.servicegraph.co/v1/datasets/pro_services/fields' )Technical Analysis
The documented authentication flow sources
.env.localwith the shell.command. Sourcing does not merely parse environment-variable assignments: it executes the entire file as shell code in the current subshell. Consequently, command substitutions, function invocations, redirections, and arbitrary commands present in.env.localexecute with the privileges of the user running the Agent.Although the subshell limits environment changes from propagating to the parent shell, it does not prevent filesystem modification, network access, process execution, credential theft, or other side effects. The behavior exceeds the minimum privilege required to retrieve
SERVICEGRAPH_API_KEY; only one configuration value needs to be read.The bearer-token transmission at lines 80–81 is otherwise consistent with the Skill's declared ServiceGraph integration: it sends the required credential over HTTPS to the documented
api.servicegraph.coendpoint. The audit found no evidence of covert exfiltration in that request.Attack Path
- An attacker or compromised project dependency creates or modifies
.env.localin the Agent's working directory. - The file includes a valid-looking key assignment and attacker-controlled shell commands, for example:
bash SERVICEGRAPH_API_KEY=vk_example malicious_command - A user invokes the Skill to search for or enrich a law firm.
- The Agent follows the documented REST authentication recipe.
- The shell evaluates
. ./.env.local, executing `malicious_com ...[truncated 763 chars]
- An attacker or compromised project dependency creates or modifies
- Remediation
View remediation
Remediation Suggestions
- Do not source
.env.localor any project-controlled configuration file as shell code. - Use a non-executing dotenv parser that reads only
SERVICEGRAPH_API_KEY. - Reject duplicate keys, malformed lines, command substitutions, shell expansions, and unexpected variables.
- Validate the extracted value against the ServiceGraph key format, including the expected
vk_prefix and a conservative character/length allowlist. - Pass the parsed value directly to the HTTP client without using
evalor constructing an executable shell command. - Preserve the existing guidance not to place the token in the LLM context or command output.
- Restrict
.env.localpermissions to the owning user and ensure it is excluded from version control. - Prefer the documented OAuth-enabled ServiceGraph MCP integration when available, because it keeps credentials inside the harness sandbox.
- Do not source
