Back to skill

Security audit

skill-to-http

Security checks for vulnerabilities and agentic risk

Overview

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.

Vulnerability Patterns
  • Skill Instruction HijackingAlters the agent's session goals or safety constraints when the skill loads
  • Unauthorized Access and Privilege EscalationObtains permissions beyond the task's legitimate needs
  • System PersistenceInstalls backdoors, hooks, services, or scheduled tasks that survive the run
  • Insecure Skill Coding PracticesFinds exploitable flaws such as hardcoded secrets or command injection
  • Agent Memory PoisoningWrites attacker-controlled rules into memory that affect later sessions
Findings (4)

T01 · Skill Instruction Hijacking

Error
Location
scripts/skill_runner.py:185
Finding

Global Confirmation Bypass for Privileged Skill Execution

Content
View full analysis
Remediation
View remediation

T05 · Unauthorized Access and Privilege Escalation

Error
Location
scripts/console.py:271
Finding

Management Console Authentication Fails Open When No API Key Is Configured

Content
View full analysis
None: ... uvicorn.run(create_app(), host=host, port=port, log_level="info") ``` ### Technical Analysis When an API key exists, the middleware performs a constant-time key comparison. When no key exists, however, access is controlled only if the client supplies an `Origin` header. If the header is absent, the condition `if origin and ...` evaluates to false and the request is accepted. The `Origin` header is not an authentication mechanism. It is commonly absent from requests made by command-line clients, backend scripts, scanners, and non-browser HTTP libraries. An attacker therefore does not need to spoof an allowed Origin; the attacke ...[truncated 1814 chars]
Remediation
View remediation

T06 · System Persistence

Error
Location
scripts/speed_mode.py:128
Finding

Unauthenticated Console Access Can Install Persistent OpenClaw Agent State

Content
View full analysis
None: """保存 openclaw.json 并同步到 k8s-config(双写保持持久化)。""" # 更新 lastTouchedAt 触发 Gateway 自动 reload cfg.setdefault("meta", {}) cfg["meta"]["lastTouchedAt"] = datetime.now(timezone.utc).strftime( "%Y-%m-%dT%H:%M:%S.000Z" ) OPENCLAW_CONFIG.write_text(json.dumps(cfg, ensure_ascii=False, indent=2)) # 同步到 k8s-config(Pod 重建后持久化) try: shutil.copy(str(OPENCLAW_CONFIG), str(K8S_CONFIG)) except Exception as e: logger.warning("Failed to sync to k8s-config: %s", e) ``` The setup operation creates a persistent workspace and registers an Agent: ```python # Step 1: 创建 workspace yield {"step": 1, "total": 6, "msg": "创建专用 workspace..."} try: RUNNER_WORKSPACE.mkdir(parents=True, exist_ok=True) (RUNNER_WORKSPACE / "SYSTEM.md").write_text(RUNNER_SYSTEM_MD) logger.info("Created stt-runner workspace at %s", RUNNER_WORKSPACE) yield {"step": 1, "total": 6, "msg": "workspace 创建完成 ✅"} except Exception as e: yield {"step": 1, "total": 6, "msg": f"创建 workspace 失败: {e}", "error": True} return # Step 2: 注册 agent 到 openclaw.json yield {"step": 2, "total": 6, "msg": "注册专用 Agent 到 openclaw.json..."} try: oc_cfg = _load_openclaw_config() if not _agent_exists(oc_cfg): oc_cfg.setdefault("agents", {}).setdefault("list", []).append({ "id": RUNNER_AGENT_ID, "name": "STT Runner", "workspace": str(RUNNER_WORKSPACE), "heartbeat": {"every": "0"}, "model": { " ...[truncated 3711 chars]
Remediation
View remediation

T09 · Insecure Skill Coding Practices

Warning
Location
scripts/server.py:97
Finding

Request-Body Size Limit Can Be Bypassed by Omitting Content-Length

Content
View full analysis
self.max_bytes: return JSONResponse( {"error": f"Request body too large (max {self.max_bytes} bytes)"}, status_code=413, ) return await call_next(request) ``` ### Technical Analysis The middleware enforces the configured size only when a trustworthy `Content-Length` header is present. HTTP clients can omit that header and use chunked transfer encoding. In that case, the middleware forwards the request without counting bytes read from the ASGI receive channel. A client may also provide a malformed nonnumeric `Content-Length`, causing `int(content_length)` to raise an exception rather than returning a controlled client error. Because downstream request-model parsing may buffer and decode the body, an attacker can send a payload substantially larger than the advertised one-megabyte default. Repeated oversized requests can consume memory, CPU, event-loop capacity, and worker time. ### Attack Path 1. The attacker connects to an exposed main service endpoint. 2. The attacker sends a POST request using `Transfer-Encoding: chunked` and omits `Content-Length`. 3. `LimitRequestSizeMiddleware` sees no length and calls the downstream application. 4. The attacker streams a body larger than `max_request_size_mb`. 5. FastAPI or Starlette reads and parses the oversized JSON body. 6. The attacker repeats the operation concurrently to ...[truncated 748 chars]
Remediation
View remediation
Vulnerability Patterns
  • Prompt InjectionInstruction Override, Hidden Instructions, Exfiltration Commands
  • Data ExfiltrationExternal Transmission, Env Variable Harvesting, File System Enumeration
  • Supply ChainUnpinned Dependencies, External Script Fetching, Obfuscated Code
  • Excessive AgencyUnrestricted Tool Access, Autonomous Decision Making, Scope Creep
  • Tool MisuseTool Parameter Abuse, Chaining Abuse, Unsafe Defaults
Findings (131)

Tp4

High
Category
MCP Tool Poisoning
Confidence
99% confidence
Finding

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.

Content

No source excerpt is available for this finding.

Tp4

High
Category
MCP Tool Poisoning
Confidence
97% confidence
Finding

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.

Content

No source excerpt is available for this finding.

Tp4

High
Category
MCP Tool Poisoning
Confidence
98% confidence
Finding

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.

Content

No source excerpt is available for this finding.

Ae1

High
Category
analysis-evasion
Confidence
100% confidence
Finding

Referenced artifact was not completely inspected

Content

Scanner excerpt · SKILL.md (reported line 75)May include surrounding context.

md
python3 scripts/server.py restart # 3. 重启

Ae1

High
Category
analysis-evasion
Confidence
100% confidence
Finding

Referenced artifact was not completely inspected

Content

Scanner excerpt · SKILL.md (reported line 447)May include surrounding context.

md
python3 scripts/server.py restart # 3. 重启

Tool Parameter Abuse

High
Category
Tool Misuse
Confidence
60% confidence
Finding

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).

Content

Scanner excerpt · references/https-deployment.md (reported line 31)May include surrounding context.

客户端如何信任自签证书

bash
# curl
curl --cacert <HTTP_ROOT>/certs/server.crt https://10.40.x.x:8080/health

# Python requests

Chaining Abuse

High
Category
Tool Misuse
Confidence
75% confidence
Finding

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.

Content

Scanner excerpt · references/https-deployment.md (reported line 124)May include surrounding context.

bash
# 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 -

Possible Typosquatting: 'uvicorn' resembles popular package 'gunicorn'

High
Category
Supply Chain
Confidence
70% confidence
Finding

Package name closely resembles a popular package, suggesting possible typosquatting. Attackers publish malicious packages with similar names to trick developers into installing them.

Content

No source excerpt is available for this finding.

Env Variable Harvesting

High
Category
Data Exfiltration
Confidence
60% confidence
Finding

Code enumerates, copies, or searches environment variables for secrets. Bulk environment access can collect credentials unrelated to the skill's stated purpose.

Content

Scanner excerpt · scripts/console.py (reported line 470)May include surrounding context.

python
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

Env Variable Harvesting

High
Category
Data Exfiltration
Confidence
60% confidence
Finding

Code enumerates, copies, or searches environment variables for secrets. Bulk environment access can collect credentials unrelated to the skill's stated purpose.

Content

Scanner excerpt · scripts/console.py (reported line 1261)May include surrounding context.

python
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

High
Category
Prompt Injection
Confidence
70% confidence
Finding

Hidden instructions were detected in comments or invisible text. These could contain malicious directives. Manual review is recommended.

Content

Scanner excerpt · scripts/console_ui/index.html (reported line 14)May include surrounding context.

html
</head>
<body x-data="appState">

  <!-- Toast container -->
  <div id="toast-container" class="toast-container"></div>

  <!-- ── API Key 引导弹窗(首次访问 / key 失效时自动弹出)──────────── -->

Hidden Instructions

High
Category
Prompt Injection
Confidence
70% confidence
Finding

Hidden instructions were detected in comments or invisible text. These could contain malicious directives. Manual review is recommended.

Content

Scanner excerpt · scripts/console_ui/index.html (reported line 14)May include surrounding context.

html
</head>
<body x-data="appState">

  <!-- Toast container -->
  <div id="toast-container" class="toast-container"></div>

  <!-- ── API Key 引导弹窗(首次访问 / key 失效时自动弹出)──────────── -->

Hidden Instructions

High
Category
Prompt Injection
Confidence
70% confidence
Finding

Hidden instructions were detected in comments or invisible text. These could contain malicious directives. Manual review is recommended.

Content

Scanner excerpt · scripts/console_ui/index.html (reported line 105)May include surrounding context.

html
</div>
        </div>

        <!-- 初始化进度弹窗 -->
        <div x-show="initializing" x-cloak class="modal-backdrop">
          <div class="modal">
            <h3>⚡ 正在初始化极速模式...</h3>

Tool Parameter Abuse

High
Category
Tool Misuse
Confidence
98% confidence
Finding

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.

Content

Scanner excerpt · scripts/doctor.py (reported line 141)May include surrounding context.

python
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()

Tool Parameter Abuse

High
Category
Tool Misuse
Confidence
87% confidence
Finding

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.

Content

Scanner excerpt · scripts/gen_cert.py (reported line 324)May include surrounding context.

python
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】")

Tool Parameter Abuse

High
Category
Tool Misuse
Confidence
87% confidence
Finding

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.

Content

Scanner excerpt · scripts/gen_cert.py (reported line 324)May include surrounding context.

python
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】")

Tool Parameter Abuse

High
Category
Tool Misuse
Confidence
90% confidence
Finding

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.

Content

Scanner excerpt · scripts/server.py (reported line 559)May include surrounding context.

python
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)])

Cloud Metadata Access

High
Category
Server-Side Request Forgery
Confidence
90% confidence
Finding

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.

Content

Scanner excerpt · scripts/skill_runner.py (reported line 132)May include surrounding context.

python
策略(内网工具的平衡取舍):
    - 仅允许 http/https scheme
    - 拒绝回环地址(localhost/127.x)——防止回打本机 Gateway/控制台等敏感端口
    - 拒绝链路本地地址(169.254.x,含云 metadata 169.254.169.254)
    - 私网地址放行(内网部署的正常回调目标)
    """
    from urllib.parse import urlparse

Autonomous Decision Making

Medium
Category
Excessive Agency
Confidence
75% confidence
Finding

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.

Content

Scanner excerpt · CHANGELOG.md (reported line 14)May include surrounding context.

md
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)

Undeclared Tool Scope

Medium
Category
MCP Least Privilege
Confidence
95% confidence
Finding

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.

Content

No source excerpt is available for this finding.

Internal Network Request

Medium
Category
Server-Side Request Forgery
Confidence
70% confidence
Finding

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.

Content

Scanner excerpt · SKILL.md (reported line 446)May include surrounding context.

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"]

text

Rp1

Medium
Category
MCP Rug Pull
Confidence
75% confidence
Finding

Docker image references without a specific tag (:latest is implicit) or digest (@sha256:...) can be silently replaced by a malicious image.

Content

No source excerpt is available for this finding.

Description-Behavior Mismatch

Medium
Category
Not specified by scanner
Confidence
97% confidence
Finding

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.

Content

No source excerpt is available for this finding.

Context-Inappropriate Capability

Medium
Category
Not specified by scanner
Confidence
89% confidence
Finding

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.

Content

No source excerpt is available for this finding.

External Transmission

Medium
Category
Data Exfiltration
Confidence
60% confidence
Finding

Data is being sent to an external URL. This could be legitimate telemetry or data exfiltration. Manual review is recommended.

Content

Scanner excerpt · references/https-deployment.md (reported line 31)May include surrounding context.

客户端如何信任自签证书

bash
# curl
curl --cacert <HTTP_ROOT>/certs/server.crt https://10.40.x.x:8080/health

# Python requests