Unit 42: LLMs obfuscate malicious JavaScript
Research showed LLMs can effectively rewrite existing malicious JavaScript to evade detection, though writing full malware from scratch was less practical at the time.
What happened
Showed LLMs can effectively rewrite and obfuscate existing malicious JavaScript to evade detection, while finding fully AI-written malware from scratch less practical at the time.
LLM used to rewrite/obfuscate existing malware JS for evasion
How it happened
Read the flow as text & sources
A catalog reconstruction of the supplied source account. Research demonstration of LLM obfuscation efficacy; not a single named campaign.
- 01 · Researchers provide malicious JavaScript
The experiment starts with existing code rather than an observed delivery campaign.
Hunt: Instructions inside a sample influence an LLM analysis result, or obfuscation changes a model's classification without changing malicious behavior.
This evaluates analysis robustness, not victim endpoint compromise. Side behaviors mentioned elsewhere in a report do not establish edges in this flow.
Source for step 1 - 02 · LLMs rewrite and obfuscate the code
Model output changes the script while retaining malicious behavior.
Hunt: Instructions inside a sample influence an LLM analysis result, or obfuscation changes a model's classification without changing malicious behavior.
This evaluates analysis robustness, not victim endpoint compromise. Side behaviors mentioned elsewhere in a report do not establish edges in this flow.
Source for step 2 - 03 · Researchers test detection outcomes
The study compares detection before and after rewriting.
Hunt: Instructions inside a sample influence an LLM analysis result, or obfuscation changes a model's classification without changing malicious behavior.
This evaluates analysis robustness, not victim endpoint compromise. Side behaviors mentioned elsewhere in a report do not establish edges in this flow.
Source for step 3 - 04 · Demo measures evasion
The finding concerns obfuscation efficacy, not a separate confirmed victim intrusion.
Hunt: Instructions inside a sample influence an LLM analysis result, or obfuscation changes a model's classification without changing malicious behavior.
This evaluates analysis robustness, not victim endpoint compromise. Side behaviors mentioned elsewhere in a report do not establish edges in this flow.
Source for step 4
Why it matters
Reported impact: The finding concerns obfuscation efficacy, not a separate confirmed victim intrusion; using the named AI products does not by itself establish exposure.
What you can do
Protection & prevention
Behavioral JS detections over static signatures
Catalog defensive guidance based on the reported behavior. Confirm scope and current mitigations in the original source.
Detection queries
Draft query starters grouped by the attack stages where they apply.
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.
01Researchers provide malicious JavaScriptIndependent malware-analysis validationCustom schema · Draft
The experiment starts with existing code rather than an observed delivery campaign.
What to look for
Instructions inside a sample influence an LLM analysis result, or obfuscation changes a model's classification without changing malicious behavior.
Preserve sample hashes and independent behavior labels before the model transformation; this is a research workflow.
Visibility: Review / research workflow
Required logs
- Sample hashes and static / dynamic analysis results
- Model verdicts with prompt provenance
- Independent analyst and deterministic scanner verdicts
Coverage limit. This evaluates analysis robustness, not victim endpoint compromise. Side behaviors mentioned elsewhere in a report do not establish edges in this flow.
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
title: Hunt - Independent malware-analysis validation
id: aa44bd2e-f46c-4884-a6db-e6b370a12c50
status: experimental
description: Instructions inside a sample influence an LLM analysis result, or
obfuscation changes a model's classification without changing malicious
behavior.
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:
- analysis.verdict
condition: selection
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 ("analysis.verdict")
| project TimeGenerated, EventType, Actor, Asset, Action, Target, CorrelationId
| order by TimeGenerated descSPL
sourcetype="openattacks:audit"
EventType IN ("analysis.verdict")
| table _time EventType Actor Asset Action Target CorrelationId
| sort - _timeInvestigation steps
- Compare model conclusions with independent behavioral evidence and a controlled evaluation set.
- Treat sample comments as data; measure disagreement and false negatives without following embedded instructions.
02LLMs rewrite and obfuscate the codeIndependent malware-analysis validationCustom schema · Draft
Model output changes the script while retaining malicious behavior.
What to look for
Instructions inside a sample influence an LLM analysis result, or obfuscation changes a model's classification without changing malicious behavior.
Visibility: Review / research workflow
Required logs
- Sample hashes and static / dynamic analysis results
- Model verdicts with prompt provenance
- Independent analyst and deterministic scanner verdicts
Coverage limit. This evaluates analysis robustness, not victim endpoint compromise. Side behaviors mentioned elsewhere in a report do not establish edges in this flow.
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
title: Hunt - Independent malware-analysis validation
id: aa44bd2e-f46c-4884-a6db-e6b370a12c50
status: experimental
description: Instructions inside a sample influence an LLM analysis result, or
obfuscation changes a model's classification without changing malicious
behavior.
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:
- analysis.verdict
condition: selection
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 ("analysis.verdict")
| project TimeGenerated, EventType, Actor, Asset, Action, Target, CorrelationId
| order by TimeGenerated descSPL
sourcetype="openattacks:audit"
EventType IN ("analysis.verdict")
| table _time EventType Actor Asset Action Target CorrelationId
| sort - _timeInvestigation steps
- Compare model conclusions with independent behavioral evidence and a controlled evaluation set.
- Treat sample comments as data; measure disagreement and false negatives without following embedded instructions.
03Researchers test detection outcomesIndependent malware-analysis validationCustom schema · Draft
The study compares detection before and after rewriting.
What to look for
Instructions inside a sample influence an LLM analysis result, or obfuscation changes a model's classification without changing malicious behavior.
Visibility: Review / research workflow
Required logs
- Sample hashes and static / dynamic analysis results
- Model verdicts with prompt provenance
- Independent analyst and deterministic scanner verdicts
Coverage limit. This evaluates analysis robustness, not victim endpoint compromise. Side behaviors mentioned elsewhere in a report do not establish edges in this flow.
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
title: Hunt - Independent malware-analysis validation
id: aa44bd2e-f46c-4884-a6db-e6b370a12c50
status: experimental
description: Instructions inside a sample influence an LLM analysis result, or
obfuscation changes a model's classification without changing malicious
behavior.
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:
- analysis.verdict
condition: selection
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 ("analysis.verdict")
| project TimeGenerated, EventType, Actor, Asset, Action, Target, CorrelationId
| order by TimeGenerated descSPL
sourcetype="openattacks:audit"
EventType IN ("analysis.verdict")
| table _time EventType Actor Asset Action Target CorrelationId
| sort - _timeInvestigation steps
- Compare model conclusions with independent behavioral evidence and a controlled evaluation set.
- Treat sample comments as data; measure disagreement and false negatives without following embedded instructions.
04Demo measures evasionIndependent malware-analysis validationCustom schema · Draft
The finding concerns obfuscation efficacy, not a separate confirmed victim intrusion.
What to look for
Instructions inside a sample influence an LLM analysis result, or obfuscation changes a model's classification without changing malicious behavior.
Compare model/scanner verdicts with known behavior on the evaluated set; this does not establish a separate victim intrusion.
Visibility: Review / research workflow
Required logs
- Sample hashes and static / dynamic analysis results
- Model verdicts with prompt provenance
- Independent analyst and deterministic scanner verdicts
Coverage limit. This evaluates analysis robustness, not victim endpoint compromise. Side behaviors mentioned elsewhere in a report do not establish edges in this flow.
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
title: Hunt - Independent malware-analysis validation
id: aa44bd2e-f46c-4884-a6db-e6b370a12c50
status: experimental
description: Instructions inside a sample influence an LLM analysis result, or
obfuscation changes a model's classification without changing malicious
behavior.
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:
- analysis.verdict
condition: selection
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 ("analysis.verdict")
| project TimeGenerated, EventType, Actor, Asset, Action, Target, CorrelationId
| order by TimeGenerated descSPL
sourcetype="openattacks:audit"
EventType IN ("analysis.verdict")
| table _time EventType Actor Asset Action Target CorrelationId
| sort - _timeInvestigation steps
- Compare model conclusions with independent behavioral evidence and a controlled evaluation set.
- Treat sample comments as data; measure disagreement and false negatives without following embedded instructions.
Technical detailsTooling, impact & MITRE ATLAS
Attack context
- AI's role
- LLM-generated malware
Tooling as reported
AI products, models and artifacts
- Commercial LLMs
Detection rules
- Review attack-specific indicatorsGUIDANCE
Monitor for the techniques described in Unit 42: LLMs obfuscating malicious JavaScript. Refer to sources for specific IOCs and TTPs.
Source defensive notes
Behavioral JS detections over static signatures
MITRE ATLAS
AI-specific catalog annotations based on the reported behavior; these are not MITRE case-study assignments.
The supplied source explicitly describes generative-model tooling assisting the reported activity; this mapping does not establish additional autonomy or victim impact. Source
Sources & research credit
1 sourceResearch by Unit 42 · Palo Alto Networks Unit 42
Record & downloads
- Source record name
- Unit 42: LLMs obfuscating malicious JavaScript
- Entry ID
- unit42-llm-js-obfuscation-2024
- Catalog review
- October 20, 2026
- Category
- adversary-use-of-ai
- AI involvement confidence
- unverified