T09 · Insecure Skill Coding Practices
- Location
browser.py:20- Finding
Unrestricted Browser Navigation Enables Server-Side Request Forgery
- Content
View full analysis
Vulnerability Details
File Location:
browser.py:20-31
Vulnerability Type: Unrestricted URL navigation and internal-resource access
Risk Level: MediumVulnerable Code
python print("🚀 Navigating to page...") page.goto(url, wait_until="domcontentloaded", timeout=60000) # Wait for dynamic content time.sleep(2) if action == "read": print("📖 Reading content...") title = page.title() # Extract body text and clean up content = page.evaluate("document.body.innerText") clean_content = ' '.join(content.split())[:5000]The untrusted URL originates from the command-line argument defined at
browser.py:49:python parser.add_argument("--url", required=True, help="URL to visit")Technical Analysis
The caller controls the URL passed directly to Playwright's
page.goto()method. The application does not validate the URL scheme, hostname, resolved IP address, destination port, or redirects before Chromium performs the request.Consequently, Chromium can potentially access network resources reachable from the runtime environment, including:
- Loopback services such as
127.0.0.1 - Private network addresses
- Link-local services
- Cloud instance metadata endpoints
- Administrative web interfaces exposed only to the local network
When the
readaction is selected, the application extractsdocument.body.innerTextand prints up to 5,000 characters. This creates an SSRF-style read primitive for resources whose responses can be rendered by Chromium. Browser security controls may limit some response handling, but they do not prevent top-level navigation to ordinary internal HTTP services.Redirect destinations are not independently validated, so validating only the initial hostname would not be sufficient.
Attack Path
- An attacker or untrusted workflow supplies a URL targeting an internal resource, such as
http://127.0.0.1:PORT/, a priva ...[truncated 1138 chars]
- Loopback services such as
- Remediation
View remediation
Remediation Suggestions
- Accept only explicitly supported schemes, preferably
httpsand, where necessary,http. - Reject URLs containing embedded credentials, malformed hostnames, or unsupported ports.
- Resolve the destination hostname before navigation and reject every address in loopback, private, link-local, multicast, reserved, and unspecified ranges for both IPv4 and IPv6.
- Explicitly block cloud metadata destinations, including link-local metadata addresses and provider-specific metadata hostnames.
- Validate every redirect destination rather than only the original URL.
- Prevent DNS rebinding by ensuring the address used for the connection remains within the validated public address set.
- Prefer an explicit domain allowlist when the expected browsing destinations are known.
- Apply network-level egress controls so the browser process cannot reach internal networks or metadata services, providing defense in depth.
- Run Chromium in an isolated, least-privileged environment with no access to sensitive local services.
- Return a clear error and nonzero exit status when a destination is rejected or navigation fails.
- Accept only explicitly supported schemes, preferably
