灯火互联
管理员
管理员
  • 注册日期2011-07-27
  • 发帖数41778
  • QQ
  • 火币41290枚
  • 粉丝1086
  • 关注100
  • 终身成就奖
  • 最爱沙发
  • 忠实会员
  • 灌水天才奖
  • 贴图大师奖
  • 原创先锋奖
  • 特殊贡献奖
  • 宣传大使奖
  • 优秀斑竹奖
  • 社区明星
阅读:2207回复:0

用来检查CVE-2012-2122漏洞的C程序

楼主#
更多 发布于:2012-08-23 23:19

CVE-2012-2122 也就是M ySQL 刚刚爆出的那个漏洞。该代码用来检查是否memcmp 存在此漏洞,如下:
/*
* CVE-2012-2122 checker
*
* You may get differing results with/without -m32
* www.atcpu.com
* Joshua J. Drake
*/

#include <stdio.h>
#include <stdlib.h>
#include <time.h>
#include <sys/types.h>
#include <unistd.h>
#include <string.h>

int main(void) {
        int one, two, ret;
        time_t start = time(0);
        time_t now;

        srand(getpid()*start);
        while (1) {
                one = rand();
                two = rand();
                ret = memcmp(;one, ;two, sizeof(int));
                if (ret < -128 || ret > 127)
                        break;
                time(;now);
                if (now - start > 10) {
                        printf("Not triggered in 10 seconds, *probably* not vulnerable..\n");
                        return 1;
                }
        }
        printf("Vulnerable! memcmp returned: %d\n", ret);
        return 0;
}

代码来源:http://pastie.org/4064638

作者: FreebuF.COM

喜欢0 评分0
游客

返回顶部