The vulnerability is a Server-Side Request Forgery (SSRF) bypass in the fetch_url tool of DeepSeek TUI. The core of the issue lies in the validate_fetch_target function located in crates/tui/src/tools/fetch_url.rs. This function is responsible for ensuring that the URL provided to the fetch_url tool does not point to a restricted internal or loopback IP address.
The vulnerability arises from the fact that the validation logic did not correctly handle IPv6 addresses when they were provided in the standard bracketed format (e.g., http://[::1]/). The code attempted to parse the host part of the URL directly as an IP address. For a URL like http://[::1]/, the host is [::1]. The std::net::IpAddr::parse function in Rust does not handle these brackets, so the parsing would fail. Consequently, the code would not enter the block where it checks if the IP is restricted, effectively bypassing the SSRF protection.
The patch addresses this by explicitly stripping the [ and ] characters from the hostname before attempting to parse it as an IP address. This ensures that bracketed IPv6 literals are correctly normalized and subjected to the same security policy as other IP addresses, preventing the bypass.