T09 · Insecure Skill Coding Practices
- Location
skills/patent-reader/tools/vault/clue_vault.py:352- Finding
Arbitrary HTTP(S) URL Fetching Enables Server-Side Request Forgery
- Content
View full analysis
dict: """自动抓取 URL 可读摘要;失败不抛错,返回 status=fetch_failed。""" parsed = urlparse(url) if parsed.scheme not in ("http", "https") or not parsed.netloc: return { "ok": False, "status": "fetch_failed", "page_title": "", "summary": "", "error": "invalid_url", } headers = { "User-Agent": ( "Mozilla/5.0 (Windows NT 10.0; Win64; x64) " "AppleWebKit/537.36 (KHTML, like Gecko) " "Chrome/121.0.0.0 Safari/537.36" ), "Accept": "text/html,application/xhtml+xml;q=0.9,*/*;q=0.8", "Accept-Language": "zh-CN,zh;q=0.9,en;q=0.8", } try: req = Request(url, headers=headers) with urlopen(req, timeout=timeout) as resp: raw = resp.read() ``` ### Technical Analysis The validation only confirms that the supplied value uses HTTP or HTTPS and contains a network location. It does not validate the resolved IP address or reject loopback, private, link-local, reserved, multicast, or cloud metadata destinations. The use of `urlopen` can also follow redirects. A URL whose initial destination appears public can consequently redirect the request to an internal address unless every redirect target is independently resolved and validated. Because the response is read and subsequently converted into a summary, this is not limited to blind SSRF. Content returned by an internal service may be included in generated output or persisted in the patent clue vault. ### Attack Path 1. An attacker supplies a patent clue containing an HTTP(S) URL or otherwise causes an attacker-controlled URL to be processed by `fetch ...[truncated 1350 chars]- Remediation
View remediation
