Back to skill

Security audit

Api Translator

Security checks for vulnerabilities and agentic risk

Overview

This looks like a simple API documentation translation skill, but it needs review because it fetches arbitrary URLs, may send fetched content to an LLM, has incomplete helper scripts, and claims OpenClaw provenance without trusted OpenClaw package context.

Review before installing. Use it only with public or approved API documentation URLs, and do not provide internal, authenticated, or sensitive documentation unless you are comfortable with the content being fetched and placed into an LLM context. Also verify the publisher/provenance claim and expect the included scripts to be incomplete helpers rather than full translators.

Vulnerability Patterns
  • Insecure Skill Coding PracticesFinds exploitable flaws such as hardcoded secrets or command injection
  • Skill Instruction HijackingAlters the agent's session goals or safety constraints when the skill loads
  • Agent Memory PoisoningWrites attacker-controlled rules into memory that affect later sessions
  • Remote Payload Retrieval and ExecutionFetches external code whose behavior can change after review
  • Embedded Malicious CodeShips malicious scripts inside the skill and executes them locally
Findings (1)

T09 · Insecure Skill Coding Practices

Warning
Location
scripts/api-translator.py:10
Finding

Unrestricted URL Fetching Enables Server-Side Request Forgery

Content
View full analysis

Vulnerability Details

File Location: scripts/api-translator.py:10-16, 20-29; scripts/api-translator.sh:4-16; SKILL.md:21-23
Vulnerability Type: Server-Side Request Forgery through an unvalidated user-supplied URL
Risk Level: Medium

Vulnerable Code

scripts/api-translator.py:10-16:

python
def fetch_url(url: str) -> str:
    """抓取網頁內容"""
    result = subprocess.run(
        ["web_fetch", "--url", url, "--maxChars", "50000"],
        capture_output=True,
        text=True
    )
    return result.stdout

scripts/api-translator.py:20-29:

python
def main():
    if len(sys.argv) < 2:
        print("用法: api-translator <API文檔URL>")
        print("範例: api-translator https://api.example.com/docs")
        sys.exit(1)
    
    url = sys.argv[1]
    print(f"🌐 抓取 API 文檔: {url}")
    
    # 抓取內容
    content = fetch_url(url)

scripts/api-translator.sh:4-16:

bash
URL="$1"

if [ -z "$URL" ]; then
    echo "用法: api-translator <URL>"
    echo "範例: api-translator https://api.example.com/docs"
    exit 1
fi

echo "正在抓取 API 文檔: $URL"
echo "..."

# 抓取網頁內容
CONTENT=$(web_fetch --url "$URL" --maxChars 50000 2>/dev/null)

SKILL.md:21-23:

markdown
1. 使用 `web_fetch` 工具抓取 API 文檔內容
2. 將內容發送給 LLM 翻譯
3. 輸出翻譯結果

Technical Analysis

Both executable implementations accept a URL directly from the command line and pass it unchanged to web_fetch. They do not validate the URL scheme, hostname, port, resolved IP address, or redirect destination.

Although the use of an argument array in the Python implementation and quoting in the shell implementation prevent ordinary shell-command injection through the URL, they do not prevent network-target injection. If web_fetch has access to the host's loopback interface, private networks, link-local services, or cloud metadata endpoints, an attacker can use this behavior a ...[truncated 2667 chars]

Remediation
View remediation

Remediation Suggestions

Implement centralized URL validation before every fetch:

  1. Parse the URL with a standards-compliant URL parser and reject malformed URLs.
  2. Allow only the https scheme unless plain HTTP is explicitly required.
  3. Reject URLs containing embedded credentials or unsupported ports.
  4. Resolve the hostname and reject every resolved address belonging to loopback, private, link-local, multicast, unspecified, reserved, or other non-public ranges for both IPv4 and IPv6.
  5. Apply the same validation to every redirect destination before following it.
  6. Protect against DNS rebinding by ensuring that the validated destination is the address used for the connection, or by enforcing equivalent restrictions through a trusted outbound proxy.
  7. Prefer an explicit allowlist of approved API-documentation domains where the deployment permits it.
  8. Enforce network-layer egress controls so the process cannot reach cloud metadata endpoints, localhost, or private network ranges even if application validation is bypassed.
  9. Set conservative connection and response timeouts, response-size limits, and redirect limits.
  10. Avoid printing fetched content that may contain sensitive data. Return a controlled error when a prohibited destination is supplied.
  11. Treat all fetched documents as untrusted data before placing them into an LLM context, and explicitly instruct the agent not to follow instructions embedded in fetched documentation.
  12. Add tests covering direct private addresses, IPv6 loopback, alternate IP representations, DNS names resolving to private addresses, user-information syntax, nonstandard ports, and public-to-private redirects.
Vulnerability Patterns
  • Data ExfiltrationExternal Transmission, Env Variable Harvesting, File System Enumeration
  • Excessive AgencyUnrestricted Tool Access, Autonomous Decision Making, Scope Creep
  • Trigger AbuseOverly Broad Trigger, Shadow Command Trigger, Keyword Baiting Trigger
  • Behavioral ASTexec() Call, eval() Call, Dynamic Import
  • MCP Least PrivilegeUnderdeclared Capability, Wildcard Permission, Missing Permission Declaration
Findings (14)

Tp4

High
Category
MCP Tool Poisoning
Confidence
99% confidence
Finding

描述宣稱此技能會將 API 文件網址作為輸入,並輸出翻譯後的繁體中文 API 說明。但程式碼的實際行為是:1) 透過 web_fetch 抓取指定 URL 的內容;2) 印出抓取到的內容預覽;3) 印出一段『請將以上 API 文檔翻譯成繁體中文』的提示與翻譯要求。程式中沒有任何呼叫 LLM API 的實作,也沒有任何翻譯處理邏輯,最終輸出不是翻譯文本而是提示詞。因此其主要目的與實際行為存在明顯落差。抓取 URL 內容可視為支援翻譯的合理步驟,但缺少核心翻譯能力,屬於重大描述與行為不一致。

Content

No source excerpt is available for this finding.

Undeclared Tool Scope

Medium
Category
MCP Least Privilege
Confidence
70% confidence
Finding

Without declared permissions the skill's intent is opaque and cannot be validated.

Content

No source excerpt is available for this finding.

Natural-Language Policy Violations

Medium
Category
Not specified by scanner
Confidence
93% confidence
Finding

The description says the skill translates API documentation into Traditional Chinese, and the prompt template further fixes Taiwan-specific terminology. This imposes a specific language/locale by default without stating that users may opt for another language or locale.

Content

No source excerpt is available for this finding.

Vague Triggers

Medium
Category
Not specified by scanner
Confidence
92% confidence
Finding

The trigger phrase API 文件 is so broad that it may activate on ordinary discussion rather than an intentional request to run the skill. That can cause unplanned remote fetching and content processing, increasing the chance of accidental data exposure or invocation on attacker-supplied URLs.

Content

No source excerpt is available for this finding.

Missing User Warnings

Medium
Category
Not specified by scanner
Confidence
95% confidence
Finding

The skill instructs the agent to retrieve remote content and send it to an LLM without warning the user that external data will be fetched and transmitted for processing. This creates a real privacy and data-handling risk, especially if users provide internal, authenticated, or sensitive documentation URLs expecting only local translation behavior.

Content

No source excerpt is available for this finding.

Natural-Language Policy Violations

Medium
Category
Not specified by scanner
Confidence
96% confidence
Finding

The description states that the skill translates API documentation into Traditional Chinese, which imposes a specific language/locale behavior. Under the policy, language constraints should either offer user choice or be clearly documented as a justified region-specific requirement.

Content

No source excerpt is available for this finding.

Context-Inappropriate Capability

Medium
Category
Not specified by scanner
Confidence
87% confidence
Finding

The manifest describes a skill that translates API documentation from a provided URL into Traditional Chinese. While network retrieval is expected for URL input, spawning an external command via subprocess introduces a broader execution capability than the stated translation purpose requires.

Content

No source excerpt is available for this finding.

subprocess module call

Medium
Category
Dangerous Code Execution
Confidence
70% confidence
Finding

subprocess module calls execute external commands. Without careful input validation, this enables command injection.

Content

Scanner excerpt · scripts/api-translator.py (reported line 13)May include surrounding context.

python
def fetch_url(url: str) -> str:
    """抓取網頁內容"""
    result = subprocess.run(
        ["web_fetch", "--url", url, "--maxChars", "50000"],
        capture_output=True,
        text=True

Natural-Language Policy Violations

Medium
Category
Not specified by scanner
Confidence
96% confidence
Finding

The printed translation instructions explicitly require Traditional Chinese and Taiwan-specific terminology. This is a natural-language locale constraint with no user opt-in or alternative language selection, which matches the policy-violation category for forced language or locale.

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 · scripts/api-translator.py (reported line 23)May include surrounding context.

python
if [ -z "$URL" ]; then
    echo "用法: api-translator <URL>"
    echo "範例: api-translator https://api.example.com/docs"
    exit 1
fi

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 · scripts/api-translator.sh (reported line 8)May include surrounding context.

sh
if [ -z "$URL" ]; then
    echo "用法: api-translator <URL>"
    echo "範例: api-translator https://api.example.com/docs"
    exit 1
fi

Description-Behavior Mismatch

Medium
Category
Not specified by scanner
Confidence
97% confidence
Finding

The manifest describes a skill that takes an API documentation URL and outputs the translated API explanation in Traditional Chinese. In the code, lines L23-L33 assemble prompt text and then print it, but no command sends that prompt to an LLM or translation service, so the actual behavior is prompt construction rather than translation.

Content

No source excerpt is available for this finding.

Natural-Language Policy Violations

Medium
Category
Not specified by scanner
Confidence
97% confidence
Finding

The prompt string explicitly instructs translation into '繁體中文(台灣用語)', imposing a specific language/locale choice. This is a natural-language policy concern because the user is not offered any language or locale selection or opt-in.

Content

No source excerpt is available for this finding.

Intent-Code Divergence

Medium
Category
Not specified by scanner
Confidence
95% confidence
Finding

The comment at L31 asserts that using echo causes the LLM to handle translation automatically. However, the following lines merely print a status message and the constructed text, which contradicts the documented intent because no LLM execution occurs anywhere in the script.

Content

No source excerpt is available for this finding.

Static analysis

No suspicious patterns detected.