T09 · Insecure Skill Coding Practices
- Location
scripts/verify_url.sh:4- Finding
Unrestricted URL Verification Enables Blind Internal Network Probing
- Content
View full analysis
Vulnerability Details
File Location:
scripts/verify_url.sh, lines 4–18
Vulnerability Type: Server-Side Request Forgery-like unrestricted outbound request
Risk Level: MediumVulnerable Code
bash URL="${1:?usage: verify_url.sh <url> [expected_snippet]}" SNIPPET="${2:-}" TMP="$(mktemp)" CODE=$(curl -sSL -o "$TMP" -w "%{http_code}" "$URL" || true) if [ "$CODE" != "200" ]; then echo "FAIL: HTTP $CODE from $URL" rm -f "$TMP" exit 10 fi if [ -n "$SNIPPET" ]; then if ! grep -Fq "$SNIPPET" "$TMP"; then echo "FAIL: snippet not found: $SNIPPET"Technical Analysis
The script passes the caller-controlled
URLdirectly tocurlwithout restricting the URL scheme, hostname, resolved IP address, or destination port. The-Loption also follows redirects without validating each redirect destination.A caller can therefore cause the Agent's execution environment to connect to loopback, private-network, link-local, or otherwise unintended services. The HTTP status check and optional attacker-selected snippet search act as a limited response oracle. For example, the output and exit code can reveal whether an internal endpoint returned HTTP 200 and whether its response contained a selected string.
The script does not print the retrieved response body, which limits direct data disclosure, but it still permits blind service discovery and content inference.
Attack Path
- An attacker persuades the Agent to verify a deployment URL that points to an internal address, such as a loopback or private-network service. Alternatively, the attacker provides an external URL that redirects to such an address.
- The Agent invokes
scripts/verify_url.shwith the attacker-controlled URL and, optionally, an attacker-selected expected snippet. curl -sSLrequests the destination and follows redirects without checking the final host or resolved address.- The script records the response body and evaluates the HTTP status.
- Its outpu ...[truncated 923 chars]
- Remediation
View remediation
Remediation Suggestions
- Restrict accepted URL schemes to
https, allowinghttponly if it is explicitly required. - Prefer an allowlist of approved Puter deployment hostnames or expected application domains.
- Resolve the destination before connecting and reject loopback, private, link-local, multicast, unspecified, and reserved IPv4 and IPv6 address ranges.
- Disable redirects or validate the scheme, hostname, port, and resolved address of every redirect target before following it.
- Restrict destination ports to those required for deployment verification, normally 443 and possibly 80.
- Add defensive resource limits such as
--connect-timeout,--max-time,--max-redirs, and a maximum response-body size. - Consider validating the supplied deployment URL against the target recorded during the deployment step rather than accepting an arbitrary URL.
- Register temporary-file cleanup immediately after creation so interruption and unexpected exits do not leave response data behind:
bash TMP="$(mktemp)" trap 'rm -f "$TMP"' EXIT- Avoid treating user-selected snippet checks as authorization to query arbitrary destinations; destination validation must occur independently before the request.
- Restrict accepted URL schemes to
