AIDEFEND in Action AIA-0179 Incident

ShadowRay 2.0: Exposed Ray Clusters Became a Mining Botnet That Infects the Next Cluster

Ray spreads computing work across many machines, including AI training jobs. In November 2025, Oligo Security reported attackers submitting jobs to Ray systems exposed to the Internet without authentication. They used the machines to mine cryptocurrency, stole credentials and used compromised clusters to reach more Ray systems. The risk starts with who can submit work, since Ray runs the code it receives.

Resource HijackingRemote Code ExecutionAI Deployment SecurityRuntime IsolationAI Infrastructure
11 applicable AIDEFEND defenses

Threat Analysis

  • An open job API, used at scale. Ray's dashboard (port 8265 by default) includes a Jobs API that runs whatever entrypoint a caller submits as the cluster's own workload. Oligo observed attackers sending test jobs that did nothing but contact an oast.fun subdomain of interact.sh, an out-of-band testing service that records when a system connects back, so any cluster that called back had shown that it runs submitted code. Those clusters then received jobs carrying Base64-encoded Bash and Python stages, which downloaded further scripts and miners, listed the cluster's nodes with ray.nodes() and used Ray's NodeAffinitySchedulingStrategy to run the payload on every live node.
  • What the payloads did on each node. Oligo reports CPU mining with XMRig capped at about 60% of the CPUs, and GPU mining on NVIDIA cards, including A100s. On one cluster 23.9 GB of GPU memory was in use while Ray's dashboard showed 0% GPU utilization. Processes were renamed to look like kernel workers or system services, rival miners were killed and their pools blocked. Access was kept with a cron entry that re-downloaded a script every 15 minutes, systemd and init services, shell startup edits and attacker SSH keys, eventually for root, plus reverse shells to AWS-hosted command-and-control servers. The attackers also took MySQL credentials with root access to a production database from job environment variables and configuration files.
  • What is new since the 2024 ShadowRay. The entry point is the one Oligo reported in March 2024. The difference is what happens after it: compromised clusters scanned for other exposed dashboards and sent them the same callback test, and the attacker then sent the full payload, so each victim helped find the next. Payloads moved from a GitLab project, removed on 5 November 2025, to GitHub release files from 10 November, and a new GitHub repository appeared the same day the previous one was taken down on 17 November. Oligo also found sockstress, a TCP state-exhaustion tool, aimed at production websites, and reads it as a sign that the clusters are being used for denial-of-service attacks.
  • A disputed CVE and an opt-in fix. CVE-2023-48022 records unauthenticated code execution through Ray's job submission API, rated 9.8 under CVSS 3.1 in CISA's enrichment of the record. It is marked disputed: Anyscale's position is that Ray is meant to run only in a strictly controlled network, and it told The Register that the activity came from self-hosted clusters incorrectly exposed to the public Internet. No release changes the API's behavior. Ray 2.52.0, published on 21 November 2025, added token authentication; 2.59 turns it on by default only for local clusters, and Ray's documentation says 2.61, not yet released on 1 December 2026, will extend that default to all clusters.
  • What the evidence shows, and what it does not. Oligo counted more than 200,000 Ray servers reachable from the Internet in Shodan data, about ten times its 2024 count; that measures exposure, not compromise, and Oligo gives no total of infected clusters. Avi Lumelsky of Oligo told The Register that the attackers had reached every Ray server the team inspected by hand. Oligo says the operation may have started as early as September 2024. Its view that the payloads were likely LLM-generated rests on comments, docstrings and error-handling style; it is an inference, not a confirmed fact. In August 2026 Oligo assessed that the actor it calls TeamPCP was responsible, based on reused infrastructure and script names, without a stated confidence level and without being able to say whether that reflects a rebrand, shared operators or collaboration.

Applicable AIDEFEND Defenses (11)

AID-I-002.001
Internal AI Network Segmentation
Very High
Ray's own guidance is to enforce isolation outside the cluster, because anyone who reaches its ports can run code. Firewall or security-group rules applied outside the hosts should admit the dashboard port (8265 by default) and Ray's other ports only from the administrator, CI and gateway hosts that need them. Internet scanners and other compromised clusters then cannot deliver the test job or the payload job at all, which stops this campaign at its entry. A host that is allowed in can still submit any code, so authentication is still needed behind this boundary.
AID-H-003.010
Deployed AI Software Vulnerability Remediation Lifecycle
Very High
Deploy Ray 2.52.0 or later and make sure token authentication is active on each running cluster. Ray 2.59 enables it by default only for local clusters. Check every job submission endpoint: a request without a token must be refused. Use an encrypted connection and keep network access restricted, because the cluster uses one shared token.
AID-I-002.002
Secure External AI Service Connectivity
Very High
Ray worker nodes rarely need to open connections to arbitrary Internet hosts. With outbound connections blocked by default at a firewall or proxy outside the nodes, and allowed only to approved package mirrors, storage and model registries by DNS name and TLS SNI, the miners cannot reach their mining pools and a compromised cluster cannot connect to other organizations' Ray dashboards. The mining earns the attacker nothing and the spread stops at this cluster. An allowed destination that relays traffic onward, or a NAT path that bypasses the proxy, reopens both. The same default-deny rule acts earlier in the chain. GitLab, GitHub release files, download servers addressed by raw IP, ip-api.com and the oast.fun callback domain are not on a worker's allowlist, so the staged scripts and miner binaries fail to download and the reverse shells to AWS-hosted servers on ports such as 3876 and 40331 cannot connect. Clusters that legitimately pull from GitHub should do so through an internal mirror rather than by allowing github.com outright, or payloads hosted in GitHub releases still come through.
AID-H-004.002
Service & API Authentication
High
Where CI pipelines or services must submit jobs from outside the cluster network, an authenticating reverse proxy can stand in front of the dashboard port and verify a short-lived OAuth token (signature, issuer, audience, expiry and scope) for each caller before forwarding the request; Ray's job submission client can send the Authorization header. Unlike Ray's single shared token, each caller then holds its own expiring credential that can be revoked alone, and the proxy also works on releases older than 2.52.0. It covers only the HTTP dashboard port, so it depends on the network restriction to keep the direct port and Ray's other ports unreachable.
AID-D-005.012
AI Host Process Lineage & Persistence-Write Detection
High
Ray jobs legitimately run arbitrary Python, so an allowlist of every child process is impractical on a Ray node. What is rare is a Ray worker process starting curl or wget piped into a shell, decoding Base64 into an interpreter, or holding a long-lived outbound shell. Recording every program started beneath the Ray worker processes, with parent chain and command line, and alerting on those patterns catches the stage downloads and the reverse shells on the node where they start. A renamed process name (kworker/0:0) does not change the executable path or parent chain the sensor records. Jobs that legitimately download data will need tuning, and the alert blocks nothing. The cron entry that re-downloads a script every 15 minutes, the systemd and init services, the shell startup edits and the added authorized_keys lines are all writes to scheduled-execution, start-up and remote-logon locations. Watching /etc/cron*, user crontabs, systemd unit directories, /etc/init.d, shell startup files and every authorized_keys file on Ray nodes, and tying each write to the process tree that made it, flags the persistence when it is created instead of after the next reboot. Appending a key to an existing file is visible only to an audit rule that records writes, not to one that records file creation.
AID-D-005.005
Accelerator Telemetry Anomaly Detection
High
On one cluster Ray's dashboard reported 0% GPU utilization while 23.9 GB of GPU memory was in use, which Oligo attributes to a miner subprocess taking over the GPU outside Ray's view. GPU telemetry collected on the host (for example the NVIDIA DCGM exporter or nvidia-smi into Prometheus) and compared with the GPUs Ray has actually allocated to jobs exposes that gap: sustained utilization or memory on a device with no Ray allocation, or far above the workload's baseline, is a finding. It detects GPU mining only. The CPU miner capped at 60% needs host CPU monitoring, and a miner hidden inside an allocated GPU job blends into that job's baseline.
AID-E-003.003
Confirmed Malicious Code & Persistence Eviction
High
The cron entry, systemd units, init script and shell startup edits are file-backed persistence that survives a job stop and a Ray restart. Once confirmed, keep copies as evidence and remove them from every node, and from any machine image, container image or shared home directory that would put them back; a shared NFS home mounted on every node would replant a .bashrc edit on all of them. Confirm afterwards that a fresh node built from those sources starts without them. If a source itself cannot be trusted, rebuild rather than clean.
AID-E-001.001
Root & Long-Lived Credential Object Eviction
High
Oligo reports that the MySQL credentials in Ray job environment variables and configuration files were taken, and that they gave root on a production database. Dealing with a stolen password means issuing a new one, moving every job and service that uses it to the new value, and then disabling the old one at the database, so that the copy the attackers hold stops working. Do the same for long-lived cloud keys found in the job environment. Do this after the compromised nodes are stopped or rebuilt; otherwise the new value lands in the same job environment and can be taken again. Rotation does not undo data already read with the old credential. The SSH keys the attackers added to authorized_keys, eventually for root, are long-lived credentials that keep working after the job API is closed. Remove every key that is not on the approved list from every account on every node, and from images and shared home directories, then confirm with an independent inventory that only approved keys remain.
AID-R-006
Clean-Room AI System Redeployment Orchestration
High
An attacker who had root, cron persistence and a reverse shell on every node leaves hosts that cannot be trusted to report their own state. Rebuild the head and worker nodes from trusted images, in order, and make the cluster's return to service depend on recorded results: network restriction verified, token authentication refusing anonymous jobs, egress limits in place, and credentials rotated. A rebuilt cluster that is still reachable without authentication would be reinfected by the next scan.
AID-H-004.008
AI Workload Identity Permission Scoping at Downstream Services
High
A MySQL credential with root on a production database had no reason to sit in a Ray job's environment. Give the cluster's workloads their own database user and cloud role, granting only the schemas, tables, buckets and actions their jobs use, so that a credential taken from a node reaches only what that workload needed. This narrows the damage of a theft; it does not stop the theft, and anything inside the granted scope stays exposed.
AID-E-001.002
Issued Token, Authentication Session & Lease Revocation
Medium
Compromised machines in this campaign held cloud tokens, and some of them could use AWS EKS roles. Role credentials are temporary but stay valid until they expire, and rotating long-lived keys does not touch them. Revoke the sessions already issued to the roles the compromised nodes used, at the cloud provider, and confirm that a session token captured during the investigation is refused. Do this after the compromised nodes are stopped or rebuilt, because a node that is still running can request fresh role credentials. The gain is bounded: it ends early only role credentials already copied and not yet expired, and it depends on the nodes being stopped first. Oligo does not report that these cloud credentials were used.

What Defenders Should Do Now

  • Find every Ray cluster and test it from outside. Include KubeRay deployments and notebook or experiment clusters. From an authorized external host, check whether the dashboard (8265) or other Ray ports answer. The Ray project's Open Ports Checker does this from a Ray-team server, which receives your IP address and open ports unless you host your own. Use read-only checks: do not submit a job to test a cluster.
  • Take the ports off networks that do not need them. Allow inbound connections only from the administrator, CI and gateway hosts that use them, and bind Ray to a private interface rather than 0.0.0.0. Pass condition: from the Internet and from an unlisted internal host, connections to 8265 and the other Ray ports fail.
  • Require authentication on job submission. Read the running Ray version. On 2.52.0 or later, set RAY_AUTH_MODE=token on every node and client and distribute the token, carrying it only over TLS, an SSH tunnel or a VPN. On an older release, upgrade; until then, keep the cluster unreachable. Pass condition: a job submitted without a token is refused.
  • Block outbound connections from Ray nodes by default. Allow only the package mirrors, storage and registries the jobs need. Pass condition: from a worker, connections to a mining-pool hostname, to an arbitrary external IP on port 8265 and to an unlisted website all fail.
  • Check whether a cluster was already used. Look in Ray's job history for jobs nobody on the team submitted, and in DNS and proxy logs for oast.fun lookups or mining-pool connections. On each node, look for cron entries that download scripts, unfamiliar systemd or init services, new authorized_keys lines (including root's), a process named kworker/0:0 that has an executable file on disk (real kernel workers have none), and GPU memory in use while Ray shows no GPU allocation. Oligo's report lists indicators to search for.
  • If a cluster was compromised, rebuild it. Preserve evidence, stop the malicious processes, rebuild every node from trusted images instead of cleaning in place, and remove planted keys and start-up entries from images and shared home directories. Rotate the MySQL and other credentials the jobs held, revoke cloud role sessions issued to the nodes, and give the replacements only the access the jobs need. Return the cluster to service only after an unauthenticated job is refused and the outbound limits are verified.

2 additional considerations

Bind Ray's listeners to private interfaces and check them after start

Oligo advises against binding Ray to 0.0.0.0. The team that starts clusters can give the head node and the dashboard a specific private address, so they listen only on a private subnet or VPN interface.
Recommendation: After each start, list the listening sockets on the head node and compare them with the intended addresses, and treat a wildcard bind as a failed start. This adds to the firewall rules: a private bind keeps an accidental public IP from exposing the port, while the firewall still decides which internal hosts may connect. On Kubernetes, the Service type and ingress decide exposure, so check those as well.

Compare host CPU use with the work Ray has scheduled

The CPU miner was capped at about 60% of the CPUs so that it would not stand out, and Ray's own dashboard did not show the GPU miner. Host-level CPU metrics from a node exporter or cloud monitoring, compared with the tasks Ray is running, show sustained load that no job explains.
Recommendation: Have the platform or SRE team alert when a node's CPU use stays well above what its scheduled Ray tasks account for, or when an idle node stays busy. This finds mining after it starts and needs per-workload baselines; bursty legitimate jobs will need tuning.

Conclusion

A public Ray job endpoint gave attackers computing power and a way to reach more clusters. AIDEFEND  points to restricting who can submit jobs, blocking unapproved outbound connections and watching the hosts for mining and persistence. Rebuild compromised nodes from trusted images and replace exposed credentials.

Last updated: