T09 · Insecure Skill Coding Practices
- Location
scripts/fetcher.py:247- Finding
Unrestricted URL Fetching Enables Server-Side Request Forgery in the Web Fetcher
- Content
View full analysis
Optional[Dict[str, Any]]: try: if not check_robots_txt(url): return { "url": url, "error": "robots.txt에 의해 차단됨 (Blocked by robots.txt)", "fetched_at": datetime.now(timezone.utc).isoformat() } rate_limit(url) response = requests.get( url, headers={"User-Agent": USER_AGENT}, timeout=REQUEST_TIMEOUT, allow_redirects=True ) response.raise_for_status() ``` The URL is taken directly from a command-line argument or batch file and passed to `requests.get()` without restricting the destination scheme, hostname, resolved IP address, or port. The `check_robots_txt()` function is not a security control; it also contacts a URL derived from the untrusted destination and permits access when `robots.txt` cannot be read. Automatic redirects are explicitly enabled, but each redirect target is not revalidated. Consequently, an initially public URL may redirect the request to a loopback, private, link-local, or otherwise privileged network destination. Fetched page content is parsed and returned through standard output or a caller-selected JSON file. This makes the flaw capable of disclosing responses, rather than being limited to blind SSRF. ### Attack Path 1. An attacker supplies a URL through the `fetch` command, a batch URL file, or content that causes an agent to invoke the fetcher with an attacker-selected URL. 2. The URL points directly to an internal service, such as a loopback administration endpoint, or to an attacker-controlled public endpoint that redirects to an internal address. 3. `check_robots_txt()` fails open if the robots fil ...[truncated 881 chars]- Remediation
View remediation
