Tongda OA getshell vulnerability analysis attachment EXP

Source: Internet
Author: User

Author:
PrivateUpload. php file under general/vmeet/
Let's look at the code
 
Include_once ("inc/conn. php"); // contains the conn. php file
Include_once ("inc/utility_file.php"); // contains the file utility_file.php
Ob_end_clean (); // clear the buffer
$ UploadFileName = $ _ FILES ['filedata'] ['name']; // get the Upload File name
$ UploadFile = $ _ FILES ['filedata'] ['tmp _ name']; // obtain the address of the uploaded temporary file
$ UploadFileName = iconv ("UTF-8", $ mya_charset, $ uploadFileName); // convert file name encoding, unified UTF-8
If (is_uploaded_file ($ uploadFile) // check whether a file has been uploaded. if a temporary file exists, run the following statement:
{
$ Pos = strrpos ($ uploadFileName, "."); // obtain the location where the file name contains the point at the best.
$ Len = strlen ($ uploadFileName); // get the Object Name Length
$ ExtendType = substr ($ uploadFileName, $ pos, $ len); // obtain the final file name
If (strtolower ($ extendType) = ". php") // judge whether the suffix is. php. if it is. php, It is not executed. if it is not, continue to execute the following statement.
{
Echo "upload file fobidden ";
Exit ();
}
$ LocalFileName = $ _ GET ['filename']; // the file name Acquisition Vulnerability occurs here.
$ ZLCHAT_ATTACH = "upload/"; // upload directory
$ LocalFile = "{$ ZLCHAT_ATTACH}/temp/". $ localFileName; // upload location, where $ localFileName is a controllable variable
If (! Td_move_uploaded_file ($ uploadFile, $ localFile) // upload the file here.
{
Echo "upload failed ";
}
}
?>
 
 
This is an explanation of the above Code. Let's see how we can bypass this process to win the webshell?
First, we must understand .... The system uses the apache server. The apache server has a parsing vulnerability, that is, when such a file (1. php.222) is encountered, it will parse the file as php.
We use this vulnerability to bypass the above detection suffix.
So we only need to upload a file with a non-php suffix, and then we can customize a file with a suffix of 1. php.111. The upload directory tells us again, so we can easily get a webshell.
This is my local Test Result

The following is an example of using exp.
Save the following code as 1.html. If you need to test the code, you only need to change 192.168.56.139 to your target site.
Put exp here
 


Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.