Detection queries Research demonstration

BlackMamba AI-generated polymorphic keylogger (PoC)

A research proof of concept asks an LLM for fresh in-memory keylogger code on each run and demonstrates exfiltration through Teams. The report describes a lab demo, not an observed campaign.

What happened

PoC that calls an LLM API to generate unique in-memory keylogger code each run via Python exec and exfiltrates via Microsoft Teams webhooks; claimed to evade an industry EDR with zero alerts in demo.

PoC polymorphic malware using LLM API to synthesize keylogger code in memory

Read the original source

How it happened

Select a stage to explore its defenses
Detect this stage
Detect this stage
Detect this stage
Select a stage · Drag to explore · + / − to zoom · Dashed edges are loopsSelect a stage · Arrows show reported connectionsResearch / qualified account
Read the flow as text & sources

A catalog reconstruction of the supplied source account. Landmark PoC published ~Aug 2023 (just before Oct 2023 window). Included as frequently cited precursor; not in-the-wild.

  1. 01 · Research execution starts in a lab

    This is a proof of concept, with no established in-the-wild initial access.

    Source for step 1
  2. 02 · LLM synthesizes keylogger code

    An API call returns a new in-memory payload at runtime.

    Hunt: An unexpected script, implant or local model client communicates with a model service near command execution, collection or file modification.

    Connecting to a legitimate model domain does not establish malicious use or reveal returned code. Local / in-process models can evade network-only hunts.

    Source for step 2
  3. 03 · Python executes the generated code

    The PoC evaluates the returned code in memory.

    Hunt: Untrusted content or a changed tool definition precedes a file read, command, or remote call outside the user's intended task.

    Process logs cannot recover model intent. Remote connectors and in-process interpreters may produce no local child process. Prompt content alone is not a reliable signature.

    Source for step 3
  4. 04 · Demo exfiltrates through Teams

    The research uses Teams webhooks to demonstrate data exfiltration.

    Hunt: Sensitive reads are followed by outbound transfer, a public artifact, or a tool call to a destination outside the approved workflow.

    An outbound connection or high byte count alone is not exfiltration. Encrypted traffic may hide content, and bulk legitimate exports are common.

    Source for step 4

Why it matters

Reported impact: The research uses Teams webhooks to demonstrate data exfiltration; using the named AI products does not by itself establish exposure.

Read the original report

What you can do

Protection & prevention

EDR behavioral on Teams webhook exfil; block unexpected generative API from endpoints

Catalog defensive guidance based on the reported behavior. Confirm scope and current mitigations in the original source.

Review the original guidance
Investigate each phase

Detection queries

Draft query starters grouped by the attack stages where they apply.

Download stage pack

Start with the logs you collect. Each hunt identifies its required visibility, field mapping and limits. Queries are catalog-authored drafts using reusable behavior profiles; test with known activity and your normal baseline before alerting.

02LLM synthesizes keylogger codeUnexpected process → model serviceCustom schema · Draft

An API call returns a new in-memory payload at runtime.

What to look for

An unexpected script, implant or local model client communicates with a model service near command execution, collection or file modification.

Visibility: Defender-side logs where collected

Required logs

  • Per-process network / DNS records
  • AI-service request logs where available
  • Process and file behavior on the calling host

Coverage limit. Connecting to a legitimate model domain does not establish malicious use or reveal returned code. Local / in-process models can evade network-only hunts.

Custom-schema candidates, not out-of-box detectors. Map your application / cloud / platform logs to EventType, Actor, Asset, Action, Target and CorrelationId. KQL uses a custom OpenAttacksAudit_CL table; SPL uses openattacks:audit. EventType values are proposed normalization names, not native vendor event names. Correlation and environment-specific alert logic remain to be built.

Sigma
Draft SigmaDownload Sigma
title: Hunt - Unexpected process → model service
id: 8560daf7-ecd1-4f2b-ad09-b794bb56a394
status: experimental
description: An unexpected script, implant or local model client communicates
  with a model service near command execution, collection or file modification.
author: MagicSword OpenAttacks catalog
date: 2026-10-23
falsepositives:
  - Authorized activity matching this broad hunt; baseline and investigate
    before alerting.
level: low
logsource:
  category: application
  product: openattacks_audit
  definition: Custom normalized audit schema; map EventType, Actor, Asset, Action,
    Target and CorrelationId from the required source logs first.
detection:
  selection:
    EventType:
      - model.connection
      - model.invoke
  condition: selection
KQL
Draft KQLDownload KQL
// SCHEMA TEMPLATE: create/map this custom table before use; not a built-in Sentinel table.
// OpenAttacksAudit_CL: TimeGenerated(datetime), EventType/Actor/Asset/Action/Target/CorrelationId(string).
// Selects candidates only. Apply the stage hypothesis and correlation steps before alerting.
OpenAttacksAudit_CL
| where TimeGenerated > ago(7d)
| where EventType in ("model.connection", "model.invoke")
| project TimeGenerated, EventType, Actor, Asset, Action, Target, CorrelationId
| order by TimeGenerated desc
SPL
Draft SPLDownload SPL
sourcetype="openattacks:audit"
EventType IN ("model.connection", "model.invoke")
| table _time EventType Actor Asset Action Target CorrelationId
| sort - _time
Investigation steps
  1. Join the network connection to the process tree and the actions before and after the response.
  2. Compare with approved AI integrations; inspect local model listeners for PoCs that do not use a hosted API.
03Python executes the generated codeUnexpected agent tool useCustom schema · Draft

The PoC evaluates the returned code in memory.

What to look for

Untrusted content or a changed tool definition precedes a file read, command, or remote call outside the user's intended task.

A research demonstration; validate with a benign test fixture rather than assuming field deployment.

Visibility: Defender-side logs where collected

Required logs

  • Agent tool-call audit records with session / tool / destination
  • Tool-definition and approval changes
  • Endpoint process, file-access and network evidence where available

Coverage limit. Process logs cannot recover model intent. Remote connectors and in-process interpreters may produce no local child process. Prompt content alone is not a reliable signature.

Custom-schema candidates, not out-of-box detectors. Map your application / cloud / platform logs to EventType, Actor, Asset, Action, Target and CorrelationId. KQL uses a custom OpenAttacksAudit_CL table; SPL uses openattacks:audit. EventType values are proposed normalization names, not native vendor event names. Correlation and environment-specific alert logic remain to be built.

Sigma
Draft SigmaDownload Sigma
title: Hunt - Unexpected agent tool use
id: c709e384-0e11-479e-ab4d-3a06e2431e4b
status: experimental
description: Untrusted content or a changed tool definition precedes a file
  read, command, or remote call outside the user's intended task.
author: MagicSword OpenAttacks catalog
date: 2026-10-23
falsepositives:
  - Authorized activity matching this broad hunt; baseline and investigate
    before alerting.
level: low
logsource:
  category: application
  product: openattacks_audit
  definition: Custom normalized audit schema; map EventType, Actor, Asset, Action,
    Target and CorrelationId from the required source logs first.
detection:
  selection:
    EventType:
      - agent.tool.call
      - agent.tool.definition.change
  condition: selection
KQL
Draft KQLDownload KQL
// SCHEMA TEMPLATE: create/map this custom table before use; not a built-in Sentinel table.
// OpenAttacksAudit_CL: TimeGenerated(datetime), EventType/Actor/Asset/Action/Target/CorrelationId(string).
// Selects candidates only. Apply the stage hypothesis and correlation steps before alerting.
OpenAttacksAudit_CL
| where TimeGenerated > ago(7d)
| where EventType in ("agent.tool.call", "agent.tool.definition.change")
| project TimeGenerated, EventType, Actor, Asset, Action, Target, CorrelationId
| order by TimeGenerated desc
SPL
Draft SPLDownload SPL
sourcetype="openattacks:audit"
EventType IN ("agent.tool.call", "agent.tool.definition.change")
| table _time EventType Actor Asset Action Target CorrelationId
| sort - _time
Investigation steps
  1. Join input provenance, tool descriptions and calls by session ID and compare the action to the approved task.
  2. Inspect child processes and destinations; record whether execution was in-process, local, or through a remote SaaS connector.
04Demo exfiltrates through TeamsSensitive data → unusual destinationCustom schema · Draft

The research uses Teams webhooks to demonstrate data exfiltration.

What to look for

Sensitive reads are followed by outbound transfer, a public artifact, or a tool call to a destination outside the approved workflow.

Visibility: Defender-side logs where collected

Required logs

  • Sensitive resource access / DLP records
  • Proxy, egress and cloud upload events
  • Agent / SaaS audit with correlation IDs

Coverage limit. An outbound connection or high byte count alone is not exfiltration. Encrypted traffic may hide content, and bulk legitimate exports are common.

Custom-schema candidates, not out-of-box detectors. Map your application / cloud / platform logs to EventType, Actor, Asset, Action, Target and CorrelationId. KQL uses a custom OpenAttacksAudit_CL table; SPL uses openattacks:audit. EventType values are proposed normalization names, not native vendor event names. Correlation and environment-specific alert logic remain to be built.

Sigma
Draft SigmaDownload Sigma
title: Hunt - Sensitive data → unusual destination
id: 04b60968-3179-4b1f-ae13-6f57c2446077
status: experimental
description: Sensitive reads are followed by outbound transfer, a public
  artifact, or a tool call to a destination outside the approved workflow.
author: MagicSword OpenAttacks catalog
date: 2026-10-23
falsepositives:
  - Authorized activity matching this broad hunt; baseline and investigate
    before alerting.
level: low
logsource:
  category: application
  product: openattacks_audit
  definition: Custom normalized audit schema; map EventType, Actor, Asset, Action,
    Target and CorrelationId from the required source logs first.
detection:
  selection:
    EventType:
      - data.export
      - agent.external.send
  condition: selection
KQL
Draft KQLDownload KQL
// SCHEMA TEMPLATE: create/map this custom table before use; not a built-in Sentinel table.
// OpenAttacksAudit_CL: TimeGenerated(datetime), EventType/Actor/Asset/Action/Target/CorrelationId(string).
// Selects candidates only. Apply the stage hypothesis and correlation steps before alerting.
OpenAttacksAudit_CL
| where TimeGenerated > ago(7d)
| where EventType in ("data.export", "agent.external.send")
| project TimeGenerated, EventType, Actor, Asset, Action, Target, CorrelationId
| order by TimeGenerated desc
SPL
Draft SPLDownload SPL
sourcetype="openattacks:audit"
EventType IN ("data.export", "agent.external.send")
| table _time EventType Actor Asset Action Target CorrelationId
| sort - _time
Investigation steps
  1. Join the resource read and outbound action by session, identity or process, preserving a bounded time window.
  2. Inspect destination ownership, payload classification and the user's intended action; baseline sanctioned sharing.
Technical detailsTooling, impact & MITRE ATLAS

Attack context

AI's role
LLM-generated malware

Tooling as reported

AI products, models and artifacts

  • OpenAI-style LLM API

Other tooling

  • Python exec
  • Microsoft Teams webhooks

Detection rules

  • Review attack-specific indicatorsGUIDANCE

    Monitor for the techniques described in BlackMamba AI-synthesized polymorphic keylogger (PoC). Refer to sources for specific IOCs and TTPs.

Source defensive notes

EDR behavioral on Teams webhook exfil; block unexpected generative API from endpoints

MITRE ATLAS

AI-specific catalog annotations based on the reported behavior; these are not MITRE case-study assignments.

AML.T0102Generate Malicious Commands

The proof of concept dynamically generates keylogger code through a model API. Source

Sources & research credit

1 source

Research by HYAS Labs · HYAS

  1. hyas.com
Record & downloads
Source record name
BlackMamba AI-synthesized polymorphic keylogger (PoC)
Entry ID
hyas-blackmamba-poc-2023-08
Catalog review
October 20, 2026
Category
adversary-use-of-ai
AI involvement confidence
unverified