{"id":"CVE-2026-35613","aliases":["CVE-2026-35613","GHSA-9h9m-rr67-9jpg"],"related":[],"kind":"vulnerability","state":"published","title":"Path traversal in coursevault-preview due to improper base-directory boundary validation","summary":"coursevault-preview is a utility for previewing course material files from a configured directory. coursevault-preview versions prior to 0.1.1 contain a path traversal vulnerability in the resolveSafe utility. The boundary check used String.prototype.startsWith(baseDir) on a normalized path, which does not enforce a directory boundary. An attacker who controls the relativePath argument to affected CoursevaultPreview methods may be able to read files outside the configured baseDir when a sibling directory exists whose name shares the same string prefix. This vulnerability is fixed in 0.1.1.","summarySource":"cvelist","descriptions":[{"lang":"en","text":"coursevault-preview is a utility for previewing course material files from a configured directory. coursevault-preview versions prior to 0.1.1 contain a path traversal vulnerability in the resolveSafe utility. The boundary check used String.prototype.startsWith(baseDir) on a normalized path, which does not enforce a directory boundary. An attacker who controls the relativePath argument to affected CoursevaultPreview methods may be able to read files outside the configured baseDir when a sibling directory exists whose name shares the same string prefix. This vulnerability is fixed in 0.1.1.","source":"cvelist"},{"lang":"en","text":"## Summary\n\n`coursevault-preview` versions prior to `0.1.1` contain a path traversal vulnerability in the `resolveSafe` utility. The boundary check used `String.prototype.startsWith(baseDir)` on a normalized path, which does not enforce a directory boundary. An attacker who controls the `relativePath` argument to affected `CoursevaultPreview` methods may be able to read files outside the configured `baseDir` when a sibling directory exists whose name shares the same string prefix.\n\n## Details\n\nThe vulnerable code in `src/utils/errors.ts`:\n\n```ts\nif (!full.startsWith(base)) {   // ← insufficient\n  throw new Error(\"Path escapes the base directory\");\n}\n```\n\nBecause the check is a raw string prefix test rather than a path-boundary test, the following bypass is possible:\n\n```\nbaseDir  = \"/srv/courses\"\npayload  = \"../courses-admin/config.json\"\nresolved = \"/srv/courses-admin/config.json\"\n\n\"/srv/courses-admin/config.json\".startsWith(\"/srv/courses\") // → true ✗\n```\n\nAny file whose absolute path begins with the `baseDir` string — including files in sibling directories that share a name prefix — passes the guard and can be accessed by the caller through affected file-access methods.\n\nThe fix replaces the check with a separator-aware comparison:\n\n```ts\nif (full !== base && !full.startsWith(base + sep)) {\n  throw new Error(\"Path escapes the base directory\");\n}\n```\n\n## Impact\n\nAn application that passes untrusted input as the `relativePath` argument to affected file-access methods may expose file contents outside the intended directory.\n\n1. Attacker control over the `relativePath` parameter.\n2. A sibling directory on the filesystem whose name shares a string prefix with `baseDir`.\n\nThere is no network exposure in the package itself; impact is limited to local file disclosure within the host process's file system permissions.","format":"markdown","source":"ghsa"},{"lang":"es","text":"coursevault-preview es una utilidad para previsualizar archivos de material de curso desde un directorio configurado. Las versiones de coursevault-preview anteriores a la 0.1.1 contienen una vulnerabilidad de salto de ruta en la utilidad resolveSafe. La comprobación de límites utilizaba String.prototype.startsWith(baseDir) en una ruta normalizada, lo que no impone un límite de directorio. Un atacante que controla el argumento relativePath de los métodos afectados de CoursevaultPreview podría leer archivos fuera del baseDir configurado cuando existe un directorio hermano cuyo nombre comparte el mismo prefijo de cadena. Esta vulnerabilidad está corregida en la 0.1.1.","source":"nvd"}],"published":"2026-04-07T16:39:44.237Z","modified":"2026-10-26T21:10:00.170Z","severity":{"scorer":"GitHub_M","scheme":"CVSS:3.1","vector":"CVSS:3.1/AV:L/AC:H/PR:N/UI:N/S:U/C:H/I:N/A:N","score":5.1,"rating":"MEDIUM"},"severities":[{"scorer":"GitHub_M","scheme":"CVSS:3.1","vector":"CVSS:3.1/AV:L/AC:H/PR:N/UI:N/S:U/C:H/I:N/A:N","score":5.1,"rating":"MEDIUM"},{"scorer":"GitHub","scheme":"CVSS:3.1","vector":"CVSS:3.1/AV:L/AC:H/PR:N/UI:N/S:U/C:H/I:N/A:N","score":5.1,"rating":"MEDIUM"},{"scorer":"NVD","scheme":"CVSS:3.1","vector":"CVSS:3.1/AV:L/AC:H/PR:L/UI:N/S:U/C:H/I:N/A:N","score":4.7,"rating":"MEDIUM"}],"cwes":["CWE-22"],"affected":[{"ranges":[{"version":"< 0.1.1","status":"affected"}],"vendor":"moritzmyrz","product":"coursevault-preview","source":"cvelist"},{"ranges":[{"type":"semver","introduced":"0","status":"affected","fixed":"0.1.1"}],"ecosystem":"npm","package":"coursevault-preview","purl":"pkg:npm/coursevault-preview","source":"ghsa"},{"ranges":[{"status":"affected","fixed":"0.1.1"}],"vendor":"moritzmyrz","product":"coursevault-preview","cpe":"cpe:2.3:a:moritzmyrz:coursevault-preview:*:*:*:*:*:node.js:*:*","source":"nvd"}],"references":[{"url":"https://github.com/moritzmyrz/coursevault-preview/security/advisories/GHSA-9h9m-rr67-9jpg","tags":["exploit","vendor-advisory","web","x-refsource-confirm"],"sources":["cvelist","ghsa","nvd"]},{"url":"https://nvd.nist.gov/vuln/detail/CVE-2026-35613","tags":["advisory"],"sources":["ghsa"]},{"url":"https://github.com/moritzmyrz/coursevault-preview","tags":["package"],"sources":["ghsa"]}],"credits":[],"assigner":"GitHub_M","ssvc":{"scorer":"CISA-ADP","exploitation":"none","automatable":"no","technicalImpact":"partial","date":"2026-04-09T15:08:47.329Z"},"sources":[{"source":"cvelist","name":"CVE List","id":"CVE-2026-35613","url":"https://www.cve.org/CVERecord?id=CVE-2026-35613","licence":"CVE Terms of Use","modified":"2026-04-09T16:18:16.501Z"},{"source":"ghsa","name":"GitHub Advisory Database","id":"GHSA-9h9m-rr67-9jpg","url":"https://github.com/advisories/GHSA-9h9m-rr67-9jpg","licence":"CC-BY-4.0","modified":"2026-04-08T00:27:17.222Z"},{"source":"nvd","name":"NVD","id":"CVE-2026-35613","url":"https://nvd.nist.gov/vuln/detail/CVE-2026-35613","licence":"Public domain","modified":"2026-10-26T21:10:00.170Z"}],"updatedAt":"2026-11-25T22:59:18.136Z","epss":{"score":0.00115,"percentile":0.01729,"date":"2026-12-01T12:00:22.000Z"}}