Disclaimer: This content was generated using AI. While we strive for accuracy, please verify critical information with official sources.
Sources: National Vulnerability Database, CISA KEV, Exploit-DB
CVE-2025-2540 Overview
CVE-2025-2540 is a stored cross-site scripting (XSS) vulnerability affecting multiple WordPress plugins that bundle the prettyPhoto JavaScript library version 3.1.6. The flaw stems from insufficient input sanitization and output escaping on user-supplied attributes processed by the library. Authenticated attackers with contributor-level access or higher can inject arbitrary web scripts into pages. The injected payload executes in the browser of any user who views the affected page, enabling session theft, redirection, and administrative actions through the victim's privileges. The vulnerability is tracked under CWE-79.
Critical Impact
Contributor-level WordPress users can inject persistent JavaScript that executes against site visitors and administrators, enabling account takeover and content manipulation across multi-author sites.
Affected Products
- WordPress plugin awesome-gallery (bundled prettyPhoto 3.1.6)
- WordPress plugin awesome-wp-image-gallery (bundled prettyPhoto 3.1.6)
- WordPress plugin easy-image-gallery, woo-3d-viewer, and wp-video-lightbox (bundled prettyPhoto 3.1.6)
Discovery Timeline
- 2025-07-03 - CVE-2025-2540 published to the National Vulnerability Database
- 2026-06-17 - Last updated in NVD database
Technical Details for CVE-2025-2540
Vulnerability Analysis
The vulnerability resides in the bundled jquery.prettyPhoto.js library used by several WordPress gallery and media plugins. The library accepts user-controlled attributes passed through gallery shortcodes and image markup, then inserts those values into the DOM without proper sanitization or escaping. Because WordPress stores shortcode content in post data, attacker-controlled strings persist in the database and execute whenever a visitor renders the containing page. The attack requires contributor-level privileges, which many multi-author WordPress sites grant freely to guest writers and freelancers. Successful exploitation lets attackers steal authenticated session cookies, perform actions on behalf of administrators, deface content, or redirect visitors to attacker-controlled infrastructure.
Root Cause
The prettyPhoto 3.1.6 library performs insufficient input sanitization and output escaping on attributes supplied through gallery items. The library inserts user-controlled values into HTML sinks via jQuery methods that interpret script content, allowing injected markup to execute. Each affected plugin ships its own copy of the vulnerable library, so a single upstream flaw propagates across the WordPress ecosystem.
Attack Vector
An authenticated contributor crafts a post that embeds one of the vulnerable plugin's shortcodes with a malicious attribute payload. The payload is stored in the WordPress database as part of the post content. When any user, including administrators, views the published or previewed page, the prettyPhoto library renders the attribute and executes the embedded JavaScript in the viewer's browser context under the site's origin.
No verified public exploit code is available. Technical details are documented in the Wordfence Vulnerability Report and the plugin source files referenced in the WordPress Plugin Trac.
Detection Methods for CVE-2025-2540
Indicators of Compromise
- Post or page content containing gallery shortcodes with attribute values that include <script>, javascript:, or encoded event handlers such as onerror= and onload=.
- Unexpected outbound requests from visitor browsers to unfamiliar domains originating from pages that render prettyPhoto galleries.
- New or modified WordPress administrator accounts created shortly after a contributor published or edited gallery content.
Detection Strategies
- Audit the wp_posts table for shortcode attributes containing HTML tags, inline event handlers, or javascript: URIs tied to affected plugins.
- Scan plugin directories for jquery.prettyPhoto.js version 3.1.6 and inventory sites running the vulnerable gallery plugins.
- Review WordPress audit logs for post edits by contributor-role accounts that introduce gallery shortcodes with unusually long or encoded attribute strings.
Monitoring Recommendations
- Enable a web application firewall rule set that blocks reflected and stored XSS patterns in WordPress POST requests to /wp-admin/post.php.
- Monitor Content Security Policy (CSP) violation reports for inline script execution on pages rendering gallery content.
- Alert on first-time script-source domains loaded from WordPress front-end pages using browser telemetry or synthetic monitoring.
How to Mitigate CVE-2025-2540
Immediate Actions Required
- Update wp-video-lightbox and woo-3d-viewer to the versions published in WordPress changesets #3266651 and #3282390 respectively.
- Update easy-image-gallery using the fix tracked in the WordPress changeset comparison.
- Deactivate awesome-gallery and awesome-wp-image-gallery if no vendor patch is available, since both still ship the vulnerable prettyPhoto 3.1.6 library.
- Review and demote untrusted contributor accounts, and audit existing posts for malicious shortcode attributes.
Patch Information
The WordPress plugin team released fixes in changesets #3266651 for wp-video-lightbox and #3282390 for woo-3d-viewer, along with a sanitization update for easy-image-gallery. Site operators should apply the latest plugin versions available from the WordPress plugin repository. Additional detail is published in the Wordfence Vulnerability Report.
Workarounds
- Restrict post publishing to editor-level and higher roles until patched plugin versions are deployed.
- Enforce a strict Content Security Policy that disallows inline scripts and limits script sources to trusted origins.
- Place the WordPress site behind a web application firewall configured to block XSS payloads in post content and shortcode attributes.
Disclaimer: This content was generated using AI. While we strive for accuracy, please verify critical information with official sources.
Sources: National Vulnerability Database, CISA KEV, Exploit-DB

