8 min readSecurity radar

How Chinese-Nexus AI Agents Found and Weaponized a Zero-Day Using Cairn

Amazon Threat Intelligence observed a Chinese-nexus threat actor using an exposed instance of the open-source Cairn framework to run autonomous hacking operations against East Asian universities. Over 48 hours, the AI agents independently discovered a zero-day path traversal flaw in a medical imaging application and chained it into a root reverse shell.

Technical illustration: How Chinese-Nexus AI Agents Found and Weaponized a Zero-Day Using Cairn

On September 10, 2026, Amazon Threat Intelligence discovered an internet-facing server running Cairn, an open-source autonomous penetration-testing framework, with no authentication in front of its management interface. Because the operator left the platform exposed, anyone on the internet could read its project configurations, task prompts, and full execution logs. Those logs documented a roughly 48-hour offensive campaign beginning September 8, 2026, targeting university IP ranges in East Asia outside mainland China. Rather than Cairn itself suffering a compromise, the evidence showed a Chinese-nexus threat actor using Cairn as an automated attacker to pursue a single plain-language objective: "obtain shell access."

This incident matters because it moves autonomous offensive AI out of benchmark suites and into live intrusion telemetry. Given only target addresses and an outcome goal, the agents planned multi-hour intrusion chains, adjusted when exploits failed, and independently discovered a previously unknown zero-day vulnerability in an open-source medical imaging AI application. Within eleven minutes of fingerprinting that application, the agents turned an upload path traversal flaw into arbitrary file writes, and in a follow-on session achieved a reverse shell running as root.

What Cairn Does and Why Attackers Adopted It

Cairn was built as an open-source research and problem-solving engine for defenders. In normal use, a security engineer supplies a starting target and a plain-language objective, and Cairn coordinates multiple specialized AI agents to test hypotheses, run commands, read error output, and iterate toward the goal. Unlike a traditional vulnerability scanner that fires static templates and stops after printing a report, an agentic framework treats every HTTP response, stack trace, or port banner as feedback that shapes the next command.

That same autonomy lowers the operational barrier for threat actors. Instead of manually scripting reconnaissance, researching target software, and chaining secondary vulnerabilities, an operator can hand Cairn a list of IP addresses and walk away. In this campaign, the operator wrote prompts in Simplified Chinese and configured executed scripts to use China Standard Time timestamps. By leaving the Cairn instance publicly reachable without authentication, the operator inadvertently gave defenders a rare window into how autonomous agents behave when turned loose against real university networks.

Anatomy of a 48-Hour Autonomous Campaign

Before reaching the zero-day, the agents spent nearly a full day grinding through hardened or dead-end services across multiple university targets. Two unsuccessful operations in particular illustrate how agentic persistence changes the defensive threat model.

The longest operation ran for roughly 16 hours and executed 148 sequential actions against an unauthenticated Redis instance at one university. Redis is an in-memory data store designed to cache frequently accessed application data for fast retrieval; when exposed without authentication, it often serves as a bridge into underlying host infrastructure. The agents systematically worked through known Redis post-exploitation techniques, including abusing Redis replication to load unauthorized modules, attempting to escape its scripting sandbox, overwriting configuration files, and trying memory corruption primitives.

When Redis resisted code execution, the agents did not terminate the run. Instead, they pivoted laterally across services sharing the same environment, attempting Log4Shell injection against a co-located service and exploiting a server-side request forgery (SSRF) vulnerability in a nearby Qdrant vector database to map the internal Docker network topology. Armed with that internal map, the agents launched credential sprays against PostgreSQL, SSH, and several other internal endpoints. Every one of those attempts failed, yet the agents kept adapting for 16 hours without human intervention.

A second operation ran for more than six hours against a university GPU server, a high-performance compute host typically deployed for machine learning workloads. Rather than blindly brute-forcing default logins, the agents first performed automated open-source intelligence gathering across the university's public footprint, harvesting faculty directories, lab websites, archived web pages, and academic papers to compile a list of roughly 80 real institutional usernames. They then tested more than 30,000 username-and-password combinations across SSH, an administrative dashboard, a network storage device, a VPN gateway, and the campus portal. None of those credentials worked, demonstrating that basic identity hygiene still stops automated spraying, even when paired with tailored username harvesting.

The 11-Minute Zero-Day Chain and Startup Hook Execution

Against a server running an open-source medical imaging AI application, the agents found a much softer trust boundary. In plain terms, path traversal occurs when an application trusts a user-supplied filename to build a filesystem path without stripping directory navigation sequences such as ../. If a web server intends to store uploads inside a dedicated directory, an unchecked filename parameter lets an attacker walk up the directory tree and overwrite files elsewhere on the host.

The agents began by fingerprinting the application framework and mapping its API surface. Within roughly 11 minutes of starting API discovery, they located a file upload endpoint accepting a filename parameter, probed it for directory traversal, and confirmed arbitrary file write access on the underlying server. Amazon Threat Intelligence assessed with high confidence that this flaw was a zero-day at the time of exploitation, as there were no existing fixes, public issues, security advisories, or vulnerability database entries corresponding to the bug.

In a subsequent session, the agents converted arbitrary file write into full remote code execution by targeting sitecustomize.py. Python automatically searches for and imports sitecustomize.py during interpreter startup whenever the file exists on the module search path, before executing any user script or application entrypoint. By writing a Python reverse shell payload to sitecustomize.py via the upload flaw, the agents did not need an explicit command-injection vulnerability to run their code; they only needed a legitimate reason for the server to start a new Python interpreter.

flowchart TD A["Cairn AI Agents (Target List + Goal)"] --> B["Fingerprint Medical Imaging AI App"] B --> C["Discover Upload Endpoint (filename Parameter)"] C --> D["Exploit Zero-Day Path Traversal (Arbitrary File Write)"] D --> E["Overwrite sitecustomize.py with Reverse Shell"] E --> F["Trigger Training API Endpoint"] F --> G["Spawn New Python Process as root"] G --> H["Auto-Import sitecustomize.py -> Root Reverse Shell"] H --> I["Human Operator Supplies Proxy into Second University"]

To trigger that startup hook, the agents called an exposed training API endpoint that spawned a new Python process. Because the application service was running with root privileges, the newly spawned interpreter imported the poisoned sitecustomize.py and opened an outbound reverse shell as root. After the agents uncovered the vulnerability, the human operator stepped back in during another session, providing a proxy tunneling into a second university network via a server running the same medical imaging software. Based on the shared software profile, Amazon Threat Intelligence inferred that the operator had used the newly discovered zero-day to compromise that bridge host and directed the agents through the tunnel to probe additional internal systems.

From a defensive engineering perspective, the root cause was a compound failure across two layers: missing path canonicalization at the API upload handler and excessive operating system privileges on the worker runtime. When an upload handler joins a base directory with an untrusted filename, naive string concatenation allows traversal outside the intended upload folder:

# Defensive containment pattern on an internal app.example upload worker
from pathlib import Path
 
UPLOAD_ROOT = Path("/var/lib/medimg/uploads").resolve()
 
def save_upload(filename: str, payload: bytes) -> Path:
    # Reject directory components and verify resolved prefix
    safe_name = Path(filename).name
    if not safe_name or safe_name in {".", ".."}:
        raise ValueError("Invalid filename")
    destination = (UPLOAD_ROOT / safe_name).resolve()
    if not destination.is_relative_to(UPLOAD_ROOT):
        raise PermissionError("Path traversal blocked")
    destination.write_bytes(payload)
    return destination

Even when an application prevents direct command execution, any arbitrary file write inside a container or host running as root collapses the boundary between data storage and code execution. Overwriting sitecustomize.py, shell profiles, cron entries, or dynamic linker configurations turns static file corruption into privileged execution on the next scheduled or API-triggered process launch.

Affected Scope, Attribution, and Known Unknowns

Several boundaries in the public reporting are important to keep clear so engineering teams prioritize the right risks:

  • Where the zero-day lived: The zero-day was in an open-source medical imaging AI application, not in Cairn itself. Amazon Threat Intelligence notified the medical imaging project's maintainers, who released a patch and published a GitHub Security Advisory. Because the affected universities were not AWS customers, AWS coordinated with a government partner to notify them.
  • Attribution assessment: Amazon Threat Intelligence assesses with moderate confidence that the operator is a Chinese-nexus threat actor, citing Simplified Chinese prompts, China Standard Time timestamps in executed scripts, and targeting focused on universities of strategic interest in East Asia outside mainland China.
  • Wider threat-actor adoption: Separate reporting from Gambit Security documented a financially motivated group also using Cairn, confirming that agentic frameworks are attracting both state-nexus and criminal operators.
  • Remaining unknowns: The public summary does not disclose the name of the affected medical imaging AI project, a specific CVE identifier, or whether the agents achieved further compromises inside the second university network after pivoting through the operator-supplied proxy.

Detection, Hardening, and Verification Steps

Defending against autonomous agents requires shifting focus from blocking individual payloads to breaking the feedback loops and privilege escalations that agents rely on across multi-hour runs. Seasoned teams should treat any unauthenticated service, permissive upload path, or root-owned ML runtime as an immediate escalation path.

First, strip root privileges from AI training, inference, and web-upload workloads, and mount Python runtime directories read-only. In container deployments, run application workers under an unprivileged UID, restrict write permissions strictly to dedicated upload or scratch volumes, and ensure site-packages and interpreter startup paths are owned by root and immutable to the service user. That single architectural invariant neutralizes sitecustomize.py persistence even if an undiscovered file-write zero-day exists in an upstream framework.

Second, audit internal and internet-facing AI platforms, vector stores, and caches for missing authentication and SSRF exposure. In the observed campaign, unauthenticated Redis and an SSRF flaw in Qdrant gave the agents both an internal Docker topology map and lateral spray targets. Enforce authentication on Redis, Qdrant, and PostgreSQL, isolate container management and database networks from web-facing ingress, and block unexpected outbound egress from training and inference containers so reverse shells cannot phone home.

Third, instrument monitoring for machine-paced reconnaissance and startup-file tampering. Single human operators rarely execute 148 sequential exploitation techniques over 16 hours or harvest 80 institutional usernames to drive 30,000 login attempts across five distinct services in six hours. Alert on sustained automated API enumeration, bursts of 400/404/500 responses tied to filename or traversal probes, unexpected writes to Python site-packages or sitecustomize.py, and outbound TCP connections initiated by training endpoints.

Finally, run local verification checks against any custom or open-source AI application before exposing it beyond 127.0.0.1 or an authenticated reverse proxy:

# Verify the service does not run as UID 0 (root) and cannot write to site-packages
id
python3 -c "import site, os; print([(p, os.access(p, os.W_OK)) for p in site.getsitepackages()])"
 
# Test upload path containment against a staging instance on localhost
curl -s -o /dev/null -w "%{http_code}\n" \
  -F "file=@/dev/null;filename=../../../../tmp/traversal_check.txt" \
  "http://127.0.0.1:8080/api/upload"

If the site-packages check returns True for write access under the runtime user, or if the localhost traversal probe returns 200 instead of rejecting the path with 400 or 403, fix the container permissions and upload canonicalization immediately. Autonomous agents do not grow tired after their first ten failed payloads; the only durable defense is ensuring that neither 11 minutes of API probing nor 16 hours of automated pivoting crosses a privileged trust boundary.

References & Sources

Related Security Reads

Comments

No comments yet.

Comments are moderated before they appear.

Get new posts by email

No ads, no tracking. Just new posts, unsubscribe any time.