T01 · Skill Instruction Hijacking
- Location
hooks/on_complete.py:93- Finding
Untrusted Codex Output Is Injected into a Privileged Agent Instruction
- Content
View full analysis
- Remediation
View remediation
Security audit
Security checks for vulnerabilities and agentic risk
This skill is coherent but should be reviewed carefully because it installs persistent Codex/OpenClaw automation that can forward task output externally and act on approval prompts.
Install only if you are comfortable granting OpenClaw/Codex persistent automation over coding sessions. Use a pinned reviewed commit, avoid sensitive repositories unless notifications are redacted or disabled, keep approval decisions human-controlled for risky commands, and reconsider the 100-year session setting.
hooks/on_complete.py:93Untrusted Codex Output Is Injected into a Privileged Agent Instruction
hooks/pane_monitor.sh:38Terminal Output Can Spoof a Codex Approval Request
hooks/on_complete.py:93Codex Output and Command Details Are Automatically Sent to External Messaging Services
INSTALL.md:86Installation Guidance Effectively Disables OpenClaw Session Expiration
INSTALL.md:16Executable Hook Is Installed from an Unpinned Mutable Repository
Skill selects an external model or provider that may use a different account or billing plan than the operator expects. Undisclosed model switches can cause unexpected cost or quota consumption.
cd /tmp && mkdir -p codex-test && cd codex-test && git init codex exec "say hello"
The declared purpose is Codex project management via tmux, but the content also instructs external notification, agent wake-up, hook handling, and forwarding task context like cwd and assistant summaries to Telegram/OpenClaw channels. This hidden expansion of behavior is dangerous because users may authorize the skill for local orchestration while it also performs external communication and automation outside the stated trust boundary.
The skill instructs modifying ~/.codex/config.toml to register a notify hook, which grants code in on_complete.py execution on every Codex turn. Touching a user-level agent config in the home directory creates a persistent execution foothold and can affect all future Codex sessions, not just this project.
### on_complete.py(notify hook)
**配置**:`~/.codex/config.toml` → `notify = ["python3", "<path>/on_complete.py"]`
**触发**:Codex 每次完成一个 turn
Skill selects an external model or provider that may use a different account or billing plan than the operator expects. Undisclosed model switches can cause unexpected cost or quota consumption.
codex exec --full-auto "<prompt>"
codex exec --full-auto -m gpt-5.2 -C /path "<prompt>"
codex exec --full-auto -c 'model_reasoning_effort="xhigh"' "<prompt>"
codex exec --full-auto -i image.png "<prompt>"
Skill selects an external model or provider that may use a different account or billing plan than the operator expects. Undisclosed model switches can cause unexpected cost or quota consumption.
codex exec --full-auto "<prompt>"
codex exec --full-auto -m gpt-5.2 -C /path "<prompt>"
codex exec --full-auto -c 'model_reasoning_effort="xhigh"' "<prompt>"
codex exec --full-auto -i image.png "<prompt>"
Skill selects an external model or provider that may use a different account or billing plan than the operator expects. Undisclosed model switches can cause unexpected cost or quota consumption.
codex exec --full-auto "<prompt>"
codex exec --full-auto -m gpt-5.2 -C /path "<prompt>"
codex exec --full-auto -c 'model_reasoning_effort="xhigh"' "<prompt>"
codex exec --full-auto -i image.png "<prompt>"
Allowing image attachment means local files can be transmitted to the external model provider, which raises a concrete data-exfiltration risk if screenshots contain secrets, customer data, tokens, or internal UI state. In the context of an automation skill that emphasizes autonomous execution, accidental attachment of sensitive images becomes more dangerous.
codex exec --full-auto "" codex exec --full-auto -m gpt-5.2 -C /path "" codex exec --full-auto -c 'model_reasoning_effort="xhigh"' "" codex exec --full-auto -i image.png ""
### 代码审查
The preflight checklist normalizes persistent edits to ~/.codex/config.toml and related environment setup, encouraging users to enable global hooks and notification behavior. This expands the blast radius from a single task to all Codex usage and could enable unintended persistence or ongoing data leakage.
首次使用前确认:
- [ ] `~/.codex/config.toml` 中已添加 `notify = ["python3", "<path>/on_complete.py"]`
- [ ] 环境变量 `CODEX_AGENT_CHAT_ID` 已设置(或已修改脚本中的默认值)
- [ ] 环境变量 `CODEX_AGENT_NAME` 已设置(默认 `main`,通常不需要改)
- [ ] `codex --version` 可用
Tool parameters are crafted to achieve unintended or unsafe behavior. Parameter abuse can bypass intended safety checks (e.g. shell=True, --force, dangerous glob patterns).
fi
# 清理日志(可选,取消注释启用)
# rm -f "/tmp/codex_monitor_${SESSION}.log"
Skill selects an external model or provider that may use a different account or billing plan than the operator expects. Undisclosed model switches can cause unexpected cost or quota consumption.
codex features list # 全部 feature flags + 成熟度 + 状态 codex --help # CLI 参数 codex mcp list # 已配置的 MCP servers(在交互模式下用 /mcp) codex exec --help # exec 模式参数 codex review --help # review 模式参数
Skill reads from agent configuration directories (.claude/, .codex/, .gemini/). These directories may contain API keys, personal settings, and other credentials that the skill has no legitimate need to access.
## Feature Flags
通过 `codex features list` 获取,`~/.codex/config.toml` 的 `[features]` 中开关。
### ✅ Stable(稳定,可放心使用)
Skill reads from agent configuration directories (.claude/, .codex/, .gemini/). These directories may contain API keys, personal settings, and other credentials that the skill has no legitimate need to access.
## Feature Flags
通过 `codex features list` 获取,`~/.codex/config.toml` 的 `[features]` 中开关。
### ✅ Stable(稳定,可放心使用)
Skill reads from agent configuration directories (.claude/, .codex/, .gemini/). These directories may contain API keys, personal settings, and other credentials that the skill has no legitimate need to access.
## Feature Flags
通过 `codex features list` 获取,`~/.codex/config.toml` 的 `[features]` 中开关。
### ✅ Stable(稳定,可放心使用)
Skill reads from agent configuration directories (.claude/, .codex/, .gemini/). These directories may contain API keys, personal settings, and other credentials that the skill has no legitimate need to access.
## Feature Flags
通过 `codex features list` 获取,`~/.codex/config.toml` 的 `[features]` 中开关。
### ✅ Stable(稳定,可放心使用)
Skill reads from agent configuration directories (.claude/, .codex/, .gemini/). These directories may contain API keys, personal settings, and other credentials that the skill has no legitimate need to access.
## Feature Flags
通过 `codex features list` 获取,`~/.codex/config.toml` 的 `[features]` 中开关。
### ✅ Stable(稳定,可放心使用)
Skill selects an external model or provider that may use a different account or billing plan than the operator expects. Undisclosed model switches can cause unexpected cost or quota consumption.
# 标准全自动执行
codex exec --full-auto "任务描述"
# 指定模型
codex exec --full-auto -m gpt-5.2 "任务描述"
Skill selects an external model or provider that may use a different account or billing plan than the operator expects. Undisclosed model switches can cause unexpected cost or quota consumption.
codex exec --full-auto "任务描述"
# 指定模型
codex exec --full-auto -m gpt-5.2 "任务描述"
# 指定工作目录
codex exec --full-auto -C /path/to/project "任务描述"
Skill selects an external model or provider that may use a different account or billing plan than the operator expects. Undisclosed model switches can cause unexpected cost or quota consumption.
codex exec --full-auto -m gpt-5.2 "任务描述"
# 指定工作目录
codex exec --full-auto -C /path/to/project "任务描述"
# 运行时覆盖配置
codex exec --full-auto -c 'model_reasoning_effort="xhigh"' "任务描述"
Skill selects an external model or provider that may use a different account or billing plan than the operator expects. Undisclosed model switches can cause unexpected cost or quota consumption.
codex exec --full-auto -C /path/to/project "任务描述"
# 运行时覆盖配置
codex exec --full-auto -c 'model_reasoning_effort="xhigh"' "任务描述"
# 附带图片
codex exec --full-auto -i screenshot.png "根据截图修复 UI"
Skill selects an external model or provider that may use a different account or billing plan than the operator expects. Undisclosed model switches can cause unexpected cost or quota consumption.
codex exec --full-auto -c 'model_reasoning_effort="xhigh"' "任务描述"
codex exec --full-auto -i screenshot.png "根据截图修复 UI"
Skill selects an external model or provider that may use a different account or billing plan than the operator expects. Undisclosed model switches can cause unexpected cost or quota consumption.
非交互执行,完成后退出。
codex exec [OPTIONS] [PROMPT]
额外选项:
Skill selects an external model or provider that may use a different account or billing plan than the operator expects. Undisclosed model switches can cause unexpected cost or quota consumption.
codex --version > /tmp/codex_version.txt codex features list > /tmp/codex_features.txt codex --help > /tmp/codex_help.txt codex exec --help > /tmp/codex_exec_help.txt cat ~/.codex/config.toml
Referencing ~/.codex/config.toml in the workflow authorizes inspection of a sensitive agent config path without guardrails. Because the surrounding workflow also fetches remote data and updates knowledge artifacts, the local configuration could be unintentionally incorporated into notes or prompts, amplifying exposure beyond the local machine.
codex features list > /tmp/codex_features.txt codex --help > /tmp/codex_help.txt codex exec --help > /tmp/codex_exec_help.txt cat ~/.codex/config.toml
### Step 2: 拉取远程数据
Referencing ~/.codex/config.toml in the workflow authorizes inspection of a sensitive agent config path without guardrails. Because the surrounding workflow also fetches remote data and updates knowledge artifacts, the local configuration could be unintentionally incorporated into notes or prompts, amplifying exposure beyond the local machine.
codex features list > /tmp/codex_features.txt codex --help > /tmp/codex_help.txt codex exec --help > /tmp/codex_exec_help.txt cat ~/.codex/config.toml
### Step 2: 拉取远程数据
Skill enumerates or reads other installed skills. Access to other skills' SKILL.md files or the skills directory reveals prompt instructions, capabilities, and secrets that should be invisible to peer skills.
验证 skill 被识别:
ls ~/.openclaw/workspace/skills/codex-agent/SKILL.md
# 应该存在
No suspicious patterns detected.