• [BJDCTF2020]Easy MD5


     抓包查看响应包。

    看来是md5注入。

    看一下md5函数

     对于ffifdyop这个字符串经过md5函数加密为16位原始二进制格式的字符串。

    content: ffifdyop
    hex: 276f722736c95d99e921722cf9ed621c
    raw: 'or'6xc9]x99xe9!r,xf9xedbx1c
    string: 'or'6]!r,b
    在mysql里面,在用作布尔型判断时,以1开头的字符串会被当做整型数。要注意的是这种情况是必须要有单引号括起来的,
    比如password=‘xxx’ or ‘1xxxxxxxxx’,那么就相当于password=‘xxx’ or 1
    也就相当于password=‘xxx’ or true,所以返回值就是true

    ffifdyop被当做参数经过md5函数加密传入到数据库,这时有'or'6的存在,这是个永真式,就可绕过sql语句对password的校验。

    传入得到一段php

    $a = $GET['a'];
    $b = $_GET['b'];
    
    if($a != $b && md5($a) == md5($b)){
        // wow, glzjin wants a girl friend.

    md5 sha1等函数无法处理数组,传入数组时会返回null,但null是等于null的。或者是md5碰撞都可绕过

    ?a[]=1&b[]=2

    加载到新的页面

     <?php
    error_reporting(0);
    include "flag.php";
    
    highlight_file(__FILE__);
    
    if($_POST['param1']!==$_POST['param2']&&md5($_POST['param1'])===md5($_POST['param2'])){
        echo $flag;
    } 

    强制类型比较,无法利用md5碰撞,不会吧0e开头的当做科学技术法来比较,但是仍然可采用数组绕过。

    post传参得到flag

  • 相关阅读:
    Centos 实现SSH证书登录
    Spring Boot 拦截器的使用
    Spring Boot 内置定时器的使用
    Spring Boot 整合Druid数据源(一)
    Spring Boot 整合滑动验证
    asp.ent core swagger
    Dapper.Contrib
    SonarQube
    Endpoint.Binding = new BasicHttpBinding(BasicHttpSecurityMode.Transport)
    wcf messageEncoding="Mtom"
  • 原文地址:https://www.cnblogs.com/akger/p/15065522.html
Copyright © 2020-2023  润新知