Chasing Shapeshifters: Investigating AI-Generated Polymorphic Malware

Stephen Sam

CypherCon 9.0 (2026)

Overview

In an era where artificial intelligence dominates tech discourse, Stephen Sam of Mandiant and Google delivered a sobering yet insightful talk at CypherCon, shifting the conversation from AI marketing hype to the stark realities of AI abuse in enterprise networks. His presentation, "Chasing Shapeshifters: Investigating AI-Generated Polymorphic Malware," illuminated a terrifying evolution in the threat landscape: adversaries are no longer just using AI to craft better phishing emails, but are embedding it directly into the execution chain of their malware. This new breed of polymorphic malware literally reinvents itself, changing its signature and hash on the fly to evade traditional static defenses.

Watch on YouTube

Visual summary for Chasing Shapeshifters: Investigating AI-Generated Polymorphic Malware by Stephen Sam
Visual summary for Chasing Shapeshifters: Investigating AI-Generated Polymorphic Malware by Stephen Sam

Key moments

  1. 2:38 Introduction to AI-driven polymorphic malware
  2. 5:00 AI for just-in-time code and dissolution attacks
  3. 7:50 Promptflux: malware rewriting its own source code
  4. 12:00 Hunting malware in RAM with Volatility 3 framework
  5. 14:15 Real-time detection using Sysmon and PowerShell logging
  6. 16:30 Disk forensics with USN Journal and PCA artifact
  7. 21:00 Identifying AI code and the future of agentic SOCs

Chasing Shapeshifters: Investigating AI-Generated Polymorphic Malware

Speakers: Stephen Sam, Instant Response Consultant, Mandiant and Google

Conference: CypherCon

YouTube: https://www.youtube.com/watch?v=mjLvrpWVyY0

Overview

In an era where artificial intelligence dominates tech discourse, Stephen Sam of Mandiant and Google delivered a sobering yet insightful talk at CypherCon, shifting the conversation from AI marketing hype to the stark realities of AI abuse in enterprise networks. His presentation, "Chasing Shapeshifters: Investigating AI-Generated Polymorphic Malware," illuminated a terrifying evolution in the threat landscape: adversaries are no longer just using AI to craft better phishing emails, but are embedding it directly into the execution chain of their malware. This new breed of polymorphic malware literally reinvents itself, changing its signature and hash on the fly to evade traditional static defenses.

Sam’s talk served as a critical reminder that the internet, once perceived as "fun," has become a battleground where advanced adversaries leverage AI for just-in-time code generation, drastically reducing dwell times and rendering conventional security tools obsolete. He provided a deep dive into the forensic artifacts left behind by these "shapeshifters" and outlined crucial hunting techniques for incident responders. The core message was clear: to combat this sophisticated threat, defenders must abandon reliance on static binary hashes and embrace advanced memory forensics, behavioral analysis, and novel disk artifact analysis.

Background

▶ Watch: Introduction to AI-driven polymorphic malware (2:38)

For decades, the cybersecurity industry relied on established methods for hunting malware, primarily focusing on static file analysis, hash-based detection, and predictable execution sequences. This approach worked when malware binaries were relatively consistent, allowing security tools to build robust blocklists and signatures. However, the advent of sophisticated AI technologies has fundamentally altered this paradigm, empowering adversaries to create highly evasive and adaptive threats.

According to Mandiant's M-Trends Report 2026, a key resource co-authored by Google and Mandiant, the threat landscape is undergoing significant shifts. One alarming trend is the dramatic reduction in the median dwell time—the period an attacker resides within a network—plummeting from 205 days a decade ago to a mere 11 days today. This isn't because attackers are slower; it's because they are exponentially more efficient. Ransomware campaigns, for instance, have evolved from simple encryption to "recovery deny" tactics, aggressively targeting backup infrastructure, identity services, and even tier-zero hypervisors to bypass guest-level protections. The most critical shift, however, is the abuse of AI within compromised environments, enabling just-in-time code generation to evade detection.

Beyond traditional compromise, adversaries are also targeting the very AI models that enterprises develop. Sam highlighted dissolution attacks, a form of intellectual property theft where attackers query highly valuable machine learning models via their APIs. Based on the outputs, they build cheaper "student models" that replicate the proprietary logic and reasoning capabilities without ever needing to steal the source code or model weights. From a forensic standpoint, these attacks are notoriously difficult to detect, as they involve seemingly benign, high-volume API traffic rather than obvious indicators like buffer overflows or SQL injections. Investigation typically requires analyzing repetitive prompt structures and output patterns, which are indicative of a model being "interrogated" to build adversarial tools.

Key Findings

▶ Watch: Promptflux: malware rewriting its own source code (7:50)

The talk unveiled several alarming developments in AI-powered malware, introducing new families that leverage large language models (LLMs) to achieve unprecedented levels of polymorphism and evasion. These findings underscore the urgent need for a paradigm shift in defensive strategies.

  1. Prompllex: The Self-Rewriting VBScript Dropper:
  • Description: An experimental VBScript dropper that fundamentally redefines polymorphism. Unlike traditional polymorphic malware that uses an encryption stub and decryption payload, Prompllex actively queries LLMs, such as Google Gemini, during execution.
  • Mechanism: It prompts the LLM (e.g., "act as an expert in VBScript obfuscation") to rewrite its own source code on the fly. The LLM generates syntactically different but functionally identical code, which Prompllex then saves to the Windows startup folder for persistence before executing it.
  • Evasion: This dynamic rewriting means there is no static "patient zero" file or hash to add to a blocklist; the file changes completely, potentially every hour. Prompllex effectively uses the LLM as an external Command and Control (C2) server, providing goal-driven guidance to evade defenses.
  1. Promsteel: The AI-Driven Data Miner:
  • Description: Identified by G-tech as being used by the Russian government-backed actor APT28 against Ukraine, Promsteel is a data miner written in Python.
  • Mechanism: It carries very little hard-coded logic. Instead, it queries an LLM, specifically Cohere 2.5 Coder 32B Instruct, to generate one-line Windows command-line tools. For example, it might ask the AI to "write a command to find all PDF and DOCX files, hide them in a folder, stage them, and exfiltrate the data." The Python script then executes these AI-generated commands using OS-level system calls and subprocesses.
  • Evasion: Static defenses are completely blind to Promsteel because the malicious commands are not present until the milliseconds before execution. The malware itself acts as an "empty shell," a mere conduit for AI-generated instructions.
  1. Quiet Vault: The Local AI-Powered Stealer:
  • Description: A JavaScript AI stealer confirmed by the M-Trends report, Quiet Vault specifically targets GitHub and npm developer tokens, a critical vector highlighted by recent compromises like the Exio npm incident.
  • Mechanism: This malware operates with particular cunning by checking the targeted machine for local AI command-line tools, such as Ollama or LM Studio. If found, it executes predefined prompts against these local instances, asking them to reveal local AI configurations and parse them for secrets. These stolen secrets are then packaged for exfiltration to publicly accessible GitHub repositories.
  • Evasion: Quiet Vault represents the "ultimate stop hitting yourself attack." The entire AI process occurs locally, completely bypassing network perimeter defenses, firewalls, and EDR tracking. Furthermore, exfiltration to public GitHub repositories blends seamlessly with benign developer network traffic, making it incredibly difficult to detect.

These findings collectively illustrate a profound shift in adversarial capabilities, moving beyond simple obfuscation to active, dynamic self-modification and context-aware evasion, necessitating a complete re-evaluation of current defensive postures.

Technical Deep Dive

▶ Watch: Hunting malware in RAM with Volatility 3 framework (12:00)

To effectively combat AI-generated polymorphic malware, Stephen Sam emphasized a multi-faceted forensic and detection strategy that moves beyond static analysis. The core principle is to hunt these "shapeshifters" in memory, on disk, and at the kernel level, focusing on their behaviors and artifacts rather than their constantly changing signatures.

Memory Forensics with Volatility 3

When Prompllex or its counterparts generate AI code, they must allocate memory, leaving a crucial artifact in the Windows Virtual Address Descriptor (VAD) tree. In healthy Windows processes, executable memory pages (marked as PAGE_EXECUTE_READ or PAGE_EXECUTE_READWRITE) are almost always mapped back to a legitimate file on disk, such as a DLL. However, when malware dynamically changes code, the Windows memory manager classifies this as private memory because there is no backing file on disk.

Using the Windows.vadinfo plugin in Volatility 3, incident responders can identify these anomalies. Persistent read/write/execute memory that is not backed by a file on disk is a definitive "smoking gun," indicating dynamic code generation or injection. This technique is invaluable for post-mortem analysis, allowing investigators to unmask hidden malicious code that never resided statically on disk.

Real-time Detection with Sysmon

While memory forensics excels in post-mortem analysis, real-time detection is crucial. AI payloads frequently employ techniques like process tampering, process herpaderping, or process hollowing to hide execution threads within benign processes such as svchost.exe or notepad.exe.

To catch these evasive maneuvers, Sam recommends deploying Sysmon configured to look for Event ID 25, which signals process tampering. Sysmon detects discrepancies between the image mapped in memory versus the image mapped on disk. If Event ID 25 triggers on a standard Windows binary, it's a strong indicator of a "shapeshifter wearing a stolen uniform."

De-obfuscation with PowerShell Script Block Logging

AI-generated payloads, particularly those received from LLM "overlords," are often heavily obfuscated using methods like Base64 encoding, XORing, or splitting across numerous variables. Traditional command-line logging (Event ID 4688) will only show a "wall of gibberish," rendering it useless.

The "silver bullet" for de-obfuscation is PowerShell Script Block Logging (Event ID 4104), enabled via Group Policy. When activated, the Windows PowerShell engine captures the completely de-obfuscated code block just before execution, in plain text. This means regardless of how many layers of AI-generated obfuscation are used, Event ID 4104 will reveal the true malicious logic. Funneling these logs into a SIEM or Security Operations Center (SOC) allows defenders to search for keywords such as VirtualAlloc, WriteProcessMemory, or large blocks of high-entropy indexes, which are indicative of embedded shellcode.

Disk Forensics with NTFS USN Journal and PCA

Even self-rewriting malware must eventually interact with the disk, and Windows, being a "hoarder," tracks everything. The NTFS USN Journal, located at $Extend\$UsnJrnl, acts as the system's data flight recorder. While the Master File Table (MFT) tracks the current state of files, the JStream within the USN Journal records the history of changes.

If Prompllex rewrites its code hourly, it generates massive amounts of user read/write/execute permission events within the USN Journal. This journal is also critical for exposing time stomping, where attackers backdate file creation times to match legitimate system files (e.g., kernel32.dll). The USN Journal records the actual file modification time, revealing discrepancies. Tools like Eric Zimmerman's MFTCmd can parse the JStream and visualize the exact timeline, pinpointing when a shapeshifter dropped and altered its code logic.

Furthermore, with the widespread migration to Windows 11 (specifically versions 22H2 and newer), Microsoft quietly introduced a new artifact: the Program Compatibility Assistant (PCA), found in Windows\appcompat\pca. This plain-text, pipe-delimited file records the full executable path and UTC timestamp of programs launched via the Windows GUI (Explorer). Unlike traditional prefetch files, which can be disabled, or AMCache, which is complex to parse, PCA offers a straightforward "dictionary" of GUI-launched applications. It logs when an insider or attacker double-clicks an AI payload from a USB drive or network share, providing crucial dwell time data and a "massive win for defenders."

Kernel-level Telemetry with ETW-TI

For catching memory injections as they happen, the "holy grail" is Microsoft Windows Threat Intelligence Event Tracing for Windows (ETW-TI). Designed to monitor malware unpacking, ETW-TI logs events like VirtualAlloc (Event ID 1) and VirtualProtect (Event ID 2) for executable or write process memory regions and thread context changes. When Promsteel, Quiet Vault, or similar malware attempts to hollow out a process, ETW-TI captures these events, immediately signaling an attack.

However, Microsoft restricts access to the ETW-TI provider, requiring processes to run as early access anti-malware or Protected Process Light (PPL). Open-source tools like Cad TI can bridge this gap, enabling defenders to subscribe to ETW-TI events and ship kernel-level injection alerts in real-time to an ELK stack or SIEM, allowing for immediate response to unexpected memory allocations within processes.

Identifying AI-Generated Code

Beyond detection, proving that code was generated by AI is an emerging area. Sam noted that AI-generated code often exhibits a "lazy" style, including distinct structural fingerprints. Forensic researchers are employing the "ocean method" to identify these stylistic traits, much like human developers have unique coding habits (logic structuring, syntax formatting, variable naming). By combining machine learning analysis of binary structures (e.g., looking for specific API call patterns), it's possible to differentiate code synthesized by an ML model from human-written code.

Furthermore, investigators can actively hunt for artifacts of the LLM interaction itself. Parsing memory dumps for JSON strings or API requests sent to public LLMs (Gemini, Cohere, GPT) or local instances (Ollama) can "fingerprint this conversation between the malware and its AI brain," providing irrefutable evidence of AI involvement. This is crucial given the 200% surge in chatter about malicious "dark LLMs" like WormGPT 4 and Kawaii GPT on cybercrime forums, which are specifically trained to generate malware without ethical guardrails.

Demo / Proof of Concept

▶ Watch: Disk forensics with USN Journal and PCA artifact (16:30)

The speaker did not present a live demo or proof of concept of the AI-generated malware or the defense techniques during the talk. Instead, he detailed real-world observations and forensic methodologies derived from Mandiant and Google's threat intelligence, referencing specific malware families and the artifacts they leave behind in compromised enterprise networks. The emphasis was on the practical application of forensic tools and detection strategies based on these observations.

Defensive Implications

▶ Watch: Identifying AI code and the future of agentic SOCs (21:00)

The rise of AI-generated polymorphic malware demands a fundamental shift in defensive strategies. Relying on static binary hashes and signature-based detection is no longer sufficient. Defenders must adopt a proactive, behavior-centric approach, leveraging advanced forensic and real-time monitoring capabilities.

  1. Prioritize Behavioral Analysis over Static Signatures: Abandon the sole reliance on static file hashes. Implement robust behavioral monitoring that can detect dynamic code generation, process tampering, and unusual memory allocations.
  2. Master Memory Forensics: Develop expertise in tools like Volatility 3 for post-mortem analysis. Actively hunt for private, persistent read/write/execute memory regions not backed by disk files, which are tell-tale signs of AI-generated dynamic code.
  3. Deploy Advanced Endpoint Telemetry: Implement Sysmon with specific rules for Event ID 25 to detect process tampering, hollowing, and discrepancies between memory and disk images. This provides crucial real-time visibility into evasive execution techniques.
  4. Enable PowerShell Script Block Logging: Mandate PowerShell Script Block Logging (Event ID 4104) via Group Policy across all endpoints. This is critical for de-obfuscating AI-generated payloads and capturing their true malicious logic in plain text before execution. Integrate these logs into your SIEM for keyword-based alerting.
  5. Utilize Disk Artifacts for Historical Context: Leverage the NTFS USN Journal to track the history of file changes and detect time stomping. Incorporate analysis of the PCA artifact in Windows 11 (22H2+) to log GUI-launched executables and gather critical dwell time data. Tools like Eric Zimmerman's MFTCmd are essential for parsing these artifacts.
  6. Implement Kernel-Level Injection Detection: Explore and deploy solutions that can tap into ETW-TI for kernel-level telemetry, specifically monitoring VirtualAlloc (Event ID 1) and VirtualProtect (Event ID 2). Open-source tools like Cad TI can help bridge the access gap, providing real-time alerts for memory injection events.
  7. Develop AI Code Identification Capabilities: Begin researching and implementing methods, such as the "ocean method" and machine learning analysis of binary structures, to identify stylistic fingerprints left by LLM-generated code. Actively hunt for LLM API requests and JSON strings in memory dumps to fingerprint the interaction between malware and its AI brain.
  8. Embrace an Agentic SOC Model: Shift towards an agentic SOC where AI agents handle the "grunt work"—intercepting alerts, extracting memory dumps, de-obfuscating scripts, and mapping to MITRE ATT&CK. This frees human analysts to focus on higher-level strategic analysis and threat hunting, enabling them to "beat" the shapeshifters rather than just keep up.

By adopting these advanced defensive postures, organizations can move beyond outdated static defenses and effectively detect, analyze, and respond to the evolving threat of AI-generated polymorphic malware.

Key Takeaways

  • AI-driven polymorphism is a game-changer: Adversaries are embedding AI directly into malware to dynamically rewrite code, change hashes, and evade traditional static defenses, rendering signature-based detection obsolete.
  • Memory forensics is paramount: Techniques like analyzing Windows VADs with Volatility 3 are crucial for detecting dynamically allocated, unbacked executable memory—a key indicator of AI-generated payloads.
  • Behavioral detection is essential for real-time response: Sysmon Event ID 25 (process tampering) and PowerShell Script Block Logging Event ID 4104 (de-obfuscated code capture) are vital for catching evasive execution and revealing true malicious intent in real-time.
  • Disk artifacts provide critical historical context: The NTFS USN Journal exposes time stomping and historical changes, while the new PCA artifact in Windows 11 tracks GUI-launched executables, offering valuable dwell time data.
  • Kernel-level telemetry offers deep visibility: ETW-TI (Event ID 1 for VirtualAlloc, Event ID 2 for VirtualProtect), enabled through tools like Cad TI, provides unparalleled insight into memory injection and dynamic code execution.
  • Identifying "AI fingerprints" is an emerging defense: Developing capabilities to recognize the stylistic patterns of AI-generated code ("ocean method") and trace LLM interactions in memory dumps is crucial for proving AI involvement and understanding the adversary's toolkit.

About the Speaker(s)

Stephen Sam is an Instant Response Consultant at Mandiant and Google. His work involves directly confronting the latest threats by analyzing "burning wreckage" from compromised enterprise networks. He is actively involved with the Google Threat Intelligence Group and contributes to the annual Mandiant M-Trends Report, which provides critical insights into the evolving threat landscape, including the abuse of AI by adversaries. Sam's expertise lies in deep forensic analysis and developing strategies to hunt down advanced, evasive malware.

Reviews

Dr. Zero (Offensive Security Researcher) — SOLID

Stephen Sam drops a competent DFIR 101 session dressed up in an 'AI malware' trenchcoat. The defensive telemetry advice is actionable—leveraging Windows 11 PCA artifacts and ETW-TI—but the premise that LLM-queried scripts fundamentally change memory forensics is overblown hype. Good refresher for junior responders, but the lack of a live demo hurts its credibility.

Heather Calloway (CISO) — STRONG ACCEPT

Mandiant demonstrates how adversaries now embed LLM queries directly into the execution chain to rewrite malware at runtime. This renders static defenses obsolete and forces a hard conversation about our telemetry. It is required reading for your detection engineering team and a wake-up call for your SIEM budget.

→ Top-rated talks at CypherCon 9.0 (2026)

All talks from CypherCon 9.0 (2026)