T09 · Insecure Skill Coding Practices
- Location
scripts/facts_sql.sh:8- Finding
Executable Shell Configuration Enables Command Execution
- Content
View full analysis
&2 exit 1 fi set -a # shellcheck disable=SC1090 source "$ENV_FILE" ``` `scripts/state_kv.sh:19-24`: ```bash ENV_FILE="${MEMORY_STACK_ENV:-$STACK_ROOT/.env}" if [[ -f "$ENV_FILE" ]]; then set -a # shellcheck disable=SC1090 source "$ENV_FILE" ``` `scripts/qdrant_request.sh:11-16`: ```bash ENV_FILE="${MEMORY_STACK_ENV:-$STACK_ROOT/.env}" if [[ -f "$ENV_FILE" ]]; then set -a # shellcheck disable=SC1090 source "$ENV_FILE" ``` ### Technical Analysis All three scripts load the stack configuration by using Bash's `source` command. An environment file sourced this way is executable shell code, not merely a collection of configuration values. It may contain command substitutions, function calls, redirections, or arbitrary commands. The `MEMORY_STACK_ENV` variable also permits callers to select a different file. Therefore, exploitation is possible if an attacker can modify the default `.env`, influence `MEMORY_STACK_ENV`, or otherwise cause a malicious file to be selected. Loading connection configuration is necessary for the Skill's declared functionality, but executing that configuration as shell code exceeds the minimum privilege required. The vulnerability is not evidence that the included `.env` is currently malicious. It creates a command-execution boundary that depends entirely on the integrity of an external file. ### Attack Path 1. An attacker obtains write access to the default memory-stack `.env`, or influences the environment used to launch the helper and sets `MEMORY_STACK_ENV` to an attacker-controlled ...[truncated 850 chars]- Remediation
View remediation
