T09 · Insecure Skill Coding Practices
- Location
scripts/skill.py:53- Finding
Unrestricted Server-Side URL Fetching Enables SSRF
- Content
View full analysis
Vulnerability Details
File Location:
scripts/skill.py, lines 53-59
Vulnerability Type: Server-Side Request Forgery (SSRF)
Risk Level: HighVulnerable Code
python parsed = urlparse(url) if not parsed.scheme: url = "https://" + url r = requests.get(url, headers=DEFAULT_HEADERS, timeout=12)Technical Analysis
The URL is entirely user-controlled and is passed to
requests.get()without validating its scheme, hostname, port, or resolved IP address. The code does not reject loopback, private, link-local, reserved, or cloud metadata destinations.In addition,
requests.get()follows HTTP redirects by default. Consequently, checking only the initial URL would not be sufficient: a public endpoint could redirect the request to an internal service. The existingurlparse()call only determines whether a scheme is present and does not provide a security boundary.Attack Path
- An attacker supplies a URL targeting an internal destination, such as a loopback service, private network host, or cloud metadata endpoint. Alternatively, the attacker supplies a public URL that redirects to such a destination.
- The Skill executes the request from its own runtime environment.
- The request reaches a service accessible from the Skill's network context but potentially inaccessible to the attacker directly.
- The returned document is parsed by BeautifulSoup.
- Text from an article, paragraph, or metadata field is returned in the JSON response, potentially disclosing internal information.
Impact Assessment
Successful exploitation may allow an attacker to probe services reachable from the Skill's network context, access unauthenticated internal HTTP endpoints, retrieve cloud instance metadata, or disclose portions of internal responses. The effective scope is limited by the network access and identity available to the process, but it may exceed the attacker's direct network privileges.
- Remediation
View remediation
Remediation Suggestions
- Accept only explicitly supported schemes, normally
httpsand, if necessary,http. - Reject URLs containing credentials, ambiguous host syntax, unsupported ports, or malformed hostnames.
- Resolve the hostname before connecting and reject every address in loopback, private, link-local, multicast, unspecified, reserved, and other non-public ranges for both IPv4 and IPv6.
- Explicitly block cloud metadata destinations, including link-local metadata addresses.
- Prefer an allowlist of legitimate domains when the intended use is limited to Facebook or another known service.
- Disable automatic redirects or validate the scheme, hostname, port, and resolved IP address of every redirect target before following it.
- Account for DNS rebinding by ensuring that the validated address is the address actually used for the connection.
- Apply outbound firewall or proxy restrictions as defense in depth.
- Accept only explicitly supported schemes, normally
