T05 · Unauthorized Access and Privilege Escalation
Error
- Location
- scripts/web_screenshot.py:29
- Finding
- Unrestricted URL Access Enables Server-Side Request Forgery<![CDATA[ ## Vulnerability Details **File Location**: `scripts/web_screenshot.py:29, 84-85` **Vulnerability Type**: Server-Side Request Forgery through unrestricted browser navigation **Risk Level**: High ### Vulnerable Code ```python page.goto(url, wait_until='networkidle', timeout=30000) ``` ```python # Ensure the URL has a protocol if not url.startswith('http'): url = 'https://' + url ``` ### Technical Analysis The user-provided URL is passed directly to Playwright without validating its scheme, hostname, resolved IP address, or redirect destinations. The `startswith('http')` condition is not a reliable URL parser or protocol allowlist. Consequently, the browser may navigate to loopback, private, link-local, reserved, or otherwise internal addresses reachable from the Agent host. Examples include localhost services, private administrative interfaces, and cloud instance metadata endpoints. An attacker may also provide a public URL that redirects to an internal destination because redirect targets are not revalidated. The browser renders the response and saves it as an image, allowing internal content to be disclosed through the returned screenshot. ### Attack Path 1. An attacker asks the Skill to capture a URL such as `http://127.0.0.1:8080`, an RFC 1918 private address, or a link-local metadata address. 2. Alternatively, the attacker supplies a public URL that redirects to an internal address. 3. The script forwards the unvalidated URL to `page.goto()`. 4. Chromium sends the request from the Agent host and therefore uses the host's network access. 5. The internal response is rendered and captured in a screenshot. 6. The screenshot path is returned, allowing the attacker to inspect content that was not directly reachable from their own environment. ### Impact Assessment An attacker can use the Agent host as a network vantage point for internal network reconnaissance and content disclosure. Depending on network reachability, exposed targets may i ...[truncated 320 chars]
- Remediation
- <![CDATA[ ## Remediation Suggestions 1. Parse the input with `urllib.parse.urlsplit()` and allow only exact `http` and `https` schemes. 2. Reject URLs containing credentials or malformed hostnames. 3. Resolve the hostname before navigation and reject every resolved address that is loopback, private, link-local, multicast, reserved, or unspecified. 4. Revalidate the destination after every redirect to prevent redirect-based SSRF and DNS rebinding bypasses. 5. Prefer an explicit hostname allowlist when the intended destinations are known. 6. Apply outbound firewall rules that prevent the browser process from reaching internal and metadata networks. 7. Consider running Chromium in a separately isolated network namespace with access only to the public internet. ]]>
