High Level

查看源码

<?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;
    }
}

?>

可以看出,服务器端代码先判断defalut值是否为空,如果不为空的话,再用switch语句进行匹配,如果匹配成功,则插入case字段的相应值,如果不匹配,则插入的是默认的值。

由于开发人员现在在服务器端只列出允许的语言白名单,我们必须找到一种无需将代码发送到服务器即可运行代码的方法。

漏洞利用

URL的锚(#符号之后的任何内容)不会发送到服务器,因此无法被阻止。

访问链接:

http://127.0.0.1/dvwa/vulnerabilities/xss_d/?default=English # <script>alert(1)</script>

可以看到,我们的script脚本成功执行了。

DVWA-10.3 XSS (DOM)(DOM型跨站脚本攻击)-High-锚的使用

我们查看源代码,可以看到,脚本被插入到代码中,所以执行了。

DVWA-10.3 XSS (DOM)(DOM型跨站脚本攻击)-High-锚的使用

 

相关文章:

  • 2021-12-21
  • 2021-07-07
  • 2021-10-27
  • 2022-12-23
  • 2021-05-27
  • 2022-12-23
  • 2021-12-17
  • 2021-11-09
猜你喜欢
  • 2021-07-20
  • 2022-02-09
  • 2021-11-17
  • 2021-11-30
  • 2023-03-06
  • 2022-12-23
  • 2022-12-23
相关资源
相似解决方案