GHSA-4pcv-mg8v-vrgf PraisonAI: Server-Side Request Forgery (SSRF) in SearxNG / search_web tools via attacker-controlled searxng_url parameter
SummaryA Server-Side Request Forgery (SSRF) vulnerability in the SearxNG / `search_web` search tools allows an attacker to make the server perform requests to arbitrary internal endpoints and read the responses back. The `searxng_url` argument is passed directly to `requests.get()` with no validation of scheme, host, or port. Because `searxng_url` is exposed to the LLM as a tool parameter and `search_web` / `searxng_search` are part of the default agent toolset, the vulnerability is reachable through prompt injection in any content an agent ingests (web pages, files, tool output). This enables reading internal services and APIs, internal host/port enumeration, and in cloud environments reachability of the instance metadata endpoint (169.254.169.254) with potential IAM/credential exposure.DetailsThe SearxNG search provider performs no validation on the `searxng_url` argument before issuing the HTTP request.`src/praisonai-agents/praisonaiagents/tools/searxng_tools.py` (lines 16–47):The same unvalidated pattern exists in the unified `search_web` dispatcher:`src/praisonai-agents/praisonaiagents/tools/web_search.py` (lines 235–247):`searxng_url` is accepted as a parameter on the public `search_web()` entry point (`web_search.py`, line 277) and is forwarded through to the request (`web_search.py`, line 357).This parameter is attacker-controllable via the LLM:`searxng_url` is a real function parameter (`searxng_tools.py:19`, `web_search.py:277`).The tool-schema generator exposes **all** function parameters to the model,  only `self`/`*args`/`**kwargs` are skipped (`src/praisonai-agents/praisonaiagents/llm/llm.py:5968`).`search_web` is part of the default tool profile (`src/praisonai-agents/praisonaiagents/tools/profiles.py:68`).Therefore an agent that ingests attacker-controlled content can be coerced into calling `search_web(...)` with an internal/attacker-chosen `searxng_url`, and the response body is parsed and returned into the agent's context.PoCThe following reproduces the vulnerability against the real `searxng_search()` source. It spins up a fake internal service simulating an internal API/admin endpoint, then demonstrates that an attacker-controlled `searxng_url` causes the tool to fetch it and return the response to the caller.Observed output (confirmed by the reviewer):The internal service's response body (`INTERNAL_SECRET` / `SSRF_TEST-12345`) is returned to the caller, confirming that responses from attacker-selected endpoints are processed and returned to the caller.Additional observations:A closed internal port (e.g. `http://127.0.0.1:65535/x`) returns a distinct `"Could not connect ..."` error, while an open port returns data, yielding an open/closed oracle for internal host/port enumeration.The cloud metadata endpoint is reachable: `searxng_url="http://169.254.169.254/latest/meta-data/iam/security-credentials/"` results in a connection attempt whose outcome depends only on whether something answers, not on any validation.Only non-`http(s)://` schemes (e.g. `file:///etc/passwd`) are rejected, incidentally, by the `requests` library, not by any check in the tool.Realistic exploit path (prompt injection):ImpactThis is a Server-Side Request Forgery (SSRF) vulnerability. It impacts any deployment of `praisonaiagents` where agents are given the default `search_web` tool and ingest content from untrusted sources , i.e. the common case of agents that browse the web, read files, or process tool output / messages.**Internal service / API access:** arbitrary internal endpoints that return JSON can be read by the attacker (admin panels, internal APIs). The response body is returned to the agent.**Internal network enumeration:** open vs closed ports are distinguishable via different error responses, enabling host/port mapping of internal services.**Cloud credential exposure:** the instance metadata endpoint (`169.254.169.254`) is reachable; depending on the cloud provider and IMDS configuration, this can lead to IAM/credential theft. (Note: because the tool parses `response.json().get('results', [])`, raw metadata without a `results` key is not dumped verbatim — so for the metadata service this is primarily request-side reachability/side-channel rather than a clean credential dump; the clean full-read applies to internal JSON services and APIs.)**No misconfiguration required:** the vulnerability is reachable through the default toolset via prompt injection, not only through a misconfigured server.
CVSS v3.1 score: 8.8