Back to skill

Security audit

zhipu web fetch

Security checks for vulnerabilities and agentic risk

Overview

This is a straightforward Zhipu-backed web page reader with disclosed external API use and no hidden persistence, though users should avoid sensitive URLs and note the wrapper script's weak input validation.

Use this skill only when you are comfortable sending the target URL and remote retrieval request to Zhipu's service under your ZHIPU_API_KEY. Avoid confidential intranet pages, localhost/cloud-metadata targets, authenticated links, and pre-signed URLs, and pass only trusted option values until the wrapper uses proper JSON encoding and validation.

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/zhipu_fetch.sh:21
Finding
Unsafe JSON Construction Allows Request-Body Injection<![CDATA[ ## Vulnerability Details **File Location**: `scripts/zhipu_fetch.sh`, lines 21–22 and 59–77 **Vulnerability Type**: JSON request-body injection through unvalidated command-line arguments **Risk Level**: Medium ### Vulnerable Code ```bash -t|--timeout) TIMEOUT="$2"; shift ;; -f|--format) RETURN_FORMAT="$2"; shift ;; ``` ```bash # Escape special characters in URL for safe JSON encoding SAFE_URL="${URL//\\/\\\\}" SAFE_URL="${SAFE_URL//\"/\\\"}" # Build JSON payload PAYLOAD=$(cat <<EOF { "url": "$SAFE_URL", "timeout": $TIMEOUT, "no_cache": $NO_CACHE, "return_format": "$RETURN_FORMAT", "retain_images": $RETAIN_IMAGES, "no_gfm": $NO_GFM, "keep_img_data_url": $KEEP_IMG_DATA_URL, "with_images_summary": $WITH_IMAGES_SUMMARY, "with_links_summary": $WITH_LINKS_SUMMARY } EOF ) ``` ### Technical Analysis The script constructs JSON by directly interpolating command-line arguments into a here-document. `TIMEOUT` is inserted as an unquoted raw JSON value, while `RETURN_FORMAT` is placed inside a JSON string without escaping or allowlist validation. An attacker who can control these arguments can terminate the intended value and inject additional JSON members. For example, a crafted format value could introduce another `timeout` property: ```bash bash scripts/zhipu_fetch.sh \ --url "https://www.example.com" \ --format 'markdown", "timeout": 999999, "injected":"' ``` This can produce a request containing attacker-introduced fields or duplicate properties. The behavior of duplicate properties depends on the API's JSON parser, but many parsers accept the last occurrence, potentially allowing an injected value to override an earlier legitimate value. The URL receives only partial escaping. Backslashes and double quotes are escaped, but JSON control characters such as literal newlines, carriage returns, and tabs are not encoded. Such input can make the request malformed. This is not shell command injection because `PAYLOAD` is passed to `cu ...[truncated 1592 chars]
Remediation
<![CDATA[ ## Remediation Suggestions 1. Validate every command-line option before constructing the request: - Require `TIMEOUT` to contain digits only. - Enforce a reasonable timeout range, such as 1–300 seconds. - Allow only `markdown` or `text` for `RETURN_FORMAT`. - Reject missing values for options that require an argument. 2. Build the request with a real JSON encoder rather than string interpolation. For example: ```bash [[ "$TIMEOUT" =~ ^[0-9]+$ ]] || { echo "Error: timeout must be an integer" >&2 exit 1 } if (( TIMEOUT < 1 || TIMEOUT > 300 )); then echo "Error: timeout must be between 1 and 300 seconds" >&2 exit 1 fi case "$RETURN_FORMAT" in markdown|text) ;; *) echo "Error: format must be markdown or text" >&2 exit 1 ;; esac PAYLOAD=$(jq -n \ --arg url "$URL" \ --argjson timeout "$TIMEOUT" \ --argjson no_cache "$NO_CACHE" \ --arg return_format "$RETURN_FORMAT" \ --argjson retain_images "$RETAIN_IMAGES" \ --argjson no_gfm "$NO_GFM" \ --argjson keep_img_data_url "$KEEP_IMG_DATA_URL" \ --argjson with_images_summary "$WITH_IMAGES_SUMMARY" \ --argjson with_links_summary "$WITH_LINKS_SUMMARY" \ '{ url: $url, timeout: $timeout, no_cache: $no_cache, return_format: $return_format, retain_images: $retain_images, no_gfm: $no_gfm, keep_img_data_url: $keep_img_data_url, with_images_summary: $with_images_summary, with_links_summary: $with_links_summary }') ``` 3. If adding `jq` is undesirable, use another available JSON serializer that correctly escapes quotes, backslashes, Unicode, and control characters. Avoid manually assembling JSON. 4. Add tests covering quotes, backslashes, newlines, tabs, duplicate-property injection attempts, nonnumeric timeouts, extreme timeout values, missing argument values, and unsupported output formats. ]]>
Vulnerability Patterns
  • Data ExfiltrationExternal Transmission, Env Variable Harvesting, File System Enumeration
  • MCP Least PrivilegeUnderdeclared Capability, Wildcard Permission, Missing Permission Declaration
  • Prompt InjectionInstruction Override, Hidden Instructions, Exfiltration Commands
  • Privilege EscalationExcessive Permissions, Sudo/Root Execution, Credential Access
  • Supply ChainUnpinned Dependencies, External Script Fetching, Obfuscated Code
Findings (5)

Lp3

Medium
Category
MCP Least Privilege
Confidence
84% confidence
Finding
The skill uses shell via curl and a wrapper script but does not declare any tool scope or allowed-tools constraints. This weakens defense-in-depth by allowing broader execution context than necessary and makes it harder for a host system to enforce least privilege for a network-capable skill.

Missing User Warnings

Medium
Confidence
95% confidence
Finding
The skill sends user-supplied URLs and the fetched page contents to Zhipu's external Reader API, but the description does not clearly warn users that their inputs and retrieved data leave the local environment. This creates a privacy and data-handling risk, especially if users provide internal, sensitive, or authenticated URLs.

External Transmission

Medium
Category
Data Exfiltration
Content
## Quick Start

### Basic cURL Usage

```bash
curl --request POST \
Confidence
92% confidence
Finding
The skill is explicitly designed to transmit a target URL to an external service, which then retrieves and parses the page content. In context this behavior is expected, but it is still security-relevant because it can expose sensitive destinations or data to a third party and could be misused to fetch internal or private resources if callers are not restricted.

External Transmission

Medium
Category
Data Exfiltration
Content
EOF
)

# Execute cURL request
curl -s --request POST \
  --url https://open.bigmodel.cn/api/paas/v4/reader \
  --header "Authorization: Bearer $ZHIPU_API_KEY" \
Confidence
94% confidence
Finding
This cURL call sends the requested URL and payload to an external endpoint, creating a data exfiltration channel for any URL the user provides. In the context of a web-fetching skill, this is expected functionality, but it becomes security-relevant because users may supply sensitive internal or private URLs and the script does not constrain or prominently disclose that remote processing occurs.

Missing User Warnings

Medium
Confidence
96% confidence
Finding
The script transmits the user-supplied URL, fetch options, and the bearer-authenticated request to a third-party API service, but it provides no runtime warning, consent gate, or data-handling notice to the user. In a URL-reading skill, users may assume the fetch happens locally; sending internal, sensitive, or pre-signed URLs to an external provider can expose confidential endpoints and metadata.

Static analysis

No suspicious patterns detected.