/

CVE-2026-45310

Severity:

HIGH RISK

(7.4)

SSRF in CodeWhale fetch_url Tool

CVE-2026-45310

Deferred

Vulnerability type

Category:

Server-Side Request Forgery (SSRF)

CWE:

CWE-918

Impact:

Unauthorized access to internal services and sensitive network resources

Severity:

HIGH RISK

(7.4)

CVSS version:

3.1

Catch this CVE while code is being written

Detect vulnerable code directly in pull requests, so CVEs are fixed before merge.

Summary

CodeWhale's terminal-based coding agent previously validated only the initial URL against a restricted IP blocklist to prevent SSRF, but allowed the HTTP client to follow redirects without reapplying those checks.

An attacker who can influence the requested URL could leverage HTTP redirects to reach internal or otherwise restricted network resources, bypassing the original SSRF protections.

Affected context

This vulnerability affects environments where CodeWhale's fetch_url tool is used to perform HTTP requests on behalf of the user or other components.

The issue arises when:

  • The tool is configured to use an HTTP client that automatically follows redirects, and
  • The initial URL is validated against a restricted-IP blocklist, but
  • Redirect targets are not revalidated against the same SSRF protections.

In such setups, redirected requests can escape the initial network and IP constraints and reach internal endpoints that are not intended to be exposed.

Exploit preconditions

  • Attack surface: The fetch_url capability within CodeWhale that can issue HTTP/HTTPS requests.
  • Required access: Ability to supply or influence the URL passed into fetch_url (for example via user input, prompt content, or external references).
  • Trigger point: An attacker-controlled or attacker-influenced URL that returns an HTTP redirect (3xx) to a restricted IP address or internal service.
  • Why exploitation is possible: The IP restriction is enforced only on the initial resolved URL. The HTTP client's redirect behavior (following up to 5 redirects) does not re-run the same is_restricted_ip() checks on each redirect target, allowing a redirect chain to lead into private or otherwise protected network locations.

Why this happens

The underlying issue is a partial and one-time validation of outbound URLs combined with automatic redirect handling.

While the first URL is checked against a restricted-IP blocklist to mitigate SSRF, subsequent redirect locations are trusted implicitly by the HTTP client and never revalidated.

This design assumes that redirect responses from external or semi-trusted hosts are safe, which is incorrect: an attacker-controlled endpoint can emit arbitrary redirect targets, including internal IPs, localhost, or cloud metadata addresses.

Conceptually, this maps to CWE-918: Server-Side Request Forgery (SSRF), where server-side HTTP functionality is exposed without consistently enforcing network access policies across all request stages, including redirects.

Potential impact

  • Access to internal HTTP services that are not directly reachable from the public internet.
  • Interaction with cloud provider metadata services, potentially disclosing credentials or configuration.
  • Discovery of internal network structure and services through response content or timing.
  • Use of the CodeWhale runtime as a pivot point for further attacks within the hosting environment.
  • Indirect data exposure or manipulation within internal APIs that trust requests originating from the local environment.

General mitigation guidance

Effective mitigation centers on ensuring that network access controls are applied consistently for every outbound request, including redirects and retries.

Common defensive approaches include:

  • Reapplying the same restricted-IP and hostname validation logic on every redirect target before issuing the next request.
  • Using an HTTP client configuration that either:
  • Disables automatic redirects and handles them manually with explicit validation, or
  • Provides hooks to approve or deny each redirect based on security policy.
  • Implementing strict allowlists for outbound destinations where feasible, rather than relying solely on blocklists.
  • Segregating the runtime environment so that tooling like CodeWhale has minimal network reach and cannot directly access sensitive internal services or metadata endpoints.
  • Treating all externally influenced URLs as untrusted and minimizing features that allow arbitrary URL fetching when not strictly necessary.

How teams detect issues like this

Detection efforts can focus on both code-level and behavioral indicators:

  • Static analysis and code review:
  • Look for HTTP client configurations that enable automatic redirects without accompanying validation callbacks.
  • Identify patterns where SSRF checks (such as IP blocklists) are applied only to the initial URL but not to redirect locations.
  • Flag network access helpers that expose arbitrary URL fetching to untrusted or semi-trusted inputs.
  • Policy and automated tooling:
  • Enforce linters or custom rules that require explicit validation for each redirect or the disabling of automatic redirect following in security-sensitive components.
  • Integrate security scanning tools that understand SSRF patterns and can highlight missing checks on redirect handling.
  • Runtime monitoring:
  • Log outbound requests along with their final destinations and redirect chains, and alert on access to known-sensitive IP ranges (localhost, link-local addresses, metadata IPs, RFC1918 space).
  • Use egress filtering or proxy solutions that can centrally enforce network access rules and provide audit trails.

Sources

SourceLink
github.comgithub.com/Hmbown/CodeWhale/security/advisories/GHSA-96ff-gc8g-wpvg
github.comgithub.com/Hmbown/DeepSeek-TUI/releases/tag/v0.8.22

Frequently asked

questions

It can be, if an attacker can remotely supply or influence the URL used by the fetch_url tool, such as through user input fields, prompts, or integrations that pass external URLs into CodeWhale.

The attacker needs the ability to control or meaningfully influence the initial URL that CodeWhale fetches. Direct shell access is not required if the application or workflow already accepts attacker-controlled URLs and forwards them to fetch_url.

Apply the same SSRF protections—IP, hostname, and scheme validation—to every outbound request, including all redirect targets, or disable automatic redirect following and handle redirects with explicit security checks. Additionally, constrain outbound traffic with network-level controls so tools cannot reach sensitive internal services.

When designing URL-fetching features, treat all remote endpoints and redirects as untrusted, enforce consistent validation throughout the entire request lifecycle, and assume that attackers can control redirect responses. Combine application-level validation with defense-in-depth measures like egress filtering, network segmentation, and secure-by-default HTTP client configurations.

Find out what's already
exploitable in your codebase.