[BJDCTF2020]Easy MD5

  1. 打开页面有一个输入框

image-20211010222703543
  1. BurpSuite 抓包测试,得到提示

select * from 'admin' where password=md5($pass,true)
image-20211010224814146
  1. 绕过MD5函数

这个点的原理是 ffifdyop 这个字符串被 md5 哈希了之后会变成 276f722736c95d99e921722cf9ed621c,这个字符串前几位刚好是'or '6,而 Mysql 刚好又会吧 hex 转成 ascii 解释,因此拼接之后的形式是

select * from 'admin' where password='' or '6xxxxx'

等价于 or 一个永真式,因此相当于万能密码,可以绕过md5()函数。

image-20211011131416965

跳转地址:./levels91.php

  1. 访问跳转地址,得到PHP代码片段

image-20211011131513807
<!--
$a = $GET['a'];
$b = $_GET['b'];

if($a != $b && md5($a) == md5($b)){
    // wow, glzjin wants a girl friend.
-->
  1. 传入两个array绕过

因为md5(array(1)) == Nullmd5(array(2)) == Null

image-20211011132602010
  1. 继续访问跳转地址

image-20211011132854717
 <?php
error_reporting(0);
include "flag.php";

highlight_file(__FILE__);

if($_POST['param1']!==$_POST['param2']&&md5($_POST['param1'])===md5($_POST['param2'])){
    echo $flag;
}
  1. 和上一步差不多的方法,改为POST

image-20211011133447923

Get Flag!

最后更新于

这有帮助吗?