CVE-2026-39391

CVE-2026-39391 is a medium-severity cross-site scripting (XSS) vulnerability in ci4-cms-erp/ci4ms (composer), affecting versions <= 0.31.3.0. It is fixed in 0.31.4.0.

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.

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-39391 has a CVSS score of 4.8 (Medium). The vector is network-reachable, high 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 (0.31.4.0); upgrading removes the vulnerable code path.

Affected versions

ci4-cms-erp/ci4ms (<= 0.31.3.0)

Security releases

ci4-cms-erp/ci4ms → 0.31.4.0 (composer)

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.

See it in your environment

Remediation advice

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

Frequently Asked Questions

  1. What is CVE-2026-39391? CVE-2026-39391 is a medium-severity cross-site scripting (XSS) vulnerability in ci4-cms-erp/ci4ms (composer), affecting versions <= 0.31.3.0. It is fixed in 0.31.4.0. Untrusted input is rendered as active markup in a victim's browser, which can run script in their session.
  2. How severe is CVE-2026-39391? CVE-2026-39391 has a CVSS score of 4.8 (Medium). 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.
  3. Which versions of ci4-cms-erp/ci4ms are affected by CVE-2026-39391? ci4-cms-erp/ci4ms (composer) versions <= 0.31.3.0 is affected.
  4. Is there a fix for CVE-2026-39391? Yes. CVE-2026-39391 is fixed in 0.31.4.0. Upgrade to this version or later.
  5. Is CVE-2026-39391 exploitable, and should I be worried? Whether CVE-2026-39391 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
  6. What actually determines whether CVE-2026-39391 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.
  7. How do I fix CVE-2026-39391? Upgrade ci4-cms-erp/ci4ms to 0.31.4.0 or later.

Other vulnerabilities in ci4-cms-erp/ci4ms

CVE-2026-45270CVE-2026-45138CVE-2026-41891CVE-2026-41890CVE-2026-41587

Stop the waste.
Protect your environment with Kodem.