@Mockoon/commons-server: Path traversal in templated `filePath` lets a request escape the served directory (prefix-only base check) (CVE-2026-59149)
A path traversal vulnerability in @mockoon/commons-server allows unauthenticated clients to read files outside the intended served directory. The vulnerability arises because the path validation uses a prefix string check that can be bypassed by crafted relative paths, enabling access to sibling directories. This affects versions prior to 9.7.0. A fix is available.
AI Analysis
Technical Summary
The vulnerability exists in the getSafeFilePath function of @mockoon/commons-server where the static base directory is checked using a string prefix match (resolvedPath.startsWith(staticBaseDir)) without ensuring a path separator boundary. This allows a crafted filePath containing '../' sequences to escape the intended directory and access files in sibling directories whose absolute paths start with the base directory string. The filePath is request-controlled via templating, affecting all FILE response types. The issue is confirmed in versions before 9.7.0. A proof-of-concept demonstrates reading sensitive files outside the served directory.
Potential Impact
An unauthenticated attacker can read arbitrary files on the server outside the intended served directory, potentially exposing sensitive information. The vulnerability does not allow modification or deletion of files, only read access. The CVSS score is 6.5 (medium severity) with network attack vector, low attack complexity, no privileges required, user interaction required, and high confidentiality impact.
Mitigation Recommendations
A patch is available for this vulnerability. Users should upgrade @mockoon/commons-server to version 9.7.0 or later where the path traversal issue is fixed by properly validating file paths with path separator boundaries. Until patched, avoid using request-controlled data in filePath templates or implement additional path validation to prevent directory traversal.
@Mockoon/commons-server: Path traversal in templated `filePath` lets a request escape the served directory (prefix-only base check) (CVE-2026-59149)
Description
A path traversal vulnerability in @mockoon/commons-server allows unauthenticated clients to read files outside the intended served directory. The vulnerability arises because the path validation uses a prefix string check that can be bypassed by crafted relative paths, enabling access to sibling directories. This affects versions prior to 9.7.0. A fix is available.
CVSS v3.1
Score 6.5medium
Affected software
Run on your own infrastructure? Check whether these packages are installed with threat-finder — our free open-source scanner.
AI-Powered Analysis
Machine-generated threat intelligence
Technical Analysis
The vulnerability exists in the getSafeFilePath function of @mockoon/commons-server where the static base directory is checked using a string prefix match (resolvedPath.startsWith(staticBaseDir)) without ensuring a path separator boundary. This allows a crafted filePath containing '../' sequences to escape the intended directory and access files in sibling directories whose absolute paths start with the base directory string. The filePath is request-controlled via templating, affecting all FILE response types. The issue is confirmed in versions before 9.7.0. A proof-of-concept demonstrates reading sensitive files outside the served directory.
Potential Impact
An unauthenticated attacker can read arbitrary files on the server outside the intended served directory, potentially exposing sensitive information. The vulnerability does not allow modification or deletion of files, only read access. The CVSS score is 6.5 (medium severity) with network attack vector, low attack complexity, no privileges required, user interaction required, and high confidentiality impact.
Mitigation Recommendations
A patch is available for this vulnerability. Users should upgrade @mockoon/commons-server to version 9.7.0 or later where the path traversal issue is fixed by properly validating file paths with path separator boundaries. Until patched, avoid using request-controlled data in filePath templates or implement additional path validation to prevent directory traversal.
Technical Details
- Gcve Source
- db.gcve.eu
- Osv Id
- GHSA-8wqc-v2q8-vff2
- Osv Schema Version
- 1.4.0
- Aliases
- ["CVE-2026-59149"]
- Ecosystems
- ["npm"]
- Database Specific Severity
- MODERATE
- Cvss Version
- 3.1
Threat ID: 6aa49ff455bf5e2cf5a863d8
Added to database: 09/12/2026, 00:42:28 UTC
Last enriched: 09/12/2026, 00:45:26 UTC
Last updated: 09/12/2026, 00:45:26 UTC
Views: 1
Community Reviews
0 reviewsCrowdsource mitigation strategies, share intel context, and vote on the most helpful responses. Sign in to add your voice and help keep defenders ahead.
Want to contribute mitigation steps or threat intel context? Sign in or create an account to join the community discussion.
Actions
Updates to AI analysis require Pro Console access. Upgrade inside Console → Billing.
Need more coverage?
Upgrade to Pro Console for AI refresh and higher limits.
For incident response and remediation, OffSeq services can help resolve threats faster.
Latest Threats
Check if your credentials are on the dark web
Instant breach scanning across billions of leaked records. Free tier available.