CVE-2024-51092 — librenms/librenms
CRITICALCVE-2024-51092 is a critical-severity (CVSS 9.1) OS Command Injection vulnerability in librenms/librenms. 1 public exploit reference exists, so weaponization risk is real. A fix is available for librenms/librenms — see the affected versions and patch details below.
LibreNMS has an Authenticated OS Command Injection
Exploitation Status
Proof-of-concept exploit code exists
- CISA’s SSVC triage found public proof-of-concept exploit code for this CVE, though no confirmed active exploitation.
Exploitation and automatability from CISA’s SSVC triage for CVE-2024-51092.
EPSS Exploitation Probability
EPSS (Exploit Prediction Scoring System) is a daily probability model maintained by FIRST.org. It estimates the likelihood a CVE will be exploited in production environments within the next 30 days, derived from real-world threat intelligence signals.
How urgent is this, really
CVE-2024-51092 plotted by exploitation likelihood (EPSS) against impact (CVSS). The shaded corner — EPSS 50%+ and CVSS 7.0+ — is where this CVE doesn't sit, though severity or exploitability alone can still warrant action.
Where this sits among everything scored
Of 378,156 CVEs with a current EPSS score, this one falls in the < 10% band (highlighted). Real counts from FIRST.org, not a sample — log-scaled since the landscape is heavily right-skewed.
Real-World Exposure
librenms/librenmsReal-time download stats are indexed for npm and PyPI packages. This vulnerability affects Packagist packages — download data is not available via public APIs for these ecosystems.
Description
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
snmpgetconfiguration 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 theAboutController.phpscript
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
Affected Packages
| Ecosystem | Package | Vulnerable range | Fix |
|---|---|---|---|
| 🐘Packagist | librenms/librenms | all versions | 24.10.0composer require librenms/librenms:^24.10.0 |
Research use only. For defensive security, authorized penetration testing, and academic research only. Never execute exploit code against systems without explicit written authorization.
Detection & mitigation playbook
Open-source dependencyDetect
Scan your dependency tree (package-lock.json, pnpm-lock.yaml, requirements.txt, go.sum, etc.) for librenms/librenms, including transitive dependencies — a direct dependency you never call can still pull in a vulnerable version.
Fix
Update librenms/librenms to 24.10.0 or later, then make sure no transitive (indirect) dependency still pins the vulnerable range — O3 confirms CVE-2024-51092 is resolved across your whole dependency graph.
Workarounds
If you can't upgrade right away: gate or disable the affected feature, validate untrusted input at the boundary, and avoid passing attacker-controlled data into the vulnerable path. O3's runtime protection blocks exploitation in production as an interim safeguard until the upgrade lands.
How O3 protects you
O3 Security's impact-aware SCA analyses which vulnerable code paths your application actually calls, so a match like CVE-2024-51092 can be triaged on real exposure rather than presence alone.
Tailored to CVE-2024-51092. Runtime protection reduces exposure until a permanent patch is applied and verified — it complements patching, it doesn't replace it.
Frequently Asked Questions
Is CVE-2024-51092 in your dependencies?
O3 Security finds CVE-2024-51092 across Packagist dependencies, including transitive ones, and its impact-aware SCA ranks findings by whether your code actually calls the vulnerable path.