How the attacks works:
Any system that silently processes transactions using a single submission is dangerous to the client.
For example, if a normal web application allows a simple URL submission, a preset session attack will allow the attacker to complete a transaction without the user's authorization. In Ajax, it gets worse: the transaction is silent; it happens with no user feedback on the page, so an injected attack script may be able to steal money from the client without authorization.
webgoat上示例,在一个银行网站应用上的转账页面中,该网页在一些基本的客户端验证后利用AJAX提交transaction。
目标:绕过用户认证并silently执行这次transaction!!
分析该页js脚本文件
发现其中processData()函数是用来验证输入金额是否超过了账户余额,若超过,认证不通过。
submitData()函数则是在验证完后被调用来提交XHR(XMLHTTPRequest)与服务端交互,执行转账。
方法一:绕过processData()的客户端验证
使用WebScarab 截获get请求,并修改get请求里的金额参数。因为获得get请求之前已经经过了客户端验证,此时修改的金额完全可以超过账户余额!
此方法bypass了客户端验证,但是还是需要经过用户认证,即必须截获客户端和服务器端的通信,因此没有达成silently的目的。
方法二:通过在browser上调用JavaScript函数submitData()来bypass客户端验证并silently执行转账。
最新版本的多数浏览器支持在地址栏里(address bar)调用JS脚本,即使用javascript:function();
因此在浏览器地址栏直接输入JavaScript:submitData(1234,11000);
即可攻击成功!
* Congratulations. You have successfully completed this lesson.
You have just silently authorized 11000$ without the user interaction.
Now you can send out a spam email containing this link and whoever clicks on it
and happens to be(有一定几率性) logged in the same time will loose their money !!