T09 · Insecure Skill Coding Practices
- Location
scripts/scan.py:43- Finding
Unrestricted URL Fetching Enables Server-Side Request Forgery
- Content
View full analysis
Optional[requests.Response]: """安全的 HTTP GET 请求""" try: resp = self.session.get(url, timeout=self.timeout, allow_redirects=True, **kwargs) return resp except RequestException: return None def safe_head(self, url: str) -> Optional[requests.Response]: """安全的 HTTP HEAD 请求""" try: resp = self.session.head(url, timeout=self.timeout, allow_redirects=True) return resp except RequestException: return None ``` The sitemap check also follows URLs supplied by the scanned server: ```python def check_sitemap(self) -> CheckResult: """检查 sitemap.xml 是否存在""" # 先尝试从 robots.txt 获取 sitemap URL robots_resp = self.safe_get(f"{self.base_url}/robots.txt") sitemap_urls = [] if robots_resp and robots_resp.status_code == 200: for line in robots_resp.text.splitlines(): if line.lower().startswith('sitemap:'): sitemap_urls.append(line.split(':', 1)[1].strip()) if not sitemap_urls: sitemap_urls = [f"{self.base_url}/sitemap.xml"] for url in sitemap_urls: resp = self.safe_get(url) ``` ### Technical Analysis The scanner accepts a user-controlled target and performs numerous requests without validating the destination hostname or resolved IP addre ...[truncated 2453 chars]- Remediation
View remediation
