Sep 3, 2026·5 min read·31 visits
A validation bypass vulnerability exists in the SiYuan Notebook server's export-handling routing branch, enabling authenticated attackers to perform arbitrary file reads on the host system via path traversal sequences.
An incomplete mitigation in the export-handling logic of SiYuan Notebook allowed authenticated users to bypass directory traversal protections. By crafting a request with percent-encoded path navigation sequences targeting the /export/temp/ route prefix, attackers can trigger an unvalidated short-circuit block that serving arbitrary files from the host server. This bypass renders previous path-traversal mitigations ineffective for the affected endpoint.
The Go-based backend application of SiYuan Notebook (github.com/siyuan-note/siyuan/kernel) exposes a suite of management endpoints, including the /export/ routing group. This group is responsible for packaging and serving generated documents, database snapshots, and workspace backups to users. Security controls are established on this route to ensure file retrieval is confined within strict physical directory bounds.
In previous development cycles, the product was hardened against unauthorized directory traversal (such as under advisory GHSA-6865-qjcf-286f). This patch integrated protective measures like IsSubPath and IsSensitivePath checks. However, these checks were only applied to the primary handling sequence within the /export/ routing branch.
To facilitate the immediate delivery of transient runtime assets, the developer subsequently implemented a short-circuit branch at the very beginning of the /export/ route handler. This branch matches requests under the /export/temp/ path prefix. Because this branch executes prior to, and independent of, the main logic path, it bypasses both the directory limit verification and the sensitive file extraction protections, exposing a raw path-traversal entry point.
The technical flaw resides within the serveExport() function of kernel/server/serve.go. When an HTTP request is received, the routing mechanism processes the request through the Go Standard Library and the Gin Web Framework. During this processing, percent-encoded components in the path (such as %2e%2e) are fully decoded to their raw characters (..) prior to route matching.
The application evaluates the incoming request using a prefix conditional check: strings.HasPrefix(c.Request.URL.Path, "/export/temp/"). If a client submits a request to /export/temp/%2e%2e/%2e%2e/etc/passwd, the router decodes it to /export/temp/../../etc/passwd. Because this decoded string still matches the prefix /export/temp/, the conditional statement evaluates to true.
Once inside this short-circuit block, the application attempts to resolve the file path utilizing filepath.Join(util.TempDir, c.Request.URL.Path). In the Go runtime, filepath.Join inherently executes filepath.Clean on the input string. This function recursively resolves parent directory selectors, moving the target path out of the intended root directory. Because the application then passes the resolved path directly to c.File() without performing any logical validation against parent directory markers or canonical root directory containment, an arbitrary file read is completed.
An examination of the codebase prior to the patch illustrates the structural logic flaw. The route handler maps the file retrieval process without any structural sandboxing in the initial evaluation block:
func serveExport(ginServer *gin.Engine) {
exportGroup := ginServer.Group("/export/", model.CheckAuth)
exportBaseDir := filepath.Join(util.TempDir, "export")
exportGroup.GET("/*filepath", func(c *gin.Context) {
// Vulnerable short-circuit branch
if strings.HasPrefix(c.Request.URL.Path, "/export/temp/") {
c.File(filepath.Join(util.TempDir, c.Request.URL.Path))
return
}
// ... Secure path logic with IsSubPath occurs here, but is never reached ...The patch implemented in commit b763d787d1f2b862c577049e4ee147c5857fe413 fixes this logic vulnerability. It defines a restricted target directory and validates the components before allowing execution to proceed:
exportGroup.GET("/*filepath", func(c *gin.Context) {
if strings.HasPrefix(c.Request.URL.Path, "/export/temp/") {
tempBaseDir := filepath.Join(util.TempDir, "export", "temp")
relativePath := strings.TrimPrefix(c.Request.URL.Path, "/export/temp/")
relativePath = filepath.Clean(relativePath)
// Explicitly block any directory traversal indicators
if strings.Contains(relativePath, "..") {
c.Status(http.StatusUnauthorized)
return
}
fullPath := filepath.Join(tempBaseDir, relativePath)
// Ensure the final resolved path physically sits inside the designated subpath
if !gulu.File.IsSubPath(tempBaseDir, fullPath) {
c.Status(http.StatusUnauthorized)
return
}
c.File(fullPath)
return
}By ensuring the relative path is stripped of the prefix, cleaned, verified against manual parent-traversal patterns, and validated via IsSubPath, the patch prevents any out-of-bounds file serving.
Exploitation of this vulnerability requires that the attacker has authenticated access to the application, satisfying the model.CheckAuth validation layer. The attack is executed via a single HTTP GET request using traversal characters encoded to escape superficial web-application firewall rules.
The target endpoint decodes the percent-encoded %2e%2e sequences to .. before assessing prefix matches. A request format like /export/temp/%2e%2e/%2e%2e/%2e%2e/%2e%2e/etc/passwd successfully triggers the short-circuit branch, traverses the server's directory structure, and outputs the target file contents.
Because the system process context is what executes the c.File() action, the scope of file exposure is constrained only by the operating system-level permissions of the user running the SiYuan process.
The direct impact of this vulnerability is the unauthorized disclosure of sensitive files from the server's local file system. This includes target system files like /etc/passwd, application database files containing proprietary notebook data, and system logs.
While the vulnerability is restricted to read operations and does not facilitate write access, retrieved information can be used to coordinate more complex system compromise campaigns. Accessing environment configuration files may expose database credentials, authentication keys, and API tokens used elsewhere in the environment.
The CVSS v3.1 score is evaluated at 6.5 (Medium). The score reflects that the vulnerability requires low privilege authentication but can be exploited with low complexity over the network, leading to high confidentiality degradation with zero impact on system availability or integrity.
The principal remediation is the direct upgrade of the SiYuan installation to a pseudo-version at or later than 0.0.0-20260510110132-b763d787d1f2 (which integrates the patch commit b763d787d1f2b862c577049e4ee147c5857fe413). This ensures that containment validation logic is enforced even during short-circuit file-serving scenarios.
For deployments where immediate system updates are not viable, administrators should restrict network-level accessibility. Keep the daemon bound strictly to localhost (127.0.0.1) and isolate the network port from untrusted external interfaces.
Additionally, Web Application Firewalls (WAFs) can be configured to filter incoming URI patterns. Rejecting any requests to the /export/ route family that contain percent-encoded directory traversal signatures like %2e%2e or /.. will prevent exploitation attempts.
CVSS:3.1/AV:N/AC:L/PR:L/UI:N/S:U/C:H/I:N/A:N| Product | Affected Versions | Fixed Version |
|---|---|---|
SiYuan siyuan-note | < 0.0.0-20260510110132-b763d787d1f2 | 0.0.0-20260510110132-b763d787d1f2 |
| Attribute | Detail |
|---|---|
| CWE ID | CWE-22 (Improper Limitation of a Pathname to a Restricted Directory) |
| Attack Vector | Network |
| CVSS v3.1 Score | 6.5 (Medium) |
| Impact Type | Confidentiality (High) |
| Exploit Status | Proof-of-Concept |
| CISA KEV Status | Not Listed |
The software uses external input to construct a pathname that is intended to identify a file or directory that is located under a restricted directory, but the software does not properly neutralize special elements within the pathname that can cause the pathname to resolve to a location that is outside of the restricted directory.
A remote code execution vulnerability exists in Microsoft .NET due to untrusted data deserialization within the PresentationCore component. The flaw stems from implicit auto-conversion flags during clipboard data retrieval operations.
An out-of-bounds write vulnerability in Microsoft .NET Framework, .NET runtime, and Visual Studio allows unauthenticated remote attackers to execute arbitrary code via crafted pixel-shader bytecode or auto-converted clipboard payloads.
ASP.NET Core contains a thread deadlock vulnerability (CWE-833) that allows an unauthenticated remote attacker to cause a denial of service over the network by exhausting server thread pool resources.
CVE-2026-70035 is a high-severity Remote Code Execution (RCE) vulnerability in Microsoft .NET Framework, .NET runtime, and Visual Studio caused by improper handling during the deserialization of untrusted data (CWE-502). An unauthenticated attacker can execute arbitrary code within the context of the affected process by delivering a crafted serialized payload.
An elevation of privilege vulnerability exists in ASP.NET Core and Microsoft Visual Studio due to improper synchronization during concurrent thread execution. Authenticated remote attackers with low privileges can exploit a timing window to manipulate shared resources and assume higher-level execution contexts.
A path traversal vulnerability (CWE-22) in Contao CMS allows unauthenticated remote attackers to bypass directory boundary restrictions in ImagesController and access files within the project directory.