GHSA-2VC6-M33R-8V36
Stored XSS via unfiltered [html] BBCode in startchat question
CVSS:3.1/AV:N/AC:L/PR:N/UI:R/S:C/C:H/I:L/A:N
Fuente: GitHub
Ciclo de vida de la vulnerabilidad
| Fecha | Fase | Evento | Detalle |
|---|---|---|---|
| Divulgación | Publicada | GHSA-2VC6-M33R-8V36 divulgada · CVSS 8.2 (GitHub) | |
| Divulgación | Modificada | Última actualización del registro | |
| Monitoreo | Detectada | Ingresó al índice | |
| Monitoreo | Verificada | Última verificación contra las fuentes |
Summary
`lib/core/lhbbcode/lhbbcode.php` uses two different markers for "this message came from a visitor". `isBBCodeTagSupported` accepts either of them, at `:1255`:
if ((isset($paramsMessage['sender']) && $paramsMessage['sender'] == 0) || (isset($paramsMessage['user_id_raw']) && $paramsMessage['user_id_raw'] == 0))The `[html]` removal at `:1375` is guarded by the first marker alone. The visitor renderer supplies only the second: `design/defaulttheme/tpl/lhchat/lists/user_msg_row.tpl.php:71` builds `array('msg_id' => ..., 'render_html' => true, 'user_id_raw' => $msg['user_id'])` with no `sender` key, so the removal never runs and the callback at `:1384` decodes and emits the attacker's HTML.
The ingest side has the same split. Two visitor endpoints strip the tag before storing, `modules/lhchat/addmsguser.php:38` and `modules/lhwidgetrestapi/addmsguser.php:99`. At least six others do not, among them `modules/lhchat/startchat.php:442` and `modules/lhchat/chatwidget.php:466`, which store the chat question verbatim as a message with `user_id = 0`.
Result: an anonymous visitor stores HTML that executes in the application origin for anyone who opens that chat, including an operator.
Details
`lhbbcode.php:1255` treats `sender == 0` or `user_id_raw == 0` as the visitor marker, while the `[html]` removal at `:1375` tests `isset($paramsMessage['sender']) && $paramsMessage['sender'] == 0` alone. `user_msg_row.tpl.php:71` supplies `user_id_raw` and `render_html` and never `sender`, so on the visitor render path the removal is skipped and the callback at `lhbbcode.php:1384` runs `htmlspecialchars_decode()` on the tag content. `modules/lhchat/startchat.php:442` and `modules/lhchat/chatwidget.php:466` save the question unchanged with `user_id = 0`, and `lhchatbox/addmsguser.php:28`, `lhrestapi/addmsguser.php:41`, `lhwidgetrestapi/submitonline.php:491` and `lhchat/readoperatormessage.php:549` are four further ingests without the removal. `lhbbcode.php:1393` deletes `<script>` elements when `render_js` is unset, so the payload uses an event handler attribute.
Reachable with no account and no configuration change. Three conditions apply and none is a hurdle: one department has to be online, the question is capped at `max_message_length` (500 by default, `lhchatvalidator.php:393`), and a one-time token from `captcha/captchastring/form/<ts>` must be sent along, which is fetched anonymously.
The stored message renders on `chat/chat`, `chat/chatpreview`, `chat/printchat`, `chat/chatwidgetchat`, `chat/syncuser`, `chat/getmessage` and four widget REST views, all through the same line 71. `chat/chat` authorises on the chat hash alone (`modules/lhchat/chat.php:40`) and applies no status gate, so it keeps rendering indefinitely.
No operator view renders it, and no operator view shows it either: for a visitor message `sender == 0` holds there, so `:1375` removes the whole block and the operator sees an empty message body. The defect is invisible from the operator panel.
Proof of concept
LiveHelperChat 4.94v (`d8787d04`), Docker, default configuration, anonymous visitor, Chromium.
- Fetch a visitor id and an anti automation token, then start a chat whose question carries the payload.
GET /index.php/chat/startchat -> session cookie + (vid)
GET /index.php/captcha/captchastring/form/<unixts> -> {"result":"<sha256>"}
POST /index.php/chat/startchat/(vid)/<vid>
Question=[html]<img src=x onerror="window.VRFYXSS=1">VRFYMARK[/html]
&StartChat=1&DepartamentID=1&user_timezone=1
&tscaptcha=<unixts>&captcha_<sha256>=<unixts>
HTTP/1.1 302 -> /index.php/chat/chat/<id>/<hash>
lh_msg: user_id = 0, msg = [html]<img src=x onerror="window.VRFYXSS=1">VRFYMARK[/html]- Open any visitor view of that chat. The server emits the HTML unescaped.
GET /index.php/eng/chat/chatpreview/<id>/<hash>
<img src="x" onerror="window.VRFYXSS=1">VRFYMARK- In Chromium the handler runs and `window.VRFYXSS` is `1`. The response carries no CSP header at all. Opened in a browser context where an operator is logged in, a `fetch` from the payload read that operator's CSRF token (`69ccd8df5eac8f8795c65cbadf33e537`, `user_id 1`) and the transcript of a different visitor's chat.
Controls
- The same payload sent to `chat/addmsguser` is stripped to nothing, and the endpoint answers `{"error":"t","r":"Please enter a message, max characters - 500"}` because no message is left. `[html]x[/html]TAILPROBE` stores `TAILPROBE` only.
- A plain `<img src=x onerror=...>` without the BBCode tag is rendered as text and inert.
- A `<script>` payload inside the tag is removed by `:1393`: no script element, and a global set from it stays undefined, while an event handler in the same message fires.
- The operator views `site_admin/chat/single`, `/printchatadmin` and `/previewchat` show an empty message body.
Live-verified: anonymous visitor input executes an event handler in the application origin in Chromium, and from an operator's browser context the payload read that operator's CSRF token and another visitor's transcript.
Impact
- Script execution in the application origin for anyone who opens the attacker's chat URL, including a logged in operator.
- From an operator's session the payload reads the CSRF token and the transcripts of other visitors, both demonstrated.
- The payload is stored, and `chat/chat` renders it with no status gate and no expiry on the hash.
- The removal exists on two visitor ingests and is absent on at least six others.
Credit
Jan Kahmen, turingpoint https://www.turingpoint.de (jan@turingpoint.de)
Incluye detalles técnicos publicados por el investigador. Úselos solo para validar y corregir sus propios sistemas.
Desglose de métricas
Rangos afectados
Estado del parche por paquete
| Paquete / producto | Estado | Corregida en | Desde divulgación | Última versión |
|---|---|---|---|---|
Packagistremdex/livehelperchat |
Sin parche | — | — | — |
Arsenal público
Sin exploits, módulos ni PoC públicos conocidos a la fecha de verificación.
https://github.com/LiveHelperChat/livehelperchat/security/advisories/GHSA-2vc6-m33r-8v36Las referencias externas se muestran para copiar: cve.llama.ec no lo redirige a otros sitios.
