CVE-2026-27016: Librenms/librenms Cross-Site Scripting Vulnerability

MODERATE
Advisory Identifier: GHSA-fqx6-693c-f55g
CVSS 5.4
CWE-116 CWE-79
Published
Advisory Summary

CVE-2026-27016 is a MODERATE (CVSS 5.4) cross-site scripting vulnerability (CWE-116: Improper Encoding or Escaping of Output) affecting Librenms/librenms libraries in the Packagist ecosystem. The issue involves librenms has a stored xss in custom oid - unit parameter missing strip_tags(). Remediation is available by upgrading affected packages to version 26.2.0.

CVE-2026-27016 at a Glance

CVE Identifier CVE-2026-27016
GHSA Identifier GHSA-fqx6-693c-f55g
Severity MODERATE
CVSS v3.1 Base Score 5.4
CWE Classification CWE-116: Improper Encoding or Escaping of Output
Affected Product Librenms/librenms
Package Ecosystem Packagist
Published Date
Last Updated

Security Impact

CVSS: 5.4

The security impact metrics below are parsed directly from the CVSS v3.1 vector string (CVSS:3.1/AV:N/AC:L/PR:L/UI:R/S:C/C:L/I:L/A:N).

Attack Vector Network (AV:N)
Attack Complexity Low (AC:L)
Privileges Required Low (PR:L)
User Interaction Required (UI:R)
Scope Changed (S:C)
Confidentiality Low (C:L)
Integrity Low (I:L)
Availability None (A:N)

How to Fix CVE-2026-27016

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.2.0
Upgrade librenms/librenms to 26.2.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 CVE-2026-27016, 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.2.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-116: Improper Encoding or Escaping of Output, where the product prepares a structured message for communication with another component, but encoding or escaping of the data is either missing or done incorrectly. as a result, the intended structure of the message is not preserved. 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

### Summary The `unit` parameter in Custom OID functionality lacks `strip_tags()` sanitization while other fields (`name`, `oid`, `datatype`) are sanitized. The unsanitized value is stored in the database and rendered without HTML escaping, allowing Stored XSS. ### Details **Vulnerable Input Processing (`includes/html/forms/customoid.inc.php` lines 18-21):** ```php $name = strip_tags((string) $_POST['name']); // line 18 - SANITIZED $oid = strip_tags((string) $_POST['oid']); // line 19 - SANITIZED $datatype = strip_tags((string) $_POST['datatype']); // line 20 - SANITIZED $unit = $_POST['unit']; // line 21 - NOT SANITIZED! ``` **Vulnerable Output (`graphs/customoid.inc.php` lines 13-20):** ```php $customoid_unit = $customoid['customoid_unit']; // Retrieved from DB $customoid_current = \LibreNMS\Util\Number::formatSi(...) . $customoid_unit; echo "...$customoid_current..."; // ECHOED WITHOUT ESCAPING! ``` ### PoC ```python #!/usr/bin/env python3 """ XSS test for LibreNMS Custom OID - unit parameter """ import html as html_module import re def strip_tags(value): return re.sub(r'<[^>]*?>', '', str(value)) # Simulate form processing (customoid.inc.php lines 18-21) test_inputs = { 'name': '<script>alert(1)</script>Test OID', 'oid': '1.3.6.1.4.1.2021.10.1.3.1', 'datatype': 'GAUGE', 'unit': '<script>alert("XSS")</script>', } name = strip_tags(test_inputs['name']) # Sanitized oid = strip_tags(test_inputs['oid']) # Sanitized datatype = strip_tags(test_inputs['datatype']) # Sanitized unit = test_inputs['unit'] # NOT SANITIZED! print("Input Processing Analysis:") print(f" name (strip_tags): {name}") print(f" oid (strip_tags): {oid}") print(f" datatype (strip_tags): {datatype}") print(f" unit (NO strip_tags): {unit}") print() print("*** VULNERABILITY: 'unit' parameter has NO strip_tags()! ***") # Test XSS payloads payloads = [ '<script>alert("XSS")</script>', '<img src=x onerror=alert(1)>', '<svg onload=alert(1)>', ] print("\nXSS Payload Tests:") for payload in payloads: escaped = html_module.escape(payload) has_xss = '<script>' in payload or 'onerror=' in payload.lower() print(f" Payload: {payload}") print(f" Raw (vulnerable): Contains executable code: {has_xss}") print(f" Escaped (safe): {escaped}") ``` ### Expected Output ``` Input Processing Analysis: name (strip_tags): alert(1)Test OID oid (strip_tags): 1.3.6.1.4.1.2021.10.1.3.1 datatype (strip_tags): GAUGE unit (NO strip_tags): <script>alert("XSS")</script> *** VULNERABILITY: 'unit' parameter has NO strip_tags()! *** ``` ### Impact - **Attack Vector:** User with device edit permissions sets malicious Unit value - **Exploitation:** XSS payload stored in database, executes for all users viewing device graphs - **Consequences:** - Session hijacking via cookie theft - Admin account takeover - Malicious actions on behalf of victims - Persistent attack affecting all users - **Affected Users:** All LibreNMS installations with Custom OID feature

CVE-2026-27016 Affected Librenms/librenms Versions

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

References

Frequently Asked Questions

What is CVE-2026-27016?
CVE-2026-27016 is a security vulnerability in Librenms/librenms involving LibreNMS has a Stored XSS in Custom OID - unit parameter missing strip_tags() under CWE-116: Improper Encoding or Escaping of Output.
Which Librenms/librenms versions are affected?
Affected versions include releases prior to 26.2.0 across affected packages: librenms/librenms.
What version fixes CVE-2026-27016?
Upgrading to 26.2.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.2.0. Upgrade your dependency to 26.2.0 or later.
What is the CVSS score of CVE-2026-27016?
CVE-2026-27016 has a CVSS v3.1 base score of 5.4 (MODERATE) with vector string CVSS:3.1/AV:N/AC:L/PR:L/UI:R/S:C/C:L/I:L/A:N.
What CWE is associated with CVE-2026-27016?
CVE-2026-27016 is classified under CWE-116: Improper Encoding or Escaping of Output (The product prepares a structured message for communication with another component, but encoding or escaping of the data is either missing or done incorrectly. As a result, the intended structure of the message is not preserved.).
How can I check Packagist dependencies for CVE-2026-27016?
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-fqx6-693c-f55g",
  "modified" : "2026-02-20T16:48:24Z",
  "published" : "2026-02-18T22:08:15Z",
  "aliases" : [ "CVE-2026-27016" ],
  "summary" : "LibreNMS has a Stored XSS in Custom OID - unit parameter missing strip_tags()",
  "details" : "### Summary\nThe `unit` parameter in Custom OID functionality lacks `strip_tags()` sanitization while other fields (`name`, `oid`, `datatype`) are sanitized. The unsanitized value is stored in the database and rendered without HTML escaping, allowing Stored XSS.\n\n### Details\n**Vulnerable Input Processing (`includes/html/forms/customoid.inc.php` lines 18-21):**\n```php\n$name = strip_tags((string) $_POST['name']);       // line 18 - SANITIZED\n$oid = strip_tags((string) $_POST['oid']);         // line 19 - SANITIZED\n$datatype = strip_tags((string) $_POST['datatype']);  // line 20 - SANITIZED\n$unit = $_POST['unit'];                            // line 21 - NOT SANITIZED!\n```\n\n**Vulnerable Output (`graphs/customoid.inc.php` lines 13-20):**\n```php\n$customoid_unit = $customoid['customoid_unit'];  // Retrieved from DB\n$customoid_current = \\LibreNMS\\Util\\Number::formatSi(...) . $customoid_unit;\necho \"...$customoid_current...\";  // ECHOED WITHOUT ESCAPING!\n```\n\n### PoC\n\n```python\n#!/usr/bin/env python3\n\"\"\"\nXSS test for LibreNMS Custom OID - unit parameter\n\"\"\"\n\nimport html as html_module\nimport re\n\ndef strip_tags(value):\n    return re.sub(r'<[^>]*?>', '', str(value))\n\n# Simulate form processing (customoid.inc.php lines 18-21)\ntest_inputs = {\n    'name': '<script>alert(1)</script>Test OID',\n    'oid': '1.3.6.1.4.1.2021.10.1.3.1',\n    'datatype': 'GAUGE',\n    'unit': '<script>alert(\"XSS\")</script>',\n}\n\nname = strip_tags(test_inputs['name'])      # Sanitized\noid = strip_tags(test_inputs['oid'])        # Sanitized\ndatatype = strip_tags(test_inputs['datatype'])  # Sanitized\nunit = test_inputs['unit']                   # NOT SANITIZED!\n\nprint(\"Input Processing Analysis:\")\nprint(f\"  name (strip_tags):     {name}\")\nprint(f\"  oid (strip_tags):      {oid}\")\nprint(f\"  datatype (strip_tags): {datatype}\")\nprint(f\"  unit (NO strip_tags):  {unit}\")\nprint()\nprint(\"*** VULNERABILITY: 'unit' parameter has NO strip_tags()! ***\")\n\n# Test XSS payloads\npayloads = [\n    '<script>alert(\"XSS\")</script>',\n    '<img src=x onerror=alert(1)>',\n    '<svg onload=alert(1)>',\n]\n\nprint(\"\\nXSS Payload Tests:\")\nfor payload in payloads:\n    escaped = html_module.escape(payload)\n    has_xss = '<script>' in payload or 'onerror=' in payload.lower()\n    print(f\"  Payload: {payload}\")\n    print(f\"    Raw (vulnerable): Contains executable code: {has_xss}\")\n    print(f\"    Escaped (safe):   {escaped}\")\n```\n\n### Expected Output\n\n```\nInput Processing Analysis:\n  name (strip_tags):     alert(1)Test OID\n  oid (strip_tags):      1.3.6.1.4.1.2021.10.1.3.1\n  datatype (strip_tags): GAUGE\n  unit (NO strip_tags):  <script>alert(\"XSS\")</script>\n\n*** VULNERABILITY: 'unit' parameter has NO strip_tags()! ***\n```\n### Impact\n- **Attack Vector:** User with device edit permissions sets malicious Unit value\n- **Exploitation:** XSS payload stored in database, executes for all users viewing device graphs\n- **Consequences:**\n  - Session hijacking via cookie theft\n  - Admin account takeover\n  - Malicious actions on behalf of victims\n  - Persistent attack affecting all users\n- **Affected Users:** All LibreNMS installations with Custom OID feature",
  "severity" : [ {
    "type" : "CVSS_V3",
    "score" : "CVSS:3.1/AV:N/AC:L/PR:L/UI:R/S:C/C:L/I:L/A:N"
  } ],
  "affected" : [ {
    "package" : {
      "ecosystem" : "Packagist",
      "name" : "librenms/librenms"
    },
    "ranges" : [ {
      "type" : "ECOSYSTEM",
      "events" : [ {
        "introduced" : "24.10.0"
      }, {
        "fixed" : "26.2.0"
      } ]
    } ]
  } ],
  "references" : [ {
    "type" : "WEB",
    "url" : "https://github.com/librenms/librenms/security/advisories/GHSA-fqx6-693c-f55g"
  }, {
    "type" : "ADVISORY",
    "url" : "https://nvd.nist.gov/vuln/detail/CVE-2026-27016"
  }, {
    "type" : "WEB",
    "url" : "https://github.com/librenms/librenms/pull/19040"
  }, {
    "type" : "WEB",
    "url" : "https://github.com/librenms/librenms/commit/3bea263e02441690c01dea7fa3fe6ffec94af335"
  }, {
    "type" : "PACKAGE",
    "url" : "https://github.com/librenms/librenms"
  }, {
    "type" : "WEB",
    "url" : "https://github.com/librenms/librenms/releases/tag/26.2.0"
  } ],
  "database_specific" : {
    "cwe_ids" : [ "CWE-116", "CWE-79" ],
    "severity" : "MODERATE",
    "github_reviewed" : true,
    "github_reviewed_at" : "2026-02-18T22:08:15Z",
    "nvd_published_at" : "2026-02-20T02:16:55Z"
  }
}