llamaCVEVulnerability Intelligence
/
Advisory · GitHub · Go · github.com/daptin/daptin

GHSA-CHG3-V4PP-8FQ3

Stored Cross-Site Scripting (XSS) in Markdown Asset Responses Due to Missing HTML Output Encoding in Daptin v0.13.39

Parche disponible
Descargar PNG JSON
CVSS 3.1
5.4
Media
CVSS:3.1/AV:N/AC:L/PR:L/UI:R/S:C/C:L/I:L/A:N Fuente: GitHub
ExplotaciónSin evidenciaNo figura en CISA KEV
Exploits públicos0Ninguno conocido
Parche2 versionesPrimer parche a 2 d de la divulgación
Exposición19 dDesde la divulgación, 31 oct 2026, 6:56 a. m.
Detección18 dDesde la divulgación hasta su ingreso al índice
Timeline

Ciclo de vida de la vulnerabilidad

Hoy
Divulgación
Publicada
Modificada
Explotación
Remediación
Parche v0.13.45
Monitoreo
Detectada +1
31 oct 26
2 nov 26
18 nov 26
20 nov 26
31 oct 26
5 nov 26
10 nov 26
15 nov 26
20 nov 26
FechaFaseEventoDetalle
Divulgación Publicada GHSA-CHG3-V4PP-8FQ3 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
Resumen
Descripción del advisory
Texto original · GitHub · en inglés
Summary

Daptin v0.13.39 contains a potential stored cross-site scripting (XSS) vulnerability in the Markdown asset-serving path. When serving a database column of type `markdown`, the server interpolates the stored content directly into an HTML `<pre>` element without applying HTML escaping or sanitization. The resulting document is returned with `Content-Type: text/html; charset=utf-8` and an inline disposition.

An attacker who is allowed to edit a Markdown field in a record that another user can view may be able to store HTML/event-handler markup in that field. If the victim opens the corresponding asset URL in their browser, the markup can be interpreted and active script can execute in the application's origin, subject to any deployment-specific browser protections such as an externally configured Content Security Policy (CSP).

Verification status: The vulnerable rendering and HTTP response construction were confirmed in the source of the stable `v0.13.39` release. In an isolated local HTTP/browser reproduction using the same HTML construction and response headers, Chromium executed a harmless JavaScript marker. A complete authenticated Daptin deployment test, including storage via a non-administrator account and navigation by a second account, has not yet been performed. This report is accordingly a source-verified and browser-reproduced vulnerability candidate, not a claim of end-to-end exploitation of a deployed instance.

Details

Project: Daptin
Repository: https://github.com/daptin/daptin
Verified version: `v0.13.39` (release published October 10, 2026)
Verified source: https://github.com/daptin/daptin/blob/v0.13.39/server/asset_route_handler.go
Affected component: Markdown branch of `AssetRouteHandler`
Endpoint: `GET /asset/:typename/:resource_id/:columnname`
Suggested weakness classification: CWE-79 — Improper Neutralization of Input During Web Page Generation ('Cross-site Scripting')

Root cause

Within `server/asset_route_handler.go`, the handler processes a column whose `ColumnType` is `markdown`, loads the record's `columnName` value, and creates an HTML response as follows:

if colInfo.ColumnType == "markdown" {
    // ... Fetch data ...
    colData := row[columnName]
    if colData == nil {
        c.AbortWithStatus(http.StatusNotFound)
        return
    }

    markdownContent := colData.(string)

    // ... ETag ...
    htmlContent := fmt.Sprintf("<pre>%s</pre>", markdownContent)
    cachedMarkdown := &cache.CachedFile{
        Data:       []byte(htmlContent),
        MimeType:   "text/html; charset=utf-8",
        IsDownload: false,
        // Other metadata omitted here for brevity.
    }
    // ... cache and serve ...
    serveCachedAsset(c, cachedMarkdown)
    return
}

The unsanitized `markdownContent` is inserted into an HTML document as markup, not text. A `<pre>` element preserves whitespace but does not prevent HTML parsing or the execution of event handlers. The response is expressly labelled `text/html` rather than `text/plain`, and `IsDownload: false` means the asset is intended to be displayed inline.

The endpoint is registered from `server/server.go`:

defaultRouter.GET("/asset/:typename/:resource_id/:columnname", dbAssetHandler)

The `dbAssetHandler` calls `AssetRouteHandler` through `CreateDbAssetHandler` in `server/assets_column_handler.go`.

The `loadAuthorizedAssetRow(...)` routine obtains the target record and authorization metadata. The existence of these access checks does not mitigate XSS where the attacker legitimately has write access to a field and a victim legitimately has permission to read the same record. This report does not claim a read-authorization bypass.

`serveCachedAsset(...)` in `server/asset_route_handler.go` sets the HTTP `Content-Type` using the cached file's `MimeType` and serves the HTML response. No default CSP was identified in the reviewed asset-serving path. A CSP supplied by a reverse proxy or another deployment layer could alter exploitability and should be tested in an actual installation.

Trust boundary

The security boundary is crossed when a stored, potentially lower-trust Markdown value is interpreted as executable HTML in the browser of another user. The attack requires a suitable write-capable actor, a target record/column readable by another user, and that user's browser navigating to the asset response.

Recommended remediation

Encode the value as HTML text before embedding it in a `<pre>` element:

import "html"

htmlContent := fmt.Sprintf("<pre>%s</pre>", html.EscapeString(markdownContent))

If rendering Markdown as HTML is not required, return the content as `text/plain; charset=utf-8` instead. If rich Markdown output is intended, convert it with a Markdown processor configured for safe output and sanitize any generated HTML. A restrictive CSP can provide defense in depth but should not replace output encoding. Add an automated regression test proving that `<img>` and other active HTML markup appear as text and are not executed.

Proof of concept
A. Source verification (performed)
  1. Check out the Daptin `v0.13.39` source:

```bash
git clone https://github.com/daptin/daptin.git
cd daptin
git checkout v0.13.39
```

  1. Inspect `server/asset_route_handler.go` for the Markdown branch, especially:

```go
htmlContent := fmt.Sprintf("<pre>%s</pre>", markdownContent)
```

  1. Confirm that the generated `cache.CachedFile` has `MimeType: "text/html; charset=utf-8"` and `IsDownload: false`, and that the route is registered in `server/server.go`.

Observed: All three properties are present in the tagged release. There is no `html.EscapeString` or equivalent output encoding applied to `markdownContent` in this branch.

B. Isolated HTTP and Chromium browser reproduction (performed)

This is a source-equivalent response test to isolate the HTML output handling. It does not run a complete Daptin server, database, or access-control stack.

  1. Save the following as `markdown_asset_browser_poc.py`:

```python
from http.server import HTTPServer, BaseHTTPRequestHandler

class Handler(BaseHTTPRequestHandler):
def do_GET(self):
if self.path != '/asset/tasks/owned-record/notes.md':
self.send_response(404)
self.end_headers()
return

# Harmless marker: no account access, network exfiltration,
# cookie collection, or destructive behavior.
marker = (
'<img src=x onerror="document.body.setAttribute('
"'data-poc-executed','true'"
')">'
)

# Mirrors fmt.Sprintf("<pre>%s</pre>", markdownContent).
html_body = '<pre>%s</pre>' % marker
self.send_response(200)
self.send_header('Content-Type', 'text/html; charset=utf-8')
self.send_header('Content-Disposition', 'inline; filename="notes.md"')
self.end_headers()
self.wfile.write(html_body.encode('utf-8'))

HTTPServer(('127.0.0.1', 18098), Handler).serve_forever()
```

  1. Start the local-only HTTP server:

```bash
python3 markdown_asset_browser_poc.py
```

  1. From another shell, inspect the headers:

```bash
curl -i http://127.0.0.1:18098/asset/tasks/owned-record/notes.md
```

  1. Use Chromium to evaluate the response:

```bash
chromium --headless --no-sandbox --disable-gpu \
--disable-dev-shm-usage --virtual-time-budget=4000 \
--dump-dom \
http://127.0.0.1:18098/asset/tasks/owned-record/notes.md
```

  1. Inspect the browser's DOM output for the harmless attribute:

```html
<body data-poc-executed="true">
```

Observed in the isolated test:

VERIFIED_SOURCE_CONSTRUCTION=true
HTTP/1.0 200 OK
Content-Type: text/html; charset=utf-8
Content-Disposition: inline; filename="notes.md"
BROWSER_SCRIPT_EXECUTED=true

Chromium's DOM showed `data-poc-executed="true"`, demonstrating that the unescaped HTML can execute browser-side script when delivered with those content semantics and without a blocking CSP.

C. Full-application validation (not yet performed)

For a full end-to-end confirmation, the following test should be performed only in a locally controlled Daptin instance:

  1. Deploy Daptin v0.13.39 with a test database and two test accounts, Author (non-admin) and Reader (a distinct user).
  2. Create or select a table containing a `markdown` column, with access controls permitting Author to update a record and Reader to read it. Record how those permissions were configured.
  3. As Author, store the harmless marker from section B in the Markdown column using the normal application API or UI.
  4. Obtain the record's actual `resource_id` and open `GET /asset/{typename}/{resource_id}/{columnname}` in Reader's authenticated Chromium session. Use the actual column name and resource UUID. Do not substitute the illustrative `tasks/owned-record/notes.md` path for a real record.
  5. Confirm (a) the response status, (b) the `Content-Type` and any CSP headers, and (c) whether the marker changes Reader's DOM. Also test a normal plain-text value as a control.
  6. If cross-user execution occurs, capture a minimal redacted HTTP request/response and a screenshot of the DOM marker for the maintainer. Do not extract secrets or perform state-changing actions beyond the test marker.

This end-to-end test remains outstanding and is not presented as completed evidence.

Impact

Type: Potential stored cross-site scripting (CWE-79).

Affected users: Users who load attacker-influenced Markdown assets in browsers where the application's normal page origin is trusted and no effective CSP prevents inline event handlers.

Potential consequences, subject to end-to-end confirmation:

  • Execution of attacker-controlled JavaScript in the origin where Daptin is hosted.
  • Browser-mediated actions under the viewing user's privileges, where cookies and other session mechanisms permit such actions.
  • Reading page-accessible data available to the victim's browser, limited by browser security controls and the application's authorization policies.

Important limitations: No real victim account compromise, data exfiltration, session theft, unauthorized database access, or privilege escalation has been demonstrated. Full exploitability depends on an attacker-accessible Markdown write path, a victim-readable record, the asset URL being opened, and deployment-specific CSP/security headers. These prerequisites should be independently verified before a final CVSS score or stronger impact claims are assigned.

The affected rendering pattern was confirmed specifically in v0.13.39. Earlier releases have not been checked individually. See the maintainer resolution below for the verified fix and patched release.

CVE Request

We respectfully request that the maintainers review and reproduce this finding, determine its security impact, and, if accepted as a vulnerability, coordinate remediation and request/assign a CVE identifier through the appropriate process.

We request acknowledgment of the following researchers as co-discoverers:

Name: Sithum Shihara
GitHub: @zaara2004
Email: zaara98zaara@gmail.com

Name: Sanidi Peiris
GitHub: @sanidipeiris-alt
Email: sanidi.peiris@gmail.com

We are willing to provide further reproducibility details or validate a proposed fix privately. Please keep technical disclosure coordinated until remediation is available.

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-3cj7-fc64-8q3v https://github.com/daptin/daptin/security/advisories/GHSA-3cj7-fc64-8q3v. Original reporter credits are retained.

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:L
AltoBajoNinguno
IntegridadI:L
AltoBajoNinguno
DisponibilidadA:N
AltoBajoNinguno
Versiones

Rangos afectados

Afectada Corregida Última
github.com/daptin/daptin< 0.13.45
0.13.45
v0.13.57
Remediación

Estado del parche por paquete

Paquete / productoEstadoCorregida enDesde divulgaciónÚltima versión
gogithub.com/daptin/daptin
Corregida v0.13.45 2 d v0.13.57 no afectada
Versiones corregidas0.13.45v0.13.45
Explotación

Arsenal público

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

Referencias
Advisoryhttps://github.com/daptin/daptin/security/advisories/GHSA-chg3-v4pp-8fq3

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