A Trojan written in Python which was downloaded by BackDoor.Crane.1 during a targeted attack on largest Russian companies producing portal and building cranes and support equipment. The backdoor is packed with pyinstaller, the code is obfuscated and additionally packed.
Once pyinstaller is unpacked, the malicious code script looks as follows:
import pkg_resources;import sys as cDxaCtkRWKmOpQ;import time as ixffpzzULZK;import subprocess as MUnXVz;import requests as mNMzIOw;import ftplib as UYFMjbSekhlu;from base64 import b64decode as ThBmw;import uuid as EMeGYfWb;import io as PmbDbkOzZTc;import os as ILCHYx;from base64 import b64decode as sxfoHNF;from Crypto.Cipher import AES as HBmHA;import shutil as MlnyFfofyOh;from PIL import ImageGrab as ouJAno
To unpack the script, b64decode and exec are called one by one. The next code level is additionally encrypted with the AES algorithm. A decrypted code is obfuscated.
The Trojan shares information with the C&C server using the HTTP protocol. Data is sent as a POST request and looks as follows:
where compid is a unique identifier received by calling the function uuid.getnode().
If the server’s reply contains the string “\xa9:\xa9”, the Trojan retrieves a command and arguments.
The Trojan can execute the following commands:
Get a list of files and folders using the specified path;
Execute random cmd commands;
Load files to the specified server over the HTTP protocol;
Load files to the specified server over the FTP protocol;
Download random files to a computer;
Create and send a screenshot;
Delete particular files;
Stop operation of certain processes;
Send a list of running processes and information on the current operating system and disks of an infected computer the C&C server;
If the operating system (OS) can be loaded (either normally or in safe mode), download Dr.Web Security Space and run a full scan of your computer and removable media you use. More about Dr.Web Security Space.
If you cannot boot the OS, change the BIOS settings to boot your system from a CD or USB drive. Download the image of the emergency system repair disk Dr.Web® LiveDisk , mount it on a USB drive or burn it to a CD/DVD. After booting up with this media, run a full scan and cure all the detected threats.
If the mobile device is operating normally, download and install Dr.Web for Android. Run a full system scan and follow recommendations to neutralize the detected threats.
If the mobile device has been locked by Android.Locker ransomware (the message on the screen tells you that you have broken some law or demands a set ransom amount; or you will see some other announcement that prevents you from using the handheld normally), do the following:
Load your smartphone or tablet in the safe mode (depending on the operating system version and specifications of the particular mobile device involved, this procedure can be performed in various ways; seek clarification from the user guide that was shipped with the device, or contact its manufacturer);
Once you have activated safe mode, install the Dr.Web for Android onto the infected handheld and run a full scan of the system; follow the steps recommended for neutralizing the threats that have been detected;