WHTNS RAT Abuse of Codex and Antigravity
BLOG

AI Agents Under Control: WHTNS RAT Abuse of Codex and Antigravity

PUBLISHED DEC 4, 2026 BY Varadharajan Krishnasamy

Rubrik Zero Labs analyzes a Windows remote access trojan named WHTNS Remote Access Toolbox.

Executive Summary

As AI coding agents become increasingly integrated into enterprise development environments, they introduce new opportunities for threat actors to exploit compromised endpoints.

Rubrik Zero Labs identified and analyzed a Windows remote access trojan named WHTNS Remote Access Toolbox. The malware incorporates dedicated functionality targeting two AI coding agents: OpenAI Codex and Google Antigravity.

Rather than using its own large language model, WHTNS is designed to abuse AI coding agents already installed on compromised systems. Through its command-and-control infrastructure, the malware enables threat actors to submit prompts, retrieve execution output, and access historical conversations. WHTNS also implements a continuous monitoring mechanism designed to capture newly generated Antigravity conversation content.

By abusing these AI agents, threat actors could potentially gain access to proprietary source code, sensitive conversations, credentials, application architecture, and internal development information. They could also leverage the agents' existing permissions and connected tools to interact with organizational resources, potentially extending the impact of a compromise beyond the infected endpoint.

In addition to these AI-specific capabilities, WHTNS supports conventional remote access operations, including desktop surveillance, shell execution, file management, process management, and credential-related collection.

These findings highlight how traditional remote access malware is evolving to target AI-assisted development environments and the sensitive data and resources accessible through them.

WHTNS RAT overview
Figure 1: Overview of WHTNS RAT and its interaction with locally installed AI coding agents

Technical Analysis

Infection Chain

The WHTNS delivery chain begins with a malicious batch script that masquerades as a Windows screen-locking utility named WINDOWS LOCKER v2.1. The script contains Russian-language comments describing its locking and unlocking functionality and attributes its authorship to ClaudeAI.

Upon execution, the batch script displays a fake system update screen through an HTML Application file launched using mshta.exe. The interface displays an animated progress bar and messages suggesting that system updates are in progress, distracting the victim while a Base64-encoded PowerShell command executes in the background.

Fake system update screen
Figure 2: Fake system update screen displayed during WHTNS payload delivery

The PowerShell command retrieves content from hxxps://pastebin[.]com/raw/KkFnwYiB, which contains a URL pointing to another PowerShell script hosted at hxxps://rat[.]whtns[.]online/d.ps1. This script is subsequently retrieved and executed.

The d.ps1 script downloads an executable named dropper.exe from hxxps://rat[.]whtns[.]online/agents/ab4b928c404f38f3/dropper.exe. The executable is saved in the Windows temporary directory with a randomly generated filename and launched with a hidden window.

The downloader then retrieves the WHTNS RAT, named RegistryHost.exe, from hxxps://rat[.]whtns[.]online/agents/ab4b928c404f38f3/RegistryHost.exe and executes it on the compromised system. The initial distribution method of the malicious batch script remains unknown.

Further investigation of the infrastructure associated with WHTNS revealed a web-based panel with an account registration and approval mechanism, as shown below.

Figure 3: Web-based panel associated with WHTNS

Establishing the Command-and-Control Channel

Upon execution, WHTNS creates the named mutex Local\WHTNS_REGISTRYHOST_SINGLETON to prevent multiple instances from running simultaneously. If another instance already exists, the malware terminates execution.

WHTNS then establishes communication with its configured C2 gateway using WinHTTP and the user agent WHTNS-RAT-Host/1.0. To register the compromised endpoint, the malware constructs an HTTP request containing the machine identifier, computer name, username, GPU information, operating system, and user identifier.

The HTTP connection is subsequently upgraded to a WebSocket connection using WinHttpWebSocketCompleteUpgrade API, enabling bidirectional communication with the C2 server. Once connected, WHTNS sends a system notification indicating that the compromised host is available to the operator. WHTNS also uses WinHttpWebSocketReceive API to receive JSON-formatted commands from the C2 server and forwards them to its central command dispatcher for execution.

Extending Remote Access to AI Coding Agents

The central command dispatcher recognizes 27 distinct operator commands. Of particular interest are six commands specifically designed to interact with OpenAI Codex and Google Antigravity.

CommandDescription
codex_sendSubmits a prompt to Codex
get_codex_chatsEnumerates saved Codex conversations
get_codex_chatRetrieves messages from a selected Codex conversation
agy_sendSubmits a prompt to a new or existing Antigravity conversation
get_agy_chatsEnumerates saved Antigravity conversations
get_agy_chatRetrieves messages from a selected Antigravity conversation

When an AI-specific command is received, WHTNS extracts the associated parameters and delegates the operation to a separate worker thread. This allows potentially long-running AI interactions to take place without interrupting the primary C2 communication or other remote access operations.

Targeting OpenAI Codex

Leveraging Codex as a Remote Execution Interface

OpenAI Codex provides a command-line interface (CLI) that allows developers to interact with an AI coding agent directly from their development environment. In addition to interactive sessions, Codex supports noninteractive execution, enabling it to process instructions without requiring direct user interaction.

WHTNS leverages this functionality through its codex_send command. Upon receiving the command from the C2 server, the malware extracts three fields from the JSON message:

  • Prompt - Instruction supplied by the remote operator
  • Cwd - Working directory for the Codex execution
  • Model - Requested AI model

If the cwd or model field is empty, WHTNS defaults to C:\Users\whitenessdev\source\repos\payload and gpt-6-luna, respectively. The hard-coded path appears to be an artifact of the malware's development environment. 

Using these parameters, WHTNS constructs and executes the following command through the Windows command interpreter:

  • cmd.exe /c codex exec "<prompt>" -C "<cwd>" -m "<model>" --skip-git-repo-check

The -C and -m parameters specify the working directory and model, respectively. The --skip-git-repo-check option allows Codex to operate outside Git repositories without disabling its sandboxing or approval mechanisms.

Reusing the Existing AI Environment

Rather than implementing its own OpenAI API client or supplying an independent API credential, WHTNS delegates AI communication to the locally installed Codex executable.

This approach potentially allows the remote operator to benefit from the authentication and configuration already available within the compromised user's environment.

For example, if Codex is installed and authenticated on a developer's workstation, WHTNS can attempt to initiate an AI-assisted operation through that existing installation without directly implementing the authentication or model communication protocols.

However, the malware's ability to successfully perform such an operation remains dependent on the local Codex installation, authentication state, model availability, sandbox restrictions, and permissions granted to the agent.

Each codex_send request creates a new noninteractive execution. However, the analyzed implementation does not attempt to resume an existing Codex conversation through this command. Once the process has been launched, WHTNS implements a separate mechanism to capture the resulting output and deliver it to the remote operator.

Streaming Codex Execution Output

To capture Codex execution output, WHTNS creates an anonymous Windows pipe using the CreatePipe API and redirects both standard output (stdout) and standard error (stderr) to it. The malware then launches the command through cmd.exe using CreateProcessW with the CREATE_NO_WINDOW flag, preventing a separate console window from appearing.

As Codex generates output, WHTNS reads the data using ReadFile, accumulates it, and transmits individual chunks to the C2 server over the established WebSocket connection as JSON messages identified by the codex_chunk message type.

Codex execution output
Figure 4:&nbsp;Capturing Codex execution output from an anonymous pipe

This mechanism enables the operator to receive output while execution is in progress. WHTNS enforces a 120-second execution timeout and limits the accumulated output to 512 KiB.Once the process-handling routine completes, WHTNS sends a final response to the C2 server containing the original request identifier and accumulated output, which may include AI-generated responses, command results, and error messages.

Enumerating Codex Conversations

Beyond submitting prompts and capturing execution output, WHTNS also targets the local conversation histories maintained by Codex to preserve context between development sessions. As these histories may contain sensitive information about projects, technologies, and organizational resources, the malware implements two dedicated commands, get_codex_chats and get_codex_chat, to enumerate and retrieve stored conversations.

Upon receiving the get_codex_chats command from the C2 server, WHTNS reads the locally maintained session index at %USERPROFILE%\.codex\session_index.jsonl.

The malware reverses the order of the nonempty records to prioritize recent entries and extracts the id and thread_namefields, representing the conversation identifier and title, respectively. If the thread name is unavailable, the conversation identifier is used as the title.

WHTNS returns up to 40 conversation identifiers and titles to the C2 server, allowing the operator to select conversations of interest and retrieve their contents using the get_codex_chat command.

Retrieving Codex Conversation History

Once the operator selects a conversation of interest, WHTNS uses the get_codex_chat command to retrieve its stored messages. Unlike the session-listing routine, the malware recursively searches %USERPROFILE%\.codex\sessions\ for a JSONL file whose path contains the requested conversation identifier.

After locating the file, WHTNS parses the message records, excluding those associated with the developer role and user records containing the <environment_context> marker, which represent internal agent instructions and automatically supplied environment information, respectively.

The malware extracts user prompts and assistant responses, classifies them as USER and MODEL, respectively, and returns up to the last 40 retained messages to the C2 server.

This selective filtering allows the operator to review conversations without retrieving the entire session file, potentially exposing proprietary source code, vulnerability information, application architecture, infrastructure details, and other sensitive information shared with Codex.

Targeting Google Antigravity

Discovering the Local Agent Service

Unlike the Codex integration, which relies on the Codex CLI, WHTNS attempts to interact with Google Antigravity through its local language server.

The malware first checks the ANTIGRAVITY_LS_ADDRESS environment variable for the language server's address. If unavailable, WHTNS uses Windows Toolhelp APIs to enumerate running processes and identify instances of language_server.exe. It then invokes the GetExtendedTcpTable API to identify an associated TCP listening port, constructs the language server address in the format localhost:<port>, and stores it in the ANTIGRAVITY_LS_ADDRESS environment variable.

If this mechanism fails, WHTNS falls back to PowerShell, using the Get-CimInstance cmdlet to identify the language-server process and the Get-NetTCPConnection cmdlet to retrieve its TCP listening port on the loopback address 127.0.0.1.

Discovery of the Antigravity language server and its TCP listening port
Figure 5:&nbsp;Discovery of the Antigravity language server and its TCP listening port

During discovery, WHTNS also checks the ANTIGRAVITY_CSRF_TOKEN environment variable. If unavailable, the malware uses PowerShell to inspect the language server's command line, extracts the value associated with the --csrf_tokenargument, and stores it in the environment variable.

Rather than implementing its own Google AI API client, WHTNS attempts to reuse Antigravity's local communication interface. The language server address and CSRF token are used to facilitate the submission of operator-supplied prompts, as discussed in the following section.

Interacting with New and Existing Antigravity Conversations

After discovering the local language server address and obtaining the CSRF token, WHTNS attempts to interact with Antigravity through its Windows batch wrapper located at %USERPROFILE%\.gemini\antigravity\bin\agentapi.bat.

The agentapi.bat file is a legitimate Windows wrapper for Antigravity's agentapi CLI, which enables programmatic interaction with its local language server, language_server.exe. WHTNS abuses this interface to submit operator-supplied prompts without interacting with the Antigravity graphical interface.

Upon receiving the agy_send command from the C2 server, the malware extracts three fields: prompt, conversationId, and model.

Google's Antigravity documentation describes two relevant agentapi subcommands: send-message and new-conversation. If a conversation identifier is provided, WHTNS uses send-message to submit the prompt to an existing conversation. Otherwise, it uses new-conversation to initiate a new conversation, with flash as the default model if none is specified.

Unlike the Codex integration, which initiates a new noninteractive execution for each request, the Antigravity integration allows WHTNS to interact with existing conversations, potentially leveraging previously established context, including project information, source code, and user-supplied instructions.

Enumerating and Retrieving Antigravity Conversations

In addition to submitting prompts, WHTNS implements two dedicated commands, get_agy_chats and get_agy_chat, to enumerate and retrieve locally stored Antigravity conversations.

Upon receiving the get_agy_chats command, WHTNS enumerates conversation directories under %USERPROFILE%\.gemini\antigravity\brain\ and locates the corresponding transcript file at <conversation-id>\.system_generated\logs\transcript.jsonl.

The malware extracts the conversation identifier from the directory name and examines up to the first 25 lines of the transcript for USER_EXPLICIT or USER markers to derive the conversation title. The conversations are then sorted by transcript modification time, and the identifiers and titles of up to 40 conversations are returned to the C2 server.

Once the operator selects a conversation, WHTNS uses the get_agy_chat command to locate its transcript file and parses the source and content fields to extract user prompts and AI-generated responses, returning up to the last 40 retained messages to the C2 server.

Continuous Surveillance of AI Conversations

One of the most distinctive capabilities of WHTNS is its ability to continuously monitor Antigravity conversations without requiring a separate C2 command.

Once a WebSocket connection is established, WHTNS identifies the most recently modified conversation directory under %USERPROFILE%\.gemini\antigravity\brain\ and records the end-of-file position of its corresponding transcript.jsonl file.

The malware monitors the transcript for newly appended records, extracts their source and content fields, and transmits them to the C2 server using the agy_new message type.

This functionality allows the operator to observe ongoing AI conversations without repeatedly requesting conversation history or monitoring the victim's desktop, potentially exposing proprietary source code, application architecture, and other sensitive project information.

Conventional Remote Access Capabilities

In addition to its AI-agent integrations, WHTNS supports the following conventional remote access commands.

CommandDescription
screen_startStarts capturing and streaming the victim's screen
screen_stopStops screen streaming
webcam_startEnables webcam-related state and configuration
webcam_stopDisables webcam-related state
mouseSimulates mouse movements and actions
keySimulates keyboard input
type_textSimulates text input
shortcutExecutes keyboard shortcuts
cmdExecutes Windows shell commands and returns their output
fs_listLists files and directories
fs_runLaunches a specified file
fs_mkdirCreates a directory
fs_deleteDeletes a file or an empty directory
fs_downloadTransfers files from the compromised endpoint
fs_uploadUploads files to the compromised endpoint
proc_listLists running processes
proc_killTerminates a specified process
self_infoRetrieves malware installation and startup information
self_installCopies the malware and removes existing autorun entries
stealCollects system information and credential-related data
pingChecks connectivity and returns a pong response

What Makes WHTNS Different?

Traditional RATs provide operators with direct control over compromised systems through remote command execution, desktop surveillance, and file manipulation. WHTNS extends these capabilities by treating locally installed AI coding agents as additional interfaces for remote interaction.

Unlike infostealers that primarily focus on collecting stored credentials and sensitive data, WHTNS combines historical conversation retrieval, continuous conversation surveillance, and remote interaction with AI agents.

Depending on the permissions and integrations available to these agents, an operator could potentially access proprietary source code, modify application files, introduce malicious changes into software projects, and interact with connected enterprise resources.

This potentially expands the impact of an endpoint compromise beyond the infected system to the broader software development environment, introducing risks to intellectual property, software integrity, and the software supply chain.

Conclusion

WHTNS illustrates how the growing adoption of AI coding agents is introducing new opportunities for conventional malware. Its approach does not rely on exploiting vulnerabilities in the AI platforms themselves, but instead abuses legitimate functionality available within a compromised environment.

As AI agents become more deeply integrated into software development and enterprise workflows, they are becoming valuable targets for threat actors. WHTNS represents an emerging shift in the threat landscape, where AI agents are not merely targets of information theft but also potential interfaces for carrying out unauthorized activities.

Detecting and Responding to WHTNS with Rubrik

The file hashes and YARA rule associated with WHTNS are available in the Rubrik Zero Labs threat intelligence feed, enabling Rubrik Threat Monitoring to detect the presence of this malware in protected backups.

Rubrik Agent Cloud provides visibility into AI-agent activities and enables organizations to monitor and enforce policies against unauthorized or malicious actions. Through Agent Rewind, organizations can also reverse unintended or malicious changes made by AI agents across supported environments.

These capabilities help organizations detect malware, identify AI-agent abuse, and recover from the impact of unauthorized actions.

File Indicators

DescriptionSHA-256
Initial batch script - Winlock.bat 372c691614c7d41f06a095f55d7f019c8ab6e9756e92a34d3b723bc5901a1b46
PS downloader - d.ps157004fc238177098e951d66011b2405e10b8ee4e0c45b2204ce9a462de17cce3
Downloader - Dropper.exee8b8b5955554272f4c4d03eeab9850e747473aa16f8a9e994fba48c327b5aa58
WHTNS RAT2bbf9d1067b2097932246fd9f8616387e029d849f68a0c1101a87a13eb97cd7d
WHTNS RATd2c2f36eb5760f4aa21ad7e18cd4bd46b8f023d167bd8b29c0ef14ac58901f6e
WHTNS RAT638580e032840d6dae4f3c51a1b106e70a9bbf5188c2e8f91364f31f1b207dc0
WHTNS RAT228cda114b37fa03f6f474a362a07adb96f0f5f3b970b81169ab3d8b25bb8bd6

Network Indicators

DescriptionIndicator
Malicious payload hosting domainrat[.]whtns[.]online

YARA RULE

rule rbrk_WHTNS_RAT

{

    meta:

        description = "Detects WHTNS RAT targeting AI agents"

        author = "Rubrik Zero Labs"

        category = "RAT"

        date = "2026-11-30"

 

    strings:

        $s1 = "WHTNS-RAT-Host/1.0" wide

        $s2 = "codex_chunk" ascii

        $s3 = "agy_new" ascii

        $s4 = "get_codex_chats" ascii

        $s5 = "get_agy_chats" ascii

 

    condition:

        uint16(0) == 0x5A4D and

        all of ($s*)

}

MITRE ATT&CK Mapping

TacticTechnique IDTechnique Name
ExecutionT1059.003Command and Scripting Interpreter: Windows Command Shell
ExecutionT1059.001Command and Scripting Interpreter: PowerShell
DiscoveryT1057Process Discovery
DiscoveryT1083File and Directory Discovery
CollectionT1005Data from Local System
CollectionT1113Screen Capture
Command and ControlT1071.001Application Layer Protocol: Web Protocols
Command and ControlT1105Ingress Tool Transfer
ExfiltrationT1041Exfiltration Over C2 Channel