Vulnerabilities in pkg:npm/obsidian-local-rest-api
PACKAGEGHSA-62gx-5q78-wrvx is a HIGH (CVSS 8.8) path traversal vulnerability (CWE-22: Improper Limitation of a Pathname to a Restricted Directory ('Path Traversal')) affecting obsidian-local-rest-api libraries in the npm ecosystem. The issue involves authenticated path traversal via url-encoded %2f in /vault/{path} — arbitrary host file read/write/delete. Remediation is available in the latest vendor maintenance releases.
pkg:npm/obsidian-local-rest-api
Vulnerability advisories affecting package pkg:npm/obsidian-local-rest-api. Select an advisory below to view technical details or fixes.
| Advisory ID | CVE / NVD | Severity | Summary |
|---|---|---|---|
| GHSA-62gx-5q78-wrvx | - | HIGH | obsidian-local-rest-api: Authenticated path traversal via URL-encoded %2F in /vault/{path} — arbitrary host file read/write/delete |
GHSA-62gx-5q78-wrvx at a Glance
Security Impact
CVSS: 8.8
The security impact metrics below are parsed directly from the CVSS v3.1 vector string (CVSS:3.1/AV:N/AC:L/PR:L/UI:N/S:U/C:H/I:H/A:H).
How to Fix GHSA-62gx-5q78-wrvx
To remediate this vulnerability, upgrade all affected obsidian-local-rest-api dependencies to a patched release. Both direct and transitive dependencies should be checked, as frameworks or security libraries may pull in vulnerable versions transitively.
npm install obsidian-local-rest-api@Latest secure release
Run the following command in your project directory to verify that all resolved dependencies use the patched release:
npm ls obsidian-local-rest-api
How to Check if You Are Affected
To determine whether your Node.js application is affected by GHSA-62gx-5q78-wrvx, inspect your project dependencies using npm:
npm ls obsidian-local-rest-api
Analyze the terminal output to locate any version of obsidian-local-rest-api in your dependency tree. If any resolved version matches the vulnerable ranges listed in the table below (for example, versions earlier than the patched release), your application is affected.
Note: The npm ls obsidian-local-rest-api command inspects dependencies declared in your package.json and lockfile; it does not perform automated runtime dynamic scanning.
Technical Details
Vulnerability Mechanism & Technical Analysis
This vulnerability is classified under CWE-22: Improper Limitation of a Pathname to a Restricted Directory ('Path Traversal'), where the product uses external input to construct a pathname that is intended to identify a file or directory that is located underneath a restricted parent directory, but the product 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. In obsidian-local-rest-api, software state validation or input boundaries are circumvented during processing. Review the official source advisory statement below for specific affected components, classes, and reproduction details.
Source Advisory Statement
GHSA-62gx-5q78-wrvx Affected obsidian-local-rest-api Versions
1 component(s)| Product / Package | Ecosystem | Affected Versions | Fixed Version |
|---|---|---|---|
|
obsidian-local-rest-api
|
npm |
|
|
References
Frequently Asked Questions
What is GHSA-62gx-5q78-wrvx?
Which obsidian-local-rest-api versions are affected?
What version fixes GHSA-62gx-5q78-wrvx?
Is obsidian-local-rest-api affected?
What is the CVSS score of GHSA-62gx-5q78-wrvx?
What CWE is associated with GHSA-62gx-5q78-wrvx?
How can I check npm dependencies for GHSA-62gx-5q78-wrvx?
Machine-readable OSV JSON
OSV v1.5 Schema
{
"schema_version" : "1.4.0",
"id" : "GHSA-62gx-5q78-wrvx",
"modified" : "2026-07-15T21:56:45Z",
"published" : "2026-07-15T21:56:45Z",
"aliases" : [ ],
"summary" : "obsidian-local-rest-api: Authenticated path traversal via URL-encoded %2F in /vault/{path} — arbitrary host file read/write/delete",
"details" : "### Summary\nThe 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.\n\n### Details\n**Framework:** Express (`import express from \"express\"`; routes registered via `this.api.route(\"/vault/*\")…`).\n\n**The vulnerable line** — in `src/requestHandler.ts`, every vault handler (`vaultGet`, `vaultPut`, `vaultPatch`, `vaultPost`, `vaultDelete`) derives the path like this:\n ```ts\n const rawPath = decodeURIComponent(\n req.path.slice(req.path.indexOf(\"/\", 1) + 1),\n );\n ```\nThe 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.\n\n**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.\n\n**The fix already exists in your code — for MOVE only.** `vaultMove` confines correctly:\n ```ts\n const syntheticRoot = \"/vault\";\n const resolved = posix.resolve(syntheticRoot, normalized);\n if (resolved !== syntheticRoot && !resolved.startsWith(syntheticRoot + \"/\")) {\n this.returnCannedResponse(res, { errorCode: ErrorCode.PathTraversalNotAllowed });\n return;\n }\n ```\nGET/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 `..`.\n\n### PoC\nPrereq: 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).\n\n ```bash\n # READ outside the vault (returns 200 + the target file's real bytes):\n curl --path-as-is -k -H \"Authorization: Bearer $API_KEY\" \\\n \"https://127.0.0.1:27124/vault/..%2F..%2F..%2F..%2Fetc%2Fpasswd\"\n\n # WRITE outside the vault (creates a file on disk outside the vault root):\n curl --path-as-is -k -X PUT -H \"Authorization: Bearer $API_KEY\" --data \"pwned\" \\\n \"https://127.0.0.1:27124/vault/..%2F..%2F..%2Ftmp%2Fcanary.txt\"\n ```\n\n`--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.\n\n### Impact\nAuthenticated 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.\n\nThis vulnerability was reported by Caleb Brisbin through responsible disclosure.",
"severity" : [ {
"type" : "CVSS_V3",
"score" : "CVSS:3.1/AV:N/AC:L/PR:L/UI:N/S:U/C:H/I:H/A:H"
} ],
"affected" : [ {
"package" : {
"ecosystem" : "npm",
"name" : "obsidian-local-rest-api"
},
"ranges" : [ {
"type" : "ECOSYSTEM",
"events" : [ {
"introduced" : "0"
} ]
} ],
"database_specific" : {
"last_known_affected_version_range" : "< 4.1.3"
}
} ],
"references" : [ {
"type" : "WEB",
"url" : "https://github.com/coddingtonbear/obsidian-local-rest-api/security/advisories/GHSA-62gx-5q78-wrvx"
}, {
"type" : "PACKAGE",
"url" : "https://github.com/coddingtonbear/obsidian-local-rest-api"
}, {
"type" : "WEB",
"url" : "https://github.com/coddingtonbear/obsidian-local-rest-api/releases/tag/4.1.3"
} ],
"database_specific" : {
"cwe_ids" : [ "CWE-22" ],
"severity" : "HIGH",
"github_reviewed" : true,
"github_reviewed_at" : "2026-07-15T21:56:45Z",
"nvd_published_at" : null
}
}