# BlackMamba AI-synthesized polymorphic keylogger (PoC)

- ID: hyas-blackmamba-poc-2023-08
- Reported: 2023-08-01
- Researcher: HYAS Labs
- Organization: HYAS
- AI role: llm_generated_malware (LLM-generated malware)
- Confidence in AI involvement: not assessed
- Research / borderline: true
- Last reviewed: 2026-10-20
- Entry page: https://openattacks.ai/attacks/hyas-blackmamba-poc-2023-08/
- Entry JSON: https://openattacks.ai/api/attacks/hyas-blackmamba-poc-2023-08.json
- Browse title: BlackMamba AI-generated polymorphic keylogger (PoC)
- Editorial summary: 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.
- Evidence class (catalog annotation): Research demonstration
- Source-stated target environments: Not specified
- Stage hunts and conditional defenses: https://openattacks.ai/api/defenses/hyas-blackmamba-poc-2023-08.json

## Evidence qualification
Landmark PoC published ~Aug 2023 (just before Oct 2023 window). Included as frequently cited precursor; not in-the-wild.

## Technique
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.

## Stack relevance (editorial)
Assessment: attacker\_tool\_only. Editorial applicability reviewed against the catalog source account; not a scan or independent incident verification.
The named AI product is used by the attacker. No reviewed mapping from owning that product to the reported victim conditions is available.
A product mention alone is not a victim-side applicability mapping. Selection does not verify affected versions, permissions or compromise.

## Initial access
unknown

## AI tooling and models
- OpenAI-style LLM API

## Other tooling
- [Python](https://github.com/python/cpython) exec
- Microsoft Teams webhooks

## Victims and sectors
unknown

## Target geography
- unknown

## Attribution
unknown

## Scale and metrics
unknown

## Attack flow
Catalog reconstruction of the supplied source account. Unknowns and research caveats are preserved.
### step-1: Research execution starts in a lab [unknown]
This is a proof of concept, with no established in-the-wild initial access.
Evidence: https://www.hyas.com/blog/blackmamba-using-ai-to-generate-polymorphic-malware

### step-2: LLM synthesizes keylogger code [ai]
An API call returns a new in-memory payload at runtime.
Evidence: https://www.hyas.com/blog/blackmamba-using-ai-to-generate-polymorphic-malware

### step-3: Python executes the generated code [execution]
The PoC evaluates the returned code in memory.
Evidence: https://www.hyas.com/blog/blackmamba-using-ai-to-generate-polymorphic-malware

### step-4: Demo exfiltrates through Teams [impact]
The research uses Teams webhooks to demonstrate data exfiltration.
Evidence: https://www.hyas.com/blog/blackmamba-using-ai-to-generate-polymorphic-malware

Connections:
- step-1 -> step-2
- step-2 -> step-3
- step-3 -> step-4

## Stage defense and hunting recommendations
Editorial recommendations, not validated coverage. Source-controlled query starters are drafts. Custom-schema examples require telemetry collection and field mapping; absence of a mapping means not assessed. MagicSword policy opportunities require managed Windows scope and enforcement.
### step-1: No source-backed runtime hunt yet
- Visibility: Not established
- Query origin: catalog_authored; status: not_applicable; log scope: gap
- Hunt hypothesis: The supplied account does not establish a deployed victim-side behavior for this stage.
- Required telemetry: not assessed
- Investigate: Obtain a source-backed procedure and identify which party could observe it before drafting a detection.
- Limitation: Marketing claims, unknown steps and unconfirmed deployments are not detection coverage. No rule is generated for this stage.
- Qualification: The supplied account leaves this stage unestablished. Obtain a source-backed procedure before proposing a runtime query.
- No direct MagicSword prevention claim is recorded for this stage.

### step-2: Unexpected process → model service
- Visibility: Defender-side logs where collected
- Query origin: catalog_authored; status: draft; log scope: custom_schema
- SIGMA query download: /api/detections/model-network.sigma.yml
- KQL query download: /api/detections/model-network.kql
- SPL query download: /api/detections/model-network.spl
- Hunt hypothesis: An unexpected script, implant or local model client communicates with a model service near command execution, collection or file modification.
- Required telemetry: Per-process network / DNS records; AI-service request logs where available; Process and file behavior on the calling host
- Investigate: Join the network connection to the process tree and the actions before and after the response.
- Investigate: Compare with approved AI integrations; inspect local model listeners for PoCs that do not use a hosted API.
- Limitation: Connecting to a legitimate model domain does not establish malicious use or reveal returned code. Local / in-process models can evade network-only hunts.
- No direct MagicSword prevention claim is recorded for this stage.

### step-3: Unexpected agent tool use
- Visibility: Defender-side logs where collected
- Query origin: catalog_authored; status: draft; log scope: custom_schema
- SIGMA query download: /api/detections/agent-tools.sigma.yml
- KQL query download: /api/detections/agent-tools.kql
- SPL query download: /api/detections/agent-tools.spl
- Hunt hypothesis: Untrusted content or a changed tool definition precedes a file read, command, or remote call outside the user's intended task.
- Required telemetry: Agent tool-call audit records with session / tool / destination; Tool-definition and approval changes; Endpoint process, file-access and network evidence where available
- Investigate: Join input provenance, tool descriptions and calls by session ID and compare the action to the approved task.
- Investigate: Inspect child processes and destinations; record whether execution was in-process, local, or through a remote SaaS connector.
- Limitation: 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.
- Qualification: A research demonstration; validate with a benign test fixture rather than assuming field deployment.
- No direct MagicSword prevention claim is recorded for this stage.

### step-4: Sensitive data → unusual destination
- Visibility: Defender-side logs where collected
- Query origin: catalog_authored; status: draft; log scope: custom_schema
- SIGMA query download: /api/detections/exfil.sigma.yml
- KQL query download: /api/detections/exfil.kql
- SPL query download: /api/detections/exfil.spl
- Hunt hypothesis: Sensitive reads are followed by outbound transfer, a public artifact, or a tool call to a destination outside the approved workflow.
- Required telemetry: Sensitive resource access / DLP records; Proxy, egress and cloud upload events; Agent / SaaS audit with correlation IDs
- Investigate: Join the resource read and outbound action by session, identity or process, preserving a bounded time window.
- Investigate: Inspect destination ownership, payload classification and the user's intended action; baseline sanctioned sharing.
- Limitation: An outbound connection or high byte count alone is not exfiltration. Encrypted traffic may hide content, and bulk legitimate exports are common.
- No direct MagicSword prevention claim is recorded for this stage.


## MITRE ATLAS
Mappings are catalog annotations based on described behavior, not assignments or endorsements by MITRE.
- AML.T0102: Generate Malicious Commands — The proof of concept dynamically generates keylogger code through a model API.
  Technique: https://atlas.mitre.org/techniques/AML.T0102
  Evidence: https://www.hyas.com/blog/blackmamba-using-ai-to-generate-polymorphic-malware

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

## Sources
- https://www.hyas.com/blog/blackmamba-using-ai-to-generate-polymorphic-malware
