Executive brief
CodeWhale is an AI agent framework that includes URL fetching capabilities with SSRF protections via DNS pinning. An attacker controlling a custom DNS server can bypass these protections by failing initial DNS resolution checks (Time of Check) while allowing secondary lookups (Time of Use) to resolve to local IP addresses, enabling the agent to access private services and cloud credentials.
Technical details
This is a Time of Check to Time of Use (TOCTOU) race condition affecting CodeWhale's DNS pinning security feature in the fetch_url component. The vulnerability exists in code that attempts to prevent SSRF attacks by resolving hostnames and caching their IP addresses. However, when an initial DNS resolution fails, the code is allowed to proceed on the assumption that subsequent resolution attempts will also fail. An attacker controlling the DNS server can exploit this by returning NXDOMAIN (failure) responses to initial A/AAAA queries but then returning a local IP address (e.g., 127.0.0.1) on subsequent requests. This allows the attacker to bypass DNS pinning and craft requests to localhost or other restricted addresses. The fix was released in version 0.8.64 (commit 26de44a8bd5051f8f944ea60b2c37ae1d2b7d25e). Attack requires the target application to use a DNS server under the attacker's control, and the attacker must invoke a URL fetch operation.
Affected products
- Hmbown CodeWhale >= 0.8.41, < 0.8.64
- npm codewhale >= 0.8.41, < 0.8.64
- Rust codewhale-tui >= 0.8.41, < 0.8.64
- Rust deepseek-tui >= 0.8.5, <= 0.8.41
- npm deepseek-tui >= 0.8.5, < 0.8.41
Timeline
- 2026-09-04: disclosed: Advisory published
- 2026: patched: Fix released in version 0.8.64 (commit 26de44a8bd5051f8f944ea60b2c37ae1d2b7d25e)
References
- https://api.github.com/users/JafarAkhondali
- https://github.com/JafarAkhondali
- https://api.github.com/users/JafarAkhondali/gists%7B/gist_id%7D
- https://api.github.com/users/JafarAkhondali/repos
- https://avatars.githubusercontent.com/u/11364402?v=4
- https://api.github.com/users/JafarAkhondali/events%7B/privacy%7D