The Grandoreiro loader that changes with every download
A Grandoreiro VBS stager and Delphi loader: 74 MB of BMP padding, C2 resolved over DoH, ports derived with SHA-256 and file names that rotate per download.
Introduction
Grandoreiro is a Brazilian banking trojan written in Delphi that has been going after bank customers in Latin America and Spain for years. In late October 2026 an email arrived with a link to what claimed to be a court summons. Behind it was a four-piece chain: a page that filters visitors, a VBScript carrying a compressed executable, a loader over 80 MB in size, and a second stage of roughly 260 MB.
Two things make this chain worth a close look. First, every download hands out files with different names and hashes, so those values are close to useless as indicators. Second, the loader doesn’t store its C2 port: it computes it from the IP address with SHA-256. That IP-to-port relationship holds even when the server moves, and you can hunt for it in network traffic.
The chain was rebuilt with static analysis in IDA Pro and dynamic analysis with Frida, inside an isolated VM routed through REMnux.
Email (summons / case file)
│
▼
"Desktop only" pre-filter ──► fake SharePoint ──► a different Mediafire link on every request
│
▼
ZIP (~5 MB) ──► self-contained VBS stager (4-7 MB)
│
▼
Embedded ZIP ──► %PUBLIC%\<random>.exe (Delphi loader, 80-91 MB, BMP padding)
│
▼
DoH to dns.google ──► C2 IP
│
▼
port = SHA256(service + IP) % 8998 + 1001
│
▼
REQUEST01 beacon ──► descriptor ──► .xml download (XOR 0x5D ──► password-protected ZIP)
│
▼
%ProgramData%\<random>\<random>.exe (second stage, ~260 MB)From the email to a ZIP on Mediafire
The link in the email points to wnausd.com, which acts as a pre-filter. From a phone, or from a browser that doesn’t look like a desktop one, the page only shows a “Not supported” notice and serves nothing. It’s a cheap way to keep crawlers and some URL sandboxes out.

With a desktop browser, the redirect ends at kztxw.com, which mimics a Microsoft SharePoint page: a blurred document in the background, a “Microsoft · Verificado” badge and a “Descargar Archivo” button. The footer reads “Conexão Segura”, in Portuguese, on a page that is otherwise in Spanish.

The button doesn’t link to a fixed file. The page’s JavaScript calls KrrSdClpqP04C.php, which answers with a single-key JSON object holding a Mediafire link. Replaying that request with Burp Intruder, every response came back with a different file identifier.

Four downloads produced four ZIP files between 5.0 and 5.8 MB, with names that mix case-file sounding fragments (Memo, Aprob, Cita, Judi, Exped) with random text. Each one holds a VBS with a different name and size, plus a ~ folder with two decoy PDFs and two .xml files that are actually PEs (one of them a DLL). The VBS never references any of those four files.

The VBScript stager
The reference sample for this section (sample A) is a 4,318,996-byte VBS with 1,506 lines. 1,214 of them are filler comments, about 855 KB of words and characters that do nothing. There are also arithmetic functions that never affect the result and indirect calls through GetRef. Stripping comments and blank lines is enough to read the real logic:
perl -ne '
s/\r//g;
next if /^\s*(?:\x27|rem(?:\s|$))/i;
next if /^\s*$/;
print;
' sample.vbs > sample_clean.vbs
What’s left is a stager that downloads nothing. Everything it needs lives inside the script:
- It expands
%PUBLIC%and builds three paths: a ZIP, an EXE and a state file. - It reads the first line of the state file. If it holds the path of an executable that still exists, it launches it and exits. Opening the VBS a second time doesn’t repeat the whole process.
- It concatenates five variables holding Base64 text. Block
0sits in the file after blocks1to3, but they are joined in order. - It strips the 201 occurrences of the
<[/@\_,=separator scattered through the Base64. - It decodes the result with a
bin.base64node fromMicrosoft.XMLDOMand writes the bytes withADODB.Stream. The output is a valid 2,589,050-byte ZIP. - It extracts the ZIP with
Shell.Application.NameSpace(...).CopyHereand waits up to about 12 seconds for the file to appear. Then it deletes any previous EXE with the same name, moves the extracted file to that name, stores the path in the state file and runs it withWScript.Shell.Exec.
The numbers add up: 2.59 MB in Base64 takes about 3.45 MB, which plus the 855 KB of comments gives the 4.3 MB script. The 2.59 MB ZIP decompresses into an 84 MB PE, a ratio above 30 to 1. That extreme compression already hints at what’s inside the executable.
What changes between downloads
Putting the two stagers side by side shows what rotates and what doesn’t:
| Sample A | Sample B | |
|---|---|---|
| VBS size | 4.3 MB | 6.9 MB |
ZIP in %PUBLIC% | ZhaI2311i#zHigJ%dA.zip | VKu7rAm0uVQ0L%mOOz8n.zip |
| Extracted file | BoJexnxTLNaOLjyXDzY.srz | fgUzfLtKrCpKcfkQo.svn |
| State file | quHr#4IZsD52H.srz | 6vf42$kRxml9s9Y5YrgyP.svn |
| Base64 chunks | 5 | 10 |
| Separator | <[/@\_,= | ./=?<[,$ |
| Resulting PE | 84,088,832 bytes | 91,326,976 bytes |
Names, extensions, separators, chunk count, size and therefore every hash change from one download to the next. Since the backend hands out a fresh Mediafire link on each request, each file is most likely generated, or picked from a batch, on the fly. An IOC like ZhaI2311i#zHigJ%dA.exe or the SHA-256 of a VBS describes a single victim.
What stays the same is the shape:
- Everything happens in
C:\Users\Public, with random 13 to 21 character names containing%,#or$, which is rare for a legitimate file. - The ZIP holds a single file with a meaningless three-letter extension (
.srz,.svn) that ends up renamed to.exe. - The executable is launched by
wscript.exeand weighs more than 80 MB. - Decoding always goes through
Microsoft.XMLDOM,ADODB.StreamandShell.Application.
An 80 MB PE that is almost all padding
The loader builds seen in this campaign weighed between 80 and 91 MB. The one analyzed in depth is 80,372,224 bytes. It’s an unsigned x86 PE32 built with Embarcadero Delphi (it has, among others, the .itext section typical of that compiler).
Nearly all of that weight sits in .rsrc, in a single RT_RCDATA resource named MasterAcademicProfessionalvmNlvtJRSXOUX that is 74,446,902 bytes long, more than 92% of the file. The resource starts with a valid BMP header (1024 × 24,234 pixels), but after that there is no code and no encrypted data: only the F8 F9 FA triplet repeated in 64 KiB blocks, near-white grey pixels.
This is binary padding (T1027.001). Many mail gateways, cloud AV engines and automated sandboxes cap file size, often somewhere between 32 and 64 MB, and anything above that is skipped or only partially analyzed. At the same time, padding this repetitive compresses to almost nothing, which is why the VBS can carry the whole executable in less than 3 MB of ZIP. Grandoreiro has used BMP images in its resources for this purpose for years: Kaspersky documented 2023 samples of about 390 MB in which the images accounted for 376 MB.
The resource name follows a pattern that repeats across everything the loader creates: English words glued together in CamelCase plus a tail of random letters. Later on you’ll see DataUltimaterwbrukLeadtekHubCleaner, PixelChartCloudbfjywjMikrotikTest and ConexantGuardFinderpCRxlPulseSupport.
Encrypted strings
The strings that would give the behavior away are not stored in clear. The routines at 0x61B008 and 0x61A720 apply three steps:
Base64 ──► decode ──► rotating FNV hash with salt ──► differential XOR ──► plaintextThe salt is rebuilt at runtime with a single-byte XOR, so it doesn’t appear in clear either:
salt = "".join(
chr(val ^ 0x42)
for val in (8, 118, 53, 16, 47, 123, 41, 24, 113, 58, 12, 50, 14, 122, 52, 19)
)
# 'J4wRm9kZ3xNpL8vQ'Walking the pointer table those functions consume yields, among others:
- C2 protocol markers:
SERVERMODULES,REQUEST01,SERVERAVISOS. - Dynamic DNS domains:
cold.hopto.me,dry.access.ly. - The DoH endpoint:
https://dns.google/resolve?name=. - Software it profiles:
Chrome,Microsoft Edge,Firefox,Binance,Electrum,Ledger Live.
Because these strings are encrypted, a YARA rule that looks for SERVERMODULES or dns.google in the file on disk won’t find anything.
The C2 is resolved over DoH
The loader doesn’t call gethostbyname or DnsQuery. To resolve its domain it makes an HTTPS request with WinHTTP to Google’s JSON API:
https://dns.google/resolve?name=cold.hopto.meThat buys the attacker two things. The lookup for cold.hopto.me travels inside TLS on port 443, so it never shows up in corporate DNS logs or in an IDS watching port 53. And since it bypasses the system resolver, a local sinkhole or DNS-based block has no effect. All that’s visible from outside is a normal resolution of dns.google and a TLS connection to that host from a process that isn’t a browser.
The first lab run ended early, and the reason is worth telling. INetSim answered every TLS connection with its sample binary (a 13,838-byte MZ). The loader’s JSON parser looked for Answer[0].data, didn’t find it, retried three times and exited without doing anything else. To get it moving, DoH queries had to be let through to Google. With a real answer:
{"Status":0,"Answer":[{"name":"cold.hopto.me","type":1,"TTL":60,"data":"184.73.136.220"}]}The port comes from the IP
The C2 port isn’t in the binary or in the DNS answer. The function at 0x7A3724 derives it from the freshly resolved IP:
$$\text{Port} = \left(\operatorname{int}\big(\operatorname{SHA256}(\text{“SERVERMODULES”} + \text{IP})[0..8],\ 16\big) \bmod 8998\right) + 1001$$
It concatenates the marker with the IP as text, computes SHA-256, takes the first 8 hex characters (4 bytes) as an integer, applies modulo 8998 and adds 1001. The result always lands between 1001 and 9998. For 184.73.136.220:
- Seed:
SERVERMODULES184.73.136.220 - The SHA-256 starts with
09d9c956, which is 165,267,798 in decimal. - 165,267,798 mod 8998 = 1532.
- 1532 + 1001 = 2533.
During the Frida run, the hook on that function returned 2533. In that run the image was loaded 0x800000 bytes above its preferred base, so the hook actually sat at 0xFA3724.
At the end of its run the loader also connects to port 5668 on the same IP. That number isn’t arbitrary: it’s what the same formula gives with the other marker, SERVERAVISOS. The odds of that matching by chance are 1 in 8998, so everything points to each C2 service having its own prefix with its port computed the same way.
import hashlib
def grandoreiro_port(prefix: str, ip: str) -> int:
h = hashlib.sha256(f"{prefix}{ip}".encode("utf-8")).hexdigest()
return int(h[:8], 16) % 8998 + 1001
for prefix in ("SERVERMODULES", "SERVERAVISOS"):
print(prefix, grandoreiro_port(prefix, "184.73.136.220"))
# SERVERMODULES 2533
# SERVERAVISOS 5668This fits what MITRE calls DNS Calculation (T1568.003): the useful value isn’t what DNS returns but something computed from it. For the operator, it means the C2 can move to another IP without touching the binary. For defenders it means something more useful: for any outbound connection, you can check whether its port is the one this formula assigns to its IP, without knowing the domain or the IP in advance.
Beacon and second stage
With the port in hand, the loader sends a GET to http://184.73.136.220:2533/ with the User-Agent Embarcadero URI Client/1.0, the default of Delphi’s HTTP client. The path carries a Base64-encoded host fingerprint. Decoded, it looks like this (host and user belong to the analysis VM):
WiPOAE0okyyqAokL7VqC|REQUEST01|CL|DESKTOP-7HX2QK|lia|11|Windows Defender|0|Nenhum|Microsoft Edge|Reenvio|...|These are |-separated fields: an identifier, the REQUEST01 marker, the country (CL), host name, user, Windows version, antivirus, a numeric flag, Nenhum (“none” in Portuguese) and the default browser.
The C2 answered with a 646-byte descriptor pointing to a different port:
http://184.73.136.220:11556/ConexantGuardFinderpCRxlPulseSupport.xmlThat port is outside the 1001-9998 range, so it comes from the response rather than from the formula. The loader downloads it with URLDownloadToFileW into a new folder under %ProgramData%, using a file name with no extension:
C:\ProgramData\DataUltimaterwbrukLeadtekHubCleaner\nPC3PO8S7Cwonv5From a fake .xml to the final executable
The .xml isn’t XML. It’s a binary encrypted byte by byte with XOR 0x5D. Once decrypted, the first bytes are 50 4B 03 04 (PK\x03\x04), a ZIP local file header. The ZIP is password protected, and the loader opens it with ZipForge, a Delphi compression library, using the hardcoded password 7684223510.
Inside there’s a single executable, PixelChartCloudbfjywjMikrotikTest.exe, also inflated, at around 260 MB. After extracting it, the loader:
- Deletes the downloaded container with
DeleteFileW. - Removes the matching WinInet cache entry with
DeleteUrlCacheEntryW. - Launches the second stage with
CreateProcessWfrom the same%ProgramData%folder. - Sends two confirmation requests to the C2, on ports 2533 and 5668.
The XOR key and the ZIP password come from a single loader. There’s no way to tell yet whether they’re fixed across the family or change per build, so they shouldn’t be treated as indicators.
Why Grandoreiro
At first the sample had no family attached. The attribution rests on overlap with what other teams have published, not on verified shared code:
- Delphi and inflated executables. ESET was already writing about Grandoreiro’s “engorged” executables in 2020, and Kaspersky describes samples inflated with BMP images in their resources in 2024.
- C2 resolution through Google’s DoH and a first beacon carrying host name, user and antivirus. Acronis describes this in the 2026 campaign against Mexico.
- A hidden folder with decoy PDF and XML files inside the ZIP, the same packaging Acronis reports.
- Portuguese leaking into a Spanish-language campaign:
Conexão Seguraon the page andNenhumin the beacon. That’s consistent with Brazilian developers.
There are differences. Deriving the port from the IP, and a second stage in an XOR-encrypted ZipForge archive, don’t appear in the public reports consulted, and Acronis describes a fixed port. This could be a new variant, or a loader from a different affiliate delivering the same trojan.
Detection: what works and what doesn’t
With names and hashes changing on every download, what lasts is infrastructure (for a while), behavior and file structure.
Infrastructure
Observed between October 28 and 30, 2026. The IP belongs to an Amazon EC2 range and can be reassigned, so keep the date attached when you use it.
| Indicator | Type | Role |
|---|---|---|
wnausd.com | Domain | ”Desktop only” pre-filter |
kztxw.com | Domain | Fake SharePoint and PHP endpoint that hands out the Mediafire link |
cold.hopto.me | Domain (dynamic DNS) | C2 resolution over DoH |
dry.access.ly | Domain (dynamic DNS) | C2 resolution over DoH |
184.73.136.220 | IPv4 | C2; ports 2533, 5668 and 11556 observed |
Host patterns
| Pattern | Where to look |
|---|---|
wscript.exe writes a multi-MB ZIP to C:\Users\Public whose name contains %, # or $ | File events (Sysmon 11, EDR) |
A file with a meaningless three-letter extension appears next to the ZIP and gets renamed to .exe | File events |
wscript.exe launches an .exe from C:\Users\Public | Process creation |
A non-browser process resolves dns.google | Sysmon 22 / DNS |
An executable in C:\Users\Public creates a new folder under %ProgramData%, downloads an extensionless file there, deletes it and launches a multi-hundred-MB .exe from the same folder | File and process events |
| HTTP connection to a literal IP whose port matches the formula | Zeek, NetFlow, firewall |
The Embarcadero URI Client/1.0 User-Agent talking to a literal IP is a useful signal, but not enough on its own: any Delphi application using THTTPClient without changing it sends that string.
The port formula as a network signature
The IP-to-port relationship doesn’t depend on any specific domain or IP. With a Zeek conn.log you can check all outbound traffic:
import hashlib
import sys
PREFIXES = ("SERVERMODULES", "SERVERAVISOS")
def port_for(prefix: str, ip: str) -> int:
h = hashlib.sha256(f"{prefix}{ip}".encode()).hexdigest()
return int(h[:8], 16) % 8998 + 1001
# Input: "ip port" per line, for example:
# zeek-cut id.resp_h id.resp_p < conn.log | python3 grandoreiro_ports.py
for line in sys.stdin:
fields = line.split()
if len(fields) < 2 or not fields[1].isdigit():
continue
ip, port = fields[0], int(fields[1])
for prefix in PREFIXES:
if port_for(prefix, ip) == port:
print(f"{ip}:{port} matches {prefix}")Any connection to a port between 1001 and 9998 has a 1 in 8998 chance of matching each prefix by accident. On a large network that will produce the odd false positive, so treat a hit as a lead to review, not a verdict. An IP that matches both prefixes, though, is much harder to explain away.
YARA
Neither rule relies on names, hashes or encrypted strings. The loader rule looks at structure: a Delphi PE over 50 MB with a huge RT_RCDATA resource that starts with BM and has near-zero entropy. The stager rule looks for the combination of COM objects used to rebuild the ZIP plus the abnormal share of comment lines. These are hunting rules: test them against more samples before putting them in production.
import "pe"
import "math"
rule Grandoreiro_Loader_BMP_Padding
{
meta:
description = "Delphi loader inflated with a BMP padding resource in RT_RCDATA (Grandoreiro, October 2026)"
author = "malwarian"
date = "2026-11-10"
condition:
uint16(0) == 0x5A4D and
filesize > 50MB and
for any s in pe.sections : ( s.name == ".itext" ) and
for any r in pe.resources : (
r.type == pe.RESOURCE_TYPE_RCDATA and
r.length > 30MB and
uint16(r.offset) == 0x4D42 and
math.entropy(r.offset + 4096, 65536) < 2.0
)
}
rule Grandoreiro_VBS_Stager_Embedded_ZIP
{
meta:
description = "VBS stager carrying a chunked Base64 ZIP decoded with XMLDOM and extracted with Shell.Application"
author = "malwarian"
date = "2026-11-10"
strings:
$xmldom = "Microsoft.XMLDOM" ascii nocase
$b64 = "bin.base64" ascii nocase
$stream = "ADODB.Stream" ascii nocase
$shell = "Shell.Application" ascii nocase
$copy = "CopyHere" ascii nocase
$public = "%PUBLIC%" ascii nocase
$cmt = { 0A 27 }
condition:
uint16(0) != 0x5A4D and
filesize > 2MB and filesize < 20MB and
5 of ($xmldom, $b64, $stream, $shell, $copy, $public) and
#cmt > 500
}Sigma
Three rules that follow the chain without relying on specific names:
title: WScript Launches an Executable from C:\Users\Public
id: e9c1bf82-8ed6-4729-bf11-37575f477c7c
status: experimental
description: A Windows Script Host script runs a binary from the Public profile, as the Grandoreiro VBS stager does after extracting its ZIP.
author: malwarian
date: 2026-11-10
tags:
- attack.execution
- attack.t1059.005
logsource:
category: process_creation
product: windows
detection:
selection:
ParentImage|endswith:
- '\wscript.exe'
- '\cscript.exe'
Image|contains: ':\Users\Public\'
Image|endswith: '.exe'
condition: selection
falsepositives:
- Deployment scripts that drop installers in Public
level: high
---
title: Executable in C:\Users\Public Launches Another from ProgramData
id: 5bd98f99-2b43-4b86-93a4-a1eb69812337
status: experimental
description: Process chain of the Grandoreiro loader, which drops and runs its second stage from a new ProgramData folder.
author: malwarian
date: 2026-11-10
tags:
- attack.execution
- attack.t1105
logsource:
category: process_creation
product: windows
detection:
selection:
ParentImage|contains: ':\Users\Public\'
Image|contains: ':\ProgramData\'
Image|endswith: '.exe'
condition: selection
falsepositives:
- Unlikely
level: high
---
title: Non-Browser Process Resolves dns.google
id: 9032d0d7-478c-4481-83c3-649cd3e5ea0b
status: experimental
description: Possible use of Google DNS-over-HTTPS to resolve a C2 while bypassing corporate DNS.
author: malwarian
date: 2026-11-10
tags:
- attack.command-and-control
- attack.t1071.001
logsource:
category: dns_query
product: windows
detection:
selection:
QueryName: 'dns.google'
filter_browsers:
Image|endswith:
- '\chrome.exe'
- '\msedge.exe'
- '\firefox.exe'
- '\brave.exe'
- '\opera.exe'
condition: selection and not filter_browsers
falsepositives:
- Software that legitimately uses Google DoH
level: mediumSamples analyzed
These hashes identify the specific samples behind this analysis, so you can find them on VirusTotal or MalwareBazaar and reproduce the work. They won’t detect other infections from the same campaign: every download produces different files.
| Sample | Size (bytes) | SHA-256 |
|---|---|---|
| VBS stager (sample A) | 4,318,996 | 8579c31e53c26b272ccc2c839b858c4398921e59696f2be66221488ef540cadc |
| ZIP rebuilt from VBS A | 2,589,050 | c93d87c55c6bb791fc5a399c3967a4204d1018df713387da93acfbf61edf3c24 |
| PE extracted from VBS A | 84,088,832 | d70b32a16c4281e0b31ad904b450565621317d7b9f548a05641df93b1322010c |
| ZIP rebuilt from VBS B | b5b3fa954444ff10a1328be8ab95baa9f0f43d84e30895dfaacdbdc08d8e85eb | |
| PE extracted from VBS B | 91,326,976 | 47bad57a58c93a5b28347018b309dcbdb263368a69e78f1cc26a46c4ab557578 |
| Loader analyzed dynamically | 80,372,224 | 987507b279b28fbb5820810db70423f0e5f4f20fd8a02237eb89c3724bab2427 |
| BMP padding resource from that loader | 74,446,902 | 15173cc0ae2d7eaea7e5798a3b6c96ae7e5044a4bdd274b09a8b5e945e515df6 |
What’s still open
The second stage, the roughly 260 MB executable launched from %ProgramData%, is where the banking logic should live: the browser and wallet monitoring the loader already profiles in its beacon. That’s for another post, along with two questions this analysis leaves open: whether the ZIP password and XOR key change between builds, and which other C2 services use prefixes besides SERVERMODULES and SERVERAVISOS.
- 01 Kaspersky GReAT - Grandoreiro, the global trojan with grandiose goals securelist.com/grandoreiro-banking-trojan/114257 ↗
- 02 Acronis TRU - Grandoreiro goes north: from Brazil to Mexico with a new DLL sideloading campaign www.acronis.com/en/tru/posts/grandoreiro-goes-north-from-brazil-to-mexico-with-a-new-dll-sideloading-campaign ↗
- 03 ESET Research - Grandoreiro: How engorged can an EXE get? www.welivesecurity.com/2020/04/28/grandoreiro-how-engorged-can-exe-get ↗
- 04 MITRE ATT&CK - Obfuscated Files or Information: Binary Padding (T1027.001) attack.mitre.org/techniques/T1027/001 ↗
- 05 MITRE ATT&CK - Dynamic Resolution: DNS Calculation (T1568.003) attack.mitre.org/techniques/T1568/003 ↗