T09 · Insecure Skill Coding Practices
- Location
scripts/init_forge.sh:18- Finding
Arbitrary Command Execution Through Sourced Workspace Configuration
- Content
View full analysis
"$WORKSPACE/forge.env" << ENV REPO_PATH="$REPO" WORKSPACE="$WORKSPACE" TIMESTAMP="$TIMESTAMP" ENV ``` `scripts/run_forge.sh:16`: ```bash source "$WORKSPACE/forge.env" ``` ### Technical Analysis The repository path is supplied by the user through the second argument to `init_forge.sh`. It is inserted directly into `forge.env` between double quotes without shell escaping. The resulting file is later loaded with Bash's `source` command. A sourced file is executable shell code, not a passive configuration format. A repository argument containing a double quote, command substitution, newline, or additional shell statement can terminate the generated assignment and inject commands. The runner also accepts an arbitrary workspace directory and sources its `forge.env` without checking that the workspace was created by FlowForge, is owned by the current user, has safe permissions, or resides below the expected `$HOME/.forge` directory. ### Attack Path 1. An attacker convinces a user or orchestration agent to initialize a task with a crafted repository path, for example a value containing shell syntax after an embedded quote. 2. `init_forge.sh` writes that value verbatim into `forge.env`. 3. The user runs `run_forge.sh` for the generated workspace. 4. `run_forge.sh` executes `source "$WORKSPACE/forge.env"`. 5. Bash interprets the injected content as commands and executes it with the privileges of the user running FlowForge. An alternative path is to provide a pre-created workspace containing a malicious `forge.env` and invoke `run_forge.sh` directly on that workspace. ### Impact Assessment Successful exploitation provides arbitrary command execution with the invoking user's priv ...[truncated 349 chars]- Remediation
View remediation
