Global SOC / Blog
DNS Audit

THREAT RESEARCH & LABS · Yogesh · 11 November 2026

Scanners Are Hunting Claude, Codex and MCP Credentials: How to Detect It and Protect Your Agents

My honeypot received 178 requests for AI API keys, coding-agent token files and MCP endpoints, on a server with none of them. I walk through the wordlists and the one MCP handshake I captured, then give detections for Splunk + CrowdStrike and Sentinel + Defender for Endpoint, including rules for the developer machines and agent hosts where these secrets actually live.

Part of my honeypot detection series. Org A runs Splunk with CrowdStrike Falcon. Its Falcon queries use Event Search field names; on raw FDR data, apply the normalisation macro first. Org B runs Microsoft Sentinel with Defender for Endpoint. The web-layer KQL ran against the honeypot's real logs. The endpoint and egress queries are written for developer workstations and agent hosts, so adapt the process names and allowlists to your environment.

1. What Hit the Server

My honeypot runs no model, no agent and no MCP server. It still got 178 requests from 73 IPs for 101 AI-related paths:

GroupRequestsSource IPsDistinct paths
MCP server endpoints74654
Model API key files53448
AI coding-tool config and tokens45544
Model API endpoints424
llms.txt211

The first one came about four hours after the server went online, from a tool that names its purpose: opendirme-credhunt/gen2+riskd-baseline-20261012-1-g5b5b7ae. It asked for exactly the files you'd want if you were stealing an AI developer's identity:

2026-10-22 09:00:34  GET / HTTP/1.1  -> 206
2026-10-22 09:00:34  GET /.local/share/opencode/auth.json HTTP/1.1  -> 404
2026-10-22 09:00:35  GET /.claude/.credentials.json HTTP/1.1  -> 404
2026-10-22 09:00:35  GET /.codex/auth.json HTTP/1.1  -> 404
2026-10-22 09:00:35  GET /.credentials.json HTTP/1.1  -> 404
2026-10-22 09:00:35  GET /auth.json HTTP/1.1  -> 404
2026-10-22 09:00:35  GET /.env HTTP/1.1  -> 404
2026-10-22 09:00:35  GET /.hermes/.env HTTP/1.1  -> 404
2026-10-22 09:00:35  GET /.grok/auth.json HTTP/1.1  -> 404
2026-10-22 09:00:36  GET /.openclaw/openclaw.json HTTP/1.1  -> 404
2026-10-22 09:00:36  GET /.openclaw/.env HTTP/1.1  -> 404
2026-10-22 09:00:36  GET /.git/config HTTP/1.1  -> 404

Those are the on-disk login stores of Claude Code, Codex CLI, opencode and Grok. They only pay off when a web root is someone's home directory or a project folder an agent has been run in. That happens more than you'd think: python3 -m http.server in the wrong folder, a dev container with its port published, an agent that "helpfully" started a static server.

The defender's lesson isn't really about web servers. These secrets live on developer laptops, build agents and agent hosts. The scanners have shown us which files they want. So the useful detections are on those machines, and on the network paths where a stolen key gets used.

2. The Attack, Step by Step

Recon Step 1: Wordlists with AI paths added

The technique is the same as for /.env, just with new entries (T1595.003). One scanner built its list by combining provider names with config extensions:

22:41:51  GET /bedrock/credentials.json HTTP/1.1  -> 404
22:41:57  GET /bedrock-credentials HTTP/1.1  -> 404
22:41:57  GET /bedrock-credentials.json HTTP/1.1  -> 404
22:41:57  GET /bedrock-credentials.yml HTTP/1.1  -> 404
22:41:57  GET /bedrock/credentials HTTP/1.1  -> 404
22:42:06  GET /.env.bedrock HTTP/1.1  -> 404
22:42:13  GET /aws-bedrock.env HTTP/1.1  -> 404
22:42:16  GET /bedrock-api-key.env HTTP/1.1  -> 404
22:42:16  GET /bedrock.env HTTP/1.1  -> 404
22:42:16  GET /bedrock/.env HTTP/1.1  -> 404
22:42:17  GET /config/bedrock.env HTTP/1.1  -> 404
22:42:19  GET /gemini.env HTTP/1.1  -> 404
22:42:29  GET /.amazonq/mcp.json HTTP/1.1  -> 404
22:42:30  GET /.claude.json HTTP/1.1  -> 404
22:42:31  GET /.claude/settings.local.json HTTP/1.1  -> 404
22:42:31  GET /.claude/settings.json HTTP/1.1  -> 404
22:42:31  GET /.config/claude.json HTTP/1.1  -> 404
22:42:32  GET /.codex/config.toml HTTP/1.1  -> 404
22:42:32  GET /.cursor/mcp.json HTTP/1.1  -> 404
22:42:33  GET /.gemini/settings.json HTTP/1.1  -> 404
22:42:33  GET /.junie/mcp.json HTTP/1.1  -> 404
22:42:34  GET /.mcp.json HTTP/1.1  -> 404
22:42:36  GET /.zed/settings.json HTTP/1.1  -> 404
22:42:36  GET /.vscode/mcp.json HTTP/1.1  -> 404
22:42:45  GET /aws-bedrock.config HTTP/1.1  -> 404
22:42:46  GET /aws-bedrock.json HTTP/1.1  -> 404
22:42:46  GET /aws-bedrock.yml HTTP/1.1  -> 404
22:42:49  GET /azure-openai.config HTTP/1.1  -> 404
22:42:49  GET /azure-openai.json HTTP/1.1  -> 404
22:42:50  GET /azure-openai.yml HTTP/1.1  -> 404
22:42:50  GET /bedrock-api-key.json HTTP/1.1  -> 404
22:42:51  GET /bedrock-api-key.txt HTTP/1.1  -> 404
22:42:51  GET /bedrock-api-key.yml HTTP/1.1  -> 404
22:42:51  GET /bedrock.config HTTP/1.1  -> 404
22:42:51  GET /bedrock.json HTTP/1.1  -> 404
22:42:51  GET /bedrock.yml HTTP/1.1  -> 404
22:42:52  GET /bedrock/config.json HTTP/1.1  -> 404
22:42:52  GET /claude.json HTTP/1.1  -> 404
22:42:52  GET /claude_desktop_config.json HTTP/1.1  -> 404
22:42:52  GET /cline_mcp_settings.json HTTP/1.1  -> 404
22:42:55  GET /config/azure-openai.json HTTP/1.1  -> 404
22:42:55  GET /config/bedrock.config HTTP/1.1  -> 404
22:42:56  GET /config/bedrock.json HTTP/1.1  -> 404
22:42:56  GET /config/bedrock.yml HTTP/1.1  -> 404
22:42:56  GET /config/gemini.json HTTP/1.1  -> 404
22:42:57  GET /config/openai.json HTTP/1.1  -> 404
22:43:00  GET /gemini.config HTTP/1.1  -> 404
22:43:01  GET /gemini.json HTTP/1.1  -> 404
22:43:01  GET /gemini.yml HTTP/1.1  -> 404
22:43:03  GET /mcp.json HTTP/1.1  -> 404
22:43:03  GET /mcp.yaml HTTP/1.1  -> 404
22:43:04  GET /mcp.yml HTTP/1.1  -> 404
22:43:04  GET /mcp_config.json HTTP/1.1  -> 404
22:43:04  GET /my/openaikey HTTP/1.1  -> 404
22:43:04  GET /openai.config HTTP/1.1  -> 404
22:43:05  GET /openai.json HTTP/1.1  -> 404
22:43:05  GET /openai.yml HTTP/1.1  -> 404
22:43:05  GET /opencode.json HTTP/1.1  -> 404

Another asked for 18 directories in nine seconds. They were the per-project folders of Claude Code, Cursor, opencode, Kilo, Windsurf, Cline, Roo, Gemini, Qwen, Continue, Aider, Codex, Amazon Q, Kiro, Zed, Trae, Augment and Junie. A 301 or a 403 on any of them tells the scanner the folder exists.

Credential Access Step 2: Read the token file

If one of these files is served, it's T1552.001 Credentials in Files. A model API key is billed by usage and resold. A coding agent's token is worse, because it carries the user's subscription and whatever repository and tool access the agent has. MCP config files (.mcp.json, .cursor/mcp.json, claude_desktop_config.json) usually hold API keys for every MCP server listed in their env blocks.

Recon Step 3: Find MCP servers

The Model Context Protocol lets an AI client call tools on a remote server over HTTP, on /mcp or /sse by convention. A scanner calling itself Infrawatch probed those paths on 18 different days. Each visit was spread across several addresses so no single IP sent more than a request or two:

2026-10-22 23:11:13  69.5.169[.]245     GET / HTTP/1.1  -> 200
2026-10-22 23:11:33  193.176.31[.]250   GET / HTTP/1.1  -> 200
2026-10-22 23:11:33  81.19.216[.]74     GET /favicon.ico HTTP/1.1  -> 404
2026-10-22 23:11:34  185.223.235[.]34   GET /mcp/ HTTP/1.1  -> 404
2026-10-22 23:11:34  89.21.67[.]181     GET / HTTP/1.1  -> 200
2026-10-22 23:11:34  81.19.216[.]100    GET /mcp HTTP/1.1  -> 404
2026-10-22 23:11:34  193.176.31[.]248   GET /api/mcp HTTP/1.1  -> 404
2026-10-22 23:11:35  81.19.216[.]70     GET /sse HTTP/1.1  -> 404

Its MCP probes came from 64 addresses in five /24 networks. A per-IP rate limit never sees that.

Discovery Step 4: Speak the protocol

One scanner sent a real MCP initialize:

{
  "jsonrpc": "2.0",
  "id": 4205234,
  "method": "initialize",
  "params": {
    "protocolVersion": "2025-06-18",
    "capabilities": {
      "sampling": {},
      "elicitation": {},
      "roots": {
        "listChanged": true
      }
    },
    "clientInfo": {
      "name": "internet-census-mcp-scanner",
      "version": "1.0.0"
    }
  }
}

A live server would reply with its name, version and capabilities. A hostile client's next calls are tools/list to see what the server can do, then tools/call to do it. On an MCP server with a shell, file or database tool and no authentication, that's remote code execution through a feature, not a bug (T1190, T1059).

Actions on Objectives Step 5: Use the key

A stolen model key gets used from somewhere else (T1078.004). A stolen agent token can be used to act as the developer: read their repos, run their tools, and spend their quota.

3. Pyramid of Pain

LevelIndicatorWhat I'd do with it
IP addressesInfrawatch's five /24s; the wordlist runnersPointless against Infrawatch, which rotates per request.
Network artefactsUAs opendirme-credhunt, Infrawatch/1.0; MCP clientInfo internet-census-mcp-scannerUseful labels, and trivially changed.
ToolsAI-path wordlists; one scanner distributed across many source IPsDetect by path set and by "many sources, one User-Agent, one path set".
TTPsAgent token files read by something other than the agent; AI API calls from unapproved processes; MCP servers spawning shellsThe highest-value rules, and they're on the endpoint, where the secrets actually are.

4. Web-Layer Detections

For Org B I've parsed the honeypot's nginx log into a WebAccess function. For Org A I've used the CIM Web data model.

let WebAccess = Syslog
| where SyslogMessage startswith "php_http: "
| extend j = parse_json(substring(SyslogMessage, 10))
| project TimeGenerated, DestHost = Computer, SrcIp = tostring(j.client), Method = tostring(j.method), Request = tostring(j.request),
          Url = tostring(j.uri), Status = toint(j.status), BytesOut = toint(j.bytes_out),
          UserAgent = tostring(j.user_agent), ContentType = tostring(j.content_type), Body = tostring(j.body);

W1. AI credential and agent-config paths (T1595.003, T1552.001)

Org B Tested: 93 requests for 86 paths from 7 sources.

let AiPaths = @"(?i)/(\.claude|\.codex|\.cursor|\.gemini|\.opencode|\.local/share/opencode|\.grok|\.hermes|\.openclaw|\.kilo|\.kilocode|\.windsurf|\.roo|\.qwen|\.continue|\.aider|\.amazonq|\.kiro|\.zed|\.trae|\.augment|\.junie|\.clinerules|\.huggingface|\.config/huggingface)(/|$)|(claude_desktop_config|cline_mcp_settings|\.mcp|/mcp|\.claude)\.json|/\.env\.(openai|anthropic|claude|gemini|bedrock|azure-openai|huggingface)$|/(\.env\.)?(openai|anthropic|claude|gemini|bedrock|aws-bedrock|bedrock-api-key|bedrock-credentials|azure-openai|huggingface|llm)[\w\-]*\.(env|json|ya?ml|config|txt)$|/bedrock(/|\.env|-)";
WebAccess
| where Url matches regex AiPaths
| summarize Requests = count(), Paths = dcount(Url), Sources = dcount(SrcIp)

Org A

| tstats count from datamodel=Web by Web.src Web.dest Web.url Web.status
| rename Web.* as *
| regex url="(?i)/(\.claude|\.codex|\.cursor|\.gemini|\.opencode|\.local/share/opencode|\.grok|\.hermes|\.openclaw|\.kilo|\.kilocode|\.windsurf|\.roo|\.qwen|\.continue|\.aider|\.amazonq|\.kiro|\.zed|\.trae|\.augment|\.junie|\.clinerules|\.huggingface|\.config/huggingface)(/|$)|(claude_desktop_config|cline_mcp_settings|\.mcp|/mcp|\.claude)\.json|/\.env\.(openai|anthropic|claude|gemini|bedrock|azure-openai|huggingface)$|/(\.env\.)?(openai|anthropic|claude|gemini|bedrock|aws-bedrock|bedrock-api-key|bedrock-credentials|azure-openai|huggingface|llm)[\w\-]*\.(env|json|ya?ml|config|txt)$|/bedrock(/|\.env|-)"
| stats sum(count) as requests dc(url) as paths values(status) as status by src dest

Pair it with the "secret file actually served" rule from the .env post. Any 200 here that isn't your home page is critical.

W2. Distributed MCP discovery

Org B Tested: 19 five-minute windows, all from Infrawatch, with up to 4 source IPs per window.

WebAccess
| where Url in ("/mcp", "/mcp/", "/sse", "/api/mcp")
| summarize Sources = dcount(SrcIp), Paths = make_set(Url), DurationSec = datetime_diff("second", max(TimeGenerated), min(TimeGenerated))
          by UserAgent, Window = bin(TimeGenerated, 5m)
| where Sources >= 3

Org A

| tstats count from datamodel=Web where Web.url IN ("/mcp","/mcp/","/sse","/api/mcp")
    by _time span=5m Web.http_user_agent Web.src Web.url
| rename Web.* as *
| stats dc(src) as sources values(url) as paths by _time http_user_agent
| where sources >= 3

On a server that doesn't run MCP, it's informational. On one that does, it means you're on a target list. Check the next rule.

W3. MCP JSON-RPC from unknown clients

Org B Tested: one initialize from the census scanner, plus my own scanner's initialize and tools/list.

WebAccess
| where Method == "POST" and Body has "\"jsonrpc\"" and Body has_any ("\"initialize\"", "\"tools/list\"", "\"tools/call\"")
| extend Rpc = extract(@"""method""\s*:\s*""([^""]+)""", 1, Body),
         Client = extract(@"""clientInfo""\s*:\s*\{[^}]*""name""\s*:\s*""([^""]+)""", 1, Body)
| summarize Requests = count() by SrcIp, Url, Rpc, Client

Org A

index=web sourcetype=nginx:access method=POST "\"jsonrpc\"" ("\"initialize\"" OR "\"tools/list\"" OR "\"tools/call\"")
| rex "\"method\"\s*:\s*\"(?<rpc>[^\"]+)\""
| rex "\"clientInfo\"\s*:\s*\{[^}]*\"name\"\s*:\s*\"(?<client>[^\"]+)\""
| stats count by clientip uri rpc client

If you run a remote MCP server, keep a list of the client names and source networks you expect. A tools/list or tools/call from anyone else is high severity. It means they got past discovery, and probably past authentication too.

5. Endpoint and Egress Detections

Here's where the secrets actually live. These rules are for developer workstations, build agents and agent hosts.

E1. Agent token files touched by something other than the agent (T1552.001)

Org B

let AgentFiles = dynamic([".claude/.credentials.json", ".codex/auth.json", ".local/share/opencode/auth.json", ".grok/auth.json",
                   ".config/gcloud/application_default_credentials.json", ".aws/credentials", ".huggingface/token",
                   "claude_desktop_config.json", ".cursor/mcp.json", ".mcp.json"]);
let AgentBinaries = dynamic(["claude", "codex", "opencode", "cursor", "code", "node", "gcloud", "aws", "huggingface-cli"]);
DeviceProcessEvents
| where Timestamp > ago(7d)
| where ProcessCommandLine has_any (AgentFiles)
| where FileName !in~ (AgentBinaries)
| project Timestamp, DeviceName, AccountName, FileName, ProcessCommandLine,
          InitiatingProcessFileName, InitiatingProcessCommandLine

Org A

index=crowdstrike event_simpleName=ProcessRollup2
    (CommandLine="*.claude/.credentials.json*" OR CommandLine="*.codex/auth.json*"
     OR CommandLine="*opencode/auth.json*" OR CommandLine="*.grok/auth.json*"
     OR CommandLine="*application_default_credentials.json*" OR CommandLine="*.aws/credentials*"
     OR CommandLine="*.huggingface/token*" OR CommandLine="*claude_desktop_config.json*"
     OR CommandLine="*.cursor/mcp.json*" OR CommandLine="*.mcp.json*")
    NOT FileName IN ("claude","codex","opencode","cursor","code","node","gcloud","aws","huggingface-cli")
| table _time ComputerName UserName ParentBaseFileName FileName CommandLine

Infostealers and post-exploitation scripts copy these files by name with cat, cp, tar or curl -F. The agent itself reads them without its path showing up in the command line, so this list stays quiet in normal use. High severity.

E2. AI API calls from processes you didn't approve (T1078.004)

Org B

let ApprovedAiClients = dynamic(["claude", "codex", "cursor", "code", "msedge.exe", "chrome.exe"]);
DeviceNetworkEvents
| where Timestamp > ago(7d)
| where RemoteUrl has_any ("api.anthropic.com", "api.openai.com", "generativelanguage.googleapis.com",
                           "bedrock-runtime", "openai.azure.com", "api.x.ai", "openrouter.ai")
| where InitiatingProcessFileName !in~ (ApprovedAiClients)
| summarize Connections = count(), Urls = make_set(RemoteUrl, 10), FirstSeen = min(Timestamp)
          by DeviceName, InitiatingProcessFileName, InitiatingProcessFolderPath, InitiatingProcessAccountName

Org A

index=crowdstrike event_simpleName=DnsRequest
    (DomainName="api.anthropic.com" OR DomainName="api.openai.com" OR DomainName="generativelanguage.googleapis.com"
     OR DomainName="bedrock-runtime.*" OR DomainName="*.openai.azure.com" OR DomainName="api.x.ai" OR DomainName="openrouter.ai")
| join type=inner aid ContextProcessId_decimal
    [ search index=crowdstrike event_simpleName=ProcessRollup2
      | rename TargetProcessId_decimal as ContextProcessId_decimal
      | fields aid ContextProcessId_decimal FileName ImageFileName ]
| search NOT FileName IN ("claude","codex","cursor","code","msedge.exe","chrome.exe")
| stats count values(DomainName) as domains min(_time) as first by ComputerName FileName ImageFileName

This catches a stolen key being used from inside your network by a script or implant, and catches shadow AI as a side effect. Start by running it as a hunt to build the allowlist, then turn it into a medium-severity rule.

E3. MCP server spawns a shell (T1059)

Org B

DeviceProcessEvents
| where Timestamp > ago(7d)
| where InitiatingProcessCommandLine has_any ("mcp", "modelcontextprotocol", "fastmcp")
| where FileName in~ ("sh", "bash", "dash", "zsh", "powershell.exe", "cmd.exe", "curl", "wget")
| project Timestamp, DeviceName, AccountName, InitiatingProcessCommandLine, FileName, ProcessCommandLine

Org A

index=crowdstrike event_simpleName=ProcessRollup2
    FileName IN ("sh","bash","dash","zsh","powershell.exe","cmd.exe","curl","wget")
| join type=inner aid ParentProcessId_decimal
    [ search index=crowdstrike event_simpleName=ProcessRollup2
        (CommandLine="*mcp*" OR CommandLine="*modelcontextprotocol*" OR CommandLine="*fastmcp*")
      | rename TargetProcessId_decimal as ParentProcessId_decimal, CommandLine as ParentCommandLine
      | fields aid ParentProcessId_decimal ParentCommandLine ]
| table _time ComputerName UserName ParentCommandLine FileName CommandLine

Some MCP servers run commands on purpose (shell and git tools). For those, alert when the parent was reached over the network rather than through local stdio, or when the command is a downloader. For everything else, any shell is high severity.

6. When It Fires

  1. W1 or W2 only: confirm nothing was served. Then search your estate for web servers whose document root is a home directory or a project folder.
  2. A W1 hit served a real file, or E1 fired: revoke the token at the provider (sign out the Claude Code or Codex session, rotate the API key), and check the provider's usage console for activity you don't recognise.
  3. W3 tools/call or E3: treat the MCP host as compromised. Org A Network-contain it in Falcon. Org B Isolate it in Defender. Then rotate every secret in that server's env block.
  4. E2: find out what the unapproved process is. If it's a script someone wrote, that's a policy conversation. If it's unsigned and new, treat it as an implant.

7. Hardening

8. IOCs

TypeValueContext
Credential hunter34.213.231[.]51, UA opendirme-credhunt/…Agent token files
Wordlist runs45.138.12[.]179 (svs), 54.170.28[.]185, 79.124.58[.]22Provider key files; agent folder census
MCP censusUA Infrawatch/1.0 from 89.21.67[.]0/24, 185.223.235[.]0/24, 81.19.216[.]0/24, 193.176.31[.]0/24, 69.5.169[.]0/24Distributed /mcp, /sse discovery
MCP handshake45.156.129[.]80, client internet-census-mcp-scannerJSON-RPC initialize