CVE-2024-51092: Librenms/librenms LibreNMS Has An Authenticated OS Vulnerability
CRITICALCVE-2024-51092 is a CRITICAL (CVSS 9.1) librenms has an authenticated os vulnerability (CWE-78: Improper Neutralization of Special Elements used in an OS Command ('OS Command Injection')) affecting Librenms/librenms libraries in the Packagist ecosystem. The issue involves librenms has an authenticated os command injection. Remediation is available by upgrading affected packages to version 24.10.0.
CVE-2024-51092 at a Glance
Security Impact
CVSS: 9.1
The security impact metrics below are parsed directly from the CVSS v3.1 vector string (CVSS:3.1/AV:N/AC:L/PR:L/UI:N/S:C/C:H/I:L/A:L).
How to Fix CVE-2024-51092
To remediate this vulnerability, upgrade all affected Librenms/librenms dependencies to a patched release. Both direct and transitive dependencies should be checked, as frameworks or security libraries may pull in vulnerable versions transitively.
Upgrade librenms/librenms to 24.10.0
Run the following command in your project directory to verify that all resolved dependencies use the patched release:
inspect dependencies for librenms/librenms
How to Check if You Are Affected
To determine whether your application is affected by CVE-2024-51092, inspect your project dependencies for Librenms/librenms:
inspect dependencies for librenms/librenms
Analyze the terminal output to locate any version of Librenms/librenms in your dependency tree. If any resolved version matches the vulnerable ranges listed in the table below (for example, versions earlier than 24.10.0), your application is affected.
Note: Verify declared build manifests and deployed runtime container environments.
Technical Details
Vulnerability Mechanism & Technical Analysis
This vulnerability is classified under CWE-78: Improper Neutralization of Special Elements used in an OS Command ('OS Command Injection'), where the product constructs all or part of an os command using externally-influenced input from an upstream component, but it does not neutralize or incorrectly neutralizes special elements that could modify the intended os command when it is sent to a downstream component. In Librenms/librenms, software state validation or input boundaries are circumvented during processing. Review the official source advisory statement below for specific affected components, classes, and reproduction details.
Source Advisory Statement
CVE-2024-51092 Affected Librenms/librenms Versions
1 component(s)| Product / Package | Ecosystem | Affected Versions | Fixed Version |
|---|---|---|---|
|
librenms/librenms
|
Packagist |
< 24.10.0
|
24.10.0
|
References
Frequently Asked Questions
What is CVE-2024-51092?
Which Librenms/librenms versions are affected?
What version fixes CVE-2024-51092?
Is librenms/librenms affected?
What is the CVSS score of CVE-2024-51092?
What CWE is associated with CVE-2024-51092?
How can I check Packagist dependencies for CVE-2024-51092?
Machine-readable OSV JSON
OSV v1.5 Schema
{
"schema_version" : "1.4.0",
"id" : "GHSA-x645-6pf9-xwxw",
"modified" : "2026-05-12T13:29:29Z",
"published" : "2024-11-15T15:54:18Z",
"aliases" : [ "CVE-2024-51092" ],
"summary" : "LibreNMS has an Authenticated OS Command Injection",
"details" : "### Summary\nAn 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.\n\n### Details\n#### OS Command Injection\nWe start by inspecting the file `app/Http/Controllers/AboutController.php`, more particularly the index() method which is executed upon simply visiting the /about page:\n```php\npublic function index(Request $request)\n {\n $version = Version::get();\n\n return view('about.index', [\n <TRUNCATED>\n\n 'version_webserver' => $request->server('SERVER_SOFTWARE'),\n 'version_rrdtool' => Rrd::version(),\n 'version_netsnmp' => str_replace('version: ', '', rtrim(shell_exec(Config::get('snmpget', 'snmpget') . ' -V 2>&1'))),\n\n <TRUNCATED>\n ]);\n }\n```\n\nWe 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.\n\n#### Configuration parameters poisoning\nWe 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.\n```php\npublic function update(DynamicConfig $config, Request $request, $id)\n{\n $value = $request->get('value');\n\n if (! $config->isValidSetting($id)) {\n return $this->jsonResponse($id, ':id is not a valid setting', null, 400);\n }\n\n $current = \\LibreNMS\\Config::get($id);\n $config_item = $config->get($id);\n\n if (! $config_item->checkValue($value)) {\n return $this->jsonResponse($id, $config_item->getValidationMessage($value), $current, 400);\n }\n\n if (\\LibreNMS\\Config::persist($id, $value)) {\n return $this->jsonResponse($id, \"Successfully set $id\", $value);\n }\n\n return $this->jsonResponse($id, 'Failed to update :id', $current, 400);\n}\n```\n\nWe 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.\nSpecifically, the `snmpget` configuration variable expects a valid path to an existing binary on the system.\nTo 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.\n\n#### Arbitrary directory creation\nWhen 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.\n\nIn 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:\n```php\nprivate function initRrdDirectory(): void\n{\n $host_rrd = \\Rrd::name($this->device->hostname, '', '');\n if (Config::get('rrd.enable', true) && ! is_dir($host_rrd)) {\n try {\n mkdir($host_rrd);\n Log::info(\"Created directory : $host_rrd\");\n } catch (\\ErrorException $e) {\n Eventlog::log(\"Failed to create rrd directory: $host_rrd\", $this->device);\n Log::info($e);\n }\n }\n}\n```\n\nThis method is called by `initDevice()`, which is itself called by the `handle()` method (executed when the job starts).\n`\\Rrd::name()` simply concatenates a string following the format `<LIBRENMS_INSTALL_DIR>/rrd/<DEVICE_HOSTNAME>`.\n\n#### Summary\nWith all this, an authenticated attacker can:\n- Create a malicious Device with shell metacharacters inside its hostname\n- Force the creation of directory containing shell metacharacters through the PollDevice job\n- 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`)\n- Trigger a code execution via the `shell_exec()` call contained in the `AboutController.php` script\n\n#### \n\n### PoC\nFor proof of concept, we will create a file located at `/tmp/rce-proof` on the server's filesystem.\n\nConsider 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.\nCreate a new Device with a name that contains the command you wish to execute enclosed in semi-colons, ending with a '3' character:\n\n\nBe careful to tick the \"Force Add\" option, otherwise the request will be rejected. Click add:\n\n\nA 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:\n\n\nWe can confirm that this directory indeed exists on the system:\n\n\nWe 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:\n\n\nVisiting the `/about` page will trigger the payload, then we can check that our code was indeed executed:\n\n\n\n### Impact\nServer takeover",
"severity" : [ {
"type" : "CVSS_V3",
"score" : "CVSS:3.1/AV:N/AC:L/PR:L/UI:N/S:C/C:H/I:L/A:L"
} ],
"affected" : [ {
"package" : {
"ecosystem" : "Packagist",
"name" : "librenms/librenms"
},
"ranges" : [ {
"type" : "ECOSYSTEM",
"events" : [ {
"introduced" : "0"
}, {
"fixed" : "24.10.0"
} ]
} ],
"database_specific" : {
"last_known_affected_version_range" : "<= 24.9.1"
}
} ],
"references" : [ {
"type" : "WEB",
"url" : "https://github.com/librenms/librenms/security/advisories/GHSA-x645-6pf9-xwxw"
}, {
"type" : "ADVISORY",
"url" : "https://nvd.nist.gov/vuln/detail/CVE-2024-51092"
}, {
"type" : "PACKAGE",
"url" : "https://github.com/librenms/librenms"
}, {
"type" : "WEB",
"url" : "https://raw.githubusercontent.com/rapid7/metasploit-framework/master/modules/exploits/linux/http/librenms_authenticated_rce_cve_2024_51092.rb"
} ],
"database_specific" : {
"cwe_ids" : [ "CWE-78" ],
"severity" : "CRITICAL",
"github_reviewed" : true,
"github_reviewed_at" : "2024-11-15T15:54:18Z",
"nvd_published_at" : "2026-05-08T06:16:10Z"
}
}