T09 · Insecure Skill Coding Practices
- Location
SKILL.md:28- Finding
Unrestricted Remote Media Retrieval Can Expose Internal Resources
- Content
View full analysis
Vulnerability Details
File Location:
SKILL.md, lines 28–35
Vulnerability Type: Server-Side Request Forgery and unintended data disclosure
Risk Level: HighVulnerable Code
bash From a URL (download it first, then upload the bytes): ```bash curl -sL "https://example.com/photo.jpg" -o /tmp/m.jpg curl -X POST https://api.postlake.dev/v1/media \ -H "Authorization: Bearer $POSTLAKE_API_KEY" \ -H "Content-Type: image/jpeg" \ --data-binary @/tmp/m.jpgTechnical Analysis
The documented workflow instructs the agent to retrieve a URL with
curl -sL. The-Loption follows redirects automatically, but the workflow does not validate the original destination or subsequent redirect targets. It also provides no restriction on schemes, hostnames, resolved IP addresses, response sizes, or actual response content.If the media URL can be influenced by an untrusted user, it may reference a service available only from the agent's execution environment, including loopback interfaces, private-network services, or cloud metadata endpoints. An apparently legitimate public URL could also redirect to such a destination.
The response is subsequently uploaded to PostLake. This turns the workflow into a potential data-exfiltration channel because content retrieved from an internal destination is transmitted to an external service.
Attack Path
- An attacker supplies a media URL to the agent or controls a URL used by the workflow.
- The supplied URL targets an internal resource directly or redirects to localhost, a private network address, a link-local address, or a cloud metadata endpoint.
- The agent runs the documented
curl -sLcommand and retrieves the resource from its privileged network position. - The retrieved bytes are stored in
/tmp/m.jpg. - The workflow uploads those bytes to
https://api.postlake.dev/v1/media. - If the attacker can access the resulting media object, associat ...[truncated 635 chars]
- Remediation
View remediation
Remediation Suggestions
- Accept remote media only from explicitly trusted HTTPS hosts.
- Resolve the destination before connecting and reject loopback, link-local, private, multicast, unspecified, and reserved IP ranges for both IPv4 and IPv6.
- Disable automatic redirects or validate the hostname and resolved address at every redirect hop.
- Protect against DNS rebinding by ensuring that the validated address is the address used for the connection.
- Enforce strict download size and timeout limits.
- Verify the actual file signature and MIME type rather than relying on the URL suffix or declared content type.
- Require explicit user confirmation before fetching and externally uploading content from a user-provided URL.
- Where practical, perform remote retrieval through a dedicated, network-isolated media proxy that cannot access internal services or cloud metadata endpoints.
