Summary
SiYuan versions before 3.8.1 contain a server-side request forgery vulnerability in the http_request and web_fetch agent tools. An attacker may use DNS rebinding to bypass hostname checks and make the server connect to private network services or cloud instance metadata endpoints.
Affected context
The issue occurs in SiYuan deployments where the http_request or web_fetch agent tools can retrieve attacker-influenced URLs. The defense performs DNS resolution during an initial guard check but does not ensure that the address used at connection time is the same approved public address. This gap may become risky when the runtime can reach private networks or cloud metadata services.
Exploit preconditions
- Attack surface: SiYuan agent tools that fetch attacker-influenced URLs
- Required access: The ability to invoke or influence requests made through
http_requestorweb_fetch - Trigger point: URL validation followed by the subsequent network connection
- Why exploitation is possible: DNS answers can change between the guard-time lookup and the connect-time lookup, allowing a public address to pass validation while a private or metadata address is used for the connection
Why this happens
The vulnerability is caused by a time-of-check/time-of-use gap in SSRF protection. SiYuan validates the result of one DNS resolution but does not bind that validated result to the address used for the connection. Under DNS rebinding conditions, the later resolution may return an internal destination, mapping to CWE-918: Server-Side Request Forgery because server-side network access is performed without reliable destination validation.
Potential impact
- Attackers may access cloud instance metadata
- Attackers could retrieve credentials or configuration from internal services
- Internal network services may be exposed to unauthorized requests
- Sensitive information may be disclosed through response handling
- Compromised internal endpoints could enable further lateral movement
General mitigation guidance
Mitigation generally focuses on making SSRF destination checks authoritative at connection time rather than relying on an earlier DNS lookup.
Common defensive patterns include:
- Resolve and validate destinations as part of the connection process
- Bind the approved address to the actual socket connection where supported
- Revalidate redirects and every subsequent destination
- Reject loopback, link-local, private, reserved, and metadata address ranges by default
- Restrict outbound network access from the application with egress controls
- Limit agent tools to approved schemes, hosts, and ports
- Run the service with minimal network and cloud identity privileges
- Avoid exposing response bodies from sensitive internal endpoints to untrusted callers
How teams detect issues like this
Organizations can look for SSRF risks through:
- Static analysis of URL-fetching code that separates DNS validation from connection establishment
- Code review signals such as hostname-only allowlists, unrestricted redirects, and repeated DNS lookups
- Tests that cover DNS changes, IPv4 and IPv6 private ranges, redirects, and cloud metadata destinations
- Network monitoring for unexpected outbound connections to private address space or metadata endpoints
- Egress policies that alert on or block application traffic to restricted network ranges
Automated security review tools may help identify unsafe URL-fetching patterns, but runtime network controls remain important because DNS behavior depends on deployment conditions.

