T09 · Insecure Skill Coding Practices
- Location
src/detail_fetcher.py:94- Finding
Unrestricted URL Fetching Enables Server-Side Request Forgery
- Content
View full analysis
Optional[Dict]: """ 获取单个技能详情 Args: url: 技能详情页 URL skill_info: 技能基本信息 Returns: 技能详情字典或 None """ if not skill_info: skill_info = {} try: response = self.session.get(url, timeout=self.timeout) response.raise_for_status() html_content = response.text # 解析页面 detail = self.parse_detail_page(html_content, url, skill_info) return detail ``` ### Technical Analysis `fetch_detail_page()` sends a request to the supplied `url` without validating its scheme, hostname, port, resolved IP address, or relationship to the expected `skills.sh` service. The `requests` session also follows redirects by default. The method is called by `fetch_top20_details()`, which accepts URLs directly from skill dictionaries: ```python url = skill.get("url", "") if not url: # 尝试构建 URL name = skill.get("name", "") owner = skill.get("owner", "") url = f"{self.base_url}/{owner}/{name}" detail = self.fetch_detail_page(url, skill) ``` Consequently, any caller capable of supplying or modifying a skill dictionary can cause the process to connect to arbitrary destinations. Potential targets include loopback services, private network systems, link-local addresses, and cloud instance metadata endpoints. Redirects from an initially permitted-looking address can also lead the request to an internal destination. The response body is retained in the returned `html_content` field, making this more than blind SSRF: accessible internal response data may be exposed to the caller. ### Attack Path 1. An attacker gains control over a skill dictionary passed to `fetch_top20_details()` or direc ...[truncated 1250 chars]- Remediation
View remediation
