Regular expression Lookup CRLF Injection Attack Vulnerability (HTTP response split vulnerability) _php tutorial

Source: Internet
Author: User
After using 360 to detect a site vulnerability, an article was sent to address the vulnerability, in this. But many children's shoes have some problems, many children's shoes are stuck in the variable name of this step, do not know how to find and add code, indeed, because each of the variable name of the program is not the same, and how to ensure the universality of the code, today we come to the hands of the church everyone, How to find and add code through regular expressions.





\$.+= \$_get\['. + ' \];
\$.+=\$_get\['. + ' \];



The above is the two regular expressions used in this secondary, note: Two lines of code are independent, can not be put together in one breath, the use of a single line of regular expression is good.



Here to say, if the children's shoes using the Comments-link-redirect plugin plug-in, you must read this article, because this plugin has CRLF Injection Attack Vulnerability (HTTP response splitting vulnerability), I have responded to Robin, he said there will be updates. Let's start with this plugin to see how to solve the site vulnerabilities.






Start by using a Dreamweaver-class code-editing program that supports regular expressions to open all PHP files that may be vulnerable.






Open the Search dialog (keyboard press ctrl+f), and then tick the "Use regular expressions" option.






Search using the two regular expressions provided above, and note that I mean in turn, not with two lines. If a matching value is found, the Code-browsing window section highlights the matching code.






The following code was found in the regular expression.


$ redirect = $ _get [ ' R ' ] ;


The following began to popularize, the above code in the $redirect redirect is the variable name, the variable name is probably called ABCD, Heheh is possible. Then we'll just insert the following code in the next line of the code above.



$redirect = Trim (Str_replace ("\ R", "" ", Str_replace (" \ r \ n "," ", Strip_tags (Str_replace (" "", "", Str_replace ("\ n", "", str _replace ("", "" ", Str_replace (" \ T "," ", Trim ($redirect))))));



The above code has two variable names, that is, the English words starting with $, if you need to use according to your own requirements, you must replace the two variable names. Copy the above code to the bottom of the vulnerable code, just like this.



$redirect = $_get[' R '];
$redirect = Trim (Str_replace ("\ R", "" ", Str_replace (" \ r \ n "," ", Strip_tags (Str_replace (" "", "", Str_replace ("\ n", "", str _replace ("", "" ", Str_replace (" \ T "," ", Trim ($redirect))))));



In this way, all the problems are solved.



This article source: http://www.yiduqiang.com/regex-find-crlf.html






http://www.bkjia.com/PHPjc/363799.html www.bkjia.com true http://www.bkjia.com/PHPjc/363799.html techarticle after using to detect a site vulnerability, an article was sent to address the vulnerability, in this. But many children's shoes have some problems, many children's shoes are stuck in the variable name of this step ...


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