T09 · Insecure Skill Coding Practices
- Location
scripts/fetch_article.py:204- Finding
Weak URL Validation Enables Server-Side Request Forgery Through Headless Chromium
- Content
View full analysis
- Remediation
View remediation
bool: try: parsed = urlparse(url) except ValueError: return False return ( parsed.scheme == "https" and parsed.hostname == "mp.weixin.qq.com" and parsed.username is None and parsed.password is None and parsed.port in (None, 443) ) ``` Apply the following additional controls: 1. Permit only HTTPS and the exact approved hostname, or use an explicit allowlist if approved subdomains are required. 2. Reject URL credentials, fragments where unnecessary, nonstandard ports, malformed hostnames, and ambiguous IP representations. 3. Resolve the hostname and reject loopback, private, link-local, multicast, reserved, and cloud metadata address ranges. 4. Intercept every browser request and abort requests whose resolved destination is outside the approved host policy. 5. Validate redirect destinations rather than trusting the initial URL alone. 6. Apply outbound network restrictions at the container or firewall layer so the process cannot reach internal services or metadata endpoints. 7. Set conservative page, redirect, and resource limits to reduce browser-driven network abuse. ]]>
