T09 · Insecure Skill Coding Practices
- Location
scripts/qzone_photos.py:496- Finding
Unrestricted Authenticated URL Retrieval Enables SSRF and Resource Exhaustion
- Content
View full analysis
str: """Download a single photo to the output directory.""" os.makedirs(output_dir, exist_ok=True) if not filename: filename = photo_url.split("/")[-1].split("?")[0] if not filename: filename = f"photo_{int(time.time() * 1000)}.jpg" filepath = os.path.join(output_dir, filename) resp = session.get(photo_url, stream=True) ``` The vulnerable function is called directly with the user-supplied `--url` argument: ```python elif args.action == "download": if not args.url: print("Error: --url is required for download action") sys.exit(1) path = download_photo(session, args.url, args.output) ``` ### Technical Analysis The `download` action accepts an arbitrary URL and requests it through an authenticated `requests.Session`. The implementation does not validate: - The URL scheme. - The destination hostname. - Whether the resolved address is loopback, private, link-local, or otherwise reserved. - Redirect destinations. - Whether the destination is an approved QQ photo or CDN endpoint. - Response size or content type. - Connection and read timeouts. Consequently, an attacker who can influence an Agent invocation can cause the process to issue HTTP requests to internal or local services. Because the same session contains cookies scoped to `.qq.com`, requests to eligible QQ subdomains may also carry the user's QQ authentication cookies. Arbitrary external hosts normally will not receive domain-scoped QQ cookies, but unrestricted redirects and broad destination support still create an unnecessary credential exposure surface. The lack of a respo ...[truncated 1541 chars]- Remediation
View remediation
