Summary
A Self Cross-Site Scripting (Self-XSS) vulnerability in the “Alert Templates” feature of the @LibreNMS/LibreNMS project allows users to inject arbitrary JavaScript into the alert template’s name. This script executes immediately upon submission but does not persist after a page refresh.
Product
This vulnerability affects LibreNMS versions prior to 24.9.0, specifically in librenms/includes/html/modal/alert_template.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
- Log into the LibreNMS web interface and navigate to Alert Templates.
- In the Name field, enter:
test1<script>{onerror=alert}throw 1337</script> - Submit the form to create the alert template.
- Observe that the JavaScript executes immediately, triggering an alert. Note that the payload does not persist after refreshing the page.
Expected result:
The XSS is triggered, and an alert is shown.
Remediation
Fixed in LibreNMS 24.9.0 by HTML-encoding the template name before rendering. In modal/alert_template.inc.php, the name variable is now escaped before appending to the table, preventing XSS.
Credit
This issue was discovered and reported by Checkmarx Security Researcher Raphael Silva.