T09 · Insecure Skill Coding Practices
- Location
scripts/summarize_article.py:72- Finding
Unrestricted URL Retrieval Enables SSRF, Local File Access, and Curl Option Injection
- Content
View full analysis
str: commands = [ [ "curl", "-L", "--silent", "--show-error", "-A", "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/145.0.0.0 Safari/537.36", url, ], [ "curl", "-L", "--silent", "--show-error", "--http1.1", "-A", "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/145.0.0.0 Safari/537.36", url, ], ] last_error = None for command in commands: try: result = subprocess.run(command, check=True, capture_output=True, text=True) return result.stdout except subprocess.CalledProcessError as exc: last_error = exc raise last_error ``` ```python def read_input(url: str | None, file_path: str | None): if url: raw_html = run_curl(url) title = extract_title(raw_html) text = extract_text(raw_html) return title, url, text ``` The primary extraction script imports and invokes this behavior: ```python parser.add_argument("--url", help="Article URL") ... title, source, article_text = read_input(args.url, args.file) ``` ### Technical Analysis The user-controlled URL is passed directly to `curl` without validating its scheme, destination host, resolved IP address, port, or redirect target. The use of `-L` automatically follows redirects, but redirected destinations are not revalidated. Consequently, the fetcher can potentially access: - Loopba ...[truncated 1781 chars]- Remediation
View remediation
