Hacking

With this PHP rootkit you can take over a server hiding it in PHP server modules

The Dutch developer Luke Paris has created a PHP rootkit that hides in PHP server modules, he also explained why it is more dangerous of classic rootkits.

The Dutch developer Luke Paris has created a rootkit that hides in PHP server modules that could be used by attackers to take over web servers.

While classic rootkits work on the lowest levels of the operating system, intercepting kernel operations to perform malicious actions, Luke Paris successfully attempted to create a rootkit that interacts with the PHP interpreter, instead of the OS kernel that is much more complex.

“The first and very obvious reason why you would write a rootkit as a PHP module is accessibility. Learning how to use the Zend Engine (the framework the entire PHP language is built with) is a lot easier than learning how to write kernel modules, simply because the code base itself is smaller, better documented and a lot less complex,” Paris explained. “Even without good documentation or tutorials, I managed to learn the basics of writing a PHP module within a day. If I (a novice C developer) can do it, the bad guys definitely can.

Paris’ PHP rootkit allows attackers to gain persistence on the hacked server without getting detected.

According to Paris, the use of PHP modules to hide rootkits is very effective for the following reasons:

Accessibility – Writing a rootkit as a PHP module is a lot easier than learning how to write kernel modules. Developers can use smaller portions of code, Paris explained that he has learned the basics of writing a PHP module in just one day.

Stability – Rootkits are designed to run in kernel space, this implies that poorly written malware can crash the entire system. Using PHP rootkits this problem is overwhelmed. A poorly written PHP rootkit can’t crash the entire system.

“In the worst-case scenario, a rootkit will cause a segmentation fault and just interrupt the current request (note: most web servers report this in their error log, so this could raise suspicion).” states Paris.

Detectability – PHP Rootkits are difficult to detect because of the lack of checks of PHP modules.

“Furthermore, kernel rootkits require you to hook system calls for every process rather than just one, this slows down your machine drastically, which might lead to more suspicion.” stated the developer.

Portability – PHP rootkits are cross-platform rootkits because PHP is (in most cases) platform-independent.

Luke Paris published on GitHub a Proof of concept PHP rootkit, it is an open-source project.  The PoC code developed by Paris hooks into the PHP server’s “hash” and “sha1” functions, the rootkit is composed of only 80 lines of code, and it is quite easy for a hacker to hide it in legitimate modules.

To prevent attackers from using his code, Paris has omitted some of its parts, making compilation harder for non-expert PHP developers.

The post also includes a recommendation for administrators:

Keep a list of the module hashes after installing PHP. Administrators can use a cron job that tries to hash all files in the extension directory and compares them to the current hash. Paris also published a Python script that checks the SHA1 hashes of a user’s PHP modules.

[adrotate banner=”9″]

Pierluigi Paganini

(Security Affairs – PHP rootkit, hacking)

[adrotate banner=”13″]

Pierluigi Paganini

Pierluigi Paganini is member of the ENISA (European Union Agency for Network and Information Security) Threat Landscape Stakeholder Group and Cyber G7 Group, he is also a Security Evangelist, Security Analyst and Freelance Writer. Editor-in-Chief at "Cyber Defense Magazine", Pierluigi is a cyber security expert with over 20 years experience in the field, he is Certified Ethical Hacker at EC Council in London. The passion for writing and a strong belief that security is founded on sharing and awareness led Pierluigi to find the security blog "Security Affairs" recently named a Top National Security Resource for US. Pierluigi is a member of the "The Hacker News" team and he is a writer for some major publications in the field such as Cyber War Zone, ICTTF, Infosec Island, Infosec Institute, The Hacker News Magazine and for many other Security magazines. Author of the Books "The Deep Dark Web" and “Digital Virtual Currency and Bitcoin”.

Recent Posts

Cisco warns of password-spraying attacks targeting Secure Firewall devices

Cisco warns customers of password-spraying attacks that have been targeting Remote Access VPN (RAVPN) services…

57 mins ago

American fast-fashion firm Hot Topic hit by credential stuffing attacks

Hot Topic suffered credential stuffing attacks that exposed customers' personal information and partial payment data.…

5 hours ago

Cisco addressed high-severity flaws in IOS and IOS XE software

Cisco addressed multiple vulnerabilities in IOS and IOS XE software that can be exploited to…

19 hours ago

Google: China dominates government exploitation of zero-day vulnerabilities in 2023

Google's Threat Analysis Group (TAG) and Mandiant reported a surge in the number of actively…

1 day ago

Google addressed 2 Chrome zero-days demonstrated at Pwn2Own 2024

Google addressed two zero-day vulnerabilities in the Chrome web browser that have been demonstrated during…

2 days ago

INC Ransom stole 3TB of data from the National Health Service (NHS) of Scotland

The INC Ransom extortion group hacked the National Health Service (NHS) of Scotland and is threatening…

2 days ago

This website uses cookies.