GHSA-g7r4-m6w7-qqqr
LOWGHSA-g7r4-m6w7-qqqr is a low-severity (CVSS 2.5) vulnerability in esbuild. O3 Security confirms whether GHSA-g7r4-m6w7-qqqr is actually reachable in your code before you act, and blocks exploitation at runtime until you patch.
esbuild allows arbitrary file read when running the development server on Windows
Blast Radius
Weekly download volume for affected packages — a proxy for how broadly this vulnerability is deployed.
esbuildnpmDescription
Summary
The development server contains a path traversal vulnerability on Windows when serving files from servedir.
Due to the use of path.Clean() (which only normalizes forward-slash / separators) instead of a Windows-aware path normalization function, it is possible to craft requests using backslashes (\) that bypass the intended directory containment logic. An attacker can escape the configured servedir root and access arbitrary files on the filesystem.
This issue affects Windows environments only.
Details
The request path is sanitized using:
// https://github.com/evanw/esbuild/blob/v0.27.3/pkg/api/serve_other.go#L165
queryPath := path.Clean(req.URL.Path)[1:]
However:
path.Clean()is POSIX-style and only understands/(docs:https://pkg.go.dev/path#Clean)- On Windows,
\is a valid path separator path.Clean()does not treat\as a separator
Later, the server constructs the absolute path:
// https://github.com/evanw/esbuild/blob/v0.27.3/pkg/api/serve_other.go#L221
absPath := h.fs.Join(h.servedir, queryPath)
If queryPath contains sequences such as:
..\..\..\..\..\..\..\Windows\system.ini
path.Clean() will not normalize them, but the Windows filesystem will interpret \ as directory separators when resolving absPath.
Because the implementation does not verify that the final resolved path remains within servedir, it allows directory traversal outside the intended root directory.
Vulnerable Code
// https://github.com/evanw/esbuild/blob/v0.27.3/pkg/api/serve_other.go#L165
queryPath := path.Clean(req.URL.Path)[1:]
....
// Check for a file in the "servedir" directory
if h.servedir != "" && kind != fs.FileEntry {
absPath := h.fs.Join(h.servedir, queryPath)
if absDir := h.fs.Dir(absPath); absDir != absPath {
if entries, err, _ := h.fs.ReadDirectory(absDir); err == nil {
if entry, _ := entries.Get(h.fs.Base(absPath)); entry != nil && entry.Kind(h.fs) == fs.FileEntry {
....
Steps to reproduce
npm install --save-exact --save-dev esbuild
echo "console.log(1)" > app.js
.\node_modules\.bin\esbuild --version
0.27.3
.\node_modules\.bin\esbuild app.js --bundle --outdir=www --servedir=www --watch
curl -i --path-as-is "http://localhost:8000/..\..\..\..\..\..\..\Windows\system.ini"
<content of Windows\system.ini>
Impact
- Arbitrary file read on Windows
- Exposure of sensitive files
Affected Packages
| Ecosystem | Package | Vulnerable range | Fix |
|---|---|---|---|
| 📦npm | esbuild | ≥ 0.27.3&&< 0.28.1 | 0.28.1 |
Detection & mitigation playbook
Open-source dependencyDetect
Scan your dependency tree (package-lock.json, pnpm-lock.yaml, requirements.txt, go.sum, etc.) for esbuild. O3's reachability analysis confirms whether the vulnerable code path is actually invoked in your application, so you act on real exposure instead of every transitive match.
Fix
Update esbuild to 0.28.1 or later, then make sure no transitive (indirect) dependency still pins the vulnerable range — O3 confirms GHSA-g7r4-m6w7-qqqr is resolved across your whole dependency graph.
Workarounds
If you can't upgrade right away: gate or disable the affected feature, validate untrusted input at the boundary, and avoid passing attacker-controlled data into the vulnerable path. O3's runtime protection blocks exploitation in production as an interim safeguard until the upgrade lands.
How O3 protects you
O3 pinpoints whether GHSA-g7r4-m6w7-qqqr is reachable in your code and exactly where to fix it, then blocks exploitation in production at runtime until the patched version is deployed.
Tailored to GHSA-g7r4-m6w7-qqqr. Runtime protection reduces exposure until a permanent patch is applied and verified — it complements patching, it doesn't replace it.
Frequently Asked Questions
Is GHSA-g7r4-m6w7-qqqr in your dependencies?
O3 detects GHSA-g7r4-m6w7-qqqr across npm dependencies and uses function-level reachability to confirm whether the vulnerable code path is actually reachable — not just present. No false positives.