PHP Malware - Basic Web Shells For Remote Code Execution

  Рет қаралды 2,508

Ripple Software Consulting

Ripple Software Consulting

2 жыл бұрын

In this this series of articles and videos I will explore some PHP malware code that has been publicly published. All the samples discussed are derived from a GitHub repository maintained by marcocesarato.
You can read the full blog article here:
www.ripplesoftware.ca/php-mal...
The advice from Ripple Software Consulting is to always maintain solid web-server security through hardened configuration and monitoring, and vulnerability scanning both internal and external surfaces with a tool such as CISOfy’s Lynis or Greenbone’s GVM. For an example of solid LAMP stack server security you can visit the RSRC’s VPS Deploy WordPress GitHub repository which is a tool for automatically deploying a WordPress website on a hardened Linux VPS Server. If you don’t want to secure your own WordPress installation, you can hire a trained security consultant such as Ripple Software, or you can use another 3rd party managed hosting provider.
PHP is a scripting language which means its source code is usually in human readable format. PHP does not need to be manually compiled and is done by the PHP interpreter. This makes the challenge of hunting PHP malware in your website easier than compiled languages, but can still be very challenging. Other scripting languages include Python, Bash, JavaScript, and Perl. PHP represents approximately 79% of the internet’s websites, and the most popular content management site (CMS) framework WordPress is written in PHP.
In Part 1, below we will look at the source code for simple web-shells. In Part 2 we will look at how attackers will encode or encrypt the payload code, making it easier to find by threat hunters.
Part 1 - Simple WebShells
Let’s gain an understanding of what a web-shell is and take a look at some simple web-shells. Firstly, a web-shell is a malicious piece of code installed within your website code that allows an unwanted attacker to execute system commands or arbitrary PHP functions. This allows an attacker to ingress files from an external source, egress files from the server, modify existing web-application source code files or other system files, and add malicious scheduled events to the server.
In order to have the commands executed, the web-shell code must be placed somewhere specific in the source code that will be either executed on every page load, or contained within a single page. The best place would depend on the type of web-shell used as we will discuss in the samples below. Commands will execute at the permission level of the server service application (Apache, Nginx) although other accessible commands may contain their own authorization, so it is critical to effectively limit the file permissions on the server to reduce the attack surface. Folders and files in Linux have 3 levels of permissions, owner, group and anyone. It is particularly important to remove ‘anyone’ read and write permissions from all files possible, but even read and write permissions for files owned by the web-server application can be configured to limit the damage that can be done by a web-shell.
Conclusion
The most effective way to protect your website source code from attacks is to protect the access controls and maintain a hardened server configuration. Another important factor is working with developers and secure hosting providers who are honest and trustworthy. If you believe your website has been hacked, you can scan the source code files for commands such as the ones used in this tutorial, but since it’s very likely that the malware infecting your website is hidden using encoding or encryption, this approach will not provide an exhaustive search of malicious code injections. Most attackers too smart (and motivated) to simply add un-encoded source code which would allow threat hunters to search for and find it. We will discuss this topic more in Part 2.
You may instead use other 3rd party tools to find malware in your WordPress site. Some examples of WordPress security plugins that include malware scanning capability include:
* Securi plugin
* WordFence plugin
* BulletProof Security Plugin
The final tutorial in this series will demonstrate how to scan your site for malicious code and remove it using these tools. Also, check out this post about other critical ways you need to protect your WordPress and other website applications.

Пікірлер: 1
@demetriusburgess8201
@demetriusburgess8201 2 жыл бұрын
🔥🔥 thank you!
PHP Malware - Hiding A Payload
11:41
Ripple Software Consulting
Рет қаралды 651
Web Server Concepts and Examples
19:40
WebConcepts
Рет қаралды 233 М.
Вечный ДВИГАТЕЛЬ!⚙️ #shorts
00:27
Гараж 54
Рет қаралды 14 МЛН
Жайдарман | Туған күн 2024 | Алматы
2:22:55
Jaidarman OFFICIAL / JCI
Рет қаралды 1,7 МЛН
ОСКАР vs БАДАБУМЧИК БОЙ!  УВЕЗЛИ на СКОРОЙ!
13:45
Бадабумчик
Рет қаралды 4,7 МЛН
Cross-Site Request Forgery (CSRF) Explained
14:11
PwnFunction
Рет қаралды 435 М.
Unraveling an obfuscated PHP web shell! Exploring web shells for malware anlaysis!
13:59
Dr Josh Stroschein - The Cyber Yeti
Рет қаралды 1,2 М.
Write a Web shell in PHP
20:24
Mossé Cyber Security Institute
Рет қаралды 8 М.
Web shell attack deep dive
26:07
Microsoft Security
Рет қаралды 9 М.
How To Scan cPanel & Website For Removing Malware / Adware / Viruses!
4:18
mlrpc.php vulnerability | bug hunting | hackerone | v3n0mt3ch
12:03
v3n0mt3ch 🚩
Рет қаралды 2,5 М.
PHP 8.1.0-dev BACKDOOR Hack (Easy RCE)
16:45
John Hammond
Рет қаралды 138 М.
Configure NGINX as a Reverse Proxy
16:43
NGINX
Рет қаралды 205 М.
Vite and Module Federation Makes Micro-Frontends EASY!
27:36
Jack Herrington
Рет қаралды 83 М.
Я УКРАЛ ТЕЛЕФОН В МИЛАНЕ
9:18
Игорь Линк
Рет қаралды 24 М.
Easy Art with AR Drawing App - Step by step for Beginners
0:27
Melli Art School
Рет қаралды 10 МЛН
Tag her 🤭💞 #miniphone #smartphone #iphone #samsung #fyp
0:11
Pockify™
Рет қаралды 36 МЛН
Mastering Picture Editing: Zoom Tools Tutorial
0:52
Photoo Edit
Рет қаралды 505 М.