CVE-2019-25400
Executive Summary
CVE-2019-25400 is a reflected cross-site scripting (XSS) vulnerability affecting IPFire 2.21 Core Update 127, specifically within the fwhosts.cgi script. An attacker can inject arbitrary JavaScript into multiple parameters of POST requests, which will execute in the context of an authenticated user's browser. This allows for session hijacking, credential theft, and other client-side attacks. The vulnerability has a CVSS score of 0.0 (likely unassigned or placeholder), but based on the vector, the actual severity is medium (CVSS 3.1 base score ~5.4). No official patch has been released, and no public exploit code is available, but the attack vector is well-documented.
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 is not related to a package manager (NPM, PyPI, Go, Ruby). It is a web application vulnerability in the IPFire firewall management interface.
CVSS Breakdown & Threat Level
- CVSS Vector: CVSS:3.1/AV:N/AC:L/PR:N/UI:R/S:C/C:L/I:L/A:N
- Base Score: 5.4 (Medium)
- Attack Vector: Network (AV:N) – The vulnerability is exploitable remotely.
- Attack Complexity: Low (AC:L) – No special conditions are required.
- Privileges Required: None (PR:N) – The attacker does not need to be authenticated.
- User Interaction: Required (UI:R) – The victim must click a crafted link or submit a form.
- Scope: Changed (S:C) – The impact extends beyond the vulnerable component.
- Confidentiality Impact: Low (C:L) – Limited information disclosure.
- Integrity Impact: Low (I:L) – Limited modification of data.
- Availability Impact: None (A:N) – No impact on system availability.
Threat Level: Medium. The vulnerability requires user interaction but can lead to session hijacking and credential theft in the context of the IPFire web interface.
Deep Dive & Mechanics
The vulnerability resides in the fwhosts.cgi script, which is part of the IPFire web interface for managing firewall hosts and services. The script fails to properly sanitize user-supplied input before reflecting it back in the HTTP response. An attacker can craft a POST request with malicious JavaScript payloads in any of the following parameters:
HOSTNAMEIPSUBNETNETREMARKHOSTREMARKnewhostgrp_nameremarkSRV_NAMESRV_PORTSRVGRP_NAMESRVGRP_REMARKupdatesrvgrp
When an authenticated user submits the form or clicks a crafted link, the injected script executes in their browser. This allows the attacker to perform actions on behalf of the victim, such as modifying firewall rules, exfiltrating session cookies, or redirecting to malicious sites.
The root cause is the lack of output encoding or input validation. The script directly embeds user input into the HTML response without escaping special characters like <, >, ", ', and &.
Vulnerable vs. Patched Code
Vulnerable Code (Conceptual):
# In fwhosts.cgi (IPFire 2.21 Core Update 127)
my $hostname = param('HOSTNAME');
print "<input type='text' name='HOSTNAME' value='$hostname'>";
Patched Code (Conceptual):
# In a patched version
use CGI qw(:standard);
my $hostname = escapeHTML(param('HOSTNAME'));
print "<input type='text' name='HOSTNAME' value='$hostname'>";
The patched code uses escapeHTML() (or equivalent) to encode HTML special characters, preventing script injection.
Exploitation & Lab Setup
Red Team
Proof of Concept (PoC): Since no public exploit code is available, the following is a conceptual PoC.
Craft a malicious POST request:
POST /cgi-bin/fwhosts.cgi HTTP/1.1 Host: target-ipfire:444 Content-Type: application/x-www-form-urlencoded Cookie: sid=valid_session_id HOSTNAME=<script>alert('XSS')</script>&IP=192.168.1.1&SUBNET=255.255.255.0&NETREMARK=test&HOSTREMARK=test&newhost=Add&grp_name=&remark=&SRV_NAME=&SRV_PORT=&SRVGRP_NAME=&SRVGRP_REMARK=&updatesrvgrp=Deliver the attack:
- Send a phishing email with a link to the crafted URL.
- Use a social engineering technique to trick an authenticated admin into clicking the link.
Advanced payload:
<script> fetch('/cgi-bin/fwhosts.cgi?action=delete&host=1').then(r => console.log('deleted')); </script>
Blue Team
Detection:
- Monitor for unusual POST requests to
/cgi-bin/fwhosts.cgicontaining HTML tags or JavaScript. - Look for anomalous parameters with
<script>oronerrorattributes. - Use WAF rules to block requests with XSS patterns.
Honeypot:
- Deploy a fake IPFire instance and log all POST requests to
fwhosts.cgifor analysis.
Indicators of Compromise (IOCs)
- Network IOCs:
- POST requests to
/cgi-bin/fwhosts.cgiwith parameters containing<script>,onerror,onload, or other event handlers. - Outbound connections from the IPFire web interface to unknown domains (exfiltration).
- POST requests to
- Host IOCs:
- Unusual entries in the IPFire web server logs (e.g.,
/var/log/httpd/access.log) with XSS payloads. - Modified firewall rules or host entries without admin knowledge.
- Unusual entries in the IPFire web server logs (e.g.,
- File IOCs:
- No specific file-based IOCs.
Detection Engineering
YARA Rule
rule CVE_2019_25400_XSS_IPFire {
meta:
description = "Detects XSS payloads targeting IPFire fwhosts.cgi"
author = "Valters IT"
date = "2025-04-10"
reference = "CVE-2019-25400"
strings:
$xss1 = /<script[^>]*>.*?<\/script>/is
$xss2 = /onerror\s*=\s*["']?[^"'\s>]+/is
$xss3 = /onload\s*=\s*["']?[^"'\s>]+/is
$param1 = "HOSTNAME="
$param2 = "IP="
$param3 = "SUBNET="
$param4 = "NETREMARK="
$param5 = "HOSTREMARK="
$param6 = "newhost="
$param7 = "grp_name="
$param8 = "remark="
$param9 = "SRV_NAME="
$param10 = "SRV_PORT="
$param11 = "SRVGRP_NAME="
$param12 = "SRVGRP_REMARK="
$param13 = "updatesrvgrp="
condition:
any of ($xss*) and any of ($param*)
}
Sigma Rule
title: Reflected XSS in IPFire fwhosts.cgi
id: 8a9b7c6d-5e4f-3a2b-1c0d-9e8f7a6b5c4d
status: experimental
description: Detects reflected XSS attempts against IPFire fwhosts.cgi
author: Valters IT
date: 2025-04-10
logsource:
category: webserver
product: apache
detection:
selection:
cs-method: 'POST'
cs-uri-query|contains: '/cgi-bin/fwhosts.cgi'
xss_payloads:
- cs-uri-query|contains: '<script'
- cs-uri-query|contains: 'onerror='
- cs-uri-query|contains: 'onload='
- cs-uri-query|contains: 'alert('
- cs-uri-query|contains: 'prompt('
- cs-uri-query|contains: 'confirm('
condition: selection and 1 of xss_payloads
falsepositives:
- Legitimate use of HTML in hostnames (unlikely)
level: high
Suricata Rule
alert http $EXTERNAL_NET any -> $HOME_NET $HTTP_PORTS (msg:"CVE-2019-25400 IPFire fwhosts.cgi Reflected XSS"; flow:to_server,established; content:"POST"; http_method; content:"/cgi-bin/fwhosts.cgi"; http_uri; pcre:"/(HOSTNAME|IP|SUBNET|NETREMARK|HOSTREMARK|newhost|grp_name|remark|SRV_NAME|SRV_PORT|SRVGRP_NAME|SRVGRP_REMARK|updatesrvgrp)=.*(<script|onerror|onload|alert|prompt|confirm)/i"; sid:1000001; rev:1;)
Remediation & Mitigation
Immediate Actions:
- Upgrade IPFire: If a newer version is available, upgrade immediately. As of this report, no official patch exists, so consider upgrading to the latest IPFire release (which may have fixed this issue in later updates).
- Web Application Firewall (WAF): Deploy a WAF (e.g., ModSecurity) with rules to block XSS payloads in POST parameters.
- Input Validation: Implement server-side input validation and output encoding for all parameters in
fwhosts.cgi. - Content Security Policy (CSP): Add a strict CSP header to the IPFire web interface to mitigate XSS impact.
- User Education: Train administrators to avoid clicking suspicious links and to verify the authenticity of requests.
Long-Term Fix:
- The vendor (IPFire) should release a security update that properly sanitizes all user inputs in
fwhosts.cgiand other CGI scripts.
Valters IT