T09 · Insecure Skill Coding Practices
- Location
scripts/crawl.py:216- Finding
Arbitrary URL Crawling Enables SSRF and External Disclosure of Retrieved Content
- Content
View full analysis
tuple[str | None, str]: try: resp = session.get(url, timeout=timeout, allow_redirects=True) resp.raise_for_status() content_type = resp.headers.get("content-type", "") if "text/html" not in content_type and "application/xhtml" not in content_type: return None, f"non-HTML content-type: {content_type}" return resp.text, "ok" except requests.exceptions.Timeout: return None, "timeout" except requests.exceptions.HTTPError as e: return None, f"HTTP {e.response.status_code}" except Exception as e: return None, str(e) ``` ```python page = context.new_page() page.goto(url, timeout=timeout_ms, wait_until="networkidle") page.wait_for_timeout(wait_ms) html = page.content() ``` ```python parser.add_argument("--url", required=True, help="Seed URL to start crawling from") ``` Retrieved content is subsequently incorporated into an Anthropic API request: ```python return f"""Documentation section from: {chunk['page_title']} ({chunk['url']}) Section heading: {chunk['section']} --- Content --- {chunk['text'][:3000]} {codes_text} --- End --- ``` ```python response = client.messages.create( model=model, max_tokens=1024, system=SYSTEM_PROMPT, messages=[{"role": "user", "content": _build_user_prompt(chunk)}], ) ``` ### Technical Analysis The crawler accepts an arbitrary HTTP or HTTPS seed URL and performs requests without resolving and validating the destination address. It does not reject loopback, private, link-local, reserved, or cloud-internal address r ...[truncated 2440 chars]- Remediation
View remediation
