Описание
praisonaiagents has an SSRF protection bypass in spider_tools._host_is_blocked() via DNS-resolved hostnames (127.0.0.1.nip.io)
Summary
praisonaiagents/tools/spider_tools.py contains an SSRF protection bypass. The function
_host_is_blocked() validates URLs against a list of blocked IP literals and hostname
aliases, but never performs DNS resolution. Any hostname that resolves to a private or
loopback IP address — including public wildcard DNS services like 127.0.0.1.nip.io —
bypasses the protection entirely.
This has been confirmed with a live exploit: scrape_page("http://127.0.0.1.nip.io:PORT/secret")
makes an HTTP request to 127.0.0.1:PORT and returns the internal service response.
No attacker-controlled infrastructure is required.
scrape_page, extract_links, crawl, and extract_text are all registered as
LLM-callable agent tools (see tools/__init__.py lines 51-55), so any agent instructed
to fetch a user-supplied URL will trigger this path.
This is a new bypass of prior fix commit 004dcfef (GHSA-q9pw-vmhh-384g), which only
rejected IP literal encoding tricks (hex, octal, backslash). The fix was also applied to
web_crawl_tools.py (line 231: socket.gethostbyname call), but that fix was not
ported to spider_tools.py.
Details
Root cause — spider_tools.py lines 26-65:
socket.inet_aton() only converts dotted-decimal strings, not hostnames. For any real
hostname (e.g. 127.0.0.1.nip.io), both ipaddress.ip_address() and socket.inet_aton()
raise exceptions, and the function returns False (not blocked).
Contrast with the fixed version in web_crawl_tools.py line 228-238:
Tool registration confirms this is user-reachable:
Any agent given these tools will call scrape_page(url) when instructed to fetch
a user-supplied URL — including attacker-controlled ones.
PoC
Environment: Python 3.x, praisonaiagents <= 1.6.52, internet access (for nip.io)
Step 1 — Verify the filter bypass (no network needed):
Expected output:
Step 2 — Full SSRF: internal service response exfiltrated
Observed output:
Step 3 — Agent-level trigger (how a user triggers this in production):
Additional bypass URLs (no setup required):
| Target | URL |
|---|---|
| Localhost | http://127.0.0.1.nip.io/ |
| Private network | http://10.0.0.1.nip.io/ |
| AWS IMDS (via sslip.io) | http://169-254-169-254.sslip.io/latest/meta-data/iam/security-credentials/ |
Impact
What kind of vulnerability: Server-Side Request Forgery (SSRF) — full read SSRF with arbitrary port access.
Who is impacted: Anyone deploying PraisonAI agents that include scrape_page,
extract_links, crawl, or extract_text tools and accept user-supplied URLs. This
includes:
- Web research agents (the primary intended use case for spider tools)
- Jobs API users — any authenticated API caller who submits jobs with
agent_yamlspecifying spider tools - Cloud deployments (Critical escalation): On AWS EC2 with IMDSv1, fetching
http://169-254-169-254.sslip.io/latest/meta-data/iam/security-credentials/may return temporary IAM credentials, leading to full cloud account compromise.
Severity note: This is a patch-gap variant. The SSRF protection was correctly
implemented for IP literals and enhanced in commit 004dcfef for encoding bypasses.
The DNS resolution check was added to web_crawl_tools.py but was missed in
spider_tools.py, creating an exploitable inconsistency.
Пакеты
praisonaiagents
< 1.6.58
1.6.58
Связанные уязвимости
PraisonAI is a multi-agent teams system. Prior to praisonaiagents 1.6.58, spider_tools._host_is_blocked() does not resolve ordinary hostnames before scrape_page fetches them. A hostname such as 127.0.0.1.nip.io passes validation and resolves to loopback, permitting internal HTTP access. The fix uses socket.getaddrinfo and fails closed on DNS errors. This issue is fixed in version 1.6.58.