Back to Intelligence

Bots Spoofing AI Agent Identities to Hunt Exposed Secrets: Detection and Hardening Guide

SA
Security Arsenal Team
November 23, 2026
14 min read

Security teams have spent the last 18 months opening their doors to AI agents — allowlisting GPTBot, ClaudeBot, PerplexityBot, and a growing roster of LLM crawlers and agentic frameworks in WAF rules, robots.txt files, and bot management platforms. Cequence Security's latest research shows threat actors have noticed. Their team has identified active bot campaigns that impersonate legitimate AI agent identities — spoofing the user-agent strings and behavioral fingerprints of well-known AI crawlers — to probe web properties for exposed secrets: .env files, .git directories, configuration backups, API keys, and cloud credentials.

The timing matters. As Cequence notes, AI agents have crossed the line from reading (indexing content for training and retrieval) to acting (executing transactions, calling APIs, and interacting with applications autonomously on behalf of users). That shift forced organizations to grant agent traffic elevated trust — broader rate limits, fewer challenges, access to API endpoints that would never be exposed to anonymous crawlers. Attackers are now riding that trust.

This is not a theoretical problem. Any organization that has tuned its bot defenses to accommodate AI agent traffic — and in 2026, that's most of you — needs to validate that the "agents" hitting its infrastructure are who they claim to be, and that nothing sensitive is reachable if that trust is abused.

Technical Analysis

What Cequence Observed

Cequence's threat research team identified malicious bot traffic presenting itself under the names of legitimate, well-known AI agents and crawlers. Rather than the generic scanning noise we've dealt with for decades, this campaign is notable for two things:

  1. Identity spoofing as an evasion technique. The bots adopt the user-agent strings of trusted AI agents. Because many security teams have explicitly allowlisted these agents — or at minimum deprioritized blocking decisions against them — the spoofed traffic inherits that trust and sails past controls tuned to challenge "unknown" bots.

  2. Objective: secrets, not content. The probing behavior targets files and paths where credentials and configuration data live. This is consistent with automated reconnaissance for cloud access keys, database connection strings, third-party API tokens, and application secrets that can be monetized directly or used as initial access.

Why the AI Agent Trust Model Is the Vulnerability

There is no CVE here — the weakness is architectural, and it's one most organizations created themselves. The "vulnerable component" is the implicit trust chain:

  • User-agent strings are client-supplied, unauthenticated data. Any client can claim to be GPTBot or ClaudeBot. Verification requires reverse DNS validation against the operator's published IP ranges (OpenAI, Anthropic, Perplexity, and others publish their crawler IP ranges and verification guidance) — a step most WAF and bot-management deployments skip.
  • Agentic AI has expanded the attack surface. As agents moved from reading to acting, organizations exposed transactional endpoints, API paths, and application functionality to agent-classified traffic. A spoofed agent doesn't just get read access to your marketing pages — it may inherit reachability to endpoints that accept actions.
  • Secrets are still sitting in web-accessible locations. Despite years of warnings, incident responders keep finding .env files, .git/HEAD, config.php.bak, wp-config.php~, and IDE artifacts exposed under web roots. The bots don't need to be sophisticated if the target list is well-known and the hit rate is non-zero.

Attack Chain (Defender's View)

  1. Reconnaissance with a borrowed identity. The bot presents a user-agent string matching a legitimate AI agent/crawler, originating from infrastructure that has not been verified against the real operator's IP ranges.
  2. Trust inheritance. Bot management / WAF logic classifies the traffic as a known-good agent. Challenges (CAPTCHA, JS proof-of-work), rate limits, or blocks are relaxed.
  3. Targeted path enumeration. The client requests high-value paths: /.env, /.git/config, /.git/HEAD, /config.yml, /.aws/credentials, /wp-config.php.bak, /.svn/entries, /server-status, backup archives, and similar.
  4. Harvest and pivot. Any returned secrets — cloud keys, database DSNs, SaaS tokens — are exfiltrated and either used directly or sold to initial access brokers. A leaked AWS key in a .env file remains one of the fastest paths from web misconfiguration to full cloud compromise I've seen in IR engagements.

Exploitation Status

  • Active in the wild: Yes — Cequence reports this as observed, ongoing bot activity, not a proof of concept.
  • CVE / CISA KEV: None applicable. This is a technique campaign (MITRE ATT&CK mapping: T1190 Exploit Public-Facing Application, T1552.001 Unsecured Credentials: Credentials in Files, T1036 Masquerading), not a patchable software flaw.
  • Affected platforms: Any public-facing web application or API fronted by bot management, WAF, or application logic that trust-classifies traffic by user-agent — regardless of stack (nginx, Apache, IIS, cloud API gateways, CDN edge rules).

Detection & Response

The highest-fidelity detections here live in your web access logs, WAF logs, and CDN edge logs — not on the endpoint. Focus on two behaviors: (1) requests for secret-bearing paths, and (2) AI-agent user-agents originating from unverifiable infrastructure. The first is near-zero-noise in most environments; the second requires you to baseline which verified agent traffic you actually expect.

Sigma Rules

The following rules assume you are ingesting web server or WAF logs via a Sigma-compatible pipeline. The path-based rule should be a priority alert in virtually every environment — there is almost no legitimate reason for an external client to request /.env or /.git/config.

YAML
---
title: Web Request for Secret-Bearing File Paths
tid: 3f8a2c91-7b4d-4e6a-9c1f-2d5e8a7b9c01
status: experimental
description: Detects HTTP requests targeting files and directories that commonly contain credentials or configuration secrets (.env, .git, wp-config backups, .aws credentials). Consistent with automated secret-hunting bot campaigns observed by Cequence impersonating AI agents.
references:
  - https://www.infosecurity-magazine.com/news/secrethunting-trafficai-agent/
  - https://attack.mitre.org/techniques/T1552/001/
  - https://attack.mitre.org/techniques/T1190/
author: Security Arsenal
date: 2026/04/06
tags:
  - attack.discovery
  - attack.t1190
  - attack.t1552.001
logsource:
  category: webserver
detection:
  selection_paths:
    cs-uri-stem|contains:
      - '/.env'
      - '/.git/'
      - '/.svn/'
      - '/.aws/credentials'
      - '/wp-config.php'
      - '/config.php.bak'
      - '/config.yml'
      - '/config.json'
      - '/secrets'
      - '/.npmrc'
      - '/.dockercfg'
      - '/id_rsa'
      - '/server-status'
      - '/.htpasswd'
  condition: selection_paths
falsepositives:
  - Internal vulnerability scanners and authorized penetration tests (allowlist by source IP/user-agent)
level: high
---
title: AI Agent User-Agent Requesting Sensitive Application Paths
id: 8c2d5f47-1a9e-4b3c-8d6f-4e7a2b5c8d12
status: experimental
description: Detects requests presenting well-known AI agent/crawler user-agent strings (GPTBot, ClaudeBot, PerplexityBot, etc.) while requesting sensitive configuration or credential paths. Legitimate AI crawlers do not enumerate .env or .git paths — this combination is a strong indicator of spoofed agent identity.
references:
  - https://www.infosecurity-magazine.com/news/secrethunting-trafficai-agent/
  - https://attack.mitre.org/techniques/T1036/
author: Security Arsenal
date: 2026/04/06
tags:
  - attack.defense_evasion
  - attack.t1036
  - attack.t1190
logsource:
  category: webserver
detection:
  selection_ua:
    cs-user-agent|contains:
      - 'GPTBot'
      - 'ClaudeBot'
      - 'Claude-User'
      - 'PerplexityBot'
      - 'Google-Extended'
      - 'Bytespider'
      - 'CCBot'
      - 'Applebot-Extended'
  selection_paths:
    cs-uri-stem|contains:
      - '/.env'
      - '/.git/'
      - '/.aws/'
      - '/wp-config'
      - '.bak'
      - '/config'
      - '/secret'
      - '/.ssh'
  condition: selection_ua and selection_paths
falsepositives:
  - Extremely rare; a verified legitimate AI crawler should never request these paths
level: critical
---
title: High-Volume Path Enumeration from Single Source Against Web Root
id: 5e1b9d38-6c4f-4a2b-9e8d-1c3a6f7b2d45
status: experimental
description: Detects a single source IP generating a high volume of distinct URI requests with 404 responses within a short window, consistent with automated secret-hunting enumeration. Tune threshold to environment baseline.
references:
  - https://www.infosecurity-magazine.com/news/secrethunting-trafficai-agent/
  - https://attack.mitre.org/techniques/T1595/
author: Security Arsenal
date: 2026/04/06
tags:
  - attack.reconnaissance
  - attack.t1595.003
logsource:
  category: webserver
detection:
  selection:
    sc-status: 404
  timeframe: 5m
  condition: selection | count(cs-uri-stem) by c-ip > 50
falsepositives:
  - Misconfigured health checks, broken links on high-traffic pages, aggressive legitimate crawlers (verify against published crawler IP ranges)
level: medium

KQL — Microsoft Sentinel / Defender

This query hunts for secret-path probing in W3C IIS logs and generic web logs ingested via CEF/Syslog, and flags requests where an AI-agent user-agent is involved. It also correlates with a failure-code pattern typical of enumeration. Adjust table/column names to match your ingestion schema (Azure Front Door, App Gateway, and Apache/nginx via Syslog all land differently).

KQL — Microsoft Sentinel / Defender
// Hunt: Secret-path probing, including spoofed AI-agent user-agents
let SecretPaths = dynamic(["/.env", "/.git", "/.svn", "/.aws", "/wp-config", "config.php.bak", "/config.yml", "/secrets", "/id_rsa", "/.npmrc", "/server-status", "/.htpasswd"]);
let AgentUAs = dynamic(["GPTBot", "ClaudeBot", "Claude-User", "PerplexityBot", "Google-Extended", "Bytespider", "CCBot", "Applebot-Extended"]);
union isfuzzy=true
    (W3CIISLog
     | extend Uri = csUriStem, UA = csUserAgent, SrcIP = cIP, Status = scStatus),
    (CommonSecurityLog
     | extend Uri = RequestURL, UA = RequestContext, SrcIP = SourceIP, Status = tostring(AdditionalExtensions)),
    (Syslog
     | where SyslogMessage has_any (SecretPaths)
     | extend Uri = extract(@'"[A-Z]+ ([^ ]+) HTTP', 1, SyslogMessage),
              UA = extract(@'"[^"]*" "([^"]*)"', 1, SyslogMessage),
              SrcIP = extract(@'^(\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3})', 1, SyslogMessage),
              Status = "")
| where Uri has_any (SecretPaths)
| extend SpoofedAgentSuspect = iif(UA has_any (AgentUAs), "YES - AI agent UA on secret path", "No")
| summarize Requests = count(),
            DistinctPaths = dcount(Uri),
            Paths = make_set(Uri, 20),
            Statuses = make_set(Status),
            UserAgents = make_set(UA, 5)
    by SrcIP, SpoofedAgentSuspect, bin(TimeGenerated, 1h)
| order by Requests desc;

Run the second half of this logic as a standing analytic rule scoped to agent user-agents only — a critical-severity, near-zero-false-positive alert — and keep the broad path match as a hunting query with source-IP allowlisting for your own scanners.

Velociraptor VQL

If you suspect a front-end web server was enumerated and want to confirm what was actually served (vs. logged), hunt the access logs on the server itself. This artifact parses nginx/Apache access logs for secret-path requests and returns requesting IPs and user-agents for triage.

VQL — Velociraptor
-- Hunt: Secret-path probing in local web server access logs
-- Parses combined-format access logs for requests to credential/config paths
LET secret_regex = '(?i)(\.env|\.git/|\.svn/|\.aws|wp-config|config\.php\.bak|config\.yml|id_rsa|\.npmrc|server-status|\.htpasswd|secrets)'
LET log_lines = SELECT parse_file_with_regex(
        filename=FullPath,
        regex='^(?P<SrcIP>\\S+) \\S+ \\S+ \\[(?P<Timestamp>[^\\]]+)\\] "(?P<Method>\\S+) (?P<Uri>\\S+)[^"]*" (?P<Status>\\d{3}) (?P<Size>\\S+)[^"]*"(?P<UA>[^"]*)"'
    ) AS Line
    FROM glob(globs=['/var/log/nginx/access.log*', '/var/log/apache2/access.log*', '/var/log/httpd/access_log*'])
SELECT Line.SrcIP AS SourceIP,
       Line.Uri AS RequestedURI,
       Line.Status AS HTTPStatus,
       Line.UA AS UserAgent,
       Line.Timestamp AS RequestTime,
       FullPath AS LogFile
FROM log_lines
WHERE Line.Uri =~ secret_regex
ORDER BY RequestTime DESC

Pay particular attention to any request that returned a 200 status against one of these paths — that is a confirmed secret disclosure and an incident, not a hunting lead. Rotate every credential in the served file immediately.

Remediation & Hardening Script

The following Bash script audits a Linux web host for the two failure modes behind this campaign: secrets reachable under the web root, and missing deny rules for dotfiles/sensitive paths in nginx. Run it on front-end servers (adapt paths for Apache/IIS).

Bash / Shell
#!/usr/bin/env bash
# Security Arsenal - Secret-Exposure & AI-Agent Spoofing Hardening Audit (nginx)
set -euo pipefail

WEBROOTS=("/var/www" "/usr/share/nginx/html" "/srv/www")
NGINX_CONF_DIR="/etc/nginx"
REPORT="/root/secret_exposure_audit_$(date +%Y%m%d).txt"

echo "=== Security Arsenal Secret-Exposure Audit $(date) ===" | tee "$REPORT"

# 1. Find secret-bearing files sitting under web roots
echo -e "\n[1] Secret-bearing files under web roots:" | tee -a "$REPORT"
FOUND=0
for ROOT in "${WEBROOTS[@]}"; do
  [ -d "$ROOT" ] || continue
  while IFS= read -r f; do
    echo "  !! EXPOSED CANDIDATE: $f" | tee -a "$REPORT"
    FOUND=1
  done < <(find "$ROOT" -type f \( -name '.env*' -o -name '*.pem' -o -name 'id_rsa*' \
        -o -name '.npmrc' -o -name 'wp-config.php*' -o -name '*.bak' -o -name '.htpasswd' \) 2>/dev/null)
  find "$ROOT" -type d -name '.git' 2>/dev/null | while read -r d; do
    echo "  !! GIT REPO IN WEBROOT: $d" | tee -a "$REPORT"; done
done
[ "$FOUND" -eq 0 ] && echo "  OK - no obvious secrets found under web roots." | tee -a "$REPORT"

# 2. Check nginx config for dotfile deny rules
echo -e "\n[2] nginx dotfile/sensitive-path protections:" | tee -a "$REPORT"
if grep -rEsq 'location\s+~?\s*[/]*\\\.' "$NGINX_CONF_DIR" 2>/dev/null; then
  echo "  OK - dotfile deny location block detected in nginx config." | tee -a "$REPORT"
else
  echo "  !! MISSING - no dotfile deny rule found. Add to your server block:" | tee -a "$REPORT"
  cat <<'EOF' | tee -a "$REPORT"
    location ~ /\. { deny all; return 404; }
    location ~* \.(env|git|svn|bak|sql|pem|key|htpasswd)$ { deny all; return 404; }
EOF
fi

# 3. Verify exposure from the server's own perspective (local requests)
echo -e "\n[3] Live reachability test (localhost):" | tee -a "$REPORT"
for PATH_T in "/.env" "/.git/config" "/.git/HEAD" "/wp-config.php.bak" "/server-status"; do
  CODE=$(curl -sk -o /dev/null -w '%{http_code}' "http://127.0.0.1${PATH_T}" || echo "ERR")
  if [ "$CODE" = "200" ]; then
    echo "  !! CRITICAL: ${PATH_T} returned HTTP 200 - SECRET DISCLOSURE. Rotate credentials NOW." | tee -a "$REPORT"
  else
    echo "  OK: ${PATH_T} -> HTTP ${CODE}" | tee -a "$REPORT"
  fi
done

# 4. Recent suspicious access-log hits (last 24h)
echo -e "\n[4] Secret-path requests in access logs (last 24h):" | tee -a "$REPORT"
grep -hEi '(\.env|\.git/|\.aws|wp-config|config\.php\.bak|id_rsa|server-status)' \
  /var/log/nginx/access.log* /var/log/apache2/access.log* 2>/dev/null \
  | grep -E "$(date +%d/%b/%Y)|$(date -d 'yesterday' +%d/%b/%Y)" \
  | awk '{print $1, $7, $9}' | sort | uniq -c | sort -rn | head -25 | tee -a "$REPORT" \
  || echo "  No matches found." | tee -a "$REPORT"

echo -e "\n=== Audit complete. Report saved to $REPORT ==="

Any line prefixed !! warrants immediate action. A 200 response on a secret path means assume compromise: rotate the exposed credentials, review cloud/SaaS audit logs for use of those keys, and scope for follow-on access.

Remediation

There is no patch for this campaign — remediation is architectural. Prioritize the following, in order:

1. Eliminate the target (highest impact, do this week)

  • Remove all secret-bearing files and directories (.env, .git, backups, .aws, key material) from web-accessible roots. Secrets belong in a secrets manager (AWS Secrets Manager, Azure Key Vault, HashiCorp Vault, Doppler) — never in files served by a web tier.
  • Add explicit deny rules for dotfiles and sensitive extensions at the web server, CDN, and WAF layers (script above provides nginx examples; for Apache use RedirectMatch 404 /\..*).
  • Confirm from an external vantage point — not just localhost — that these paths return 404/403. Your CDN or edge may behave differently than origin.

2. Verify AI agent identity — stop trusting user-agent strings

  • Implement reverse-DNS + forward-confirmed IP validation for any traffic claiming to be a legitimate AI agent. OpenAI, Anthropic, Perplexity, Google, Apple, and other operators publish their crawler IP ranges and verification guidance — enforce it at the WAF/bot-management layer and reject or challenge agent-claimed traffic from outside those ranges.
  • Move to cryptographic verification where available: signed-agent standards (HTTP message signatures / verified-bot programs offered by major CDN and bot-management vendors) remove user-agent spoofing as a viable technique entirely.
  • Audit your WAF allowlists right now. Any rule that keys trust off a user-agent string alone is a hole the size of this campaign.

3. Reduce what "agent" traffic can reach

  • Apply the principle of least privilege to agent-classified traffic: agents that need to read your content do not need access to transactional API endpoints, authenticated actions, or administrative paths. Segregate agent-facing functionality and scope it tightly.
  • Rate-limit and challenge by behavior, not identity claim — burst enumeration of distinct paths should trip controls regardless of what the client calls itself.

4. Detection & monitoring

  • Deploy the Sigma rule for secret-path requests as a high-severity analytic. Any 200 response on those paths is a P1 incident.
  • Baseline your legitimate verified-agent traffic so spoofed sources stand out; alert on agent UAs from unverified IPs.
  • Feed WAF/CDN edge logs into your SIEM — origin logs alone will miss blocked or edge-absorbed probing.

5. Incident response readiness

  • Pre-stage a credential rotation runbook. When (not if) a .env or key file is confirmed served to an external requester, rotation speed determines whether you have a log entry or a breach.
  • Review cloud provider audit logs (CloudTrail, Azure Activity Log, GCP Audit Logs) and SaaS token usage for any credential that has ever been reachable from the web tier.

The deeper lesson of Cequence's finding is one I'd put in front of every CISO this quarter: the AI agent era is creating new trust relationships faster than we're securing them. Every convenience you extend to agent traffic is an inheritance attackers can claim. Verify identity cryptographically, scope access minimally, and make sure there is nothing for a spoofed agent to find.

Related Resources

Security Arsenal Penetration Testing Services AlertMonitor Platform Book a SOC Assessment vulnerability-management Intel Hub

Is your security operations ready?

Get a free SOC assessment or see how AlertMonitor cuts through alert noise with automated triage.