T05 · Unauthorized Access and Privilege Escalation
- Location
src/xhs_skill/providers/openai_images.py:82- Finding
Provider-Controlled Image URL Enables Server-Side Request Forgery and Unbounded Download
- Content
View full analysis
bytes: client = await get_http_pool().get() response = await client.get(url, timeout=120.0) response.raise_for_status() content = response.content if not content: raise RuntimeError("Image URL download returned empty body") return content ``` ### Technical Analysis The image-generation provider can return either base64 image data or a URL. When it returns a URL, the Skill requests that URL without applying `validate_public_url()`, restricting the destination to approved image hosts, or rejecting loopback, link-local, private, and reserved addresses. Although the shared HTTP client disables redirects, this does not prevent direct requests to destinations such as loopback services, private network services, or cloud instance metadata addresses. The response is also read into memory in its entirety through `response.content`. There is no maximum response-size limit, and the received bytes are written with a `.png` extension without validating the response content type or decoding the data as an image. ### Attack Path 1. An attacker controls, compromises, or impersonates a configured OpenAI-compatible image provider. 2. The user invokes cover-image generation. 3. The provider returns an item without `b64_json` but with a URL pointing to an internal service, ...[truncated 965 chars]- Remediation
View remediation
