T09 · Insecure Skill Coding Practices
- Location
scripts/infomagnet.py:248- Finding
Unrestricted URL Fetching Enables Server-Side Request Forgery and Local Resource Access
- Content
View full analysis
]+>", " ", content) text = re.sub(r"\s+", " ", text).strip()[:5000] h = hashlib.sha256(text.encode()).hexdigest()[:16] return {"url": url, "hash": h, "snippet": text[:300]} ``` ### Technical Analysis URLs supplied through the `--rss`, `--urls`, and `import-rss --url` arguments are stored and subsequently passed directly to `urllib.request.urlopen`. The implementation does not: - Restrict URLs to approved schemes such as HTTPS. - Reject local-resource schemes such as `file:`. - Block loopback, private, link-local, reserved, or multicast IP addresses. - Block common cloud metadata endpoints. - Resolve and validate hostnames before connecting. - Revalidate the destination after HTTP redirects. - Protect against DNS rebinding between validation and connection. Consequently, a user or attacker who can influence a magnet configuration can make the process issue requests to destinations that are not normally externally accessible. Because `urllib` supports more than ordinary HTTP URLs, loca ...[truncated 1764 chars]- Remediation
View remediation
