T09 · Insecure Skill Coding Practices
- Location
scripts/goldmine.py:190- Finding
Unrestricted Browser Navigation Enables Server-Side Request Forgery
- Content
View full analysis
tuple: """从 URL 获取内容""" try: from playwright.sync_api import sync_playwright with sync_playwright() as p: browser = p.chromium.launch() page = browser.new_page() page.goto(url, wait_until="networkidle", timeout=30000) page.wait_for_timeout(2000) content = page.evaluate("document.getElementById('js_content')?.innerText || ''") title = page.title() browser.close() if not content: return None, None return content, title except ImportError: print("错误: 需要安装 playwright (pip install playwright && playwright install chromium)") return None, None except Exception as e: print(f"抓取失败: {e}") return None, None ``` The untrusted URL is accepted and passed to this function without validation: ```python parser.add_argument("url", nargs="?", help="要拆解的内容URL") ``` ```python elif args.url: content, title = fetch_content_from_url(args.url) if not content: sys.exit(1) source_name = source_name or title print(f"成功抓取: {title}") ``` ### Technical Analysis The script passes a user-controlled URL directly to Playwright's `page.goto()` method. It does not validate: - The URL scheme. - The requested hostname. - Whether the hostname resolves to a loopback, private, link-local, or otherwise restricted address. - Redirect destinations. - The response content type or size. - Whether the destination belongs to the documented WeChat domain. A headless browser request originates from the environment running the Skill and therefore inherits that environment's network reachability. An attacker who ca ...[truncated 2180 chars]- Remediation
View remediation
