Use the $ _ SERVER and $ _ SESSION variables to create various Backdoors

Source: Internet
Author: User

First, let's take a look at the php official manual's Annotation for $ _ SERVER ['path _ info']: This value is any PATH information submitted by the client, the value is after the actual Script Name and before the query string. For example, assume that the current url is http://www.bkjia.com /Php/path_info.php/some/stuff? Foo = bar, then the value of $ _ SERVER ['path _ info'] Is/some/stuff. Then let's look at the following code: test. php <? Php session_start (); var_dump ($ _ SESSION ['test']); echo '<br/> '; $ _ SESSION ['test'] = $ _ SERVER ['path _ info']; var_dump ($ _ SESSION ['test']);?> access url: http://localhost/test.php/a Return page: Notice: A session had already been started-ignoring session_start () in D: \ Apacheroot \ test. php on line 2 Notice: Undefined index: test in D: \ Apacheroot \ test. php on line 3 NULL string (2) "/B" refresh and return: Notice: A session had already been started-ignoring session_start () in D: \ Apacheroot \ test. php on line 2 string (7) "/notice" string (2) "/B" what's strange? After the refresh, var_dump ($ _ SESSION ['test']) returns/notice, which is the same as the address of the img tag. Why? The reason is that /test is loaded for browser access. php/notice, which triggers test. in php, the $ _ SERVER ['path _ info'] variable changes, and the session variable changes. Therefore, every time you refresh the page, $ _ SESSION ['test'] outputs notice. So what security risks will this cause? Any address in the img tag can be output to the webpage and valid in the session, which forms a natural (reflection + storage + dom type) XSS/CSRF, because the vast majority of security software only scans webshell, one-sentence Trojan, and other content, and does not scan js script content, it can avoid killing, other dangers can also be determined with the Environment

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.