# Automating defenses against agentic AI espionage
Agentic AI has changed the speed of cyberespionage. CrowdStrike research shows the China-nexus threat actor VAPOR PANDA used a framework called ARTEX to scale its global campaign [1]. The campaign began on October 17, 2026, and targeted more than 200 distinct organizations worldwide [1]. Targets include foreign ministries in Asia, Europe, the Middle East, and Latin America, plus organizations in the semiconductor, defense, and pharmaceutical sectors [1].
VAPOR PANDA used multi-agent AI. It paired the Chinese DeepSeek large language model (LLM) with a second commercial LLM to run parallel intrusions [1]. That let the group compromise 140 sensitive targets in 11 days [2]. Manual response timelines no longer work against that pace.
Detecting agentic AI patterns with working examples
Agentic AI frameworks like ARTEX do not follow a static playbook. They adapt in real time to how target systems respond. The VAPOR PANDA campaign hit more than 200 organizations in at least 14 countries [2], which points to rapid, automated reconnaissance.
Practitioners should move toward behavioral automation. Use Zeek or another monitoring suite to flag anomalous bursts of authentication attempts or rapid directory traversal across multiple segments. ARTEX uses LLMs to drive its logic [1]. The traffic may look human, but the velocity is machine-driven.
None of the rules below are published ARTEX indicators. CrowdStrike's write-up describes behavior, not signatures [1], so these are rate and pattern detections you tune to your own baseline.
Zeek script for high-velocity detection
Zeek's notice framework lets a script raise a named alert when a threshold is crossed, and route it to email, a log or an external system [5]. The script below counts HTTP login POSTs, path traversal requests and failed SSH logins per source. Zeek's SSH analyzer raises ssh_auth_failed when it infers a failed login [10]. When five or more /24 segments trip the login threshold within an hour, it raises a parallel-intrusion notice. The last handler posts selected notices to an n8n webhook with Zeek's ActiveHTTP module, which shells out to curl [9]. It needs Zeek 6 or later for the when [req] capture syntax.
# agentic_ai_detection.zeek: copy to the site directory, then add
# "@load agentic_ai_detection" to local.zeek
@load base/frameworks/notice
@load base/protocols/http
@load base/protocols/ssh
@load base/utils/active-http
module AgenticAI;
export {
redef enum Notice::Type += {
HighVelocityAuth,
RapidDirectoryTraversal,
LLMEndpointInteraction,
ParallelIntrusionPattern
};
## Login paths to count. Adjust to your applications.
option auth_paths: set[string] = { "/login", "/api/auth", "/token" };
## LLM API ranges change often and many sit behind shared CDNs, so fill
## this from current threat intel in local.zeek, for example:
## redef AgenticAI::llm_endpoints += { <llm-api-subnet> };
option llm_endpoints: set[subnet] = {};
option http_auth_threshold = 50;
option traversal_threshold = 100;
option ssh_fail_threshold = 30;
option segment_threshold = 5;
## n8n webhook that receives selected notices as JSON
option webhook_url = "https://<your-n8n-host>/webhook/agentic-ai-alert";
option forward_notes: set[Notice::Type] = { HighVelocityAuth, ParallelIntrusionPattern };
}
# Counters expire 5 minutes after the first hit from a source
global auth_attempts: table[addr] of count &default=0 &create_expire=5min;
global traversals: table[addr] of count &default=0 &create_expire=5min;
global ssh_failures: table[addr] of count &default=0 &create_expire=5min;
# /24 segments that produced a HighVelocityAuth notice in the last hour
global noisy_segments: set[subnet] &create_expire=1hr;
function flag_auth(c: connection, n: count, what: string)
{
NOTICE([$note=HighVelocityAuth, $conn=c,
$msg=fmt("%s: %d from %s in 5 min", what, n, c$id$orig_h),
$identifier=cat(c$id$orig_h)]);
add noisy_segments[mask_addr(c$id$orig_h, 24)];
if ( |noisy_segments| == segment_threshold )
NOTICE([$note=ParallelIntrusionPattern,
$msg=fmt("High-velocity logins from %d /24 segments within an hour", |noisy_segments|),
$identifier="parallel"]);
}
event http_request(c: connection, method: string, original_URI: string,
unescaped_URI: string, version: string)
{
local src = c$id$orig_h;
if ( method == "POST" && original_URI in auth_paths )
{
++auth_attempts[src];
if ( auth_attempts[src] == http_auth_threshold )
flag_auth(c, auth_attempts[src], "HTTP login POSTs");
}
if ( /\.\.|%2e%2e|%252e%252e/i in original_URI )
{
++traversals[src];
if ( traversals[src] == traversal_threshold )
NOTICE([$note=RapidDirectoryTraversal, $conn=c,
$msg=fmt("%d path traversal requests from %s in 5 min", traversals[src], src),
$identifier=cat(src)]);
}
}
event ssh_auth_failed(c: connection)
{
local src = c$id$orig_h;
++ssh_failures[src];
if ( ssh_failures[src] == ssh_fail_threshold )
flag_auth(c, ssh_failures[src], "SSH login failures");
}
event connection_established(c: connection)
{
if ( c$id$resp_h in llm_endpoints )
NOTICE([$note=LLMEndpointInteraction, $conn=c,
$msg=fmt("%s connected to listed LLM endpoint %s", c$id$orig_h, c$id$resp_h),
$identifier=cat(c$id$orig_h, c$id$resp_h)]);
}
# Forward selected notices to n8n as they are logged
event Notice::log_notice(rec: Notice::Info)
{
if ( rec$note !in forward_notes )
return;
local req = ActiveHTTP::Request($url=webhook_url, $method="POST",
$client_data=to_json(rec, T),
$addl_curl_args="-H 'Content-Type: application/json'");
when [req] ( local resp = ActiveHTTP::request(req) )
{
if ( resp$code != 200 )
Reporter::warning(fmt("n8n webhook returned HTTP %d", resp$code));
}
}# Deploy the script (zeekctl default paths; adjust to your install)
sudo cp agentic_ai_detection.zeek /opt/zeek/share/zeek/site/
echo '@load agentic_ai_detection' | sudo tee -a /opt/zeek/share/zeek/site/local.zeek
sudo zeekctl check && sudo zeekctl deploy
# Test offline against a capture first
zeek -r sample.pcap localSuricata rules for the same patterns
Run custom rules like these beside a maintained rule set. Emerging Threats publishes a free open rule set for Suricata that covers known scanners and exploit kits [6]. SSH login results are encrypted, so Suricata cannot see a failed SSH login; the fourth rule counts new SSH connections per source instead.
# agentic-ai.rules: add the file to rule-files in suricata.yaml
# High velocity login POSTs
alert http any any -> $HOME_NET any (msg:"AGENTIC-AI High velocity login POSTs"; \
flow:to_server,established; http.method; content:"POST"; http.uri; content:"/login"; \
detection_filter:track by_src, count 50, seconds 300; \
classtype:attempted-recon; sid:1000001; rev:2;)
# Rapid path traversal (raw URI, so encoded dots are still visible)
alert http any any -> $HOME_NET any (msg:"AGENTIC-AI Rapid path traversal"; \
flow:to_server,established; http.uri.raw; pcre:"/(\.\.|%2e%2e|%252e%252e)/i"; \
detection_filter:track by_src, count 100, seconds 300; \
classtype:web-application-attack; sid:1000002; rev:2;)
# TLS sessions to public LLM API hosts, matched on the server name (SNI)
alert tls $HOME_NET any -> $EXTERNAL_NET any (msg:"AGENTIC-AI TLS to LLM API host"; \
flow:to_server,established; tls.sni; \
pcre:"/^(api\.openai\.com|api\.anthropic\.com|api\.deepseek\.com|generativelanguage\.googleapis\.com)$/"; \
classtype:policy-violation; sid:1000003; rev:2;)
# Burst of new SSH connections from one source
alert tcp any any -> $HOME_NET 22 (msg:"AGENTIC-AI SSH connection burst"; \
flow:to_server; flags:S,CE; \
detection_filter:track by_src, count 30, seconds 300; \
classtype:attempted-admin; sid:1000004; rev:2;)# Test the configuration, then reload rules without a restart
# (reload-rules needs the unix-command socket enabled in suricata.yaml)
sudo suricata -T -c /etc/suricata/suricata.yaml
sudo suricatasc -c reload-rulesn8n workflow for automated containment
The workflow takes the Zeek notice posted above, checks that the source is a well-formed IPv4 address, runs a block script on the n8n host, and opens a Jira issue. Three nodes do the work:
- The Code node runs JavaScript in the
jsCodeparameter and returns a list of items [12]. - The Execute Command node has one main parameter,
command, and runs it in the n8n host's default shell. It exists only on self-hosted n8n and is disabled by default from n8n 2.0, so enable it deliberately [11]. - The HTTP Request node posts the issue with
method,url,authenticationand a JSON body [13]. Jira Cloud's v2 REST API accepts a plain-text description onPOST /rest/api/2/issue[14].
block-host.sh is a placeholder for your own script that calls your firewall or EDR. n8n has no built-in firewall action, and a memory capture on the remote host has to come from your EDR's own API, so it is not part of this workflow.
{
"name": "Agentic AI Auto-Containment",
"nodes": [
{
"parameters": {
"httpMethod": "POST",
"path": "agentic-ai-alert",
"responseMode": "onReceived",
"options": {}
},
"name": "Zeek Notice Webhook",
"type": "n8n-nodes-base.webhook",
"typeVersion": 2,
"position": [250, 300]
},
{
"parameters": {
"jsCode": "// One item per source address to block\nconst ipv4 = /^(25[0-5]|2[0-4]\\d|1?\\d?\\d)(\\.(25[0-5]|2[0-4]\\d|1?\\d?\\d)){3}$/;\nconst out = [];\nfor (const item of $input.all()) {\n const notice = item.json.body ?? item.json;\n const note = String(notice.note ?? '');\n const src = String(notice.src ?? '');\n if (!/HighVelocityAuth|ParallelIntrusion/.test(note)) continue;\n if (!ipv4.test(src)) continue;\n out.push({ json: { target: src, note, msg: String(notice.msg ?? '') } });\n}\nreturn out;"
},
"name": "Pick Hosts To Block",
"type": "n8n-nodes-base.code",
"typeVersion": 2,
"position": [500, 300]
},
{
"parameters": {
"command": "=/usr/local/bin/block-host.sh {{ $json.target }}"
},
"name": "Block Host",
"type": "n8n-nodes-base.executeCommand",
"typeVersion": 1,
"position": [750, 300]
},
{
"parameters": {
"method": "POST",
"url": "https://<your-site>.atlassian.net/rest/api/2/issue",
"authentication": "genericCredentialType",
"genericAuthType": "httpBasicAuth",
"sendBody": true,
"specifyBody": "json",
"jsonBody": "={{ JSON.stringify({ fields: { project: { key: 'SEC' }, issuetype: { name: 'Task' }, summary: 'AUTO-CONTAIN: blocked ' + $('Pick Hosts To Block').item.json.target, description: $('Pick Hosts To Block').item.json.note + ': ' + $('Pick Hosts To Block').item.json.msg + ' (blocked at ' + $now.toISO() + ')', labels: ['agentic-ai', 'auto-containment'] } }) }}",
"options": {}
},
"name": "Create Jira Issue",
"type": "n8n-nodes-base.httpRequest",
"typeVersion": 4.2,
"position": [1000, 300]
}
],
"connections": {
"Zeek Notice Webhook": { "main": [[{ "node": "Pick Hosts To Block", "type": "main", "index": 0 }]] },
"Pick Hosts To Block": { "main": [[{ "node": "Block Host", "type": "main", "index": 0 }]] },
"Block Host": { "main": [[{ "node": "Create Jira Issue", "type": "main", "index": 0 }]] }
}
}After import, attach an HTTP Basic Auth credential (your Jira account email and an API token) to the Create Jira Issue node, and change the project key and issue type to ones that exist in your Jira site.
Hardening the attack surface with Semgrep and CodeQL
The VAPOR PANDA campaign shows that AI can find and exploit vulnerabilities faster than humans can patch them [3]. Teams need to automate the discovery of vulnerabilities in their own code to block the initial entry that lets ARTEX operate. Semgrep matches code patterns with rules written to look like the code itself [7]. CodeQL treats code as a database you can query, which suits tracing untrusted input through to a dangerous call [8].
Semgrep rules for common entry points
These rules target Python web apps built on Flask. Three use Semgrep's taint mode, which tracks data from a source (here, any attribute of flask.request) to a sink and stops at a sanitizer [15]. A rule's patterns are parsed in each listed language, so keep one language per rule and write a sibling rule for each other language you use.
# .semgrep-rules/ai-exploited-patterns.yaml
rules:
# Command injection: request data reaches a shell
- id: flask-request-to-shell
mode: taint
languages: [python]
severity: ERROR
message: Request data reaches a shell command
metadata:
cwe: "CWE-78"
pattern-sources:
- pattern: flask.request.$ATTR
pattern-sinks:
- pattern: os.system(...)
- pattern: subprocess.$FUNC(..., shell=True, ...)
# SSRF: request data controls an outbound URL
- id: flask-request-to-outbound-url
mode: taint
languages: [python]
severity: ERROR
message: Request data controls the URL of an outbound request
metadata:
cwe: "CWE-918"
pattern-sources:
- pattern: flask.request.$ATTR
pattern-sinks:
- patterns:
- pattern: requests.$METHOD($URL, ...)
- focus-metavariable: $URL
- patterns:
- pattern: urllib.request.urlopen($URL, ...)
- focus-metavariable: $URL
# Path traversal: request data opens a file
- id: flask-request-to-open
mode: taint
languages: [python]
severity: ERROR
message: Request data controls a file path
metadata:
cwe: "CWE-22"
pattern-sources:
- pattern: flask.request.$ATTR
pattern-sanitizers:
- pattern: werkzeug.utils.secure_filename(...)
pattern-sinks:
- patterns:
- pattern: open($PATH, ...)
- focus-metavariable: $PATH
# Weak hashes
- id: weak-hash-md5-sha1
languages: [python]
severity: WARNING
message: MD5 and SHA-1 are not collision resistant
metadata:
cwe: "CWE-327"
pattern-either:
- pattern: hashlib.md5(...)
- pattern: hashlib.sha1(...)--json-output and --sarif-output write copies of the results to files, and --error makes semgrep scan exit 1 when there are findings [16].
# Local scan: custom rules plus the registry rules Semgrep picks for the project
semgrep scan --config .semgrep-rules/ai-exploited-patterns.yaml --config auto \
--json-output ai_exploited_vulns.json \
--sarif-output ai_exploited_vulns.sarif \
/path/to/codebase/# .github/workflows/semgrep.yml: fail the build on ERROR findings
name: semgrep
on: [pull_request]
jobs:
semgrep:
runs-on: ubuntu-latest
container:
image: semgrep/semgrep
steps:
- uses: actions/checkout@v4
- run: semgrep scan --config .semgrep-rules/ai-exploited-patterns.yaml --severity ERROR --errorCodeQL query for untrusted input in Java
This query uses CodeQL's current taint-tracking API: a configuration module implementing DataFlow::ConfigSig, passed to TaintTracking::Global [17]. RemoteFlowSource covers request parameters, headers and other remote input the standard library models already know.
/**
* @name Untrusted input reaches a command or file read
* @kind path-problem
* @id custom/java/untrusted-input-to-sink
*/
import java
import semmle.code.java.dataflow.FlowSources
import semmle.code.java.dataflow.TaintTracking
module UntrustedToSinkConfig implements DataFlow::ConfigSig {
predicate isSource(DataFlow::Node source) { source instanceof RemoteFlowSource }
predicate isSink(DataFlow::Node sink) {
exists(MethodCall mc |
(
mc.getMethod().hasQualifiedName("java.lang", "Runtime", "exec") or
mc.getMethod().hasQualifiedName("java.nio.file", "Files", "readAllBytes")
) and
sink.asExpr() = mc.getArgument(0)
)
}
}
module UntrustedToSinkFlow = TaintTracking::Global<UntrustedToSinkConfig>;
import UntrustedToSinkFlow::PathGraph
from UntrustedToSinkFlow::PathNode source, UntrustedToSinkFlow::PathNode sink
where UntrustedToSinkFlow::flowPath(source, sink)
select sink.getNode(), source, sink, "Untrusted input from $@ reaches a sensitive call.",
source.getNode(), "this source"A custom query has to live in a query pack that depends on the Java library. Java databases can be built without compiling the code by passing --build-mode=none [18].
# One-time pack setup: save the query as queries/untrusted-to-sink.ql
mkdir -p queries
cat > queries/qlpack.yml << 'EOF'
name: local/agentic-queries
version: 0.0.1
dependencies:
codeql/java-all: "*"
EOF
codeql pack install queries
# Build the database and run the custom query plus the security-extended suite
codeql database create /tmp/java-db --language=java-kotlin --build-mode=none --source-root=/path/to/code
codeql database analyze /tmp/java-db queries/untrusted-to-sink.ql \
codeql/java-queries:codeql-suites/java-security-extended.qls \
--download --format=sarif-latest --output=ai-attack-vectors.sarif \
--ram=8192 --threads=4Actions for the VAPOR PANDA event
The VAPOR PANDA campaign confirmed post-exploitation at nine organizations, including two Latin American foreign ministries [4]. To reduce the risk of similar agentic AI attacks, practitioners should take these actions:
- Audit logs for activity starting October 17, 2026, looking for patterns of rapid, parallel intrusions across different network segments [1].
# Zeek notices from Oct 17 onward (-d prints readable timestamps)
zeek-cut -d ts src note msg < /opt/zeek/logs/current/notice.log | \
awk -F'\t' '$1 >= "2026-10-17" && $3 ~ /HighVelocityAuth|ParallelIntrusion/'
# Suricata alerts from the rules above, from eve.json
jq -r 'select(.event_type == "alert" and .timestamp >= "2026-10-17" and .alert.signature_id >= 1000001 and .alert.signature_id <= 1000004) | "\(.timestamp) \(.src_ip) \(.alert.signature)"' /var/log/suricata/eve.json- Review access logs for interactions with known DeepSeek or other commercial LLM endpoints, which may indicate an attacker is using these tools to proxy commands into the environment [1].
# Proxy or firewall logs (path and format depend on your product)
grep -E "api\.(deepseek|anthropic|openai)\.com|generativelanguage\.googleapis\.com" /var/log/proxy/access.log
# Zeek ssl.log, matched on the TLS server name
zeek-cut -d ts id.orig_h id.resp_h server_name < /opt/zeek/logs/current/ssl.log | \
grep -E "api\.(deepseek|anthropic|openai)\.com|generativelanguage\.googleapis\.com"- Set up an automated containment workflow in n8n or a similar tool to isolate systems that show the high-velocity reconnaissance patterns seen in the ARTEX framework. Import the workflow JSON above, set
AgenticAI::webhook_urlin local.zeek to the production URL of its webhook node, and runzeekctl deploy. For Suricata, ship eve.json alerts to the same webhook with your log shipper.
- Deploy CodeQL or Semgrep to scan public-facing applications for vulnerabilities, focusing on the sectors VAPOR PANDA is targeting, such as pharmaceutical and semiconductor infrastructure.
# Run both scanners on internet-facing repos
semgrep scan --config .semgrep-rules/ai-exploited-patterns.yaml --config auto /path/to/public-apps/
codeql database analyze /tmp/public-db queries/untrusted-to-sink.ql --format=sarif-latest --output=public-ai-vectors.sarif- Update incident response playbooks to include a Machine-Speed Response tier, since agentic AI can compromise over 100 targets in less than two weeks [2].
# Create machine-speed runbook template
cat > /opt/playbooks/machine-speed-response.md << 'EOF'
# Machine-Speed Response Playbook - Agentic AI Threats
## Trigger Conditions
- Zeek HighVelocityAuth notice (50 login POSTs or 30 SSH failures in 5 min)
- Zeek ParallelIntrusionPattern notice (5+ segments in an hour)
- Suricata AGENTIC-AI rules firing
## Automated Actions (n8n workflow)
1. Block the source host through block-host.sh
2. Open a Jira issue with the notice details
## Manual Follow-up (within 15 min)
- Verify containment succeeded
- Capture memory on affected hosts through the EDR
- Check for lateral movement to high-value targets
- Rotate credentials for affected accounts
- Update threat intel with new indicators
## Recovery
- Restore from clean backup if compromise confirmed
- Re-image affected systems
- Validate no persistence mechanisms remain
EOFTry it yourself: BitLocker Recovery Key: Find It or Fix a Lost One, a free tool from CyberAutomations.