T09 · Insecure Skill Coding Practices
- Location
save_article_to_miaoyan.py:57- Finding
Unrestricted URL Fetching Enables SSRF and Local File Access
- Content
View full analysis
str: """Use curl to fetch content directly.""" cmd = [ "curl", "-s", "-L", "--max-time", "20", "-H", "User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/120.0.0.0 Safari/537.36", "-H", "Accept: text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8", "-H", "Accept-Language: zh-CN,zh;q=0.9,en;q=0.8", url ] result = subprocess.run(cmd, capture_output=True, text=True) if result.returncode != 0: raise Exception(f"curl failed: {result.stderr}") return result.stdout ``` The unrestricted fetch is reachable through the fallback sequence: ```python def fetch_article(url: str) -> dict: """Fetch article content using multiple methods.""" site_type = detect_site_type(url) html = None method = None try: html = fetch_with_jina(url) if html and len(html) > 100: method = 'jina' print(f"✅ 使用 Jina Reader 抓取成功") except Exception as e: print(f"⚠️ Jina 抓取失败: {e}") if not html or len(html) < 100: try: html = fetch_with_curl(url) if html and len(html) > 100: method = 'curl' print(f"✅ 使用 curl 抓取成功") except Exception as e: print(f"⚠️ curl 抓取失败: {e}") if not html or len(html) < 100: try: html = fetch_with_tavily(url) if html and len(html) > 100: method = 'tavily' print(f"✅ 使用 Tavily 抓取成功") except Exception as e: print(f"⚠️ Tavily 抓取失败: {e}") if not html or len(html) < 100: raise Exception("所有抓取方式都失败了") if me ...[truncated 2939 chars]- Remediation
View remediation
