Home Backend Development PHP Tutorial Regular expression to find CRLF injection attack vulnerability (HTTP response splitting vulnerability)_PHP tutorial

Regular expression to find CRLF injection attack vulnerability (HTTP response splitting vulnerability)_PHP tutorial

Jul 21, 2016 pm 02:58 PM
360 http use response Split attack Find Detection regular injection loopholes site expression

After using 360 to detect website vulnerabilities, I posted an article to solve the vulnerabilities, here it is. But many children's shoes have some problems. Many children's shoes are stuck in the step of variable names. They don't know how to find and add codes. It is true, because the variable names of every program cannot be the same, so what? To ensure the versatility of the code, today we will teach you step by step how to find and add codes through regular expressions.

$.+= $_GET['.+'];
$.+=$_GET['.+'];

The above are the two regular expressions to be used this time. Note: The two lines of code are independent and cannot be used together in one go. Just use one line of regular expressions at a time.

I want to say here that if you use the comments-link-redirect plug-in written by Robin Bird, you must read this article, because this plug-in has a CRLF injection attack vulnerability (HTTP response splitting vulnerability) ), I have reported it to Robin, and he said there will be an update. Let’s start with this plug-in and see how to solve site vulnerabilities.

Regular expression to find CRLF injection attack vulnerability (HTTP response splitting vulnerability)_PHP tutorial

First use a code editing program such as Dreamweaver that supports regular expressions to open all PHP files that may contain vulnerabilities.

Regular expression to find CRLF injection attack vulnerability (HTTP response splitting vulnerability)_PHP tutorial

Open the search dialog box (press Ctrl+F on the keyboard), and then check the "Use regular expressions" option.

Regular expression to find CRLF injection attack vulnerability (HTTP response splitting vulnerability)_PHP tutorial

Use the two regular expressions provided above in sequence to search. Note that I mean sequentially, not two lines together. If a matching value is found, the matching code will be highlighted in the code browser portion of the window.

Regular expression to find CRLF injection attack vulnerability (HTTP response splitting vulnerability)_PHP tutorial

See the following code found in the regular expression search.

$redirect = $_GET ['r'];

Let’s start to popularize it. The redirect in $redirect in the above code is the variable name. The variable name may be called abcd or heheh. It is possible. Then we insert the following code immediately after the above line of code.

$redirect = trim(str_replace("r","",str_replace("rn","",strip_tags(str_replace("'","",str_replace("n", "", str_replace(" " ,"",str_replace("t","",trim($redirect))))),""))));

There are two variable names in the above code, which are English words starting with $. If you need to use them according to your own requirements, you must change the two variable names. Just copy the above code below the vulnerable code, like below.

$redirect = $_GET['r'];
$redirect = trim(str_replace("r","",str_replace("rn","",strip_tags(str_replace("'","" ,str_replace("n", "", str_replace(" ","",str_replace("t","",trim($redirect))))),""))));

In this way, all problems will be solved.

Source of this article: http://www.yiduqiang.com/regex-find-crlf.html

www.bkjia.comtruehttp: //www.bkjia.com/PHPjc/363799.htmlTechArticleAfter using 360 to detect site vulnerabilities, I published an article to solve the vulnerabilities, here. But many children's shoes have some problems. Many children's shoes are stuck in the variable name step...
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn

Hot Article Tags

Notepad++7.3.1

Notepad++7.3.1

Easy-to-use and free code editor

SublimeText3 Chinese version

SublimeText3 Chinese version

Chinese version, very easy to use

Zend Studio 13.0.1

Zend Studio 13.0.1

Powerful PHP integrated development environment

Dreamweaver CS6

Dreamweaver CS6

Visual web development tools

SublimeText3 Mac version

SublimeText3 Mac version

God-level code editing software (SublimeText3)

What software is crystaldiskmark? -How to use crystaldiskmark? What software is crystaldiskmark? -How to use crystaldiskmark? Mar 18, 2024 pm 02:58 PM

What software is crystaldiskmark? -How to use crystaldiskmark?

How to add trusted sites in Google Chrome How to add trusted sites in Google Chrome Jul 19, 2024 pm 04:14 PM

How to add trusted sites in Google Chrome

How to download foobar2000? -How to use foobar2000 How to download foobar2000? -How to use foobar2000 Mar 18, 2024 am 10:58 AM

How to download foobar2000? -How to use foobar2000

How to use Baidu Netdisk app How to use Baidu Netdisk app Mar 27, 2024 pm 06:46 PM

How to use Baidu Netdisk app

How to use NetEase Mailbox Master How to use NetEase Mailbox Master Mar 27, 2024 pm 05:32 PM

How to use NetEase Mailbox Master

MIT's latest masterpiece: using GPT-3.5 to solve the problem of time series anomaly detection MIT's latest masterpiece: using GPT-3.5 to solve the problem of time series anomaly detection Jun 08, 2024 pm 06:09 PM

MIT's latest masterpiece: using GPT-3.5 to solve the problem of time series anomaly detection

BTCC tutorial: How to bind and use MetaMask wallet on BTCC exchange? BTCC tutorial: How to bind and use MetaMask wallet on BTCC exchange? Apr 26, 2024 am 09:40 AM

BTCC tutorial: How to bind and use MetaMask wallet on BTCC exchange?

Teach you how to use the new advanced features of iOS 17.4 'Stolen Device Protection' Teach you how to use the new advanced features of iOS 17.4 'Stolen Device Protection' Mar 10, 2024 pm 04:34 PM

Teach you how to use the new advanced features of iOS 17.4 'Stolen Device Protection'

See all articles