Zabbix latest.php Insert注入分析与实践

概要

因为未能过滤掉latest.php页面中toggle_ids数组的输入,导致Zabbix 2.2.x,3.0.x 远程SQL注入

源码分析

下载了两份官方代码对比,左为3.0.4(已修复的版本),右为3.0.3

\zabbix-3.0.3rc1\frontends\php\jsrpc.php

compare1

compare2

可见新版本中删除的代码即为漏洞触发部分。


/*
 * Ajax
 */
if (hasRequest('favobj')) {
    if ($_REQUEST['favobj'] == 'toggle') {
        // $_REQUEST['toggle_ids'] can be single id or list of ids,
        // where id xxxx is application id and id 0_xxxx is 0_ + host id
        if (!is_array($_REQUEST['toggle_ids'])) {
            if ($_REQUEST['toggle_ids'][1] == '_') {
                $hostId = substr($_REQUEST['toggle_ids'], 2);
                CProfile::update('web.latest.toggle_other', $_REQUEST['toggle_open_state'], PROFILE_TYPE_INT, $hostId);
            }
            else {
                $applicationId = $_REQUEST['toggle_ids'];
                CProfile::update('web.latest.toggle', $_REQUEST['toggle_open_state'], PROFILE_TYPE_INT, $applicationId);
            }
        }
        else {
            foreach ($_REQUEST['toggle_ids'] as $toggleId) {
                if ($toggleId[1] == '_') {
                    $hostId = substr($toggleId, 2);
                    CProfile::update('web.latest.toggle_other', $_REQUEST['toggle_open_state'], PROFILE_TYPE_INT, $hostId);
                }
                else {
                    $applicationId = $toggleId;
                    CProfile::update(
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值