CVE-2026-35613
JSON

5.1medium

Path traversal in coursevault-preview due to improper base-directory boundary validation

Severity
5.1medium CVSS:3.1 by GitHub_M
Exploit likelihood
0.11% (higher than 1% of CVEs; EPSS, by FIRST)
Published
Last changed
Assigned by
GitHub_M
Also known as
GHSA-9h9m-rr67-9jpg

Description

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.

Affected

Product or packageVersionsReported by
moritzmyrz coursevault-preview< 0.1.1, before 0.1.1CVE List, NVD
coursevault-preview (npm)before 0.1.1GitHub Advisory Database

All scores

GitHub_M5.1medium CVSS:3.1CVSS:3.1/AV:L/AC:H/PR:N/UI:N/S:U/C:H/I:N/A:N
GitHub5.1medium CVSS:3.1CVSS:3.1/AV:L/AC:H/PR:N/UI:N/S:U/C:H/I:N/A:N
NVD4.7medium CVSS:3.1CVSS:3.1/AV:L/AC:H/PR:L/UI:N/S:U/C:H/I:N/A:N

Classification

CWE-22

SSVC (CISA-ADP): exploitation none, automatable no, technical impact partial.

What each source says

CVE List

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.

GitHub Advisory Database

Summary

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.

Details

The vulnerable code in src/utils/errors.ts:

if (!full.startsWith(base)) {   // ← insufficient
  throw new Error("Path escapes the base directory");
}

Because the check is a raw string prefix test rather than a path-boundary test, the following bypass is possible:

baseDir  = "/srv/courses"
payload  = "../courses-admin/config.json"
resolved = "/srv/courses-admin/config.json"

"/srv/courses-admin/config.json".startsWith("/srv/courses") // → true ✗

Any 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.

The fix replaces the check with a separator-aware comparison:

if (full !== base && !full.startsWith(base + sep)) {
  throw new Error("Path escapes the base directory");
}

Impact

An application that passes untrusted input as the relativePath argument to affected file-access methods may expose file contents outside the intended directory.

  1. Attacker control over the relativePath parameter.
  2. A sibling directory on the filesystem whose name shares a string prefix with baseDir.

There is no network exposure in the package itself; impact is limited to local file disclosure within the host process's file system permissions.

NVD (es)

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.

References

Sources

SourceRecordLicence
CVE ListCVE-2026-35613 changed 2026-04-09CVE Terms of Use
GitHub Advisory DatabaseGHSA-9h9m-rr67-9jpg changed 2026-04-08CC-BY-4.0
NVDCVE-2026-35613 changed 2026-10-26Public domain