cd /news/ai-safety/kimi-code-is-vulnerable-to-a-fetchur… · home topics ai-safety article
[ARTICLE · art-84626] src=research.jfrog.com ↗ pub= topic=ai-safety verified=true sentiment=↓ negative

Kimi Code is vulnerable to a FetchURL SSRF Protection Bypass via DNS-resolving Hostnames and Redirects

Moonshot AI's Kimi Code, a coding agent, is vulnerable to a FetchURL SSRF protection bypass in versions before 0.27.0, allowing attackers to reach internal network services via DNS-resolving hostnames or redirects. The flaw stems from a static denylist that fails to resolve DNS or revalidate after redirects, and FetchURL is in the default auto-approve tool set. The fix in version 0.27.0 adds DNS resolution, per-hop redirect validation, and connection pinning.

read2 min views14 publishedJul 27, 2026

Summary Kimi Code is vulnerable to a FetchURL SSRF Protection Bypass via DNS-resolving Hostnames and Redirects

[Component](#component)

@moonshot-ai/kimi-code (Kimi Code)

[Affected versions](#affected-versions)

< 0.27.0

Description Kimi Code implements FetchURL SSRF hardening as a static hostname and IP-literal denylist in assertSafeFetchTarget, without resolving DNS or re-validating hosts after HTTP redirects. An attacker who can influence a FetchURL call, for example via prompt injection, can supply a crafted public hostname that resolves to loopback or another internal address, or a public URL that redirects to such a target, and thereby reach internal network services that the denylist was intended to block. FetchURL is included in the default auto-approve tool set, so the call does not require interactive user confirmation in manual mode.

PoC Step 1 - Start a local HTTP listener

python3 -m http.server 1337 --bind 127.0.0.1 Step 2 - Confirm the literal denylist blocks localhost

Ask the agent to use FetchURL on http://localhost:1337

(or http://127.0.0.1:1337 ).

Expected result: the request is denied by assertSafeFetchTarget (for example, "Refusing to fetch private host").

Step 3 - Bypass via a DNS-resolving hostname

Ask the agent to use FetchURL on a public hostname whose DNS resolves to loopback, for example http://localtest.me:1337

.

Step 4 - Verify the request reaches the local listener

Watch the simple HTTP server console. A GET request arrives from the Kimi Code process, demonstrating that DNS-resolving names are not validated against private address ranges.

The same class of bypass applies to public URLs that HTTP-redirect to loopback or internal targets, because redirects were followed without re-running the safety check on each hop.

Vulnerability Mitigations Upgrade to Kimi Code 0.27.0 or later. The fix resolves hostnames via DNS and rejects addresses in loopback, RFC1918, link-local, CGNAT, and ULA ranges; follows redirects manually with per-hop revalidation; and pins connections to the validated resolved addresses to reduce DNS-rebinding (TOCTOU) races.

[References](#references)

[https://github.com/MoonshotAI/kimi-code/pull/1791](https://github.com/MoonshotAI/kimi-code/pull/1791)

https://github.com/MoonshotAI/kimi-code/commit/31449728b72df94e22bcb2de350a1e7624895e30 https://github.com/MoonshotAI/kimi-code/releases/tag/%40moonshot-ai%2Fkimi-code%400.27.0

── more in #ai-safety 4 stories · sorted by recency
── more on @moonshot ai 3 stories trending now
sponsored brought to you by zahid.host 4,200+ EU-deployed projects
reading about agents? ship yours in a single git push.

Run your AI side-project on zahid.host

EU-based hosting, git-push deploys, automatic HTTPS, no cold starts. Free tier with a custom domain — perfect for shipping the agent you just read about.

$git push zahid main
Live at https://your-agent.zahid.host
Get free account → Pricing
from €0/mo · no card required
LIVE [news/kimi-code-is-vulnera…] indexed:0 read:2min 2026-07-27 ·