T01 · Skill Instruction Hijacking
- Location
scripts/search.sh:54- Finding
Prompt Injection into a Full-Auto Codex Agent
- Content
View full analysis
&1 | tee "${RESULT_DIR}/task-output.txt" ``` ### Technical Analysis The caller-controlled `PROMPT` value is interpolated directly into the instruction sent to Codex. There is no strong separation between trusted instructions and untrusted query content. Consequently, text supplied as a research query can contain additional instructions asking the nested agent to disregard the intended research task and perform unrelated actions. This risk is amplified by the following execution settings: - `--full-auto` allows the nested agent to perform tool actions without interactive approval. - `--sandbox workspace-write` gives the nested agent write access within the effective workspace. - The query is inserted as ordinary instruction text rather than being passed through a dedicated data channel or enclosed in a clearly defined, non-executable data boundary. Shell metacharacters in `PROMPT` are not directly evaluated by the outer Bash shell because the final instruction is passed as a quoted argument. The vul ...[truncated 1736 chars]- Remediation
View remediation
... ``` 3. Prefer a structured input mechanism supported by Codex that separates system instructions from user-supplied data. 4. Avoid `--full-auto` when processing prompts from untrusted users. Require approval for command execution and filesystem access. 5. Use a read-only sandbox for research tasks unless file writes are strictly required. 6. If writes are necessary, grant access only to a newly created, task-specific output directory. 7. Prevent the agent from accessing credentials, configuration files, source repositories, or unrelated workspace content. 8. Apply output filtering before forwarding report content to Telegram or other external services. 9. Document the nested-agent prompt-injection risk and restrict who may invoke this script. ]]>
