Beware of New Crypto Malware Targeting Linux: Perfctl
Beware of New Crypto Malware Targeting Linux: Perfctl
A new and dangerous malware, called Perfctl, has been infecting thousands of Linux machines. This malware, identified by security researchers from Aqua Security, is hard to detect, highly persistent, and capable of performing various malicious activities, making it a significant threat to servers and organizations. Here’s what you need to know about Perfctl and how to protect your systems.
What is Perfctl?
Perfctl is a form of crypto malware that secretly uses infected machines to mine cryptocurrency. It first surfaced around 2021 and spreads by exploiting misconfigurations on servers—over 20,000 different misconfigurations, making millions of Linux systems potential targets. It can also exploit CVE-2023-33426, a critical vulnerability in Apache RocketMQ, which has a severity score of 10/10. Despite being patched, many systems remain vulnerable.
How Perfctl Evades Detection
One of the malware's key tactics is its ability to hide in plain sight. It uses common Linux process names and file names that seem legitimate to avoid being noticed. For example, it names itself after Linux system tools like perf (a Linux performance monitoring tool) to blend in. Additionally, it employs a rootkit, allowing it to hide from system tools and administrators. Other techniques include:
Persistence After Reboots
Perfctl is particularly dangerous because of its persistence—it doesn’t go away after a reboot. It can:
Even if administrators manage to detect and remove parts of the malware, Perfctl can respawn and continue its malicious activities.
What Does Perfctl Do?
Perfctl's main function is cryptomining, meaning it hijacks the machine’s resources to mine cryptocurrency for the attackers. But that’s not all. It also:
Real-World Impact
Administrators have reported a rise in servers infected by Perfctl. In one case, an admin noticed the infection due to 100% CPU usage, but when they logged in, the malware stopped running, only to restart once they logged out. Despite efforts to remove it, the malware kept coming back after each reboot. This persistence makes it extremely frustrating and dangerous for system administrators.
How to Protect Your Systems
Here’s how you can minimize the risk of getting infected by Perfctl:
In summary, Perfctl is a sophisticated malware targeting Linux servers. It hides its activities, persists after reboots, and can be used for cryptomining, proxy-jacking, and further malware installations. Protect your systems by staying up-to-date with patches, reviewing configurations, and monitoring system resources.
Files and Directories Added by the Malware:
The malware adds several files, directories, and cron jobs to the infected system to ensure its persistence and stealth.
The cron job is located at /root/.config/cron/perfcc. This cron job runs every hour (on the 11th minute) to execute the cryptomining malware.
领英推荐
Several files are added by the malware. The main executable is found at /usr/bin/perfcc, which is likely the core of the malware. Another instance of the same file is stored at /root/.config/cron/perfcc, which is linked to the cron job for automatic execution. Additionally, the malware places files in the system’s cron directories to ensure persistence. These include /etc/cron.d/perfclean and /etc/cron.d/perfcc.
To further its stealth capabilities, the malware modifies critical system utilities with malicious shell scripts. For example, the ps command (used to display running processes) is replaced with a script located at /usr/bin/.local/bin/ps. This modified version of ps filters out any processes related to the malware (e.g., perfctl), hiding its presence from the system administrator. Similarly, the top command (used to monitor system processes) is replaced with a script at /usr/bin/.local/bin/top. This modified script hides the malware from the process viewer while also killing its activity under certain conditions using environmental variables.
The malware ensures it is automatically loaded during user login by modifying the .profile file in the user’s home directory (~/.profile). This modification ensures that the malware is executed before any legitimate workloads, making it difficult to detect and remove.
Additionally, Perfctl installs itself as a systemd service to ensure it runs at every system reboot. The fake systemd service is named kmodaudit.service, and it can be found at /etc/systemd/system/kmodaudit.service. This service uses deceptive names, such as "Kernel module perf audit and reporting," but its purpose is to execute the malware from /bin/perfcc.
The malware also creates directories in the /tmp folder to store temporary files and executables used in its operations. Two key directories are /tmp/dxdiag and /tmp/perfc. Inside the /tmp/perfc directory, an executable named "sh" is used as part of the malware’s payload, further disguising its activities by mimicking legitimate Linux processes.
How the Malware Operates on a Technical Level
Perfctl malware employs several sophisticated techniques to ensure it remains hidden, persistent, and difficult to remove. Here’s how it operates:
1. Installation and Persistence
2. Hiding in Plain Sight
3. Execution and Communication
4. CPU Hijacking for Cryptomining
5. Self-Repair Mechanism
6. Use of Privilege Escalation
In summary, Perfctl combines persistence, stealth, and adaptability, making it highly effective at evading detection while it mines cryptocurrency and operates as a backdoor for other malicious activities. It is considered over the web that the malware is probably developed or was part of malware developed by state security agencies or leaked tools of NSA (Shadowbrokers leaks, 2016 - https://en.wikipedia.org/wiki/The_Shadow_Brokers)
#LinuxSecurity #MalwareAlert #CyberSecurity #Perfctl #CryptoMining #InfoSec #LinuxServers #ThreatDetection #Rootkits #SystemSecurity #CyberThreats #ServerSecurity #LinuxVulnerabilities #PersistenceThreats #Cryptojacking