T09 · Insecure Skill Coding Practices
- Location
scripts/monitor.py:24- Finding
Unrestricted URL Fetching Enables Server-Side Request Forgery
- Content
View full analysis
]*>.*?", "", resp.text, flags=re.DOTALL) text = re.sub(r"]*>.*?", "", text, flags=re.DOTALL) text = re.sub(r"<[^>]+>", " ", text) text = re.sub(r"\s+", " ", text).strip() return resp.status_code, text, elapsed except requests.exceptions.Timeout: elapsed = int((time.time() - start) * 1000) return 0, "", elapsed ``` All command modes ultimately pass caller-controlled URLs to this function. The relevant command arguments are defined at `scripts/monitor.py:153-166`: ```python p_check.add_argument("url") p_watch = sub.add_parser("watch", help="Detect changes vs last snapshot") p_watch.add_argument("url") p_watch.add_argument("--state-dir", default="/tmp/monitor-state") p_match = sub.add_parser("match", help="Check for content pattern") p_match.add_argument("url") p_match.add_argument("--pattern", required=True) p_batch = sub.add_parser("batch", help="Batch check from file") p_batch.add_argument("file") p_batch.add_argument("--state-dir", default="/tmp/monitor-state") ``` ### Technical Analysis The monitor makes outbound requests to user-controlled URLs without validating the URL scheme, hostname, port, or resolved IP address. It also enables automatic redirects through `allow_redirects=True` without validating each redirect destination. An attacker who can influence a direct command argument or an entry in a batch file can caus ...[truncated 1908 chars]- Remediation
View remediation
