Vulnerabilities in pkg:npm/better-helperjs
PACKAGEGHSA-3p34-w4f6-5xh2 is a HIGH (CVSS 7.5) path traversal vulnerability (CWE-22: Improper Limitation of a Pathname to a Restricted Directory ('Path Traversal')) affecting Better helperjs libraries in the npm ecosystem. The issue involves better-helperjs vulnerable to directory traversal via string prefix bypass in static server. Remediation is available by upgrading affected packages to version 3.0.6.
pkg:npm/better-helperjs
Vulnerability advisories affecting package pkg:npm/better-helperjs. Select an advisory below to view technical details or fixes.
| Advisory ID | CVE / NVD | Severity | Summary |
|---|---|---|---|
| GHSA-3p34-w4f6-5xh2 | - | HIGH | better-helperjs Vulnerable to Directory Traversal via String Prefix Bypass in Static Server |
GHSA-3p34-w4f6-5xh2 at a Glance
Security Impact
CVSS: 7.5
The security impact metrics below are parsed directly from the CVSS v3.1 vector string (CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:N/A:N).
How to Fix GHSA-3p34-w4f6-5xh2
To remediate this vulnerability, upgrade all affected Better helperjs dependencies to a patched release. Both direct and transitive dependencies should be checked, as frameworks or security libraries may pull in vulnerable versions transitively.
npm install better-helperjs@3.0.6
Run the following command in your project directory to verify that all resolved dependencies use the patched release:
npm ls better-helperjs
How to Check if You Are Affected
To determine whether your Node.js application is affected by GHSA-3p34-w4f6-5xh2, inspect your project dependencies using npm:
npm ls better-helperjs
Analyze the terminal output to locate any version of Better helperjs in your dependency tree. If any resolved version matches the vulnerable ranges listed in the table below (for example, versions earlier than 3.0.6), your application is affected.
Note: The npm ls better-helperjs command inspects dependencies declared in your package.json and lockfile; it does not perform automated runtime dynamic scanning.
Technical Details
Vulnerability Mechanism & Technical Analysis
This vulnerability is classified under CWE-22: Improper Limitation of a Pathname to a Restricted Directory ('Path Traversal'), where the product uses external input to construct a pathname that is intended to identify a file or directory that is located underneath a restricted parent directory, but the product does not properly neutralize special elements within the pathname that can cause the pathname to resolve to a location that is outside of the restricted directory. In Better helperjs, software state validation or input boundaries are circumvented during processing. Review the official source advisory statement below for specific affected components, classes, and reproduction details.
Source Advisory Statement
GHSA-3p34-w4f6-5xh2 Affected Better helperjs Versions
1 component(s)| Product / Package | Ecosystem | Affected Versions | Fixed Version |
|---|---|---|---|
|
better-helperjs
|
npm |
< 3.0.6
|
3.0.6
|
References
Frequently Asked Questions
What is GHSA-3p34-w4f6-5xh2?
Which Better helperjs versions are affected?
What version fixes GHSA-3p34-w4f6-5xh2?
Is better-helperjs affected?
What is the CVSS score of GHSA-3p34-w4f6-5xh2?
What CWE is associated with GHSA-3p34-w4f6-5xh2?
How can I check npm dependencies for GHSA-3p34-w4f6-5xh2?
Machine-readable OSV JSON
OSV v1.5 Schema
{
"schema_version" : "1.4.0",
"id" : "GHSA-3p34-w4f6-5xh2",
"modified" : "2026-06-26T20:56:26Z",
"published" : "2026-06-26T20:56:26Z",
"aliases" : [ ],
"summary" : "better-helperjs Vulnerable to Directory Traversal via String Prefix Bypass in Static Server",
"details" : "## Summary\nA 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.\n\n## Details\nThe 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.\n\nHowever, the validation uses `String.prototype.startsWith()`:\n```typescript\n const root = path.resolve(rootDir);\n const resolved = path.resolve(root, `.${decodedPath}`);\n \n if (!resolved.startsWith(root)) {\n return null;\n }\n```\nThis 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\"`. \n\nBecause 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.\n\n## Impact\n- **Severity:** High (7.5)\n- **Vector:** `CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:N/A:N`\n- **Affected Versions:** `<= 3.0.5`\n- **Patched Version:** `>= 3.0.6`\n\n## Proof of Concept\nTo reproduce this locally on a vulnerable installation:\n1. Assume the framework static configuration serves from a `.dist/client` directory.\n2. Build the project and create an adjacent prefix secret simulating sensitive deployment structure:\n ```bash\n npm run build\n mkdir -p dist/client-secrets\n echo \"EXPOSED_SECRET\" > dist/client-secrets/secret.txt\n ```\n3. Start the application in Production mode (`NODE_ENV=production tsx server.ts`).\n4. Using an HTTP client that doesn't pre-normalize `/../` paths (e.g., `netcat` or raw sockets), send a GET request spanning into the prefix-sharing adjacent folder:\n ```http\n GET /%2e%2e%2fclient-secrets/secret.txt HTTP/1.1\n Host: localhost:4174\n Connection: close\n ```\n5. The server incorrectly validates the path and responds with `HTTP/1.1 200 OK` exposing `EXPOSED_SECRET`.\n\n*(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).*\n\n## Remediation / Patches\nThe path validation block has been updated to mandate exact path separation bounds by enforcing `path.sep` onto the evaluated traversal string.\n```typescript\n // Enforces separator OR exact root matches preventing prefix extension\n if (!resolved.startsWith(root + path.sep) && resolved !== root) {\n return null;\n }\n```\n\n## Workarounds\nIf 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.",
"severity" : [ {
"type" : "CVSS_V3",
"score" : "CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:N/A:N"
} ],
"affected" : [ {
"package" : {
"ecosystem" : "npm",
"name" : "better-helperjs"
},
"ranges" : [ {
"type" : "ECOSYSTEM",
"events" : [ {
"introduced" : "0"
}, {
"fixed" : "3.0.6"
} ]
} ],
"database_specific" : {
"last_known_affected_version_range" : "<= 3.0.5"
}
} ],
"references" : [ {
"type" : "WEB",
"url" : "https://github.com/Rigby-Foundation/BetterHelperjs/security/advisories/GHSA-3p34-w4f6-5xh2"
}, {
"type" : "PACKAGE",
"url" : "https://github.com/Rigby-Foundation/BetterHelperjs"
} ],
"database_specific" : {
"cwe_ids" : [ "CWE-22" ],
"severity" : "HIGH",
"github_reviewed" : true,
"github_reviewed_at" : "2026-06-26T20:56:26Z",
"nvd_published_at" : null
}
}