• Welcome to TechPowerUp Forums, Guest! Please check out our forum guidelines for info related to our community.

Dutch Developer Creates Rootkit That Hides in PHP Server Modules

Joined
Jan 5, 2006
Messages
17,847 (2.67/day)
System Name AlderLake / Laptop
Processor Intel i7 12700K P-Cores @ 5Ghz / Intel i3 7100U
Motherboard Gigabyte Z690 Aorus Master / HP 83A3 (U3E1)
Cooling Noctua NH-U12A 2 fans + Thermal Grizzly Kryonaut Extreme + 5 case fans / Fan
Memory 32GB DDR5 Corsair Dominator Platinum RGB 6000MHz CL36 / 8GB DDR4 HyperX CL13
Video Card(s) MSI RTX 2070 Super Gaming X Trio / Intel HD620
Storage Samsung 980 Pro 1TB + 970 Evo 500GB + 850 Pro 512GB + 860 Evo 1TB x2 / Samsung 256GB M.2 SSD
Display(s) 23.8" Dell S2417DG 165Hz G-Sync 1440p / 14" 1080p IPS Glossy
Case Be quiet! Silent Base 600 - Window / HP Pavilion
Audio Device(s) Panasonic SA-PMX94 / Realtek onboard + B&O speaker system / Harman Kardon Go + Play / Logitech G533
Power Supply Seasonic Focus Plus Gold 750W / Powerbrick
Mouse Logitech MX Anywhere 2 Laser wireless / Logitech M330 wireless
Keyboard RAPOO E9270P Black 5GHz wireless / HP backlit
Software Windows 11 / Windows 10
Benchmark Scores Cinebench R23 (Single Core) 1936 @ stock Cinebench R23 (Multi Core) 23006 @ stock
"A Dutch web developer has created a rootkit that hides inside a PHP module and can be used to take over web servers via a rarely used attack vector: Apache modules.

According to a classic definition of a rootkit, this is a piece of code that works on the lowest levels of the operating system, intercepting kernel operations and injecting malicious actions.

Many of today's rootkits work near the OS kernel and require a high-level of proficiency on the attacker's side to get it to run without crashing the victim's computer.

It's this need for advanced C and C++ coding skills that drove Luke Paris, a Dutch web developer, to attempt to create a rootkit that interacts with the PHP interpreter, instead of the OS kernel.
"

"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 explains. "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."
PHP rootkits have many advantages
"According to Paris, using PHP modules to hide rootkits is actually a pretty clever idea. The developer details a series of advantages"

"⋙ Poorly written PHP rootkits will not crash the OS, only causing segmentation faults that interrupt current server requests, allowing infections to go unnoticed for a longer time.
⋙ Very few developers check the hashes of their PHP modules, meaning it's quite easy to trick devs into downloading a tainted PHP module or replacing PHP modules on hacked servers.
⋙ PHP rootkits only have to hook into one system process, while kernel rootkits have to hook into every single kernel call, reducing a machine's performance.
⋙ PHP rootkits are cross-platform rootkits because PHP is a cross-platform project and PHP modules can be cross-compiled for different platforms.
"
Proof of concept code available on GitHub
"Paris has created a proof-of-concept PHP rootkit which he open-sourced on GitHub. The test rootkit he developed hooks into the PHP server's "hash" and "sha1" functions. The entire rootkit is 80 lines of code, and an attacker could easily hide it in legitimate modules.

To prevent attackers from easily weaponizing his code, the developer has defanged some of its parts, making compilation harder for people with no expertise in PHP modules.

Nevertheless, his test PHP rootkit shows a possible attack vector that server administrators need to take into consideration. To prevent such attacks, Paris has a series of recommendations for server owners.

"The most simple way of detecting whether or not any of your modules are malicious would be to keep a list of the module hashes after installing PHP," Paris says. "Once you have a list of hashes, add a cron job that tries to hash all files in the extension directory and compares them to the current hash."

To make everyone's job easier, Paris even published a Python script that checks the SHA1 hashes of a user's PHP modules.
"

Mitigate attack by scanning Apache module file hashes
"This is an interesting research project," Scott Arciszewski, Chief Development Officer at Paragon Initiative Enterprise, told Bleeping Computer in an email today.

"I've seen .htaccess-based malware used in infected systems before, a PHP module or Apache module is certainly not out of the question," Arciszewski added.

The expert, who is also the man behind Airship, a PHP CMS designed with improved security, says the only suggestion he'd make to Paris' mitigation script is to use SHA256 hashes instead of SHA1.

His advice comes after Google researchers have broken the SHA1 hashing function earlier this year, creating two files with the same SHA1 hash. This would allow an attacker to add the PHP rootkit and then generate an Apache module with the same hash (at least in theory for now, has not been done before).
"

PHP rootkit gives attackers the persistence they always wanted
"On hacked servers, most incident responders would not consider looking for malicious code inside PHP modules, as this is not a common place to hide malware, usually found in the source code of public websites, .htaccess files, or other files stored in the web server's directories.

Paris' PHP rootkit is the persistence tool that many attackers have always wanted, allowing them to remain at the lowest server level without getting detected.

It's because of this increased level of persistence that Arciszewski recommends taking drastic options when dealing with servers suspected of being infected with malware, as there's always a new attack vector around the corner, unknown to most server administrators.

"If you're trying to clean up a compromised system, after the forensic investigation is complete, we always recommend building a new, clean environment and migrating the data over from a trusted backup for reasons like this," the expert said.

Paris is not the first to play around with the idea of hiding malicious code in Apache modules. Back in 2015, London-based developer Christian Papathanasiou created a similar rootkit that he hid inside an Apache module.
"

https://www.bleepingcomputer.com/ne...tes-rootkit-that-hides-in-php-server-modules/
 
Joined
Oct 17, 2012
Messages
9,781 (2.32/day)
Location
Massachusetts
System Name Americas cure is the death of Social Justice & Political Correctness
Processor i7-11700K
Motherboard Asrock Z590 Extreme wifi 6E
Cooling Noctua NH-U12A
Memory 32GB Corsair RGB fancy boi 5000
Video Card(s) RTX 3090 Reference
Storage Samsung 970 Evo 1Tb + Samsung 970 Evo 500Gb
Display(s) Dell - 27" LED QHD G-SYNC x2
Case Fractal Design Meshify-C
Audio Device(s) on board
Power Supply Seasonic Focus+ Gold 1000 Watt
Mouse Logitech G502 spectrum
Keyboard AZIO MGK-1 RGB (Kaith Blue)
Software Win 10 Professional 64 bit
Benchmark Scores the MLGeesiest
 
Joined
Jan 5, 2006
Messages
17,847 (2.67/day)
System Name AlderLake / Laptop
Processor Intel i7 12700K P-Cores @ 5Ghz / Intel i3 7100U
Motherboard Gigabyte Z690 Aorus Master / HP 83A3 (U3E1)
Cooling Noctua NH-U12A 2 fans + Thermal Grizzly Kryonaut Extreme + 5 case fans / Fan
Memory 32GB DDR5 Corsair Dominator Platinum RGB 6000MHz CL36 / 8GB DDR4 HyperX CL13
Video Card(s) MSI RTX 2070 Super Gaming X Trio / Intel HD620
Storage Samsung 980 Pro 1TB + 970 Evo 500GB + 850 Pro 512GB + 860 Evo 1TB x2 / Samsung 256GB M.2 SSD
Display(s) 23.8" Dell S2417DG 165Hz G-Sync 1440p / 14" 1080p IPS Glossy
Case Be quiet! Silent Base 600 - Window / HP Pavilion
Audio Device(s) Panasonic SA-PMX94 / Realtek onboard + B&O speaker system / Harman Kardon Go + Play / Logitech G533
Power Supply Seasonic Focus Plus Gold 750W / Powerbrick
Mouse Logitech MX Anywhere 2 Laser wireless / Logitech M330 wireless
Keyboard RAPOO E9270P Black 5GHz wireless / HP backlit
Software Windows 11 / Windows 10
Benchmark Scores Cinebench R23 (Single Core) 1936 @ stock Cinebench R23 (Multi Core) 23006 @ stock
Joined
Oct 17, 2012
Messages
9,781 (2.32/day)
Location
Massachusetts
System Name Americas cure is the death of Social Justice & Political Correctness
Processor i7-11700K
Motherboard Asrock Z590 Extreme wifi 6E
Cooling Noctua NH-U12A
Memory 32GB Corsair RGB fancy boi 5000
Video Card(s) RTX 3090 Reference
Storage Samsung 970 Evo 1Tb + Samsung 970 Evo 500Gb
Display(s) Dell - 27" LED QHD G-SYNC x2
Case Fractal Design Meshify-C
Audio Device(s) on board
Power Supply Seasonic Focus+ Gold 1000 Watt
Mouse Logitech G502 spectrum
Keyboard AZIO MGK-1 RGB (Kaith Blue)
Software Win 10 Professional 64 bit
Benchmark Scores the MLGeesiest

the54thvoid

Intoxicated Moderator
Staff member
Joined
Dec 14, 2009
Messages
12,463 (2.37/day)
Location
Glasgow - home of formal profanity
Processor Ryzen 7800X3D
Motherboard MSI MAG Mortar B650 (wifi)
Cooling be quiet! Dark Rock Pro 4
Memory 32GB Kingston Fury
Video Card(s) Gainward RTX4070ti
Storage Seagate FireCuda 530 M.2 1TB / Samsumg 960 Pro M.2 512Gb
Display(s) LG 32" 165Hz 1440p GSYNC
Case Asus Prime AP201
Audio Device(s) On Board
Power Supply be quiet! Pure POwer M12 850w Gold (ATX3.0)
Software W10
Cute unicorn and tiny sympathy violin wins the debate.

Edit: no idea why I think that's a unicorn.... Checks bestiary.. yup, horses cannot play violin, unicorns being magical can.
 
Joined
Jan 5, 2006
Messages
17,847 (2.67/day)
System Name AlderLake / Laptop
Processor Intel i7 12700K P-Cores @ 5Ghz / Intel i3 7100U
Motherboard Gigabyte Z690 Aorus Master / HP 83A3 (U3E1)
Cooling Noctua NH-U12A 2 fans + Thermal Grizzly Kryonaut Extreme + 5 case fans / Fan
Memory 32GB DDR5 Corsair Dominator Platinum RGB 6000MHz CL36 / 8GB DDR4 HyperX CL13
Video Card(s) MSI RTX 2070 Super Gaming X Trio / Intel HD620
Storage Samsung 980 Pro 1TB + 970 Evo 500GB + 850 Pro 512GB + 860 Evo 1TB x2 / Samsung 256GB M.2 SSD
Display(s) 23.8" Dell S2417DG 165Hz G-Sync 1440p / 14" 1080p IPS Glossy
Case Be quiet! Silent Base 600 - Window / HP Pavilion
Audio Device(s) Panasonic SA-PMX94 / Realtek onboard + B&O speaker system / Harman Kardon Go + Play / Logitech G533
Power Supply Seasonic Focus Plus Gold 750W / Powerbrick
Mouse Logitech MX Anywhere 2 Laser wireless / Logitech M330 wireless
Keyboard RAPOO E9270P Black 5GHz wireless / HP backlit
Software Windows 11 / Windows 10
Benchmark Scores Cinebench R23 (Single Core) 1936 @ stock Cinebench R23 (Multi Core) 23006 @ stock
Cute unicorn and tiny sympathy violin wins the debate.

Edit: no idea why I think that's a unicorn.... Checks bestiary.. yup, horses cannot play violin, unicorns being magical can.

Nothing to "win" here, I just don't want to derail the thread any further.

Thanks.
 
Joined
Oct 17, 2012
Messages
9,781 (2.32/day)
Location
Massachusetts
System Name Americas cure is the death of Social Justice & Political Correctness
Processor i7-11700K
Motherboard Asrock Z590 Extreme wifi 6E
Cooling Noctua NH-U12A
Memory 32GB Corsair RGB fancy boi 5000
Video Card(s) RTX 3090 Reference
Storage Samsung 970 Evo 1Tb + Samsung 970 Evo 500Gb
Display(s) Dell - 27" LED QHD G-SYNC x2
Case Fractal Design Meshify-C
Audio Device(s) on board
Power Supply Seasonic Focus+ Gold 1000 Watt
Mouse Logitech G502 spectrum
Keyboard AZIO MGK-1 RGB (Kaith Blue)
Software Win 10 Professional 64 bit
Benchmark Scores the MLGeesiest
the more i read articles like these, the more worried i get ....its genuinely startling sometimes how Much insecurity is "out there". Of course safe browsing practices are among the best tools a user can implement, but still.

Free tools for all:
For technicians
Malwarebytes Techbench
LEARN MORE
APPLY NOW
Malwarebytes AdwCleaner
LEARN MORE
DOWNLOAD
Junkware Removal Tool by Malwarebytes
LEARN MORE
DOWNLOAD
Malwarebytes Anti-Rootkit beta <<<
LEARN MORE
DOWNLOAD
Malwarebytes Chameleon
LEARN MORE
DOWNLOAD
Malwarebytes startupLITE
LEARN MORE
DOWNLOAD
Malwarebytes FileASSASSIN
LEARN MORE
DOWNLOAD
Malwarebytes RegASSASSIN
LEARN MORE
DOWNLOAD
 
Last edited:

Aquinus

Resident Wat-man
Joined
Jan 28, 2012
Messages
13,147 (2.94/day)
Location
Concord, NH, USA
System Name Apollo
Processor Intel Core i9 9880H
Motherboard Some proprietary Apple thing.
Memory 64GB DDR4-2667
Video Card(s) AMD Radeon Pro 5600M, 8GB HBM2
Storage 1TB Apple NVMe, 4TB External
Display(s) Laptop @ 3072x1920 + 2x LG 5k Ultrafine TB3 displays
Case MacBook Pro (16", 2019)
Audio Device(s) AirPods Pro, Sennheiser HD 380s w/ FIIO Alpen 2, or Logitech 2.1 Speakers
Power Supply 96w Power Adapter
Mouse Logitech MX Master 3
Keyboard Logitech G915, GL Clicky
Software MacOS 12.1
I don't have a whole lot of sympathy for PHP applications these days. It's the best way to tie yourself to the past and do things the wrong way. There are far more efficient ways to design web applications these days than using a language like PHP.
 

W1zzard

Administrator
Staff member
Joined
May 14, 2004
Messages
27,051 (3.71/day)
Processor Ryzen 7 5700X
Memory 48 GB
Video Card(s) RTX 4080
Storage 2x HDD RAID 1, 3x M.2 NVMe
Display(s) 30" 2560x1600 + 19" 1280x1024
Software Windows 10 64-bit
This is a complete non-issue, either you get your php modules from your distro's repository or you compile them yourself.

They don't magically install themselves and you can't install new ones remotely unless you have root access, at which point there are much better attack vectors.
 

Aquinus

Resident Wat-man
Joined
Jan 28, 2012
Messages
13,147 (2.94/day)
Location
Concord, NH, USA
System Name Apollo
Processor Intel Core i9 9880H
Motherboard Some proprietary Apple thing.
Memory 64GB DDR4-2667
Video Card(s) AMD Radeon Pro 5600M, 8GB HBM2
Storage 1TB Apple NVMe, 4TB External
Display(s) Laptop @ 3072x1920 + 2x LG 5k Ultrafine TB3 displays
Case MacBook Pro (16", 2019)
Audio Device(s) AirPods Pro, Sennheiser HD 380s w/ FIIO Alpen 2, or Logitech 2.1 Speakers
Power Supply 96w Power Adapter
Mouse Logitech MX Master 3
Keyboard Logitech G915, GL Clicky
Software MacOS 12.1

W1zzard

Administrator
Staff member
Joined
May 14, 2004
Messages
27,051 (3.71/day)
Processor Ryzen 7 5700X
Memory 48 GB
Video Card(s) RTX 4080
Storage 2x HDD RAID 1, 3x M.2 NVMe
Display(s) 30" 2560x1600 + 19" 1280x1024
Software Windows 10 64-bit

Aquinus

Resident Wat-man
Joined
Jan 28, 2012
Messages
13,147 (2.94/day)
Location
Concord, NH, USA
System Name Apollo
Processor Intel Core i9 9880H
Motherboard Some proprietary Apple thing.
Memory 64GB DDR4-2667
Video Card(s) AMD Radeon Pro 5600M, 8GB HBM2
Storage 1TB Apple NVMe, 4TB External
Display(s) Laptop @ 3072x1920 + 2x LG 5k Ultrafine TB3 displays
Case MacBook Pro (16", 2019)
Audio Device(s) AirPods Pro, Sennheiser HD 380s w/ FIIO Alpen 2, or Logitech 2.1 Speakers
Power Supply 96w Power Adapter
Mouse Logitech MX Master 3
Keyboard Logitech G915, GL Clicky
Software MacOS 12.1
Top