Severity:

HIGH RISK

(7.2)

Stored XSS (CWE-79) in WP Rocket WordPress Plugin AJAX

CVE-2026-5934

Deferred

Vulnerability type

Category:

Stored Cross-Site Scripting

CWE:

CWE-79

Impact:

Arbitrary script execution in a victim's browser

Severity:

HIGH RISK

(7.2)

CVSS version:

3.1

Catch this CVE while code is being written

Detect vulnerable code directly in pull requests, so CVEs are fixed before merge.

Summary

WP Rocket contains a stored cross-site scripting vulnerability caused by insufficient sanitization and output escaping of data submitted through the rocket_beacon AJAX endpoint. An unauthenticated attacker may store malicious script content that executes in the browser whenever a user visits an affected page.

Affected context

The issue affects WordPress sites using WP Rocket versions up to and including 3.21.0.1 when data accepted through the rocket_beacon AJAX endpoint is later rendered in a page without sufficient output encoding. Risk depends on whether the endpoint is reachable without authentication and whether submitted data is persisted and displayed to other users.

Exploit preconditions

  • Attack surface: The WP Rocket rocket_beacon AJAX endpoint
  • Required access: Typically no authentication, subject to site-specific endpoint controls
  • Trigger point: A victim loads a page containing attacker-controlled stored content
  • Why exploitation is possible: User-supplied data is insufficiently sanitized before storage or output and is not safely escaped for its rendering context

Why this happens

The underlying bug is a failure to treat externally supplied data as untrusted at both input and output boundaries. Data submitted through the AJAX endpoint can be retained and later inserted into web pages without context-appropriate sanitization and escaping. This behavior maps to CWE-79, which covers improper neutralization of user-controlled input in web output, allowing browser-interpreted script content to execute.

Potential impact

  • Arbitrary JavaScript may execute in a victim's browser
  • An attacker could perform actions through the victim's authenticated session
  • Sensitive page data may be exposed to attacker-controlled code
  • Site administrators could be targeted for account or content compromise
  • Users may be redirected, deceived, or subjected to malicious page behavior

General mitigation guidance

Mitigation generally focuses on applying context-aware output escaping and strict allowlist-based sanitization to all data received through the AJAX endpoint. Secure-by-default designs should keep untrusted values inert and encode them for their exact HTML, attribute, URL, or script context rather than relying on generic filtering. Input trust should be minimized through capability checks, request validation, and appropriate authorization where functionality permits. Sensitive administrative operations should also use least privilege, nonce or equivalent request-integrity controls, and restrictive browser security policies where practical.

How teams detect issues like this

Detection can include static analysis for unsanitized values flowing from AJAX handlers into HTML responses, templates, DOM updates, or stored content. Code reviews should examine endpoint registration, persistence paths, output contexts, escaping functions, authorization checks, and request-integrity protections. Dynamic testing can submit harmless marker values and verify that rendered output is safely encoded. Content Security Policy reports, web application firewall telemetry, and automated security review tools may help identify suspicious script-bearing submissions or unsafe data flows.

Sources

SourceLink
github.comgithub.com/wp-media/wp-rocket/releases/tag/v3.21.1
wordfence.comwordfence.com/threat-intel/vulnerabilities/id/3560bf50-2190-4469-9d92-b6b59f118324?source=cve

Frequently asked

questions

Yes, exploitation may be possible remotely because the affected AJAX endpoint can accept unauthenticated input. The attacker must still reach a site configuration where the submitted content is stored and later rendered.

The described issue does not require authentication for the attacker, although endpoint availability and WordPress security controls can vary by deployment. A victim generally only needs to visit a page containing the stored content.

Ensure all endpoint input is validated and sanitized according to its intended data type, then apply context-specific output escaping immediately before rendering. Untrusted values should never be treated as markup or executable script.

Use centralized encoding and sanitization APIs, review every user-data flow from request to storage to output, enforce request-integrity and authorization controls, and test stored-content paths in CI and security assessments.

Find out what's already
exploitable in your codebase.