- 111fc5ec15d2c5f8c2e2571311bec62319741081 (pyinstaller)
- 33fc645890ad71f9cbeb4ed3e34bdf53e59e92b1 (python script, packed)
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
exec(ThBmw("ZXhlYyhIQm1IQ..."))
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:
compid=<id>&nat=nat
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;
- Copy files.
- Send a list of running processes and information on the current operating system and disks of an infected computer the C&C server;
- Terminate its operation on the command.