T09 · Insecure Skill Coding Practices
- Location
scripts/task-dispatcher.sh:141- Finding
Shell Command Injection Through Task Prompts and Workspace Paths
- Content
View full analysis
- Remediation
View remediation
Security audit
Security checks for vulnerabilities and agentic risk
This skill is a disclosed Codex task-automation tool, but it can autonomously modify repositories, relaunch agents, send task data externally, and merge pull requests with weak safety gates.
Install only if you intentionally want an autonomous coding workflow that can write files, run Codex with broad approvals, manage tmux sessions, use GitHub credentials, and optionally send task details to messaging/webhook services. Avoid using it on sensitive repositories unless auto-merge and auto-retry are disabled or heavily supervised, tokens are tightly scoped, and prompt/workspace inputs are trusted.
scripts/task-dispatcher.sh:141Shell Command Injection Through Task Prompts and Workspace Paths
scripts/auto-merge.sh:96Automatic Merge Fails Open When CI or Review Controls Are Missing
scripts/task-execute.sh:24Path Traversal Allows Unauthorized Agent Memory Access
SKILL.md:202Unsafe Export of All Secrets from a Shared Environment File
scripts/task-monitor.sh:308Predictable Temporary File Enables Local Symlink Clobbering
scripts/task-registry.sh:120Unsafe JSON Construction and Unlocked Registry Updates
YARA rule matched a known malware signature (reverse shell, backdoor, ransomware, C2 framework, or info stealer).
#!/bin/bash
# auto-merge.sh - 自动 PR 创建、CI 检查、代码审查、自动合并
set -euo pipefail
SCRIPT_DIR="$(cd "$(dirname "$0")" && pwd)"
REGISTRY="$SCRIPT_DIR/task-registry.sh"
# 配置
GITHUB_TOKEN="${GITHUB_TOKEN:-}"
REPO_DIR="${REPO_DIR:-$HOME/projects}"
MAX_RETRIES="${MAX_RETRIES:-3}"
# 颜色
RED='\033[0;31m'
GREEN='\033[0;32m'
YELLOW='\033[1;33m'
BLUE='\033[0;34m'
NC='\033[0m'
print_msg() { echo -e "${1}${2}${NC}"; }
# 检查依赖
check_deps() {
local missing=()
if ! command -v gh &>/dev/null; then
missing+=("gh CLI")
fi
if ! command -v jq &>/dev/null; then
missing+=("jq")
fi
if [[ ${#missing[@]} -gt 0 ]]; then
print_msg "$RED" "缺少依赖: ${missing[*]}"
return 1
fi
return 0
}
#
The finding suggests additional context-reading, source copying, asynchronous external session launching, and undocumented commands beyond the stated purpose. Even where some details are inferred from surrounding docs, undocumented expansion of capability reduces transparency and can expose local project data or create unattended execution paths.
The finding suggests additional context-reading, source copying, asynchronous external session launching, and undocumented commands beyond the stated purpose. Even where some details are inferred from surrounding docs, undocumented expansion of capability reduces transparency and can expose local project data or create unattended execution paths.
The finding suggests additional context-reading, source copying, asynchronous external session launching, and undocumented commands beyond the stated purpose. Even where some details are inferred from surrounding docs, undocumented expansion of capability reduces transparency and can expose local project data or create unattended execution paths.
The finding suggests additional context-reading, source copying, asynchronous external session launching, and undocumented commands beyond the stated purpose. Even where some details are inferred from surrounding docs, undocumented expansion of capability reduces transparency and can expose local project data or create unattended execution paths.
The finding suggests additional context-reading, source copying, asynchronous external session launching, and undocumented commands beyond the stated purpose. Even where some details are inferred from surrounding docs, undocumented expansion of capability reduces transparency and can expose local project data or create unattended execution paths.
The finding suggests additional context-reading, source copying, asynchronous external session launching, and undocumented commands beyond the stated purpose. Even where some details are inferred from surrounding docs, undocumented expansion of capability reduces transparency and can expose local project data or create unattended execution paths.
The documented pattern export $(cat ~/.openclaw/.env | xargs) loads secrets from a plaintext file into the shell environment, where they may be exposed through process inspection, shell history patterns, or accidental logging by child processes. In this skill, those credentials are then used for outbound notifications, increasing the blast radius if mishandled.
# 方式一:加载环境变量后启动监控
export $(cat ~/.openclaw/.env | xargs) && codex-tasks monitor-start 60 &
# 方式二:直接指定间隔
codex-tasks monitor-start 60 &
Recommending storage of bot tokens and webhook URLs in ~/.openclaw/.env creates a plaintext secret repository without any documented file-permission or secret-management guidance. If the host is shared, backed up insecurely, or inspected by other tools, these credentials can be harvested and abused for impersonation or data exfiltration.
推荐将配置写入 ~/.openclaw/.env:
# ~/.openclaw/.env
TELEGRAM_BOT_TOKEN="your-bot-token"
TELEGRAM_CHAT_ID="your-chat-id"
TELEGRAM_TOPIC_ID="123456" # 可选,Forum 话题 ID
Loading .env secrets directly into the process environment before starting background monitoring can expose those credentials to long-lived child processes and any subprocesses the monitor launches. Because the monitor may run continuously and interact with external services, credential lifetime and exposure are increased.
启动监控时加载:
export $(cat ~/.openclaw/.env | xargs) && codex-tasks monitor-start
The recovery path launches codex --sandbox workspace-write --full-auto exec and then injects prompt content from /tmp/codex-results/tasks/$task_id/prompt.txt into the session. This creates an autonomous execution path with write access based on potentially mutable local files and task registry data, which can be abused to execute unintended or malicious actions in the workspace.
The webhook sender posts arbitrary task messages and timestamps to any URL provided in WEBHOOK_URL, with no allowlist, confirmation, or data classification guardrails. In an agent/task-execution context, this can leak task IDs, names, outputs, and error details to attacker-controlled infrastructure if the environment variable or invocation is influenced by an untrusted party.
The script invokes acpx --approve-all codex prompt, which grants blanket approval to an autonomous code-modifying agent without any approval gate, scope restriction, or confirmation. In this skill context, the tool is explicitly used to change project files, so a malicious task description or poisoned project context can cause unintended file modification, dependency installation, secret access, or destructive actions with the user's permissions.
The skill documents shell-capable behavior but declares no explicit tool scope or permission boundary. That makes repository mutation, process control, filesystem writes, and network-capable helper scripts possible without clear least-privilege constraints, increasing the chance of unsafe execution in agent environments.
The documentation advertises automatic PR merge without a prominent warning that it changes repository state and may integrate unreviewed code. In an agent skill context, this is risky because automation may merge generated changes into protected or production-bound branches with minimal oversight.
The skill instructs users to store bot tokens and webhooks and send notifications externally, but it does not warn about credential sensitivity, secret storage hygiene, or outbound data exposure. This can lead to accidental token leakage, misuse of webhooks, or disclosure of task and repository metadata to third parties.
The skill exposes a wide set of generic command triggers such as execute, start, stop, monitor, and report without any visible scoping, confirmation requirements, or activation constraints. In an automation/task-execution skill, broad triggers increase the chance of unintended invocation, command collision with other skills, or misuse of powerful task-control behaviors through ambiguous user input.
The script’s implemented behavior materially exceeds the stated skill scope by creating, merging, and deleting GitHub branches and pull requests. In an agent skill context, capability mismatch is dangerous because operators may authorize a seemingly simple task-monitoring tool that can actually perform destructive repository actions.
The code review function reports success even though it performs no substantive review and merely marks review status as pending in the registry. This can create a false assurance gate before automatic merge, allowing unsafe or malicious code to be merged without actual review.
The script performs gh pr merge --squash --delete-branch without confirmation, approval validation, or a safety interlock. In an automated agent workflow, this can directly cause unintended merges, loss of branch history, and production-impacting code changes if triggered on the wrong PR or repository.
The script transmits task completion data to Telegram and consumes Telegram bot credentials even though that external notification capability is not clearly justified by the declared skill purpose. Hidden or under-disclosed outbound communication increases the risk of unintended data leakage from agent execution contexts.
The hardcoded Telegram API endpoint confirms that the script communicates with an external third-party service. In the context of a repository automation skill, that outbound path expands the attack surface and creates a potential leakage channel for internal workflow information.
# 发送消息
local response
response=$(curl -s -X POST "https://api.telegram.org/bot$tg_token/sendMessage" \
-d "chat_id=$tg_chat_id" \
-d "text=$message" \
-d "parse_mode=Markdown" 2>&1)
The hardcoded Telegram API endpoint confirms that the script communicates with an external third-party service. In the context of a repository automation skill, that outbound path expands the attack surface and creates a potential leakage channel for internal workflow information.
# 发送消息
local response
response=$(curl -s -X POST "https://api.telegram.org/bot$tg_token/sendMessage" \
-d "chat_id=$tg_chat_id" \
-d "text=$message" \
-d "parse_mode=Markdown" 2>&1)
Task data is sent to an external Telegram service without clear user-facing disclosure in the main workflow, which can leak internal task names, statuses, and PR references outside the local environment. In agent skills, undisclosed network transmission is especially risky because it may occur automatically after repository operations.
The header advertises periodic checking and Telegram reporting, but the implementation also changes task state and restarts execution sessions. This mismatch is security-relevant because reviewers or operators may grant trust or permissions appropriate for passive monitoring while the script actually performs active control-plane actions.
No suspicious patterns detected.