GHSA-3p34-w4f6-5xh2
HIGHGHSA-3p34-w4f6-5xh2 is a high-severity (CVSS 7.5) vulnerability in better-helperjs. O3 Security confirms whether GHSA-3p34-w4f6-5xh2 is actually reachable in your code before you act, and blocks exploitation at runtime until you patch.
better-helperjs Vulnerable to Directory Traversal via String Prefix Bypass in Static Server
Real-World Exposure
How broadly this vulnerability is actually deployed: weekly install volume shows current usage, a proxy for how much of the ecosystem is exposed.
better-helperjsnpmDescription
Summary
A directory traversal vulnerability exists in the production static file server of better-helperjs (<= 3.0.5). Attackers can read arbitrary files located in adjacent directory structures that share the same string prefix as the intended static root directory.
Details
The framework utilizes a custom static file server engine used when running in NODE_ENV=production (src/ssr/site-server.ts). Inside the safeStaticPath() method, the requested path is checked against the static root directory to prevent directory traversal out of the designated public folder.
However, the validation uses String.prototype.startsWith():
const root = path.resolve(rootDir);
const resolved = path.resolve(root, `.${decodedPath}`);
if (!resolved.startsWith(root)) {
return null;
}
This is logically flawed because startsWith evaluates plain strings rather than structural directory paths. If the application's assigned rootDir is /app/dist/client, and an attacker tries to access /app/dist/client-secrets/database.sqlite, the string "/app/dist/client-secrets/database.sqlite" successfully starts with "/app/dist/client".
Because of this bypass, an attacker can read sensitive files stored inside any adjacent directory traversing through the parent, as long as the adjacent directory name begins with the exact same prefix as the target public directory.
Impact
- Severity: High (7.5)
- Vector:
CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:N/A:N - Affected Versions:
<= 3.0.5 - Patched Version:
>= 3.0.6
Proof of Concept
To reproduce this locally on a vulnerable installation:
- Assume the framework static configuration serves from a
.dist/clientdirectory. - Build the project and create an adjacent prefix secret simulating sensitive deployment structure:
npm run build mkdir -p dist/client-secrets echo "EXPOSED_SECRET" > dist/client-secrets/secret.txt - Start the application in Production mode (
NODE_ENV=production tsx server.ts). - Using an HTTP client that doesn't pre-normalize
/../paths (e.g.,netcator raw sockets), send a GET request spanning into the prefix-sharing adjacent folder:GET /%2e%2e%2fclient-secrets/secret.txt HTTP/1.1 Host: localhost:4174 Connection: close - The server incorrectly validates the path and responds with
HTTP/1.1 200 OKexposingEXPOSED_SECRET.
(Note: Developer environment npm run dev servers are immune as static requests are handled defensively by Vite's Dev Middlewares. This vulnerability only triggers upon production starts).
Remediation / Patches
The path validation block has been updated to mandate exact path separation bounds by enforcing path.sep onto the evaluated traversal string.
// Enforces separator OR exact root matches preventing prefix extension
if (!resolved.startsWith(root + path.sep) && resolved !== root) {
return null;
}
Workarounds
If upgrading is temporarily impossible, users can safeguard their environment by ensuring no sensitive directories are deployed adjacent to their static build client directories sharing the identical word-prefix string.
Affected Packages
| Ecosystem | Package | Vulnerable range | Fix |
|---|---|---|---|
| 📦npm | better-helperjs | all versions | 3.0.6 |
Detection & mitigation playbook
Open-source dependencyDetect
Scan your dependency tree (package-lock.json, pnpm-lock.yaml, requirements.txt, go.sum, etc.) for better-helperjs. 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 better-helperjs to 3.0.6 or later, then make sure no transitive (indirect) dependency still pins the vulnerable range — O3 confirms GHSA-3p34-w4f6-5xh2 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-3p34-w4f6-5xh2 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-3p34-w4f6-5xh2. 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-3p34-w4f6-5xh2 in your dependencies?
O3 detects GHSA-3p34-w4f6-5xh2 across npm dependencies and uses function-level reachability to confirm whether the vulnerable code path is actually reachable — not just present. No false positives.