Summary
CodeWhale's HTTP request handling logic insufficiently validates IPv6 literals, allowing requests to localhost-style addresses such as http://[::1] to bypass SSRF defenses.
In environments where CodeWhale can initiate network calls on behalf of a user or agent, this can enable an attacker to coerce the tool into reaching internal services that should not be directly accessible.
Affected context
The vulnerability arises when CodeWhale is used in contexts where:
- The tool can send HTTP/HTTPS requests to user-specified URLs (e.g., via prompts, configuration, or extensions).
- SSRF protections rely on hostname resolution checks that treat private or loopback addresses as disallowed.
- IPv6 literal addresses such as
[::1]are not normalized or validated consistently with their hostname equivalents.
Under these conditions, a crafted URL using an IPv6 loopback literal may reach local or internal services that SSRF filters were intended to block.
Exploit preconditions
- Attack surface: Network requests initiated by CodeWhale, driven by user input, agent instructions, or integrated features that fetch external resources.
- Required access: Ability to influence or control the URL that CodeWhale fetches (e.g., by providing prompts, configuration, or project files that contain URLs).
- Trigger point: Submission of a URL using an IPv6 literal (for example, http://[::1]/ or other IPv6 forms) that resolves to loopback or internal resources.
- Why exploitation is possible: The SSRF validation logic correctly filters hostnames that resolve to private IPv6 addresses but does not equivalently enforce restrictions when the address is specified directly as an IPv6 literal, allowing requests to protected targets such as localhost.
Why this happens
This issue is an SSRF validation gap corresponding to CWE-918: Server-Side Request Forgery.
The core problem is that the URL validation layer focuses on hostnames and their DNS resolution results, but treats IPv6 literal addresses differently, leaving a blind spot for [::1] and potentially other literal forms.
Because the security decision is tied to an incomplete interpretation of the target address—rather than a canonical representation of the actual destination—requests to loopback or internal interfaces can slip past filters.
Abstractly, this reflects a common SSRF anti-pattern: performing allow/deny checks on unnormalized URL components instead of validating the resolved destination endpoint (IP, port, scheme, and interface) in a consistent and comprehensive way.
Potential impact
- Access to local services bound to loopback interfaces (e.g., http://[::1]:port) that are not otherwise exposed.
- Interaction with internal HTTP APIs, metadata endpoints, or developer tools reachable from the CodeWhale host.
- Potential exposure of sensitive configuration data, credentials, or tokens hosted on local services.
- Use of CodeWhale as a pivot to map or interact with portions of the internal network reachable from the host environment.
- Facilitation of further attack chains where internal services trust requests originating from localhost.
General mitigation guidance
Effective mitigation typically focuses on canonical, protocol-aware validation of outbound requests and tightening trust boundaries:
- Normalize and canonicalize all target URLs before enforcement, including proper parsing of IPv4, IPv6 literals (e.g.,
[::1]), and hostnames. - Apply SSRF checks on the resolved destination IP and port, not only on the hostname string, ensuring loopback and private ranges (both IPv4 and IPv6) are consistently blocked where appropriate.
- Maintain explicit allowlists for external destinations when feasible, instead of attempting to blacklist internal ranges.
- Segregate the network environment of tools like CodeWhale using firewall rules, container/network namespaces, or proxies that limit access to local and sensitive services.
- Run CodeWhale with the least network and system privileges necessary, reducing the blast radius of any SSRF-related flaws.
How teams detect issues like this
Organizations can look for this class of issue and its manifestations through:
- Static analysis and code review:
- Identify code paths that construct or send HTTP/HTTPS requests based on user-influenced URLs.
- Check whether SSRF validation logic handles IP literals (including IPv6), hostnames, and DNS results in a unified manner.
- Flag patterns where only hostname-based blocking (e.g.,
localhost,127.0.0.1) is implemented without corresponding IP range checks. - Dynamic and integration testing:
- Add tests that attempt to access loopback and private network resources using IPv6 literals such as
http://[::1]. - Validate that requests to disallowed targets are blocked regardless of how the address is encoded.
- Operational monitoring:
- Instrument outbound HTTP traffic from CodeWhale's execution environment and alert on connections to loopback or private addresses.
- Automated security tools (e.g., SAST, DAST, policy-as-code scanners) can be configured to highlight network call sites and enforce SSRF-safe patterns.

