T09 · Insecure Skill Coding Practices
Warning
- Location
- SKILL.md:92
- Finding
- Overbroad and Executable Environment File Loading## Vulnerability Details **File Location**: `SKILL.md`, line 92 **Vulnerability Type**: Unsafe shell evaluation of a credential configuration file **Risk Level**: Medium **Vulnerable Code**: ```bash source ~/clawd/.env ``` ### Technical Analysis The Skill requires only `COMFY_DEPLOY_API_KEY`, but the documented command uses the shell `source` built-in to evaluate the entire `~/clawd/.env` file as executable shell code. An `.env` file is therefore not treated merely as configuration: command substitutions, shell functions, redirections, and arbitrary commands in that file execute with the invoking user's privileges. This behavior exceeds the minimum privilege required for the declared functionality. The API key should either already be provided through the process environment or be read from a narrowly scoped configuration source without evaluating it. Sourcing the complete file also imports unrelated variables and secrets into the Skill's process environment. ### Attack Path 1. An attacker, compromised process, or untrusted installer obtains write access to `~/clawd/.env`. 2. The attacker inserts shell commands or command substitutions into the file. 3. A user follows the Skill's upload procedure. 4. The shell executes `source ~/clawd/.env`. 5. The injected commands run before the legitimate ComfyDeploy requests and inherit the permissions and accessible environment of the Agent user. Exploitation requires the attacker to gain write access to the referenced environment file or influence its contents. The Skill does not itself grant that access, but it turns a configuration-file compromise into a command-execution path. ### Impact Assessment Successful exploitation permits arbitrary command execution under the account invoking the Skill. The attacker could read or alter files accessible to that account, access environment variables and credentials, make network requests, or tamper with generated outputs. The issue do ...[truncated 404 chars]
- Remediation
- ## Remediation Suggestions - Remove `source ~/clawd/.env` from the documented workflow. - Prefer requiring `COMFY_DEPLOY_API_KEY` to be supplied through the process environment or a dedicated secret manager. - If file-based configuration is unavoidable, use a parser that treats the file strictly as data and retrieves only the exact `COMFY_DEPLOY_API_KEY` field. Do not use `source`, `eval`, or command substitution. - Store the credential in a dedicated file with restrictive permissions, such as mode `0600`, rather than a shared environment file containing unrelated secrets. - Validate that the key exists before issuing requests without printing its value: ```bash : "${COMFY_DEPLOY_API_KEY:?COMFY_DEPLOY_API_KEY is required}" ``` - Avoid enabling shell tracing while handling the key, and do not include the authorization header in diagnostic output. - Document that user-provided images are uploaded to ComfyDeploy so users can make an informed decision before transmitting potentially personal media.
