Skip to main content
← Vulnerabilities

obsidian-local-rest-api: Authenticated path traversal via URL-encoded %2F in /vault/{path} — arbitrary host file read/write/delete

Exploited
No known exploitation
Fix
Fixed in 4.1.3
Who is exposed
Specific setups only

Do first: Check whether your setup matches what the bug needs. Plugin version 4.1.2 or earlier is affected (fixed in 4.1.3). Obsidian must be running with the Local REST API plugin enabled and the attacker must hold its API key.

Published
Last modified
25/100
Specific setups only
High (ghsa)
None on Exploit-DB, Metasploit or GitHub

Summary

The obsidian-local-rest-api plugin for Obsidian has a path traversal flaw in its vault file endpoints. An authenticated client can use URL-encoded path separators to read, modify, or delete arbitrary files on the host system with the privileges of the Obsidian process.

Written by anthropic/claude-haiku-5.5 from the sources below. Verify against them.

Read the original description

The Local REST API's /vault/{path} endpoints (GET/PUT/PATCH/POST/DELETE) percent-decode the request path *inside the handler — after* Express has already routed and normalized it, then hand it to the Obsidian vault adapter with no confinement check. A literal ../ is resolved/rejected at the routing layer (→ 404), but %2F is not a separator there, so ..%2F..%2F survives routing and is only turned into a real / by the handler's decodeURIComponent, reconstituting a ../ traversal that walks out of the vault. An authenticated client can read, write, or delete arbitrary files on the host with the Obsidian process's privileges.

Details

Framework: Express (import express from "express"; routes registered via this.api.route("/vault/*")…).

The vulnerable line — in src/requestHandler.ts, every vault handler (vaultGet, vaultPut, vaultPatch, vaultPost, vaultDelete) derives the path like this: ``ts const rawPath = decodeURIComponent( req.path.slice(req.path.indexOf("/", 1) + 1), ); ` The path is decodeURIComponent'd **after** Express routing. A literal ../ is collapsed/rejected at the routing layer, but %2F isn't a separator there — so ..%2F..%2F reaches the handler intact and this decodeURIComponent turns it into a real ../../. **The string routing saw (…%2F…) is not the string the handler uses (…/…)**, and %2e%2e` behaves the same way.

No confinement on the decoded path. The handlers pass rawPath straight to the vault adapter — e.g. this.app.vault.adapter.readBinary(filePath) / this.app.vault.getAbstractFileByPath(filePath) — with no path.resolve + vault-root prefix check, so the reconstituted ../../ escapes.

The fix already exists in your code — for MOVE only. vaultMove confines correctly: ``ts const syntheticRoot = "/vault"; const resolved = posix.resolve(syntheticRoot, normalized); if (resolved !== syntheticRoot && !resolved.startsWith(syntheticRoot + "/")) { this.returnCannedResponse(res, { errorCode: ErrorCode.PathTraversalNotAllowed }); return; } ` GET/PUT/PATCH/POST/DELETE lack this guard. **Apply the same posix.resolve(syntheticRoot, …) + startsWith check to the decoded path in every vault handler**, and reject any segment that decodes to ..`.

PoC

Prereq: a running Obsidian with the Local REST API plugin enabled and its configured API key ($API_KEY). Targets below are Unix; adjust per OS (e.g. ..%2F..%2FWindows%2Fwin.ini on Windows).

```bash

READ outside the vault (returns 200 + the target file's real bytes):

curl --path-as-is -k -H "Authorization: Bearer $API_KEY" \ "https://127.0.0.1:27124/vault/..%2F..%2F..%2F..%2Fetc%2Fpasswd"

WRITE outside the vault (creates a file on disk outside the vault root):

curl --path-as-is -k -X PUT -H "Authorization: Bearer $API_KEY" --data "pwned" \ "https://127.0.0.1:27124/vault/..%2F..%2F..%2Ftmp%2Fcanary.txt" ```

--path-as-is stops curl from collapsing .. client-side. A plain ../ (unencoded) request returns 404 — only the %2F/%2e%2e encoded form bypasses, confirming the decode-after-routing gap.

Impact

Authenticated arbitrary file read / write / delete outside the Obsidian vault, with the OS privileges of the Obsidian process — typically the user's home directory (SSH keys, browser profiles, dotfiles, credentials). Amplified in MCP/LLM-agent deployments: this API is widely used as an MCP server, so a prompt-injection in vault content (or a malicious MCP client) can make an agent emit a %2F path — turning "the agent can edit my notes" into "the agent can read/write any file on the host," with no user intent to grant filesystem access beyond the vault.

This vulnerability was reported by Caleb Brisbin through responsible disclosure.

cve.now Index

25cve.now Index 25 of 100 · methodology v3
  • Exploitation?/40Unknown. No CISA SSVC exploitation rating yet
  • Exposure8/25Specific setups only, reachable over the network
  • Reach10/20Affects npm packages
  • Severity7/10Rated high by ghsa
  • No patch0/5No signal

What would change the score

  • Would score about 75 if added to CISA KEV
  • Would score about 70 if CISA's SSVC rates exploitation active
  • Would score about 32 if CISA's SSVC rates it automatable

Impact

  • Widely used

    obsidian-local-rest-api has 1.5k weekly downloads.Source: npmjs.com

What to do

  • Check whether your setup matches what the bug needs.

    Plugin version 4.1.2 or earlier is affected (fixed in 4.1.3). Obsidian must be running with the Local REST API plugin enabled and the attacker must hold its API key.
  • Upgrade to a fixed version: 4.1.3.

Timeline

  1. Advisory published110 days
  2. Record last updated

Affected versions

Evidence 4

  1. Advisory
  2. Repository
  3. Repository
  4. Repository

Corrections

None so far.

Something wrong on this page? Report an error. Every fix is listed here.

Questions about GHSA-62GX-5Q78-WRVX

Is GHSA-62GX-5Q78-WRVX being exploited?

It is not in CISA's Known Exploited Vulnerabilities catalog, and CISA's SSVC assessment does not mark exploitation as active. That does not mean it has not been attacked: vendors and researchers can report attacks before CISA lists them. No public exploit code is tracked.Source: cve.now feed data

What does this mean?

The plugin's /vault/{path} endpoint does not properly handle URL-encoded slashes (%2F) in the path. A caller holding the API key can use this to reach files outside the Obsidian vault and read, write, or delete them with the privileges of the Obsidian process.Source: github.com

Which versions are affected by GHSA-62GX-5Q78-WRVX?

obsidian-local-rest-api (npm): before 4.1.3.Source: cve.now feed data

Am I affected, and how do I check?

Plugin versions 4.1.2 and earlier are affected, provided the Local REST API plugin is enabled in a running Obsidian. To check, open the plugin's settings in Obsidian and look at the installed version.Source: github.com

How do I fix GHSA-62GX-5Q78-WRVX?

Update obsidian-local-rest-api to version 4.1.3, which contains the fix. Affected versions 4.1.2 and earlier should not be used.Source: github.com