The vulnerability is a Server-Side Request Forgery (SSRF) in the crawl4ai package, specifically within the Docker API server. The root cause is an incomplete validation mechanism for URLs provided by the user. The functions validate_webhook_url and its wrapper validate_url_destination in deploy/docker/utils.py were intended to prevent requests to internal network resources. However, the implementation had two main flaws:
- Incomplete Blocklist: The validation relied on an explicit blocklist of CIDR ranges which was not exhaustive.
- Insufficient IPv6 Handling: The helper function
_expand_ip_candidates failed to correctly identify internal IPv4 addresses embedded within various IPv6 transition formats, such as NAT64, 6to4, and the IPv6 unspecified address (::).
An attacker could exploit this by providing a specially crafted URL containing an IPv6 address that, when resolved by the server, would point to an internal service (e.g., 169.254.169.254). Because the validation logic did not recognize these IPv6 formats, the request would be allowed, leading to an SSRF vulnerability.
The patch addresses this by completely replacing the blocklist approach. The new implementation in validate_webhook_url checks if the resolved IP address is a globally routable address using the is_global property. Furthermore, the _expand_ip_candidates function was rewritten to correctly parse and check all relevant IPv6 transition formats. This ensures that any URL resolving to a non-global (i.e., private, reserved, or internal) IP address is blocked, effectively closing the SSRF vulnerability.