Summary
PraisonAI's FileTools.download_file() method can be abused to perform server-side request forgery (SSRF) because it forwards an attacker-controlled URL directly to httpx.stream() with redirects enabled.
If an attacker can influence the URL parameter, they may coerce the server into making requests to internal services or cloud metadata endpoints that are not directly exposed to the attacker.
Affected context
This vulnerability affects PraisonAI deployments that expose or indirectly use FileTools.download_file() with user-controlled or externally influenced URLs.
It is most relevant when the PraisonAI process can reach internal network resources or cloud provider metadata services that are not publicly accessible.
The risk increases when the application runs in a privileged network zone, has broad outbound access, or when downloaded responses are further processed in security-sensitive ways.
Exploit preconditions
- Attack surface: Any API, tool, agent, or workflow that accepts a URL parameter and passes it—directly or indirectly—to FileTools.download_file().
- Required access: Ability to supply or manipulate the URL argument (e.g., via HTTP request parameters, prompt-injected tool calls, configuration, or task definitions).
- Trigger point: Invocation of FileTools.download_file() which calls
httpx.stream(url, follow_redirects=True)on the attacker-controlled URL. - Why exploitation is possible: The URL is not validated or restricted to safe domains or schemes, and automatic redirect following allows the attacker to pivot from benign-looking URLs to internal or sensitive endpoints.
Why this happens
The core issue is unvalidated, attacker-controlled URL input being used as the target of an outbound HTTP request from a trusted server environment.
FileTools.download_file() verifies only the destination file path but does not constrain the URL's host, scheme, or redirect behavior before passing it to httpx.stream() with follow_redirects=True.
This aligns with CWE-918: Server-Side Request Forgery (SSRF), where a server makes arbitrary HTTP requests on behalf of an attacker, effectively exposing internal network resources and cloud metadata services that are otherwise inaccessible.
Potential impact
- Access to cloud provider metadata endpoints, potentially exposing credentials, tokens, or instance configuration.
- Interaction with internal HTTP services (e.g., admin panels, databases with HTTP interfaces, internal APIs, or service meshes) that are not publicly reachable.
- Discovery of internal network structure and service inventory through response-based probing.
- Use of the application server as a pivot point for further attacks inside the infrastructure.
- Potential data exfiltration or configuration manipulation if internal services trust the server's network location.
General mitigation guidance
Effective mitigation focuses on constraining where the server is allowed to send outbound HTTP requests and how URLs are handled:
- Introduce strict URL validation and allowlisting, limiting outbound requests to explicitly approved domains and schemes.
- Block or heavily restrict access to link-local and private address ranges (e.g., 169.254.0.0/16, 10.0.0.0/8, 192.168.0.0/16, 172.16.0.0/12, localhost).
- Disable or tightly control automatic redirect following, or re-validate targets after each redirect.
- Enforce network-level egress controls (firewalls, security groups, service mesh policies) to prevent the application from reaching sensitive internal or metadata endpoints.
- Treat any content fetched from remote URLs as untrusted, avoiding implicit trust or high-privilege processing of downloaded data.
How teams detect issues like this
Detection typically involves a combination of code-level analysis and runtime monitoring:
- Static analysis and code review:
- Search for HTTP client calls (e.g., httpx, requests) that take unvalidated URL parameters, especially with
follow_redirects=True. - Flag locations where URLs from user input, prompts, configs, or tool calls are passed directly into outbound requests without allowlists or scheme/host checks.
- Review helper utilities like FileTools for generic "download" or "fetch" methods that may be reused across the codebase.
- Runtime monitoring and logging:
- Log outbound HTTP requests, including destination hosts and paths, and alert on requests to internal IP ranges or metadata endpoints.
- Use network telemetry or egress proxies to detect unusual patterns, such as repeated access to 169.254.169.254 or other internal-only services.
- Security testing:
- Incorporate SSRF test cases into application security testing and CI pipelines, especially for endpoints that accept URLs or trigger tool executions.

