codex-image-gen
Fail
Audited by Gen Agent Trust Hub on Oct 10, 2026
Risk Level: HIGHCOMMAND_EXECUTIONINDIRECT_PROMPT_INJECTIONDATA_EXFILTRATION
Full Analysis
- [COMMAND_EXECUTION]: The "Manual fallback" section in
SKILL.mdprovides a shell command template (printf '... <prompt>' | codex exec ...) that is inherently unsafe. Because it uses single quotes to wrap a placeholder (<prompt>) intended for user-supplied text, an attacker could provide a prompt containing a closing single quote and shell metacharacters (e.g.,'; touch /tmp/pwned; #) to execute arbitrary commands on the host system if the agent follows the instruction without manual escaping. - [INDIRECT_PROMPT_INJECTION]: The helper script
scripts/codex-image.tsis vulnerable to prompt injection because it interpolates untrusted user input directly into the session's instruction block without adequate sanitization or boundary markers. - Ingestion points: User-provided text supplied via the
--promptargument or piped tostdinofscripts/codex-image.ts. - Boundary markers: The script uses a simple
PROMPT:header but lacks any closing delimiters or escaping mechanisms to prevent the user input from breaking out of its intended context and influencing the agent's behavior. - Capability inventory: The skill can execute shell commands via the
codexCLI and has broad file system read/write access through the helper script's use ofreaddirandcopyFile. - Sanitization: No filtering or sanitization is applied to the prompt content before it is passed to the underlying model.
- [DATA_EXFILTRATION]: The logic in
scripts/codex-image.tsfor handling thethreadIdis vulnerable to a directory traversal attack. The script extracts thethread_idfrom the Codex CLI's JSON output stream and uses it to construct a file path (join(codexHome, "generated_images", threadId!)) without validation. A malicious user could use prompt injection to trick the model into outputting a fake event line containing a traversal string (e.g.,{"type": "thread.started", "thread_id": "../../../.ssh"}). Because the script updatesthreadIdwith the last matching event found in the output, the injected value would override the legitimate ID, causing the script to read from a sensitive directory and copy files (like SSH keys) to the output location designated by the user.
Recommendations
- AI detected serious security threats
Audit Metadata