T09 · Insecure Skill Coding Practices
Error
- Location
- scripts/trigger_call.sh:12
- Finding
- Arbitrary Command Execution Through Sourced Environment File## Vulnerability Details **File Location**: `scripts/trigger_call.sh`, lines 12-17 **Vulnerability Type**: Unsafe execution of configuration data **Risk Level**: High **Vulnerable Code**: ```bash ROOT="$(cd "$(dirname "${BASH_SOURCE[0]}")/../../../" && pwd)" ENV_FILE="${ENV_FILE:-$ROOT/.env.elevenlabs-call}" if [[ -f "$ENV_FILE" ]]; then # shellcheck disable=SC1090 set -a; source "$ENV_FILE"; set +a fi ``` ### Technical Analysis The script loads the selected environment file with the Bash `source` built-in. `source` does not treat the file as passive key-value configuration; it interprets every line as shell code in the current process. The `ENV_FILE` path can be supplied through an environment variable. Consequently, anyone able to influence that variable or modify the default `.env.elevenlabs-call` file can introduce command substitutions, function calls, redirections, or arbitrary shell commands. These commands execute with the permissions of the user or agent running the skill. This is a configuration-to-code injection vulnerability. The use of `set -a` does not mitigate the issue because it only controls automatic variable export. ### Attack Path 1. An attacker creates or modifies an environment file accessible to the victim. 2. The file contains apparently valid configuration followed by a malicious shell command. 3. The attacker causes `ENV_FILE` to reference that file, or replaces the default workspace configuration file. 4. A user or agent invokes `scripts/trigger_call.sh`. 5. Bash evaluates the file through `source`. 6. The malicious command executes before the outbound API request is made. Exploitation requires control over the selected configuration file, the `ENV_FILE` environment variable, or the default workspace configuration. ### Impact Assessment Successful exploitation provides arbitrary command execution with the privileges of the account running the skill. An attacke ...[truncated 333 chars]
- Remediation
- ## Remediation Suggestions - Do not load configuration files with `source`, `.`, or `eval`. - Parse the file as data using a non-executing dotenv parser. - Accept only an explicit allowlist of keys: - `ELEVENLABS_API_KEY` - `ELEVENLABS_AGENT_ID` - `ELEVENLABS_OUTBOUND_PHONE_ID` - `TO_NUMBER` - Reject command substitutions, shell metacharacters, malformed assignments, duplicate keys, and unexpected variables. - Resolve the configuration file to an approved path rather than accepting an unrestricted caller-provided `ENV_FILE`. - Verify that the file is a regular file owned by the expected user and is not writable by other users. - Require restrictive permissions such as `0600`. - Validate each parsed value before using it, including strict E.164 validation for `TO_NUMBER`.
