# Tags
#Malware

Bladabindi Malware Abusing Pastebin.com as Infection Vector

Earlier, malware authors kept their payloads on Command and Control (C&C) servers or compromised websites. And to do this, they had to setup their C&C server or compromise a genuine website. But now, they don’t need to bother about such things, as they have started using genuine file sharing sites like “Pastebin.com” which allows user to store malware in plain-text. Pastebin.com is a well-known website where users can store plain text.

While analyzing malware samples, we found that the malware is downloading the “Base64” encoded text from pastebin.com. On decoding this Base64 data, we received an executable file which is the main payload of the malware. Most of these executables are from “Bladabindi” family.

The downloader enters into the user’s computer using various techniques like spam emails and social engineering. In this report, we will see how pastebin.com is misused with analysis of one malware sample.

Analysis of Bladabindi (MD5: 0C34D70FF9DD1BA3B7BFE9F4FBA8F010)

The file is an Auto-it installer. On execution, it drops two executable files at “C:\Documents and Settings\[user]\Local Settings” and executes the same. The dropped files are as follows:

  1. TempWinToFlash.exe: Genuine tool used to create bootable USB with any Windows Setup from a DVD/ISO
  2. TempWindows.exe: Copies itself in “%temp%” as system.exe and executes it. Now this system.exe downloads Base64 encoded file from “pastebin.com\download.php?i=pejXu40a” decodes it and injects the decoded executable in self-process. Thereafter, all activities are carried out by this downloaded file.

This Base64 Encoded file on Pastebin.com looks like the below figure 1.

Figure 1
Figure 1

After Base64 decode it is .Net file as below.

Figure 2
Figure 2

Activity of Main_Component.exe (In memory component)

This component is developed using Microsoft Visual Basic.Net.

Auto-run

It copies system.exe in “Startup” folder as 12ce4e06a81e8d54fd01d9b762f1b1bb.exe

Registry changes for Auto-run

It adds the following auto-run registry entry:

  1. HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Run\

12ce4e06a81e8 d54fd01d9b762f1b1bb:  “%temp%\system.exe”

  1. HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Run\

12ce4e06a81e8d54fd01d9b762f1b1bb : “%temp%\system.exe”

Other Registry Changes

It also adds the following registry entry:

HKEY_CURRENT_USER\Environment\SEE_MASK_NOZONECHECKS = 1

Further it saves downloaded Base64 encoded data in registry such as:

HKEY_CURRENT_USER\Software\12ce4e06a81e8d54fd01d9b762f1b1bb\f8c065f4e758233f0d12dc9b8cf7a2ce = [Base64_Encoded_Main_Payload]

Bypass Firewall:

It executes the following command to bypass Firewall:

netsh firewall add allowedprogram  [Path_Of_system.exe] ENABLE

Main Activity

This backdoor gathers the following data and sends it to C&C server:

  • Computer name
  • User name
  • OS version
  • Date of installation

It provides the following RAT functionalities to the attacker:

  • Keylogging
  • Capturing screenshots
  • Bypassing Firewall
  • Process Management: start new process or kill any process
  • Registry Management: get or set registry key/value
  • Provides remote shell access to the attacker
  • Downloading and executing files
  • Updating current RAT
  • Compressing files for uploading
  • Deleting self-copies

The main payload of the virus saves all keystrokes in the registry as shown in figure 3.

Figure3
Figure3

Encryption and decryption

The malware sends all data in Base64 encoded format. Except files are uploaded after ZIP compression.

The backdoor supports following commands:

“CAP”Take screen shot and send it to C&C.
“kl”Sends key logged data in Base64 encoded format.
“rn”Download and execute file.
“un” + “~”Bypass firewall  by using

“netsh firewall delete allowedprogram \””.

“un” + “!”End current application.
“un” + “@”Start new process and end current application.
“Up”Update RAT downloads new file and replace it with current.
rssRemote shell
infSend information of installed malware component like:

Installed volumes serial number, Auto run Registry Key, Exe Process with path, etc.

RG + “~”List all registry sub-keys and  values of specified registry key
RG +  “!”Set Registry value as specified key
RG +  “@”Delete value for specified Registry key
RG +  “#”Create Sub-Key for specified key
RG +  “$”Delete sub-key tree for specified registry key

 

Tricks used by the malware to avoid detection and cleaning

  1. Critical process

It makes itself as a critical process to prevent it from being stopped. The infected system may crash with a stop code 0x000000F4 if the malware process is interrupted. This can make it difficult to clean the computer when the malware is running.

  1. Registry resident non executable payload

Downloaded file is never saved on the disk, but it gets saved in the registry. The next time the system is booted, the downloaded file is read from the registry and decoded; the decoded executable is then injected into the system.exe process.

  1. Bypass automated analysis or make analysis difficult

The first component mentioned above (0C34D70FF9DD1BA3B7BFE9F4FBA8F010) is an auto-it installer. The Auto-It script contains the following code:

bladabindi 4

Due to this code, it will not show any malicious activity when any one of these monitoring tools is running. This enables the malware to bypass automated analysis. It also makes it difficult for analysts to manually analyze the sample.

Statistics about the “pastebin.com”

The main payload is stored in Base64 encoded format. We have found more than 100 Base64 encoded files on “pastebin.com”. Almost all of these files are malicious. Interestingly, 90% of them belong to the same malware family i.e., Bladabindi. The Bladabindi samples have been listed below:

File NameMD5(After Base64 Decryption)Date UploadedNo. of Downloads
maYGSJCE.txtd6970b1ecb80a3d547e8f4e02cee539824-Jan-161288
6A2bWaLW.txt3bbcf3bd1da31a9db42016c4df579efe7-Feb-1646
etyinjbb.txte52e16c23ae389045ce8f3016baf29179-Feb-1660
ypi89T1N.txt50bdce08a13587a9163d2e3e15038b3c11-Feb-1696
Kc063FLa.txt0ca6c92280ca9f6c0d6f3de56510278913-Feb-1690
r73g5ZcQ.txt6cafb49af51a081dfabea417ddf6338215-Feb-1617
4vkGXgMm.txt0332726731694abcc3859ab31d91017819-Feb-1646
4UNdJehk.cs777252b978e8fded255d87dd4e14186525-Feb-1649
g4TpnaQx.txt291b7a2bccc2cd132a3a7ada301687ca25-Feb-1650
YyVDCPGF.txte52c69649019a84e4f00616b029c481329-Feb-1646
G4pyW8Nd.cs6926608e7cf967597ab16a8e615a12951-Mar-1648
PnTq9Tzu.txt8c3906072e1767ce83fde2dcfb4ae5a04-Mar-1641
sN33WjEs.txtc38f4c069940318236f265df4bf503696-Mar-1643
7kmFXuv2.txt8fc065c4e26c3088f4ee510d679fcb506-Mar-1645
qgW3iaZd.txte00d4bc57c9613d78b89c6175fa5c4226-Mar-1655
tNyvK9La.txt5c6365694e219baaa93c964265a99d8e10-Mar-1646
QmYfNwMe.txtcbaebc74b7991028d8b0deb7a7feef5b13-Mar-1646
w8pR9Kx7.txt54a00dce2b6150b991d69d72aa20f88f27-Mar-1661
WPveSANA.txtdd7971459d2f2436a2d7ded062560ebe28-Mar-1654
vbFuaG8B.txte1d6994007b77db2137b3c37211da64128-Mar-1642
jKjxmp3H.txt011b816123c586362ff84c40c5367e5f28-Mar-1647
JL0AhHvt.txtcfdd43745ada1e35e0d54a1c03372fc528-Mar-1642
J7yDkhG4.cs37087fb23720f2d153d5d93ff5ac2b0228-Mar-1647
FWy2Bwze.txtf712efdecf834da398a68ceb2b1066bc28-Mar-1650
d7b36SCq.txtb6029da18724abd87efbab6942cf2ad28-Mar-1650
b2S1QH7b.txt4befc92ce3d59e7f91c29d967cb2e5128-Mar-1647
wWUCRtUn.txt7B75861CCF60960CB7A4510F62DCC7593-Aug-15204
X9qT2gdv.txtB6E3214B8571667E9E6C8D949143A4092-Aug-15203
pMFr9T7Z.txt95175B900A661E6517466ECDBB11F8EC2-Aug-15182
WSm8bhnD.txt38C833ED93ECCB73EA652749AB5FF6D22-Aug-15189
q6TcsD93.txtA7DE2A7A3E88EC73A6E5DDDAF1EBFEF41-Aug-15211
5c4Gkx4s.txt1DA67EB93E87C84F538D7070EB9EF9461-Aug-15229
gmePj6As.txtB31E511502634C47067B2247D487AE5230-Jul-15170
B0YtjY5d.txt0C9F01C2417B8E45C51E29A544B5D8FE30-Jul-15212
SDfnfN22.txt467DEE8AC854B9294D818900847EC98630-Jul-15182
UCNZ6vAT.txtD46A18E03CA59BD1F9925C70D3C537C129-Jul-15192
bJWCCZcH.txt712B9273724AFE942B52D31593EBC02028-Jul-15192
ziN2uncg.txtC4481C61E8FC87627E74B9E86DFA598422-Jul-15195
zy7aQ0XC.txt959E924082E4F6B12CFC802FD0E5E2CB14-Jul-15156
dcQbqCHN.txtE50FD6BC5E6969AA3D10C34ED9EAC0BB22-Jul-15189
8y93ZV9w.txt80E4F2BD93CFAD05C27D82DB52A671732-Jul-15233
hcYBCaqP.txtCEA83249D6DD7E0DA1233AA694A241A427-Jul-15209
J9HkHtEQ.txt0CAD1A373392EB6C494F8B1991E4597824-Jul-15195
ympQ7j6V.txt9F6BD8384EF226AC45AEF44D6DB5439114-Jul-15178
ynbvfred.txt1642873BBEF7D991DF11539E16CA600029-Jul-15217
ZwCAc7A4.txt6C30D822F38114E6D2B68BD7A761856815-Jun-15219
KCyVSNK1.txt800388926C83A71121562308FDC1B10523-Apr-15191
7GC1AXmv.txt2B155E4268482A8CEE87CA27E400C80319-Mar-15211
Ym7e4iDh.txtF15353C8FD5EA57C02417A8921DCBD5B27-Mar-15218
KPuZ5NQX.txt487C285566533C4CFC9AF6A3814CBB3B23-Jan-15215
kjipFGzz.txt652302915BDE357879A8594E62E3280813-Oct-14220
TOTAL7564

Quick Heal Detection

Component Name/DescriptionMD5Quick Heal Detection Name
Random_Name.exe0C34D70FF9DD1BA3B7BFE9F4FBA8F010TrojanDownldr.Bladabindi.BS64
TempWindows.exeEBB8BC149C8D7FFBAFD8D232BDD9D796TrojanDownldr.Bladabindi.BS64
Main Payload959E924082E4F6B12CFC802FD0E5E2CBBackdoor.Bladabindi.AL3

Conclusion

Malware authors are abusing “pastebin.com” for spreading different malware families. As per our analysis among all these families, “Bladabindi” RAT is spreading rapidly. More than 7500 users have been infected via pastebin.com since 2015. As the main payload is never stored on the disk, it is difficult to detect such malware.

Acknowledgment

Subject Matter Experts

  • Prakash Galande
  • Sagar Daundkar
    – Threat Research & Response Team

 

Bladabindi Malware Abusing Pastebin.com as Infection Vector

7 Useful Computer Security Habits you Must

Bladabindi Malware Abusing Pastebin.com as Infection Vector

Ramnit Malware: Improvising its weapons