Your RSA-2048 keys break in 2030. Find every one of them before attackers do.
📦
📦 npm
Not in CISA KEV
HIGH severity

GHSA-3p34-w4f6-5xh2 — better-helperjs

HIGH

GHSA-3p34-w4f6-5xh2 is a high-severity (CVSS 7.5) vulnerability in better-helperjs. A fix is available for better-helperjs — see the affected versions and patch details below.

better-helperjs Vulnerable to Directory Traversal via String Prefix Bypass in Static Server

Published
Jun 26, 2026
Updated
Jun 26, 2026
Affected
1 pkg
Patched
1 / 1
Exploits
None indexed
Exploitation data as of Jun 26, 2026 · OSV.dev, FIRST.org (EPSS)

Real-World Exposure

1 pkg affected

How broadly this vulnerability is actually deployed: weekly install volume shows current usage, a proxy for how much of the ecosystem is exposed.

better-helperjsnpm
7downloads / week

Description

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:

  1. Assume the framework static configuration serves from a .dist/client directory.
  2. 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
    
  3. Start the application in Production mode (NODE_ENV=production tsx server.ts).
  4. 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:
    GET /%2e%2e%2fclient-secrets/secret.txt HTTP/1.1
    Host: localhost:4174
    Connection: close
    
  5. The server incorrectly validates the path and responds with HTTP/1.1 200 OK exposing EXPOSED_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

1 total 1 fixed
EcosystemPackageVulnerable rangeFix
📦npmbetter-helperjsall versions3.0.6npm install better-helperjs@3.0.6

Detection & mitigation playbook

Open-source dependency
  1. Detect

    Scan your dependency tree (package-lock.json, pnpm-lock.yaml, requirements.txt, go.sum, etc.) for better-helperjs, including transitive dependencies — a direct dependency you never call can still pull in a vulnerable version.

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

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

  4. How O3 protects you

    O3 Security's impact-aware SCA analyses which vulnerable code paths your application actually calls, so a match like GHSA-3p34-w4f6-5xh2 can be triaged on real exposure rather than presence alone.

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

## 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
O3 Security · Impact-Aware SCA

Is GHSA-3p34-w4f6-5xh2 in your dependencies?

O3 Security finds GHSA-3p34-w4f6-5xh2 across npm dependencies, including transitive ones, and its impact-aware SCA ranks findings by whether your code actually calls the vulnerable path.

GHSA-3p34-w4f6-5xh2: better (High 7.5) | O3 Security