GHSA-7cm9-v848-cfh2
MEDIUMGHSA-7cm9-v848-cfh2 is a medium-severity (CVSS 4.8) Cross-site Scripting (XSS) vulnerability in ci4-cms-erp/ci4ms. O3 Security confirms whether GHSA-7cm9-v848-cfh2 is actually reachable in your code before you act, and blocks exploitation at runtime until you patch.
CI4MS has stored XSS via Unescaped Blacklist Note in Admin User List
Real-World Exposure
ci4-cms-erp/ci4msReal-time download stats are indexed for npm and PyPI packages. This vulnerability affects Packagist packages — download data is not available via public APIs for these ecosystems.
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¬e=%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
Affected Packages
| Ecosystem | Package | Vulnerable range | Fix |
|---|---|---|---|
| 🐘Packagist | ci4-cms-erp/ci4ms | all versions | 0.31.4.0 |
Detection & mitigation playbook
Open-source dependencyDetect
Scan your dependency tree (package-lock.json, pnpm-lock.yaml, requirements.txt, go.sum, etc.) for ci4-cms-erp/ci4ms. O3's reachability analysis confirms whether the vulnerable code path is actually invoked in your application, so you act on real exposure instead of every transitive match.
Fix
Update ci4-cms-erp/ci4ms to 0.31.4.0 or later, then make sure no transitive (indirect) dependency still pins the vulnerable range — O3 confirms GHSA-7cm9-v848-cfh2 is resolved across your whole dependency graph.
Workarounds
If you can't upgrade right away: gate or disable the affected feature, validate untrusted input at the boundary, and avoid passing attacker-controlled data into the vulnerable path. O3's runtime protection blocks exploitation in production as an interim safeguard until the upgrade lands.
How O3 protects you
O3 pinpoints whether GHSA-7cm9-v848-cfh2 is reachable in your code and exactly where to fix it, then blocks exploitation in production at runtime until the patched version is deployed.
Tailored to GHSA-7cm9-v848-cfh2. Runtime protection reduces exposure until a permanent patch is applied and verified — it complements patching, it doesn't replace it.
Frequently Asked Questions
Is GHSA-7cm9-v848-cfh2 in your dependencies?
O3 detects GHSA-7cm9-v848-cfh2 across Packagist dependencies and uses function-level reachability to confirm whether the vulnerable code path is actually reachable — not just present. No false positives.