T09 · Insecure Skill Coding Practices
- Location
SKILL.md:186- Finding
Unrestricted URL Fetching Enables Server-Side Request Forgery
- Content
View full analysis
Vulnerability Details
File Location:
SKILL.md, lines 186-199
Vulnerability Type: Unrestricted URL fetching / SSRF
Risk Level: HighVulnerable Code
bash HTML=$(curl -s "$URL") DATA=$(echo "$HTML" | grep -o '__NEXT_DATA__.*' | head -1) AUDIO_URL=$(echo "$DATA" | jq -r '.props.pageProps.episodeInfo.audioUrl') TITLE=$(echo "$DATA" | jq -r '.props.pageProps.episodeInfo.title') SHOW_NAME=$(echo "$DATA" | jq -r '.props.pageProps.episodeInfo.podcast.title') EPISODE_DIR="${OUTPUT_DIR}/${SHOW_NAME}-${TITLE}" mkdir -p "$EPISODE_DIR" curl -L -o "$EPISODE_DIR/${TITLE}.m4a" "$AUDIO_URL"Technical Analysis
The workflow passes the user-supplied
URLdirectly tocurlwithout validating its scheme, destination hostname, resolved address, or port. It then extracts another URL from remotely supplied page data and passes that value to a secondcurlinvocation.The second request uses
-L, allowing HTTP redirects, but the destination is not revalidated after each redirect. Consequently, an initially permitted address could redirect the request to localhost, a private network, a link-local service, or another unintended destination.Shell quoting protects these values from direct shell command injection, but it does not address server-side request forgery. If the skill is used by an Agent with access to internal network resources, attacker-controlled input could induce requests to destinations that are inaccessible to the attacker directly. Retrieved audio content is also subsequently supplied to
ffmpeg, increasing the attack surface if the downloaded file is maliciously constructed.Attack Path
- An attacker supplies a URL using an unexpected scheme or pointing to an attacker-controlled HTTP server.
- The Agent executes
curl -s "$URL"without confirming that the destination is an approved Xiaoyuzhou domain. - The attacker-controlled response provides data containing an
audioUrlf ...[truncated 1304 chars]
- Remediation
View remediation
Remediation Suggestions
- Require
httpsand reject all other schemes, includingfile,ftp, and custom protocol handlers. - Allowlist the exact Xiaoyuzhou and required media CDN hostnames rather than accepting arbitrary hosts.
- Resolve destination hostnames before connecting and reject:
- Loopback addresses.
- Private address ranges.
- Link-local addresses.
- Multicast and unspecified addresses.
- IPv6 local and mapped-private addresses.
- Disable redirects unless they are required. If redirects are necessary, validate the scheme, hostname, port, and resolved address at every redirect hop.
- Reject URLs containing embedded credentials, nonstandard ports, malformed hostnames, or raw IP literals unless explicitly required.
- Apply connection, transfer, and total execution timeouts.
- Enforce a maximum response and audio-file size.
- Run network retrieval and media conversion in a sandbox with restricted network connectivity and minimal filesystem permissions.
- Verify the response content type and file signature before passing downloaded content to
ffmpeg. - Fail closed if URL validation, DNS resolution, metadata parsing, or domain verification is unsuccessful.
- Require
