Skip to main content

CVE-2024-51092 — Vulnerability in librenms/librenms — CVE Details

CRITICAL

LibreNMS has an Authenticated OS Command Injection

Published November 15, 2024Updated May 12, 2026Source: OSV

What Should I Do?

Address in Next Maintenance Window

Low exploitation probability (3.22%). Schedule for your next planned update.

Does your project use an affected librenms/librenms version?

Paste your composer.lock to check it for CVE-2024-51092 and every other known vulnerability, with CISA KEV and EPSS on each finding. Free with no signup for up to 10 packages, or up to 500 per scan with a free account, which also keeps up to 200 packages in saved projects.

Check my composer.lock

Summary

Summary

An authenticated attacker can create dangerous directory names on the system and alter sensitive configuration parameters through the web portal. Those two defects combined then allows to inject arbitrary OS commands inside shell_exec() calls, thus achieving arbitrary code execution.

Details

OS Command Injection

We start by inspecting the file app/Http/Controllers/AboutController.php, more particularly the index() method which is executed upon simply visiting the /about page:

public function index(Request $request)
    {
        $version = Version::get();

        return view('about.index', [
            <TRUNCATED>

            'version_webserver' => $request->server('SERVER_SOFTWARE'),
            'version_rrdtool' => Rrd::version(),
            'version_netsnmp' => str_replace('version: ', '', rtrim(shell_exec(Config::get('snmpget', 'snmpget') . ' -V 2>&1'))),

           <TRUNCATED>
        ]);
    }

We can see that the version_netsnmp key receives a value direclty dependent of a shell_exec() call. The argument to this call reflects a configuration parameter with no sanitization. Should an attacker identify a way to alter this parameter, the server is at risk of being compromised.

Configuration parameters poisoning

We now focus on the update() method of the SettingsController.php script. This method is called when the user visits the route /settings/{key} via HTTP PUT. The key parameter here is simply the name of the configuration key the user wishes to modify.

public function update(DynamicConfig $config, Request $request, $id)
{
    $value = $request->get('value');

    if (! $config->isValidSetting($id)) {
        return $this->jsonResponse($id, ':id is not a valid setting', null, 400);
    }

    $current = \LibreNMS\Config::get($id);
    $config_item = $config->get($id);

    if (! $config_item->checkValue($value)) {
        return $this->jsonResponse($id, $config_item->getValidationMessage($value), $current, 400);
    }

    if (\LibreNMS\Config::persist($id, $value)) {
        return $this->jsonResponse($id, "Successfully set $id", $value);
    }

    return $this->jsonResponse($id, 'Failed to update :id', $current, 400);
}

We can see that some protections are implemented around the configuration parameters by $config_item->checkValue($value), with a format of data being expected depending on the data type of the variable the user wants to modify. Specifically, the snmpget configuration variable expects a valid path to an existing binary on the system. To summarize : if an attacker finds a valid full-path to a system binary, while that full-path also holds shell metacharacters, then those characters would be interpreted by the shell_exec() call defined above and allow for arbitrary command execution.

Arbitrary directory creation

When creating a new Device through the "Add Device" page, the server allows the user to send malformed or impossible hostnames and force the data to be stored, with no sanitization being performed on this field.

In the file app/Jobs/PollDevice.php, the initRrdDirectory() method is responsible for creating a directory named after the Device's hostname. We can see the mkdir() call inside the try block:

private function initRrdDirectory(): void
{
    $host_rrd = \Rrd::name($this->device->hostname, '', '');
    if (Config::get('rrd.enable', true) && ! is_dir($host_rrd)) {
        try {
            mkdir($host_rrd);
            Log::info("Created directory : $host_rrd");
        } catch (\ErrorException $e) {
            Eventlog::log("Failed to create rrd directory: $host_rrd", $this->device);
            Log::info($e);
        }
    }
}

This method is called by initDevice(), which is itself called by the handle() method (executed when the job starts). \Rrd::name() simply concatenates a string following the format <LIBRENMS_INSTALL_DIR>/rrd/<DEVICE_HOSTNAME>.

Summary

With all this, an authenticated attacker can:

  • Create a malicious Device with shell metacharacters inside its hostname
  • Force the creation of directory containing shell metacharacters through the PollDevice job
  • Modify the snmpget configuration variable to point to a valid system binary, while also using the directory created in the previous step via a path traversal (i.e: /path/to/install/dir/rrd/<DEVICE_HOSTNAME>/../../../../../../../bin/ls)
  • Trigger a code execution via the shell_exec() call contained in the AboutController.php script

PoC

For proof of concept, we will create a file located at /tmp/rce-proof on the server's filesystem.

Consider the following command : /usr/bin/touch /tmp/rce-proof, encoded in base64 (L3Vzci9iaW4vdG91Y2ggL3RtcC9yY2UtcHJvb2Y=). This encoding is necesary whenever the command contains '/' characters, as this would otherwise generate invalid directory paths. Create a new Device with a name that contains the command you wish to execute enclosed in semi-colons, ending with a '3' character:

Be careful to tick the "Force Add" option, otherwise the request will be rejected. Click add:

A directory matching the hostname of the Device will be created whenever a PollDevice job is launched. For the purpose of the demonstration, we will be triggering this manually with artisan:

We can confirm that this directory indeed exists on the system:

We can now update the snmpget parameter value to point to any binary on the system, making sure that the specified path includes the directory that was just created:

Visiting the /about page will trigger the payload, then we can check that our code was indeed executed:

Impact

Server takeover

Advisory Timeline

  • First published November 15, 2024 (741 days ago).
  • Last revised May 12, 2026 — 543 days after initial publication.

Remediation

Upgrade to the fixed version using your package manager.

Composer
Update librenms/librenms to 24.10.0 or later
composer require "librenms/librenms:^24.10.0"

After upgrading, scan your dependencies again to confirm the vulnerability is resolved.

Affected Packages (1)

Affects 1 ecosystem: Packagist (1).

PackageFixed In
librenms/librenms Packagist · Affected: 1.19, 1.20, 1.20.1, 1.21 (+126 more)24.10.0

Vulnerability Classification

Common Weakness Enumeration (CWE) identifiers for this vulnerability type.

  • CWE-78
    OS Command InjectionMITRE

CVSS Score Breakdown

What the CVSS (Common Vulnerability Scoring System) 9.1 score means for each attack dimension.

Attack Vector
Network
Attack Complexity
Low
Privileges Required
Low
User Interaction
None
Scope
Changed
Confidentiality
High
Integrity
Low
Availability
Low

CVSS:3.1/AV:N/AC:L/PR:L/UI:N/S:C/C:H/I:L/A:L

Frequently Asked Questions

What is CVE-2024-51092?
LibreNMS has an Authenticated OS Command Injection. This vulnerability has been assigned a severity rating of CRITICAL (CVSS score: 9.1/10).
How do I check if my project is affected by CVE-2024-51092?
CVE-2024-51092 affects librenms/librenms. It has a 3.2% probability of exploitation within 30 days (EPSS score). Use GeekWala's free vulnerability scanner to check your dependencies against CVE-2024-51092 and 200,000+ other known vulnerabilities.

Severity & Exploitability

CVSS Score
9.1

Maximum impact if exploited, often with little effort or access required.

EPSS Score (30-day exploit probability)
3.22%
EPSS percentile: 89

This places it in the top quartile of EPSS-scored vulnerabilities — 89% of tracked vulnerabilities score at or below it, so it is more likely to be exploited than most of the tracked corpus.

Also Known As

GHSA-x645-6pf9-xwxw

Related CVEs

  • CVE-2022-4070
    CRITICAL

    Insufficient Session Expiration in librenms/librenms

  • CVE-2026-84192
    HIGH

    LibreNMS — Stored XSS via SNMP/Syslog Data in Legacy Templates

  • CVE-2024-49759
    HIGH

    Stored XSS ('Cross-site Scripting') in librenms/includes/html/pages/edituser.inc.php

  • CVE-2024-52526
    HIGH

    LibreNMS has a Stored XSS ('Cross-site Scripting') in librenms/includes/html/pages/device/services.inc.php

  • CVE-2024-50350
    HIGH

    LibreNMS has a Stored XSS ('Cross-site Scripting') in librenms/app/Http/Controllers/Table/EditPortsController.php

  • CVE-2025-62365
    MEDIUM

    LibreNMS is vulnerable to Reflected-XSS in `report_this` function

  • CVE-2026-26992
    MEDIUM

    LibreNMS /port-groups name Stored Cross-Site Scripting

  • CVE-2024-47528
    LOW

    LibreNMS vulnerable to Stored Cross-site Scripting via File Upload

Check your own dependencies

Free, with no signup for up to 10 packages.

Check my composer.lock