Skip to main content
Vulnerability Database/CVE-2024-55659

CVE-2024-55659: B3log Siyuan Path Traversal Vulnerability

CVE-2024-55659 is a path traversal flaw in B3log Siyuan that enables arbitrary file writes and stored XSS attacks. This article covers the technical details, affected versions, security impact, and mitigation strategies.

Published:

Disclaimer: This content was generated using AI. While we strive for accuracy, please verify critical information with official sources.

Sources: National Vulnerability Database, CISA KEV, Exploit-DB

CVE-2024-55659 Overview

CVE-2024-55659 affects SiYuan, an open-source personal knowledge management system developed by B3log. The /api/asset/upload endpoint allows attackers to write arbitrary files to the host filesystem outside the intended workspace directory. The same flaw enables stored cross-site scripting (XSS) through the uploaded content. The vulnerability is classified as a path traversal weakness [CWE-22] and affects all SiYuan versions prior to 3.1.16. The maintainers patched the issue in version 3.1.16 by enforcing workspace boundary validation on resource paths.

Critical Impact

Unauthenticated network attackers can write files to arbitrary locations on the host and inject persistent scripts that execute in the context of SiYuan users.

Affected Products

  • B3log SiYuan versions prior to 3.1.16
  • SiYuan 3.1.15 and earlier releases
  • Self-hosted SiYuan desktop and server deployments

Discovery Timeline

  • 2024-12-12 - CVE-2024-55659 published to NVD
  • 2026-06-17 - Last updated in NVD database

Technical Details for CVE-2024-55659

Vulnerability Analysis

The vulnerability resides in SiYuan's asset upload and resource handling logic. The /api/asset/upload endpoint accepted user-controlled paths without validating that the resolved path remained within the application's workspace directory. Attackers can supply path traversal sequences to place arbitrary files anywhere the SiYuan process can write.

Because SiYuan renders uploaded assets inside the application UI, the file write primitive also doubles as a stored XSS vector. An attacker can upload HTML or JavaScript payloads that execute when a victim views the asset. The combined impact includes host-level file placement and client-side script execution against authenticated SiYuan users.

Root Cause

The root cause is missing boundary validation on paths passed to filesystem operations. Functions in kernel/api/template.go and kernel/model/export.go joined user-supplied path components with the workspace directory using filepath.Join without verifying that the resolved absolute path stayed inside the workspace. Traversal sequences such as ../ escaped the intended directory.

Attack Vector

Exploitation requires network access to the SiYuan API. An attacker sends a crafted upload request to /api/asset/upload with a filename or resource path containing traversal segments. No prior authentication is required, and no user interaction is needed for the file write. Triggering the stored XSS requires a user to load the uploaded asset in the SiYuan client.

go
// Patch excerpt: kernel/api/template.go
		return
	}

+	if !util.IsAbsPathInWorkspace(p) {
+		ret.Code = -1
+		ret.Msg = "Path [" + p + "] is not in workspace"
+		return
+	}
+
	preview := false
	if previewArg := arg["preview"]; nil != previewArg {
		preview = previewArg.(bool)

The patch introduces an IsAbsPathInWorkspace check that rejects any resolved path falling outside the workspace root. A similar guard was added in kernel/model/export.go for resource paths processed during export. Source: SiYuan Security Patch Commit.

Detection Methods for CVE-2024-55659

Indicators of Compromise

  • Files written outside the SiYuan workspace directory, especially in system or user profile paths
  • Uploaded assets containing HTML, SVG, or JavaScript content types not expected in a knowledge base
  • Unexpected .html, .js, or script-bearing files appearing in SiYuan asset directories

Detection Strategies

  • Inspect HTTP request logs for calls to /api/asset/upload containing .., URL-encoded %2e%2e, or absolute path components in parameters
  • Monitor filesystem events for file creation by the SiYuan process outside the configured workspace path
  • Review stored assets for files whose MIME type does not match their declared extension

Monitoring Recommendations

  • Enable application-level logging on the SiYuan API gateway and forward events to a centralized SIEM for correlation
  • Alert on write operations by the SiYuan process to directories outside its workspace root
  • Track outbound connections from browsers rendering SiYuan content to flag XSS-driven exfiltration attempts

How to Mitigate CVE-2024-55659

Immediate Actions Required

  • Upgrade SiYuan to version 3.1.16 or later, which contains the official fix for the path traversal and XSS issues
  • Restrict network exposure of the SiYuan API to trusted networks or authenticated reverse proxies
  • Audit the workspace and host filesystem for files created outside expected asset directories since deployment

Patch Information

The fix is included in SiYuan 3.1.16 and tracked in GitHub Security Advisory GHSA-fqj6-whhx-47p7. The code change is available in the upstream patch commit, which adds util.IsAbsPathInWorkspace checks to template and export handlers.

Workarounds

  • Place SiYuan behind a reverse proxy that blocks requests to /api/asset/upload containing traversal patterns
  • Run SiYuan under a dedicated low-privilege user account with filesystem write access limited to the workspace directory
  • Disable or firewall the SiYuan API endpoint on multi-user hosts until the patched version is deployed
bash
# Example reverse proxy rule to block traversal in upload paths
location /api/asset/upload {
    if ($request_uri ~* "(\.\./|%2e%2e)") {
        return 403;
    }
    proxy_pass http://siyuan_backend;
}

Disclaimer: This content was generated using AI. While we strive for accuracy, please verify critical information with official sources.

Sources: National Vulnerability Database, CISA KEV, Exploit-DB

Experience the Most Advanced Cybersecurity Platform

See how the world’s most intelligent, autonomous cybersecurity platform can protect your organization today and into the future.