GHSA-h6gw-8f77-mmmp WeKnora has DNS Rebinding Vulnerability in web_fetch Tool that Allows SSRF to Internal Resources
SummaryA DNS rebinding vulnerability in the `web_fetch` tool allows an unauthenticated attacker to bypass URL validation and access internal resources on the server, including private IP addresses (e.g., 127.0.0.1, 192.168.x.x). By crafting a malicious domain that resolves to a public IP during validation and subsequently resolves to a private IP during execution, an attacker can access sensitive local services and potentially exfiltrate data.DetailsThe vulnerability exists because the `web_fetch` tool lacks complete DNS pinning. The application performs URL validation only once via `validateParams()`, but the URL is then passed unchanged to the `fetchHTMLContent()` function, which eventually reaches `fetchWithChromedp()`. The headless browser (Chromedp) resolves the hostname independently without DNS pinning, allowing a time-of-check-time-of-use (TOCTOU) attack.**Validation phase (first DNS resolution):****Execution phase (second DNS resolution):**
The original URL (not the resolved IP) is passed through the execution chain:**Chromedp execution (vulnerable DNS resolution):**The attacker controls a domain that can be configured to return different DNS responses to different queries, enabling them to bypass the initial private IP check and access restricted resources during the actual fetch.PoC**Setup:**Deploy the DNS rebinding server (attached Python file) with the following systemd configuration:This configures the DNS server to:Return `1.1.1.1` (a public IP) for the first DNS queryReturn `127.0.0.1` (localhost) for all subsequent queriesTTL is set to 0 to prevent cachingThe sequence can also be reset via reset.domain.com (reset to 1.1.1.1).Note: We may need to reset the sequence as the TOCTOU attack is not truly reliable and needs to be triggered multiple times.Set up a simple HTTP server on the localhost of the backend service:Configure the malicious domain to point to the DNS rebinding server**Execution:**Enable web search on an agent.Prompt the agent to fetch content from the attacker-controlled domain (e.g., `http://attacker.example.com`)The sequence of events:**First DNS query** (validation phase): `attacker.example.com` → `1.1.1.1` ✓ Passes validation**Second DNS query** (execution phase): `attacker.example.com` → `127.0.0.1` ✗ Bypass achievedThe `web_fetch` tool successfully connects to `127.0.0.1:8080` and returns the local server's content**Result:**
The attacker gains access to the local HTTP server and can read its content, demonstrating that internal resources are now accessible through the rebinding attack.PoC video:https://github.com/user-attachments/assets/68daaa87-4b9b-4b6e-b6f6-ee123f5fcda9Impact**Vulnerability Type:** DNS Rebinding / Server-Side Request Forgery (SSRF)**Who is impacted:**Any user or agent with web search capability can exploit this vulnerabilityThe vulnerability grants access to internal services, configuration files, metadata services, and other sensitive resources normally restricted to the internal networkIn cloud environments, this could allow access to metadata endpoints (e.g., AWS IMDSv1) to obtain credentials and secrets\
CVSS v3.1 score: 7.5