llamaCVEVulnerability Intelligence
/
Advisory · GitHub · Go · github.com/siyuan-note/siyuan

GHSA-JF98-M24W-GM9M

Admin path traversal in exportBrowserHTML via folder allows out-of-workspace arbitrary-content index.html write

Parche disponible
Descargar PNG JSON
CVSS 3.1
7.6
Alta
CVSS:3.1/AV:N/AC:L/PR:H/UI:N/S:C/C:N/I:H/A:L Fuente: GitHub
ExplotaciónSin evidenciaNo figura en CISA KEV
Exploits públicos0Ninguno conocido
Parche1 versiónPrimer parche a 7 d de la divulgación
Exposición71 dDesde la divulgación, 10 sept 2026, 10:05 a. m.
Detección70 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 v3.8.4+incompatible
Monitoreo
Detectada +1
10 sept 26
17 sept 26
28 sept 26
20 nov 26
10 sept 26
28 sept 26
16 oct 26
2 nov 26
20 nov 26
FechaFaseEventoDetalle
Divulgación Publicada GHSA-JF98-M24W-GM9M divulgada · CVSS 7.6 (GitHub)
Remediación Parche v3.8.4+incompatible github.com/siyuan-note/siyuan · 7 d desde divulgación
Divulgación Modificada Última actualización del registro
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
`exportBrowserHTML` (`kernel/api/export.go:842-875`) binds the request `folder` field with no `..`/containment check, then builds `tmpDir := filepath.Join(util.TempDir, "export", folder)` and writes `index.html` at that path via `filelock.WriteFile(htmlPath, []byte(htmlContent))` with fully attacker-controlled, unfiltered HTML/JS content. A `..`-laden `folder` escapes the export directory, letting an authenticated administrator write/overwrite `index.html` with arbitrary content anywhere the kernel process can write (a served web root, another workspace's export dir). This route additionally has no `CheckReadonly`, so it is exploitable even in read-only mode. This is the strongest-content-control member of the siyuan path-traversal write family (same CWE-22 root cause and admin tier as accepted advisory GHSA-94vh-rpgr-rpwc).

## Root Cause
`util.ParseJsonArgs(arg, ret, util.BindJsonArg("folder", &folder, true, true), util.BindJsonArg("html", &htmlContent, true, true), ...)` (export.go:852-855) only trims + enforces non-empty. The only conditional guard is the encrypted-box check at export.go:862 — `if parts := strings.SplitN(folder, "/", 2); len(parts) >= 1 && ast.IsNodeIDPattern(parts[0]) && model.IsEncryptedBox(parts[0])` — which sets `boxID` only when `parts[0]` is a valid NodeID. A `..`-leading `folder` fails `ast.IsNodeIDPattern(parts[0])`, so `boxID` stays `""` and the check is skipped entirely. Then `tmpDir := filepath.Join(util.TempDir, "export", folder)` (export.go:873), `htmlPath := filepath.Join(tmpDir, "index.html")` (export.go:874), and `filelock.WriteFile(htmlPath, []byte(htmlContent))` (export.go:875). `filepath.Join` cleans but does not reject `..`, so the path escapes `TempDir/export`. `htmlContent` is written verbatim with no sanitization.

## Impact
An authenticated administrator writes/overwrites `index.html` with arbitrary HTML/JS content at any pre-existing kernel-writable directory outside the workspace — e.g. deface/plant into a served web root (stored XSS against anyone served that path) or overwrite another workspace's export. Fully attacker-controlled content is the strongest of the three sibling findings. Constraint: the escaped parent directory must pre-exist (`filelock.WriteFile`→`WriteFileSafer` does not `MkdirAll`) and the filename is fixed to `index.html`. Escaping the workspace crosses a boundary SiYuan enforces elsewhere (CVSS Scope Changed), consistent with GHSA-94vh-rpgr-rpwc.

Proof of Concept

curl -X POST http://127.0.0.1:6806/api/export/exportBrowserHTML \
  -H "Authorization: token <ADMIN_API_TOKEN>" -H "Content-Type: application/json" \
  -d '{"folder":"../../../../var/www/html","html":"<h1>pwn</h1><script>/*...*/</script>","name":"x"}'
# -> writes /var/www/html/index.html (if /var/www/html exists)

## Attack Chain
1. Entry: `POST /api/export/exportBrowserHTML`, route `CheckAuth, CheckAdminRole` (router.go:421 — no `CheckReadonly`), body `{"folder":"../../../../var/www/html","html":"<script>...</script>","name":"x"}`.
- Action: bind `folder`, `html` raw. Guard: none on `folder` traversal (export.go:852-855). Bypass proof: only conditional is the encrypted-box check at export.go:862, which requires `ast.IsNodeIDPattern(parts[0])`; a `..`-leading folder fails it → `boxID=""` → check skipped.
2. Sink: `tmpDir = Join(TempDir,"export",folder)` (export.go:873); `htmlPath = Join(tmpDir,"index.html")` (export.go:874); `filelock.WriteFile(htmlPath, htmlContent)` (export.go:875). Guard: none; `WriteFileSafer` requires parent dir to pre-exist (no MkdirAll). Bypass proof: `Join(Join(TempDir,"export","../../../../var/www/html"),"index.html")` = `/var/www/html/index.html`; `htmlContent` fully attacker-controlled and unfiltered.
3. Impact: out-of-workspace arbitrary-content `index.html` write (web-root defacement / served-HTML XSS).

## Bypass Evidence
- `filepath.Join` arithmetic re-run with `go run`: `Join(Join("/ws/temp","export","../../../../var/www/html"),"index.html")` = `/var/www/html/index.html`.
- Encrypted-box check at export.go:862 gated on `ast.IsNodeIDPattern(parts[0])`; a `..`-leading folder skips it.
- Route lacks `CheckReadonly` (router.go:421) → exploitable in read-only mode too.
- Version: HEAD `8641553a` == tag v3.8.3 (latest release); `git log v3.8.3..HEAD -- kernel/api/export.go` is empty — vulnerable on the current release.

## Affected Versions
`<= 3.8.3` (github.com/siyuan-note/siyuan, Go). Unpatched on the latest release.

## Suggested Fix
Reject `..`/absolute components in `folder` (or enforce `IsSubPath` against `filepath.Join(util.TempDir, "export")`) before building `tmpDir`.

---
Reported by zx (Jace) — GitHub: @manus-use

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:H
NingunoBajosAltos
InteracciónUI:N
NingunaRequerida
AlcanceS:C
CambiadoSin cambio
ConfidencialidadC:N
AltoBajoNinguno
IntegridadI:H
AltoBajoNinguno
DisponibilidadA:L
AltoBajoNinguno
Versiones

Rangos afectados

Afectada Corregida Última
github.com/siyuan-note/siyuan≤ 3.8.3
3.8.3
v3.8.7+incompatible
Remediación

Estado del parche por paquete

Paquete / productoEstadoCorregida enDesde divulgaciónÚltima versión
gogithub.com/siyuan-note/siyuan
Corregida v3.8.4+incompatible 7 d v3.8.7+incompatible no afectada
Versiones corregidasv3.8.4+incompatible
Explotación

Arsenal público

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

Referencias
Advisoryhttps://github.com/siyuan-note/siyuan/security/advisories/GHSA-jf98-m24w-gm9m

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