Any ThinkSNS file contains

Source: Internet
Author: User

Any ThinkSNS file contains. Under certain conditions, the getshell problem occurs in public/minify. php.

Allowed_content_types = array ('js', 'css '); $ getfiles = explode (', ', strip_tags ($ _ GET ['F']); // resolution parameter $ gettype = (isset ($ _ GET ['T']) & $ _ GET ['T'] = 'css ')? 'Css ': 'js'; if ($ gettype = 'css') {$ content_type = 'text/css ';} elseif ($ gettype = 'js ') {$ content_type = 'application/x-javascript ';} else {die ('not allowed content type');} header ("content-type :". $ content_type. "; charset: UTF-8"); // note that you need to modify the encoding header ("cache-control: must-revalidate"); // header ("expires :". gmdate ("D, d m y h: I: s", time () + 60*60*24*7 ). "GMT"); // expiration time ob_start ("compress"); functio N compress ($ buffer) {// remove comments in the file $ buffer = preg_replace ('! /\ * [^ *] * \ * + ([^/] [^ *] * \ * + )*/! ', '', $ Buffer); return $ buffer;} foreach ($ getfiles as $ file) {$ fileType = strtolower (substr ($ file, strrpos ($ file ,'. ') + 1); if (in_array ($ fileType, $ allowed_content_types) {// contains all your css documents include ($ file );} else {echo 'not allowed file type :'. $ file ;}}

 

You can use $ _ GET ['F'] to pass a js or css suffix file. The content of the file is a php script and can be included and executed. When allow_url_fopen = On, it is very simple to use remote files directly. When it is Off, you can find a way to upload a js or css file to the server and then include it to be executed! Write a 1. js file in the root directory of the website <? Php phpinfo (); Access http: // xxxxxx/public/minify. php? F = ../1.js Solution:Strictly filter parameters

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.