llamaCVEVulnerability Intelligence
/
Advisory · GitHub · Packagist · nilsteampassnet/teampass

GHSA-MWXW-GG4P-8XPC

Second-Order Stored XSS in Item History (value.detail)

Sin parche publicado
Descargar PNG JSON
CVSS 3.1
8.7
Alta
CVSS:3.1/AV:N/AC:L/PR:L/UI:R/S:C/C:H/I:H/A:N Fuente: GitHub
ExplotaciónSin evidenciaNo figura en CISA KEV
Exploits públicos0Ninguno conocido
ParcheSin parcheEl fabricante no ha publicado corrección
Exposición87 dDesde la divulgación, 26 ago 2026, 12:17 a. m.
Detección85 dDesde la divulgación hasta su ingreso al índice
Decisión estimadaSeguir de cerca
Monitorear y programar la remediación
Estimación de Llama con el árbol SSVC de CISA a partir de vector CVSS 3.1 y la evidencia de explotación (sin evaluación oficial): sin explotación conocida, no automatizable e impacto técnico total. No hay versión corregida: aplique mitigaciones.
Si el fabricante actualiza el aviso, vuelve a mirar.Yo la vigilo, tú la programas. ¿Trato?
Timeline

Ciclo de vida de la vulnerabilidad

Hoy
Divulgación
Publicada
Explotación
Remediación
Monitoreo
Detectada +1
26 ago 26
19 nov 26
21 nov 26
26 ago 26
17 sept 26
8 oct 26
30 oct 26
21 nov 26
FechaFaseEventoDetalle
Divulgación Publicada GHSA-MWXW-GG4P-8XPC divulgada · CVSS 8.7 (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

Second-Order Stored XSS in Item History (value.detail)

Summary

When an item is edited, TeamPass records the previous value of each changed
field in the audit log (teampass_log_items.raison), e.g.:

at_label : <old label> => <new label>

When any user later opens that item, loadItemHistory() fetches the log
entries. The server composes a per-entry "detail" string that EMBEDS THE
PREVIOUS FIELD VALUE RAW inside a <span>, with no htmlspecialchars:

// sources/items.queries.php, case load_item_history
$tmp = explode(' => ', $reason[1]);
$detail = ... 'previous_value: <span class="font-weight-light">' . $tmp[0] . ' </span>';

This applies to at_label, at_login, at_url, at_email, at_tag and at_field
(custom-field previous value). The client then renders every entry's
detail by concatenating it raw into an HTML string and inserting it with
jQuery .html():

// pages/items.js.php, loadItemHistory
html += ... (value.detail === '' ? '' : (' | ' + value.detail)) ...;
$('#card-item-history').html(html);

Because the log response is decoded with decodeQueryReturn/purifyData, the
entity-encoded previous value (e.g. &lt;img onerror=...&gt;) is decoded
back to live <img onerror> markup -- simplePurifier decodes entities first
and then returns any value containing "img" unchanged -- and .html() parses
it as live DOM.

This is a SECOND-ORDER vector: the payload is planted as an item field value
(label/login/url/etc.) through the normal New Item form; it becomes
weaponised only when the field is later EDITED (so the old payload is
captured in the audit log) and a user opens the item and views its history.
It bypasses every sink that defends the live field: the item detail card
shows the NEW (edited) value safely (label via htmlEncode, url via .text()),
while the audit-log history card renders the OLD payload value raw.

Cross-user reach: any user with read access to the item who opens it
triggers loadItemHistory automatically; the previous-value payload executes
in their session. An attacker who can create and later edit an item in a
shared folder can therefore attack every colleague who opens the item,
including after the attacker has "cleaned up" the visible field value.

Affected Version

TeamPass 3.1.7.6

The same sinks are present in the current git branch 3.2.1.6
(app/pages/items.js.php loadItemHistory renders value.detail via
$('#card-item-history').html(html); app/sources/items.queries.php
load_item_history composes $detail with the raw previous value for
at_label/at_login/at_url/at_email/at_tag/at_field).

PoC

The PoC requires the two accounts used below:

administrator : admin / admin123!
non-admin : deleter / deleter123! (write access to the shared
folder "E2E Folder", id 9002)

------------------------------------------------------------------
Step 1 - Attacker plants the payload (browser: New Item form)
------------------------------------------------------------------
1. Open teampass and log in as the non-administrator
(deleter / deleter123!).
2. Open the Items page, select folder "E2E Folder" (id 9002), click
"New item".
3. Fill:
Label = xssLblE2E<img src=x onerror=document.body.dataset.xssLabel=1>
Login = (anything)
Password = (any value satisfying the folder complexity policy)
Save.

The label is stored HTML-entity-encoded (FILTER_SANITIZE_FULL_SPECIAL_CHARS):

stored label = xssLblE2E&lt;img src=x onerror=document.body.dataset.xssLabel=1&gt;

------------------------------------------------------------------
Step 2 - Attacker edits the field (browser: Edit form)
------------------------------------------------------------------
1. Still as the item author, open the Items page, select folder 9002.
2. Click the edit (pen) icon on the "xssLblE2E" item row.
3. Change the Label (e.g. append a character so it becomes "xssLblE2EZ").
4. Save.

The update_item handler logs the change with the OLD label value embedded
raw in the audit log raison (this happens automatically on save; no
database operation is performed by the user):

action = at_modification
raison = at_label : xssLblE2E&lt;img src=x onerror=...&gt; => xssLblE2EZ

------------------------------------------------------------------
Step 3 - Victim triggers the payload (browser: open item)
------------------------------------------------------------------
1. Log in as any user with read access to folder 9002 (the same account or
any colleague).
2. Open the Items page, select folder 9002.
3. Click the item row "xssLblE2EZ" to open its detail view.

Opening the item automatically calls loadItemHistory (pages/items.js.php).
The server's load_item_history handler builds the history detail for the
at_label entry with the raw previous value:

$detail = 'previous_value: <span class="font-weight-light"> xssLblE2E<img ...> </span>';

The client decodes the response (purifyData decodes entities, "img" bypass
returns it live) and renders it with the real sink:

$('#card-item-history').html(html);

The decoded <img onerror> executes. The detail card itself shows the NEW
label ("xssLblE2EZ") safely via htmlEncode, so the only execution comes
from the history card's rendering of the OLD value.

Expected result (observed in the browser DOM only, no database access):
document.body.dataset.xssLabel === "1"
#card-item-history innerHTML includes:
... | previous_value: <span class="font-weight-light">
xssLblE2E<img src="x" onerror="document.body.dataset.xssLabel=1">
</span> ...

The onerror handler fired from the history card, confirming execution
through the application's own loadItemHistory rendering path. The whole
chain (plant -> edit -> open) was reproduced with the browser alone; no
database commands, fetch() or manual sink scripting were used.

(The same steps with the payload in the Login or URL field, then editing
that field, produce at_login / at_url history entries that fire the same
way; the at_field path likewise captures a previous custom-field value.)

Root Cause Analysis

  1. Planting (sources/items.queries.php, new_item):
  1. Capture (sources/items.queries.php, update_item):
  1. Composition (sources/items.queries.php, case load_item_history):
  1. Client decode (includes/js/functions.js, simplePurifier / purifyData,
  1. Sink (pages/items.js.php, loadItemHistory):

This is a second-order sink: the live field sinks defend the CURRENT value,
but the history card renders a PREVIOUS value that was never re-sanitised.
The encoding sentinel tests/Unit/ClientHtmlEncodingSentinelTest.php does
not inspect value.detail (it is not in WATCHED_FIELDS) and does not cover
the server-side detail composition, so the gap is undetected.

The minimal fix is to htmlspecialchars() each $tmp[0] / $tmp[1] when
composing $detail in load_item_history (so the previous value is emitted as
text, not live HTML), and/or to render value.detail via .text() /
htmlEncode() in loadItemHistory instead of concatenating it into the
.html() string. (Hardening the shared simplePurifier "img" bypass would
additionally neutralise this and the other sinks that rely on it.)

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:C
CambiadoSin cambio
ConfidencialidadC:H
AltoBajoNinguno
IntegridadI:H
AltoBajoNinguno
DisponibilidadA:N
AltoBajoNinguno
Score de explotaciónQué tan fácil y probable es que la exploten
7.2/ 10Alto
Vector 7.2 (fácil) · sin evidencia de explotación.
Versiones

Rangos afectados

Afectada Corregida
nilsteampassnet/teampass≤ 3.2.1.6
3.2.1.6
Remediación

Estado del parche por paquete

Paquete / productoEstadoCorregida enDesde divulgaciónÚltima versión
Packagistnilsteampassnet/teampass
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/nilsteampassnet/TeamPass/security/advisories/GHSA-mwxw-gg4p-8xpc

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