Python-Based Malware Slithers Into Systems via Legit VS Code

Python-Based Malware Slithers Into Systems via Legit VS Code

October 2, 2024 at 11:24AM

Mustang Panda, a Chinese APT group, is conducting a cyber-espionage campaign via malicious emails and the use of Visual Studio Code (VS Code) to distribute Python-based malware. Its tactics include establishing remote access to infected machines, exfiltrating data, and employing legitimate entities like GitHub for unauthorized access. Organizations are advised to use advanced endpoint protection and review scheduled tasks to detect and block such activities.

From the meeting notes, we can gather that a sophisticated cyber-espionage campaign has been discovered, with a Chinese APT group named Mustang Panda being identified as the likely perpetrator. The attack begins with a malicious email and employs a Python-based malware distributed through Visual Studio Code (VS Code) to gain unauthorized and persistent remote access to infected machines. The malicious activities include exfiltrating data, accessing files, and executing commands through the terminal.

The attack starts with the execution of a disguised .lnk file, which silently downloads additional components, including a Python distribution package and a malicious script. The script checks for the existence of VS Code on the system and downloads the VS Code command line interface (CLI) if it is not found. It sets up a task for persistence and establishes a remote tunnel using VS Code Remote-Tunnels to provide attackers access to the infected machine.

The attackers leverage a GitHub account for authentication and extract an activation code to enable further malicious activity. They gather sensitive data, such as system information and user details, and send the exfiltrated data to a command-and-control (C2) server. With the obtained activation code, the attackers gain unauthorized access to the victim’s machine, enabling them to browse files, execute commands, and potentially install further malware or alter system settings.

The research conducted by Cyble at the time of publishing found that the malicious Python script had no detections on VirusTotal, making it challenging for defenders to detect the attack through standard security tools. To mitigate these types of attacks, organizations are advised to implement advanced endpoint protection solutions with behavioral analysis and machine-learning capabilities, regularly review scheduled tasks on all systems, limit user permissions to install software, and conduct training sessions to educate users about the risks of opening suspicious files or links.

In summary, the clear takeaways from the meeting notes are the identification of the sophisticated cyber-espionage campaign orchestrated by the Mustang Panda APT group, the specific tactics and mechanisms employed in the attack, and the recommended mitigation strategies for organizations to enhance their defense against such APTs.

Full Article