T01 · Skill Instruction Hijacking
- Location
scripts/skill_runner.py:185- Finding
Global Confirmation Bypass for Privileged Skill Execution
- Content
View full analysis
- Remediation
View remediation
Security audit
Security checks for vulnerabilities and agentic risk
This skill is a disclosed HTTP gateway for local agent skills, but its defaults and management paths can expose powerful local actions too broadly.
Install only in a controlled environment. Before running it, bind the main service and console to 127.0.0.1 unless you truly need network access, set a strong API key, enable HTTPS for cross-host use, replace expose_skills ["*"] with an explicit allowlist, deny side-effecting skills, avoid the full-auto Codex path for untrusted callers, and do not enable speed mode or doctor fixes through a remotely reachable unauthenticated console.
scripts/skill_runner.py:185Global Confirmation Bypass for Privileged Skill Execution
scripts/console.py:271Management Console Authentication Fails Open When No API Key Is Configured
scripts/speed_mode.py:128Unauthenticated Console Access Can Install Persistent OpenClaw Agent State
scripts/server.py:97Request-Body Size Limit Can Be Bypassed by Omitting Content-Length
The declared description is about serving skills over HTTP(S) through a persistent FastAPI-based API platform with endpoint generation, callbacks, execution engines, and a web UI. The actual code chunk does none of that. Instead, it is a standalone utility for detecting whether a skill requires 'full' or 'light' context based on signals in SKILL.md, and then storing that classification in JSON metadata files. This is a materially different purpose and introduces an undeclared capability: local metadata inspection and annotation of skills. While this code could theoretically be a supporting internal component of a larger project, evaluated on its own it does not match the declared primary behavior.
The declared purpose centers on serving Skills over HTTP(S) via a persistent FastAPI server with API endpoint generation, remote invocation, webhook support, and management UI. The supplied code chunk does something materially different: it performs offline dependency analysis of skills and persists scan results locally. While dependency scanning could be a supporting internal feature of a larger skill-to-HTTP system, this chunk itself does not exhibit the core declared behaviors (no HTTP server, no endpoint creation, no request handling, no HTTPS/certificate logic, no console, no sub-agent execution). Therefore the description does not accurately represent what this code chunk actually does.
This code chunk does not implement the declared main behavior of exposing Skills over HTTP(S) via a persistent FastAPI server. Instead, it performs a narrower, different function: generating parameter schemas from SKILL.md, including making an outbound HTTP request to a configured LLM endpoint for extraction. While params generation could be a supporting component of a larger skill-to-HTTP system, the supplied chunk’s direct behavior is materially different from the declared purpose and lacks the core advertised capabilities such as API serving, endpoint generation, webhooks, executor orchestration, or web console functionality.
Referenced artifact was not completely inspected
python3 scripts/server.py restart # 3. 重启
Referenced artifact was not completely inspected
python3 scripts/server.py restart # 3. 重启
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).
# curl
curl --cacert <HTTP_ROOT>/certs/server.crt https://10.40.x.x:8080/health
# Python requests
The one-liner chains certbot renewal, certificate import, and service restart inside a quoted string piped into sudo crontab, creating a brittle privileged automation path. Chained root-level shell commands increase the chance of command injection through later editing, quoting errors, or environment/path confusion, and they make failures harder to audit safely.
# cron 每天检查一次(certbot 自动跳过未到期的)
echo "0 3 * * * certbot renew --quiet --post-hook 'cd /path/to/skill-to-http/scripts && python3 server.py cert --cert-action import --cert-src /etc/letsencrypt/live/api.yourdomain.com/fullchain.pem --key-src /etc/letsencrypt/live/api.yourdomain.com/privkey.pem && python3 server.py restart'" | sudo crontab -
Package name closely resembles a popular package, suggesting possible typosquatting. Attackers publish malicious packages with similar names to trick developers into installing them.
Code enumerates, copies, or searches environment variables for secrets. Bulk environment access can collect credentials unrelated to the skill's stated purpose.
if executor:
cmd.extend(["--executor", executor])
# API Key 通过环境变量传递(--api-key 命令行会在进程列表中泄漏)
child_env = dict(os.environ)
api_key = config.get("api_key", "")
if api_key:
child_env["SKILL_HTTP_API_KEY"] = api_key
Code enumerates, copies, or searches environment variables for secrets. Bulk environment access can collect credentials unrelated to the skill's stated purpose.
if executor:
cmd.extend(["--executor", executor])
# API Key 通过环境变量传递(--api-key 命令行会在进程列表中泄漏)
child_env = dict(os.environ)
api_key = config.get("api_key", "")
if api_key:
child_env["SKILL_HTTP_API_KEY"] = api_key
Hidden instructions were detected in comments or invisible text. These could contain malicious directives. Manual review is recommended.
</head>
<body x-data="appState">
<!-- Toast container -->
<div id="toast-container" class="toast-container"></div>
<!-- ── API Key 引导弹窗(首次访问 / key 失效时自动弹出)──────────── -->
Hidden instructions were detected in comments or invisible text. These could contain malicious directives. Manual review is recommended.
</head>
<body x-data="appState">
<!-- Toast container -->
<div id="toast-container" class="toast-container"></div>
<!-- ── API Key 引导弹窗(首次访问 / key 失效时自动弹出)──────────── -->
Hidden instructions were detected in comments or invisible text. These could contain malicious directives. Manual review is recommended.
</div>
</div>
<!-- 初始化进度弹窗 -->
<div x-show="initializing" x-cloak class="modal-backdrop">
<div class="modal">
<h3>⚡ 正在初始化极速模式...</h3>
This is the core dangerous primitive: attacker-influenced command text is passed into subprocess.run(..., shell=True). In this script, multiple fix commands embed file paths, config fields, and skill names into shell snippets, so a crafted value can escape quoting and execute arbitrary commands once fix mode is run.
def _run_fix(cmd: str) -> tuple[bool, str]:
"""执行修复命令,返回 (成功, 输出)。"""
try:
result = subprocess.run(
cmd, shell=True, capture_output=True, text=True, timeout=120
)
out = (result.stdout + result.stderr).strip()
This duplicate finding points to the same insecure guidance encouraging curl -k, which disables server certificate verification. For a tool whose purpose is to expose network-accessible skill APIs, recommending verification bypass undermines transport security and may train users into unsafe defaults.
print(f"证书路径:{CERT_PATH}")
print()
print("【curl】")
print(f" curl --cacert {CERT_PATH} https://your-host:port/health")
print(" # 或临时跳过验证:curl -k https://...")
print()
print("【Python requests】")
This duplicate finding points to the same insecure guidance encouraging curl -k, which disables server certificate verification. For a tool whose purpose is to expose network-accessible skill APIs, recommending verification bypass undermines transport security and may train users into unsafe defaults.
print(f"证书路径:{CERT_PATH}")
print()
print("【curl】")
print(f" curl --cacert {CERT_PATH} https://your-host:port/health")
print(" # 或临时跳过验证:curl -k https://...")
print()
print("【Python requests】")
The DELETE /history endpoint accepts a caller-supplied retention_days parameter and can erase persisted job history, which is sensitive operational and audit data for a service that remotely executes installed skills. If the service is run in its documented insecure modes (HTTP by default, API key optional, 0.0.0.0 default bind), an attacker or unauthorized internal user could destroy evidence, disrupt monitoring, or cover tracks after abusing exposed skills.
logger.warning(f"Scheduled history cleanup failed: {_ce}")
_cleanup_thr.Thread(target=_scheduled_history_cleanup, daemon=True).start()
logger.info("History endpoints registered: GET /history, GET /history/stats, GET /history/{job_id}, DELETE /history")
# ── 管理接口 ────────────────────────────────────────────────────
@app.get("/api/logs", dependencies=[Depends(auth_dep)])
Code accesses a cloud instance metadata endpoint (e.g. 169.254.169.254). A single request can return temporary IAM credentials, making this a high-value SSRF target for credential theft.
策略(内网工具的平衡取舍):
- 仅允许 http/https scheme
- 拒绝回环地址(localhost/127.x)——防止回打本机 Gateway/控制台等敏感端口
- 拒绝链路本地地址(169.254.x,含云 metadata 169.254.169.254)
- 私网地址放行(内网部署的正常回调目标)
"""
from urllib.parse import urlparse
Skill enables autonomous high-impact decisions without human-in-the-loop verification. Critical operations (destructive commands, financial transactions, data deletion) should require explicit user confirmation.
Security hardening in response to clawhub SkillSpector review (no functional change):
- **Directory permissions**: `ensure_dirs()` created the HTTP root at `0o755` despite the docstring stating `0o700`. Tightened to `0o700` in both `tls_auth.py` and `gen_cert.py` (the latter re-set the parent to `0o755`), preventing directory traversal/metadata exposure on multi-user hosts. Service runs as a single user, so no functional impact.
- **Prominent Security Notice** added to the top of `SKILL.md` and `README.md`: explains that exposing installed Skills over HTTP widens the attack surface, that `expose_skills: ["*"]` / `--expose-skill "*"` opens every Skill, that default HTTP is cleartext, and that execution is immediate without confirmation — so operators deploy with informed consent.
## v1.0.0 (open-source first release)
The skill explicitly exposes locally installed skills over HTTP(S), and those downstream skills may have shell, file, network, and credential access. However, the skill declares no restrictive tool scope or permissions boundary, so operators and reviewers have no machine-readable constraint on what capabilities are being exposed remotely.
Code issues a request to a loopback, link-local, or private-range host. This can reach internal services not meant to be exposed and is a common SSRF pivot.
SKILL_HTTP_MAX_CONCURRENT=5
EXPOSE 8080
HEALTHCHECK --interval=30s --timeout=5s
CMD python -c "import urllib.request; urllib.request.urlopen('http://localhost:8080/health')"
CMD ["python", "server.py", "--non-interactive"]
Docker image references without a specific tag (:latest is implicit) or digest (@sha256:...) can be silently replaced by a malicious image.
The example configuration defaults to exposing all installed skills via expose_skills: ["*"] and listening on 0.0.0.0, which makes remote access broadly available by default. In the context of a skill that can execute arbitrary installed skills, this significantly increases attack surface and can unintentionally publish sensitive or side-effectful capabilities to any reachable network client.
The configuration supports an executor mode that can delegate requests to external CLIs/sub-agents such as OpenClaw, Claude Code, and Codex, expanding the capability from simple HTTP wrapping to indirect code/tool execution. When combined with network exposure, this broadens the blast radius of any exposed endpoint and may let remote callers trigger powerful external tooling through the service.
Data is being sent to an external URL. This could be legitimate telemetry or data exfiltration. Manual review is recommended.
# curl
curl --cacert <HTTP_ROOT>/certs/server.crt https://10.40.x.x:8080/health
# Python requests