/

CVE-2026-45270

Severity:

HIGH RISK

(8.7)

Stored XSS (CWE-79) in CI4MS Pages Backend Module

CVE-2026-45270

Deferred

Vulnerability type

Category:

Cross-Site Scripting (XSS)

CWE:

CWE-79

Impact:

Stored Cross-Site Scripting leading to session hijacking and account compromise

Severity:

HIGH RISK

(8.7)

CVSS version:

3.1

Catch this CVE while code is being written

Detect vulnerable code directly in pull requests, so CVEs are fixed before merge.

Summary

CI4MS prior to version 0.31.9.0 suffers from a stored cross-site scripting flaw in the Pages backend module, where user-supplied page content is saved and rendered without proper escaping.

Attackers who can create or edit pages can inject scripts that execute in every visitor's browser, including administrators, especially when the malicious page is promoted to the site's home page.

Affected context

This vulnerability appears in CI4MS deployments where the Pages backend module is used to manage front-end content.

The issue manifests when language-keyed page content is validated with html_purify but the un-purified POST data is persisted and later rendered via Home::index() and pages.php without esc().

It is most risky on sites where untrusted or semi-trusted users can author or edit pages, or where editorial workflows do not filter or review embedded HTML or script content.

Exploit preconditions

  • Attack surface: Web application front-end, via publicly rendered pages managed by the Pages backend.
  • Required access: Ability to submit or modify page content through the CI4MS administration or content-authoring interface (e.g., editor, compromised admin account, or abused integration).
  • Trigger point: The vulnerable page is requested in a browser; the stored payload inside $pageInfo->content is emitted without escaping by pages.php.
  • Why exploitation is possible: The backend registers an html_purify validation rule but fails to store the purified value, and the public renderer outputs raw content without esc(), allowing arbitrary script execution in the client.

Why this happens

The underlying bug is a classic stored XSS pattern where untrusted input is accepted, insufficiently sanitized, and later rendered as HTML without contextual escaping.

In this case, validation rules suggest purification (html_purify), but the implementation persists the original, un-purified POST value to the database.

On the read path, Home::index() and app/Views/templates/default/pages.php emit $pageInfo->content directly, bypassing framework escaping helpers such as esc().

This maps to CWE-79: Improper Neutralization of Input During Web Page Generation, where user-controlled data is mixed into HTML output without neutralizing scripting constructs.

Potential impact

  • Attacker-controlled JavaScript execution in visitors' browsers.
  • Theft of session cookies and potential account takeover, including administrative accounts.
  • Unauthorized actions performed on behalf of logged-in users (CSRF-like effects via XSS).
  • Defacement of site content and injection of misleading or malicious UI elements.
  • Distribution of malware or phishing content to all visitors, particularly if the payload is served from /.

General mitigation guidance

Mitigation should focus on enforcing robust output encoding, aligning validation behavior with storage semantics, and constraining trust in page content.

Recommended defensive patterns include:

  • Always applying context-aware output escaping (e.g., HTML, attribute, JavaScript) when rendering user-controlled content in views.
  • Ensuring that any server-side purification or filtering rule (such as html_purify) is applied to the data that is actually persisted, not merely validated.
  • Restricting which roles can author raw HTML content and separating fully trusted content from user-generated content.
  • Implementing a defense-in-depth model where potentially active content (scripts, event handlers, inline JavaScript) is disallowed or stripped from editable page fields.
  • Applying least-privilege principles to administrative accounts and content-authoring roles, reducing the blast radius of a compromised editor.

How teams detect issues like this

Detection commonly involves a mix of code inspection and automated checks aimed at identifying unescaped output in templates.

Useful strategies include:

  • Static analysis rules that flag direct echoing of database-backed content without passing through escaping helpers or templating safeguards.
  • Code review practices that treat any view variable originating from user input or CMS fields as untrusted and require explicit escaping.
  • Pattern-based checks in CI pipelines looking for risky constructs such as <?= $variable ?> in views instead of <?= esc($variable) ?>.
  • Security-focused tests that submit benign script payloads in page content and verify that they are neutralized or displayed as plain text in rendered output.
  • Use of automated web scanners configured to probe CMS content fields for reflected and stored XSS behavior, followed by manual confirmation.

Sources

SourceLink
github.comgithub.com/ci4-cms-erp/ci4ms/releases/tag/0.31.9.0
github.comgithub.com/ci4-cms-erp/ci4ms/security/advisories/GHSA-gqr2-7hcg-rchf

Frequently asked

questions

If an attacker can create or modify pages, the exploit will fire for every visitor who loads the affected page. When the page is promoted to the site home page, the payload can be delivered to all visitors reaching /, amplifying the impact dramatically.

The attacker needs the ability to submit or edit page content through CI4MS. This could be a legitimate editor abusing their privileges, a compromised administrator account, or any integration that exposes page content fields to untrusted input.

The safest approach is to ensure that the value stored in the database is either properly sanitized or treated as untrusted and always rendered with context-aware escaping. Template code should mandatorily use escaping helpers (such as esc()) for user-controlled fields, and validation rules like html_purify must be applied to the actual persisted data.

Adopt a consistent, framework-wide policy that all user or editor-supplied content is untrusted by default and must be escaped for its specific output context. Complement this with secure coding guidelines for view templates, automated checks that flag unescaped output, and periodic review of CMS features where non-technical users can influence rendered HTML.

Find out what's already
exploitable in your codebase.