GHSA-7cm9-v848-cfh2

Suggest an improvement
Source
https://github.com/advisories/GHSA-7cm9-v848-cfh2
Import Source
https://github.com/github/advisory-database/blob/main/advisories/github-reviewed/2026/04/GHSA-7cm9-v848-cfh2/GHSA-7cm9-v848-cfh2.json
JSON Data
https://api.osv.dev/v1/vulns/GHSA-7cm9-v848-cfh2
Aliases
  • CVE-2026-39391
Published
2026-04-08T19:15:32Z
Modified
2026-04-08T19:36:54.614161Z
Severity
  • 4.8 (Medium) CVSS_V3 - CVSS:3.1/AV:N/AC:L/PR:H/UI:R/S:C/C:L/I:L/A:N CVSS Calculator
Summary
CI4MS has stored XSS via Unescaped Blacklist Note in Admin User List
Details

Summary

The blacklist (ban) note parameter in UserController::ajax_blackList_post() is stored in the database without sanitization and rendered into an HTML data-note attribute without escaping. An admin with blacklist privileges can inject arbitrary JavaScript that executes in the browser of any other admin who views the user management page.

Details

In modules/Users/Controllers/UserController.php, the ajax_blackList_post() method (line 344-362) accepts a note POST parameter with only a required validation rule:

// Line 347 — validation only checks 'required', no sanitization
$valData = (['note' => ['label' => lang('Backend.notes'), 'rules' => 'required'],
             'uid' => ['label' => 'uid', 'rules' => 'required|is_natural_no_zero']]);

// Line 352 — raw user input passed directly to ban()
$user->ban($this->request->getPost('note'));

Shield's Bannable::ban() trait stores the message as-is:

// vendor/codeigniter4/shield/src/Traits/Bannable.php
public function ban(?string $message = null): self
{
    $this->status         = 'banned';
    $this->status_message = $message;  // No escaping
    // ...
}

In the users() method (line 13-91), when building the DataTables response, the status_message is concatenated directly into HTML without escaping:

// Line 55 — esc() IS used here (correct)
$result->fullname = esc($result->firstname) . ' ' . esc($result->surname);

// Line 58-59 — NO esc() on status_message (vulnerable)
if ($result->status == 'banned'):
    $result->actions .= '<button ... data-note="' . $result->status_message . '">'

The HTML string is returned as JSON (line 90) and DataTables renders it into the DOM. CSP is disabled ($CSPEnabled = false in App.php), and no SecureHeaders filter is applied.

PoC

Step 1 — Store XSS payload via ban endpoint:

curl -X POST 'https://TARGET/backend/users/blackList' \
  -H 'X-Requested-With: XMLHttpRequest' \
  -H 'Cookie: ci_session=ADMIN_SESSION_WITH_UPDATE_PERM' \
  -d 'uid=2&note=%22+onmouseover%3D%22alert(document.cookie)%22+x%3D%22'

Expected response: {"result":true,"error":{"type":"success","message":"..."}}

Step 2 — Trigger payload: Any admin navigating to /backend/users will receive HTML containing:

<button ... data-note="" onmouseover="alert(document.cookie)" x="">

The XSS fires when the admin hovers over the blacklist button for the banned user.

Alternative immediate-execution payload:

note="><img src=x onerror=alert(document.cookie)>

Impact

  • Session hijacking: An attacker with blacklist privileges can steal session cookies of other admins (including superadmins who view the user list but are themselves protected from being banned).
  • Privilege escalation: A lower-privileged admin could use stolen superadmin sessions to gain full control.
  • Persistent: The payload persists in the database and fires every time the user list is loaded, affecting all admins who view the page.

Recommended Fix

Wrap status_message with esc() to match the escaping already applied to other user fields on line 55:

// In users() method, line 58-59 — change:
$result->actions .= '<button type="button" class="btn btn-outline-dark btn-sm open-blacklist-modal"
                        data-id="' . $result->id . '" data-status="' . $result->status . '" data-note="' . esc($result->status_message) . '"><i
Database specific
{
    "cwe_ids": [
        "CWE-79"
    ],
    "severity": "MODERATE",
    "github_reviewed": true,
    "nvd_published_at": "2026-04-08T15:16:13Z",
    "github_reviewed_at": "2026-04-08T19:15:32Z"
}
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

source
"https://github.com/github/advisory-database/blob/main/advisories/github-reviewed/2026/04/GHSA-7cm9-v848-cfh2/GHSA-7cm9-v848-cfh2.json"
last_known_affected_version_range
"<= 0.31.3.0"