DVWA之DOM型XSS

DOM型XSS

是一种特殊类型的反射型XSS,它是基于DOM文档对象模型的一种漏洞,其触发不需要经过服务器端,也就是说,服务端的防御并不起作用。

Security Level: low

源码

<?php

# No protections, anything goes

?> 

分析

什么限制都没有,大胆尝试

进行下方的实验

在这里插入图片描述
发现在url的default写什么页面便生成什么

Security Level: medium

源码

 <?php

// Is there any input?
if ( array_key_exists( "default", $_GET ) && !is_null ($_GET[ 'default' ]) ) {
    $default = $_GET['default'];
    
    # Do not allow script tags
    if (stripos ($default, "<script") !== false) {
        header ("location: ?default=English");
        exit;
    }
}

?>

分析

源码,发现只对script标签进行了过滤,过滤方式是调用stripos()函数获取“<script”字符串出现在参数的哪个位置(不区分大小写),因此重复内嵌和大小写等方式无法绕过该过滤机制

进行下方的实验

在这里插入图片描述

Security Level: high

源码

 <?php

// Is there any input?
if ( array_key_exists( "default", $_GET ) && !is_null ($_GET[ 'default' ]) ) {

    # White list the allowable languages
    switch ($_GET['default']) {
        case "French":
        case "English":
        case "German":
        case "Spanish":
            # ok
            break;
        default:
            header ("location: ?default=English");
            exit;
    }
}

?>



分析

需要找一种方法在本地运行你的JS代码而无需经过服务器端的处理。这里提供的一种方法就是,应用#号,URL栏的#号之后的内容并不会发送至服务器端,JS应用该符号实现在页面创建加载过程中定向到指定的页面内容上。

进行下方的实验

在这里插入图片描述

  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 1
    评论
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值