All reports
Medium

WordPress <= 6.9.1 - Cross-Site Scripting via Client-Side Template Override in Admin Area

Affected versions

WordPresswordpress
Affected versions
>=6.8 <=6.8.3 || >=6.9 <=6.9.1
Fixed version
6.8.4 · 6.9.2

Description

WordPress core is vulnerable to Cross-Site Scripting via client-side template overriding in the admin area in all versions up to and including 6.9.1. The wp.template() JavaScript function uses document.getElementById() to locate templates, which matches any HTML element by ID regardless of element type. WordPress admin templates are intended to be <script type="text/html" id="tmpl-*"> elements, but getElementById also matches <div>, <img>, and other injected elements. If an attacker can inject a non-script element with a matching tmpl-* ID, the template content is overridden with attacker-controlled HTML, which is then compiled by Underscore.js _.template() with JavaScript execution support. This is a conditional vulnerability that requires an existing HTML injection vector in the admin context.

Links

Credits

  • Asaf Mozes

Data rights and licenses

Wordfence

Copyright 2012-2026 Defiant Inc.

Defiant hereby grants you a perpetual, worldwide, non-exclusive, no-charge, royalty-free, irrevocable copyright license to reproduce, prepare derivative works of, publicly display, publicly perform, sublicense, and distribute this software vulnerability information. Any copy of the software vulnerability information you make for such purposes is authorized provided that you include a hyperlink to this vulnerability record and reproduce Defiant's copyright designation and this license in any such copy.

License terms