The vulnerability is a two-stage attack that leads to arbitrary file reading and Server-Side Request Forgery (SSRF). The root cause is the lack of input sanitization and path validation when handling user-provided markdown content.
First, an attacker uses the /api/filetree/createDocWithMd endpoint, handled by the createDocWithMd function, to create a document containing a malicious markdown link. This link can point to a sensitive local file (e.g., file:///etc/passwd) or an internal network resource. The createDocWithMd function is an initial vulnerable step as it does not validate the URLs within the markdown content it receives.
Second, the attacker triggers the /api/format/netAssets2LocalAssets endpoint. This action invokes the netAssets2LocalAssets0 function, which parses the previously created document. When it encounters the malicious link, the function, prior to being patched, would proceed to fetch the resource. In the case of a file:// URL, it would read the contents of the specified local file. In the case of an http:// URL, it would make a request to the specified server. This lack of validation in netAssets2LocalAssets0 is the core of the vulnerability, allowing the file read or SSRF to occur.
The patch mitigates this by introducing a check (util.IsSensitivePath) within netAssets2LocalAssets0 to block access to a list of known sensitive file paths and directories before any file operations are performed.