GHSA-3CJ7-FC64-8Q3V
Stored XSS via a `markdown`-typed column served inline as text/html without escaping (asset route)
CVSS:3.1/AV:N/AC:L/PR:L/UI:R/S:C/C:L/I:L/A:N
Fuente: GitHub
Ciclo de vida de la vulnerabilidad
| Fecha | Fase | Evento | Detalle |
|---|---|---|---|
| Divulgación | Publicada | GHSA-3CJ7-FC64-8Q3V divulgada · CVSS 5.4 (GitHub) | |
| Divulgación | Modificada | Última actualización del registro | |
| Remediación | Parche v0.13.45 | github.com/daptin/daptin · 2 d desde divulgación | |
| Monitoreo | Detectada | Ingresó al índice | |
| Monitoreo | Verificada | Última verificación contra las fuentes |
Summary
The asset route serves a `markdown`-typed column's value by wrapping the raw stored string in `<pre>%s</pre>` and returning it with `Content-Type: text/html; charset=utf-8`, inline, with no CSP and no `X-Content-Type-Options`. A `<pre>` wrapper does not neutralize `<script>` / `<img onerror=…>`. So a low-privileged user who can write a row with a markdown column stores HTML/JS, and any higher-trust user (e.g. an admin) who opens that asset URL executes the script on the same origin as `/api` and the dashboard — stored XSS. Affected: `daptin/daptin` v0.13.36 (latest; HEAD `edda1f69`). Cross-site Scripting (CWE-79); Medium, CVSS 3.1 5.4.
Details
Read at v0.13.36 (`edda1f69`).
- `server/asset_route_handler.go:103` — `row[columnName]` (the stored column value).
- `:109` — `markdownContent := colData.(string)` — taken raw, no sanitizer.
- `:115` — `htmlContent := fmt.Sprintf("<pre>%s</pre>", markdownContent)` — the raw string is interpolated into HTML; `<pre>` does not escape `<script>`/`<img onerror>`.
- `:120` — the response MimeType is set to `text/html; charset=utf-8`; `:123` `IsDownload:false` (served inline); `:500` `serveCachedAsset` sets that Content-Type verbatim. No CSP, no `X-Content-Type-Options: nosniff`.
The write side is ordinary: a user with write permission on a table that has a markdown column stores the payload via a normal JSON:API create/update. The payload fires when a victim (higher-trust user/admin) loads the asset URL for that column.
Suggested fix: HTML-escape the markdown column value before wrapping (e.g. `html.EscapeString`), or render markdown → sanitized HTML through a real markdown renderer with an HTML sanitizer (bluemonday-class) allow-list; and add `Content-Type` hardening (`X-Content-Type-Options: nosniff`) and a restrictive CSP on the asset response.
Proof of concept
ll testing was local, against the shipped code with synthetic data; no hosted system was contacted.
As a low-privileged user with write permission on a table that has a markdown column, store a value containing an HTML/JS payload (e.g. an `<img>` with an `onerror` handler) via a normal create/update. Opening the asset URL for that column in a browser (as any user, e.g. an admin) returns it as `text/html` inline and the script executes on the app origin. Control: HTML-escaping the value (or sanitizing the rendered HTML) renders the payload inert as text. Full request/response captures available on request.
Impact
A low-privileged authenticated user can store script that executes in a higher-trust user's browser on the application origin (same origin as `/api` and the dashboard) — enabling actions as the victim (e.g. an admin), session/data access within the app, and a scope change across the origin's privilege boundary. CVSS 3.1 5.4 (`CVSS:3.1/AV:N/AC:L/PR:L/UI:R/S:C/C:L/I:L/A:N`). CWE-79.
---
*Credit: please consider requesting a CVE and crediting Santosh Kumar Puppala (https://github.com/Santoshkumarpuppala) if one is assigned. Coordinated disclosure — happy to work to your timeline; all testing was local, on synthetic data.*
Maintainer resolution (2026-10-31)
Accepted and fixed in commit `7e5d7fa2c0323d1d99f47f803fa33dff870bed7e` https://github.com/daptin/daptin/commit/7e5d7fa2c0323d1d99f47f803fa33dff870bed7e. Markdown asset values are now HTML-escaped before inclusion in the preformatted HTML response, so embedded markup is displayed as text. Rendered Markdown uses a separate cache key to prevent reuse of unescaped HTML cached before the upgrade. Stored values remain unchanged.
The vulnerable construction is also present in v0.13.44. The fix is released in v0.13.45 https://github.com/daptin/daptin/releases/tag/v0.13.45. Upgrade to v0.13.45 or later; operators unable to upgrade can restrict access to Markdown asset URLs as a temporary mitigation.
Validation: `DAPTIN_REAL_E2E=1 go test -count=1 -run '^TestMarkdownAssetEscapesStoredHTMLRealE2E$' ./cmd/daptin` passed against the fixed revision. The test stores HTML payloads through the normal resource API as a non-administrator, retrieves the asset as a distinct authorized reader, and parses the HTML to verify that the payload remains text. It covers a seeded pre-fix cache entry, cold and warm responses, gzip, conditional requests, and denial after read permission is revoked. This is an application HTTP and HTML-parser test, not a browser automation test.
Related report of the same vulnerability: GHSA-chg3-v4pp-8fq3 https://github.com/daptin/daptin/security/advisories/GHSA-chg3-v4pp-8fq3. Original reporter credits are retained.
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 |
|---|---|---|---|---|
gogithub.com/daptin/daptin |
Corregida | v0.13.45 | 2 d | v0.13.57 no afectada |
0.13.45v0.13.45Arsenal público
Sin exploits, módulos ni PoC públicos conocidos a la fecha de verificación.
https://github.com/daptin/daptin/security/advisories/GHSA-3cj7-fc64-8q3vLas referencias externas se muestran para copiar: cve.llama.ec no lo redirige a otros sitios.
