Example analysis of webshell uploaded traceability events
Inspection and Killing
First of all, I understand that what I have to do is not to find where the upload location appears. I should log on to the server to perform webshel inspection and inspection, and check to see if Has it been invaded by others, is there a backdoor, etc. Although the IP address reported is our company's IP address, if a few webshells are missed and uploaded successfully by others but not detected, what can we do if the server is invaded? So I went up to inspect the server, uploaded this webshell killing tool for killing, used netstat -anpt and iptables -L to determine whether there was a backdoor established, checked whether there was a mining program occupying the CPU, etc., I will not go into details here. . Fortunately, the server was not compromised, and I started to think about what happened to this upload point.
File Upload Vulnerability Review
First of all, I asked the developer who contacted me about the address of this server that is open to the public. After asking for the address, I opened it and found that what looked familiar was the one I tested recently. Of? At this time, I felt a little confused, and I confronted the developer about the rectification information. After the last test, I found that the upload place used a whitelist restriction, which only allowed the upload of jpeg, png and other image formats. At that time, I also discovered that although the upload was restricted by a whitelist, a random number was added to the uploaded file name, and the time rules were matched, I still found the upload path and file name in the return package. This and others It was suggested that rectification be carried out, otherwise this would cause the file to contain vulnerabilities. He reported to me that the rectification had indeed been carried out and the path was no longer returned.
File suffix encoding bypass
After discussing and reviewing the problems of the last rectification, I clarified my thinking. Then I logged into the website to check the reason. Because the website only has one place to upload pictures, I tried to capture the packet. After using the repeater to replay the package, I found that the returned package did not return the file upload path. Then I tried various detours. But the result is no good. In the end, I couldn't get any results after thinking hard, and then I asked the cloud platform what was the reason for the alarm provided to them. After reading the feedback results from the cloud platform, I found that there is an image code. This is not a big problem. The uploaded file does not have execution permission, and the file path is not returned. The file name was randomly changed, but why is this jsp uploaded successfully? Okay, this makes me puzzled.
When I looked carefully at the webshel data provided by the cloud platform, I carefully observed that the file name uses base64 encoding. I am very confused about this. Why do I need to encode it when I have already made a random function? Last time No coding was done during testing. I suddenly thought of the key to the problem, and then used the decoder module of burpsuite to base64 encode the file name "1.jsp" into "MS5Kc1A=", and then sent a successful feedback status code of 200, instead of this upload failure feedback status code of 500 error .
So, the problem is that during the rectification process, the R&D personnel used base64 encoding for the file name, which caused the file name to be decoded using base64 during the storage process, and when I uploaded the file, I changed the suffix name to .jsp was also base64 encoded, and .jsp was successfully decoded during the storage process. The R&D team did not impose any whitelist restrictions after decoding. In fact, this kind of coding change is unnecessary. After all, the random number has been used to change the file name. Recoding is a bit superfluous. This is why changing a program bug causes more bugs.
The above is the detailed content of Example analysis of webshell uploaded traceability events. For more information, please follow other related articles on the PHP Chinese website!

Hot AI Tools

Undresser.AI Undress
AI-powered app for creating realistic nude photos

AI Clothes Remover
Online AI tool for removing clothes from photos.

Undress AI Tool
Undress images for free

Clothoff.io
AI clothes remover

AI Hentai Generator
Generate AI Hentai for free.

Hot Article

Hot Tools

Notepad++7.3.1
Easy-to-use and free code editor

SublimeText3 Chinese version
Chinese version, very easy to use

Zend Studio 13.0.1
Powerful PHP integrated development environment

Dreamweaver CS6
Visual web development tools

SublimeText3 Mac version
God-level code editing software (SublimeText3)

Hot Topics



Scenario description assumes that in a real production environment, there is an RCE vulnerability, which allows us to obtain the installation of the WebShell environment. First, before pulling the vulnerable image on GetHub, we need to install nginx and tomcat on centos in advance and configure nginx and tomcat. Configuration file, use docker to pull down the image, and reproduce the vulnerability. 1. Set up the docker environment first. 2. Test whether tomcat can be accessed. As can be seen from the above figure, the back-end tomcat is accessible. 3. Check the load balancing of nginx reverse proxy in docker. 4. Check the ant in lbsnode1 in docker. .jsp text

1. After opening the URL, it was found that it was an upload page. 2. Directly uploaded the file with the suffix php, but found that it could not be uploaded. 3. Use BurpSuite to capture the packet, and change the suffix of the uploaded file with the suffix php to php5 to bypass it. After 4. Use a kitchen knife to connect. In the directory of var/www/html, a file with KEY is found. Open it and you will see key5. Open another URL, which is also an upload page, but the upload list is set. Only Allow files with the suffix .gif.jpg.png to be uploaded through 6. We write a txt one-sentence Trojan and change its suffix to jpg7. When uploading, use BurpSiuit to capture the packet and modify the file suffix to display

As Internet security issues become increasingly prominent, the security of major websites and applications has become an increasingly important issue. Especially in website operation and maintenance management, tools such as WebShell are often needed for maintenance and repair. However, WebShell is also often used by hackers and becomes an entry point for attackers to invade. This article will introduce the WebShell security settings of the Pagoda Panel to help website administrators improve the security of the site. 1. The concept and common uses of WebShell 1. Concept WebShell is

This article introduces you to the Webshell of the Empire CMS framework. It has certain reference value. Friends in need can refer to it. I hope it will be helpful to everyone.

Local environment setup Judging from the retained screenshots, the other party's PHP version is 5.6.40, so I want to set up a test environment of apache+php5.6.40. Open virtualbox, copy the link to the centos image system, and configure it according to the following process. 1.Install apacheyuminstall-yhttpdhttpd-vServerversion:Apache/2.4.6(CentOS)Serverbuilt:Aug8201911:41:182.Install php5.6yum-yinstallepel-releaserpm-Uvhhttps://mi

SINE Security was conducting website vulnerability detection and repair on a customer's website and found that the website had serious SQL injection vulnerabilities and uploaded webshell website Trojan file vulnerabilities. The website used a CMS system, developed using PHP language, and the MySQL database architecture. The source code of this website is currently open source. A certain CMS is a social CMS system that focuses on providing paid knowledge. Payment for knowledge is in high demand on the current Internet. This system can share documents and download them for a fee. The knowledge content published by users can be hidden and provided to paying customers. read. The code is relatively streamlined and is well liked by the majority of webmasters. The vulnerability of this website mainly occurs when uploading the compressed package and constructing malicious decompression code to refer to the w in the zip package.

What is WebShell? In the beginning, Webshell was often used as the abbreviation of a type of script used by Web server administrators to remotely manage the server. Later, with the birth of some Webshell management tools, the process of obtaining Web permissions was greatly simplified, so it was gradually called a Web intrusion tool script. Webshell is different from vulnerabilities, but uses application vulnerabilities or server vulnerabilities (file upload vulnerabilities, file inclusion vulnerabilities, etc.) to upload script files to the server for subsequent exploitation. It belongs to the subsequent exploitation of penetration testing and the TA0002Execution (execution) stage of ATT&CK. Figure 1TA0002 reference source: https

First of all, I understand that what I have to do is not to find where the uploaded location appears. I should log on to the server to perform webshel inspection and inspection to see if it has been invaded by others, whether there is a backdoor, etc. etc. Although the IP address reported is our company's IP address, if a few webshells are missed and uploaded successfully by others but not detected, what can we do if the server is invaded? So I went up to inspect the server, uploaded this webshell killing tool for killing, used netstat-anpt and iptables-L to determine whether there was a backdoor established, checked whether there was a mining program occupying the CPU, etc., I will not go into details here. . Fortunately, the server was not compromised, and then
