Tracking Claude Code network traffic via network namespaces

A new technical breakdown examines where Claude Code actually sends requests when using the built-in WebFetch and WebSearch tools. The core question is whether the target server sees your IP address or Anthropic's IP when the agent initiates a network connection.
Linux does not natively support process-level traffic interception, as AF_PACKET and tcpdump monitor the entire interface rather than a specific PID. The solution is using a network namespace, which provides the Claude process with a dedicated network interface containing only its traffic.
From there, you can identify connection destinations via TLS SNI hostnames and DNS queries without needing decryption. To read request bodies, you can use MITMproxy restricted to that single process.
The code and scripts are available in the CaptainMcCrank/claude-netns repository. Requirements include tcpdump, iproute2, iptables, Python 3, mitmproxy, and slirp4netns for rootless capture.
Related stories
- Confessor reconstructs what Claude Code actually touched
- One git call let a repo escape the Claude Code sandbox
- Stolen session keys are draining Claude Max accounts
- Breaking Claude Code Opus 5 Auto Mode
- Claude Opus broke four SAML libraries in a month
- Hidden China tracker pulled from Claude Code after exposé
Comments
No comments yet. Be the first.
Join the conversation
Sign in with Google to leave a comment. Your name and avatar come from your Google profile, and the comment appears after moderation.
