PHPCMS V9.1.13 Arbitrary File Inclusion Vulnerability Analysis

Source: Internet
Author: User

Recently, the PHPCMS V9.1.13 Arbitrary File Inclusion Vulnerability was reported. The new version (v9.1.16) has fixed the vulnerability.

Download PHPCMS V9.1.13 and decompress it.

Here I will use the efficient analysis capability inherent in Linux to quickly locate functions with vulnerabilities. I am too lazy to look for the code at the entry point.

First, let's look at the url that triggers the vulnerability:/index. php? M = search & c = index & a = public_get_suggest_keyword & url = test & q =.../../phpsso_server/caches/configs/database. php

I use public_get_suggest_keyword as a keyword to search for it in the source code:

1, cd phpcms_v9_GBK/install_package/

2, grep-H-n-R "public_get_suggest_keyword "*

Parameter description:-H indicates the file name,-n indicates the row number, and-R indicates the recursive directory to find all files.

Result

In row 198th of the phpcms/modules/search/index. php file, find the function Definition: public function public_get_suggest_keyword ()

Vim phpcms/modules/search/index. php

Then press shift + colon in vim to enter the vim command line mode. Enter set number to display the row number, and then enter 198 to directly jump to the 198 line:

198 public function public_get_suggest_keyword (){

199 $ url = $ _ GET ['url']. '& q ='. $ _ GET ['q'];

200

201 $ res = @ file_get_contents ($ url );

202 if (CHARSET! = 'Gbk '){

203 $ res = iconv ('gbk', CHARSET, $ res );

204}

205 echo $ res;

206}

Note that the file_get_contents function of Row 3 can obtain the content of the specified file, and can directly read the content of any file without filtering.

In the new version, this function has been fixed:

198 public function public_get_suggest_keyword (){

199 $ url = $ _ GET ['url']. '& q ='. $ _ GET ['q'];

200 $ trust_url = array ('c8430fcf851e85818b546addf5bc4dd3 ');

201 $ urm_md5 = md5 ($ url );

202 if (! In_array ($ urm_md5, $ trust_url) exit;

203

204 $ res = @ file_get_contents ($ url );

205 if (CHARSET! = 'Gbk '){

206 $ res = iconv ('gbk', CHARSET, $ res );

207}

208 echo $ res;

209}

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.