Summary
CodeWhale before 0.8.64 contains a server-side request forgery vulnerability in its DNS pinning logic. An attacker who can influence DNS responses may bypass address validation and cause the server to send requests to internal IP addresses.
Affected context
The vulnerability occurs in CodeWhale deployments that use DNS-based destination validation to reduce SSRF risk. It becomes risky when an attacker can influence or control DNS responses and the application performs separate resolution checks and connection attempts without ensuring that both operations use the same validated address.
Exploit preconditions
- Attack surface: Server-side request functionality that accepts or derives attacker-influenced hostnames
- Required access: Ability to submit requests or otherwise influence destinations processed by CodeWhale
- Trigger point: DNS resolution and subsequent outbound connection handling
- Why exploitation is possible: DNS pinning does not reliably bind the validated resolution to the later request, allowing different responses between the initial check and secondary connection
Why this happens
The underlying bug is a time-of-check-time-of-use condition in DNS-based SSRF protection. The application validates one DNS result but later performs a request based on another resolution, allowing an attacker-controlled DNS response to change the destination after validation. This behavior maps to CWE-918: Server-Side Request Forgery, because attacker-influenced input can cause the server to make requests to unintended internal or restricted network locations.
Potential impact
- Requests to internal IP addresses may be issued by the server
- Internal services may be exposed to unauthorized probing or interaction
- Cloud or infrastructure metadata endpoints could be reachable where network controls permit
- Sensitive response data could be disclosed
- Internal network reconnaissance or follow-on attacks could occur
General mitigation guidance
Mitigation generally focuses on making destination validation and connection establishment use one consistent, trusted result.
Common defensive patterns include:
- Resolve hostnames once and bind the validated address to the outbound connection
- Revalidate every address used after redirects or connection retries
- Reject private, loopback, link-local, multicast, and other restricted address ranges by policy
- Prefer explicit destination allowlists over accepting arbitrary hostnames
- Apply network egress controls and least-privilege service permissions
- Reduce trust in attacker-controlled DNS and request destination inputs
How teams detect issues like this
Organizations can assess this risk through:
- Static analysis searches for separate DNS validation and connection-resolution paths
- Code review checks for DNS time-of-check-time-of-use patterns
- Tests using changing DNS answers across sequential lookups
- Runtime monitoring of outbound requests to private, loopback, link-local, and metadata address ranges
- Egress policies that alert on or block unexpected internal destinations
Automated security review tools may help identify SSRF sinks and unsafe hostname validation logic.

