Researchers at threat analytics firm Securonix have uncovered a new Python-based malware that has been spotted in the wild. The malware, named PY#RATION, is a remote access trojan (RAT) that gives its operators control over breached systems.
According to Securonix, the RAT uses the WebSocket protocol to communicate with its command and control (C2) server and to exfiltrate data from the infected host. The company’s technical report indicates that the malware is actively developed, as researchers have identified multiple versions of it since the PY#RATION campaign began in August.
The malware is distributed via a phishing campaign using password-protected ZIP file attachments containing two .LNK files disguised as images named
back.jpg.lnk. When run, these files appear to the victim to be the front and back of a driving licence. However, it also executes malicious code that contacts the C2 server and downloads two .TXT files,
back.txt, which are renamed to .BAT files to accommodate malware execution.
On launch, the malware creates the directories
Cortana/Setup in the user’s temporary directory and then downloads, unpacks and runs additional executables from this location.
The malware obtain persistence by adding a batch file (
CortanaAssist.bat) to the user’s startup directory: it is delivered to the target as a Python RAT packed into an executable using automated packers such as pyinstaller and py2exe, which can convert Python code into Windows executables containing all the libraries needed to run.
This approach results in an inflated payload size, with version 1.0 (original) being 14MB and version 1.6.0 (latest) being 32MB. The newer version is larger because it contains additional code (+1000 lines) and a layer of Fernet encryption.
This helps the malware evade detection, and according to Securonix’s tests, version 1.6.0 of the payload was undetected by all but one antivirus engine on VirusTotal. According to the report, the malware takes advantage of Python’s built-in Socket.IO framework, which provides functions for both client and server WebSocket communication, and is used for both communication and data exfiltration.
Indicators of compromise