Summary
A server-side request forgery (SSRF) vulnerability in Agentscope up to version 1.0.18 allows attackers to abuse the Cloud Metadata Endpoint via the _parse_url, prepare_image, and openai_audio_to_text functions to make arbitrary outgoing HTTP requests.
By manipulating the image_url or audio_file_url parameters, a remote attacker may coerce the service into contacting internal or otherwise restricted network resources on their behalf.
Affected context
The vulnerability occurs in Agentscope deployments that expose functionality for processing remote image or audio resources through the Cloud Metadata Endpoint.
When user-supplied URLs (image_url / audio_file_url) are accepted and fetched by the backend without strict validation or isolation, the server becomes a proxy capable of reaching internal services.
This is especially risky in environments where the application can access cloud instance metadata services, internal APIs, or other sensitive resources on private networks.
Exploit preconditions
- Attack surface: Network-accessible endpoints that accept
image_urloraudio_file_urlparameters and trigger_parse_url,prepare_image, oropenai_audio_to_text. - Required access: Ability to send crafted requests to the application (typically unauthenticated or low-privilege, depending on deployment configuration).
- Trigger point: The application attempts to fetch or process the remote resource at the supplied URL.
- Why exploitation is possible: URL inputs are treated as trusted destinations, with insufficient filtering, allow-listing, or network-level isolation, enabling requests to arbitrary (including internal) hosts and protocols.
Why this happens
The core issue aligns with CWE-918: Server-Side Request Forgery, where a server-side component issues HTTP or related network requests based on user-controlled URLs.
In this case, helper functions such as _parse_url, prepare_image, and openai_audio_to_text appear to accept URLs and forward them to network-fetching logic without robust destination validation or contextual restrictions.
This insecure pattern allows external users to influence where the server connects, effectively turning the application into an unwilling proxy to reach internal networks, metadata endpoints, or other protected infrastructure.
Potential impact
- Access to internal HTTP services that are not directly exposed to the internet
- Interaction with cloud provider metadata services, potentially leaking credentials or instance configuration
- Discovery and mapping of internal network topology via response behavior
- Bypassing IP-based access controls or firewalls by leveraging the server's network position
- Potential chaining with other vulnerabilities (e.g., internal admin endpoints) for privilege escalation
General mitigation guidance
Effective mitigation generally focuses on strict control over outbound requests initiated from user-supplied URLs and on limiting trust in remote resources:
- Prefer an allow-list of safe domains and URL schemes rather than attempting to block known-bad patterns.
- Enforce URL parsing and validation that rejects private IP ranges, loopback addresses, link-local ranges, and non-HTTP(S) protocols where not explicitly required.
- Use network-level egress controls (such as firewall rules or VPC service controls) to prevent application containers from reaching metadata services and sensitive internal subnets.
- Isolate URL-fetching functionality into a minimal-privilege service or sandbox with tightly constrained outbound connectivity.
- Normalize and re-validate URLs after redirects, or disable following redirects where possible to avoid redirect-based SSRF bypasses.
- Treat remote media ingestion (images, audio, etc.) as untrusted input and avoid embedding it directly in privileged workflows without additional checks.
How teams detect issues like this
High-level detection for SSRF issues typically combines code-level analysis with behavioral monitoring:
- Static analysis and code review:
- Flag usage of HTTP client libraries (e.g.,
requests,httpx,urllib, or cloud SDKs) where the target URL is derived from user-controllable parameters such asimage_urlandaudio_file_url. - Look for missing checks against private IP ranges, loopback, and non-HTTP(S) schemes in URL parsing utilities like
_parse_url. - Review any "URL proxy", "image fetch", or "media download" utilities to ensure they enforce allow-lists and egress restrictions.
- Runtime monitoring:
- Monitor outbound traffic from application instances for unusual destinations (e.g., 169.254.169.254, RFC1918 ranges, or unexpected internal hostnames).
- Use network policies or egress proxies that log and, where necessary, block connections to sensitive endpoints.
- Security testing:
- Incorporate SSRF test cases into routine penetration testing and automated DAST, focusing on parameters that accept URLs or file references.
Automated application security tools and custom static analysis rules can assist in flagging SSRF-prone patterns early in development and during CI.

