# Contextual Related Posts <= 4.5.6 - Authenticated (Contributor+) Stored Cross-Site Scripting via Post Title in Shortcode and Block Heading Template

- **ID:** WPSEC-2026-3694
- **Plugin:** Contextual Related Posts (`contextual-related-posts`), https://wordpress.org/plugins/contextual-related-posts/
- **Affected versions:** from 1.9 before 4.5.7
- **Fixed in:** 4.5.7 (Update to 4.5.7 or later.)
- **Severity:** Medium 6.4 (CVSS:3.1/AV:N/AC:L/PR:L/UI:N/S:C/C:L/I:L/A:N)
- **Weakness:** CWE-79
- **Usage among sites WPSec scans:** plugin Medium, affected versions Medium (as of 2026-11-22)
- **Attack surface analysis:** https://attacksurface.wpsec.com/plugin/contextual-related-posts
- **Fix released:** 2026-11-21
- **Published:** 2026-11-22
- **URL:** https://wpsec.com/vuln/WPSEC-2026-3694/

## Description

The Contextual Related Posts plugin for WordPress is vulnerable to Stored Cross-Site Scripting via the %postname% placeholder in versions 1.9 up to, and including, 4.5.6 due to the post title being inserted unescaped for the %postname% placeholder after the heading template supplied through the [crp] shortcode or Related Posts block 'title' attribute has been sanitized. Because WordPress leaves double quotes in post titles, an attacker can place %postname% inside an HTML attribute of the template and use a crafted title to break out of it and add event handlers. This makes it possible for authenticated attackers, with contributor-level access and above, to inject arbitrary web scripts in pages that will execute whenever a user accesses an injected page.

## References

- https://wpsec.com/vuln/WPSEC-2026-3694/
- https://plugins.svn.wordpress.org/contextual-related-posts/tags/4.5.7/
- https://wordpress.org/plugins/contextual-related-posts/

Source: WPSec, https://wpsec.com/vuln/WPSEC-2026-3694/

License: CC BY 4.0 (https://creativecommons.org/licenses/by/4.0/). Free to use, share and adapt, also commercially, if you credit WPSec and link to this advisory.
