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-2026-112951 Overview
CVE-2026-112951 is a stored cross-site scripting (XSS) vulnerability in ApostropheCMS, an open-source Node.js content management system. The flaw resides in the color field validation logic. The field relies on TinyColor, which locates functional notations like rgb() or hsl() anywhere within a string rather than requiring the entire value to match a valid color format. An authenticated user with edit rights can append arbitrary HTML after a valid color prefix. When the stored value is later rendered, the attacker-supplied payload executes in the victim's browser context. The issue is resolved in ApostropheCMS version 4.34.0.
Critical Impact
Authenticated editors can inject persistent JavaScript into color field values, enabling session hijacking, credential theft, or administrative action abuse against users who view the rendered content.
Affected Products
- ApostropheCMS versions prior to 4.34.0
- @apostrophecms/color-field module
- Node.js sites rendering ApostropheCMS color field output
Discovery Timeline
- 2026-10-20 - CVE-2026-112951 published to NVD
- 2026-10-20 - Last updated in NVD database
Technical Details for CVE-2026-112951
Vulnerability Analysis
The vulnerability is a stored cross-site scripting flaw classified under [CWE-79]. It lives in the color field module packages/apostrophe/modules/@apostrophecms/color-field/index.js. The module uses the @ctrl/tinycolor library to validate user-submitted color values. TinyColor's parser is permissive: it scans input for a color-shaped substring instead of verifying the entire input conforms to a color grammar.
As a result, a value such as rgb(0,0,0)<img src=x onerror=alert(1)> passes validation. The trailing HTML is preserved verbatim in the stored document. When the color field is later rendered into page markup, the attacker payload is inserted into the DOM and executed by any viewer, including other editors and administrators.
Root Cause
The root cause is improper input validation. The validator trusts TinyColor's substring match rather than anchoring the value to a strict regular expression. Edit rights are required to reach the field, but no server-side sanitization strips non-color characters before persistence.
Attack Vector
Exploitation requires an authenticated account with content edit privileges and a victim who renders the affected area. The attacker submits a color value through the normal edit workflow, appending an HTML payload after a legitimate rgb() or hsl() prefix. The payload persists in storage and executes whenever the content is rendered.
// Source: https://github.com/apostrophecms/apostrophe/commit/40b989b1a9dd23d30029b8ce7668634265cfe5ea
// Fix in packages/apostrophe/modules/@apostrophecms/color-field/index.js
const { TinyColor } = require('@ctrl/tinycolor');
const _ = require('lodash');
// TinyColor finds functional notations like rgb() anywhere in the string,
// so the whole value must also have the shape of a color
const colorShape = /^\s*(?:#?[0-9a-f]{3,8}|[a-z]+|(?:rgba?|hsla?|hsva?|cmyk)[\s(][-+0-9.%,\s/]*\)?)\s*$/i;
module.exports = {
options: {
name: 'color',
The patch introduces an anchored colorShape regular expression. Values must match from start (^) to end ($), rejecting any trailing HTML or script content before TinyColor processes the input.
Detection Methods for CVE-2026-112951
Indicators of Compromise
- Stored color field values containing characters outside the color grammar, such as <, >, onerror=, or script.
- Document records where color properties exceed typical length (greater than ~30 characters).
- Browser console errors or unexpected network beacons on pages that render user-edited areas.
Detection Strategies
- Query the ApostropheCMS document store for color field values that fail to match the anchored colorShape regular expression used in the 4.34.0 patch.
- Review audit logs for edit actions by low-privilege authors that modify color fields with unusually long payloads.
- Deploy Content Security Policy (CSP) reports to surface inline script execution originating from rendered content areas.
Monitoring Recommendations
- Monitor HTTP POST and PATCH requests to Apostrophe editor APIs for color field submissions containing HTML metacharacters.
- Alert on administrative session activity that follows a page view from an editor-authored document.
- Enable web application firewall (WAF) rules that flag angle brackets or event handler attributes within JSON fields named color or background.
How to Mitigate CVE-2026-112951
Immediate Actions Required
- Upgrade ApostropheCMS to version 4.34.0 or later across all environments.
- Audit existing content for color field values that contain non-color characters and remediate stored payloads.
- Review and reduce edit permissions so only trusted accounts can modify content.
Patch Information
The fix is delivered in ApostropheCMS Release Version 4.34.0. The technical fix lands in commit 40b989b, which introduces an anchored colorShape regular expression that validates the entire input before passing it to TinyColor. Additional context is available in GitHub Security Advisory GHSA-vmgj-9cwm-cf3h.
Workarounds
- Enforce a strict Content Security Policy that blocks inline scripts and restricts allowed script sources until the patch is applied.
- Add a server-side pre-save hook that rejects color field values failing an anchored color regular expression.
- Temporarily revoke edit rights from untrusted accounts if upgrade cannot be scheduled immediately.
# Upgrade ApostropheCMS to the patched release
npm install apostrophe@4.34.0 --save
npm audit
npm run build
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

