Skip to main content

@hapi/inert CVE-2026-48049

MEDIUM
Path Traversal (CWE-22)
2026-06-11 https://github.com/hapijs/inert GHSA-rcvq-m9j9-6f4g
5.3
CVSS 3.1 · Vendor: https://github.com/hapijs/inert
View

Attack ChainAIDerived

Hypothetical attack flow derived from CVE metadata – not a confirmed exploit chain

  1. Access
    Identify hapi.js app using @hapi/inert
  2. Delivery
    Enumerate or guess sibling directory with matching name prefix
  3. Exploit
    Craft URL-encoded path traversal request
  4. Execution
    Bypass confinement via string-prefix flaw
  5. Impact
    Read sensitive files from sibling directory

Vulnerability Assessment

Weakness
CWE
OWASP Top 10:2025
A01:2025 - Broken Access Control
ASVS 5.0
V5 - File Handling Path canonicalization, traversal prevention
MITRE ATT&CK

2 techniques across 2 tactics: Discovery, Collection

The technique list with ATT&CK links and the kill-chain view is part of the Basic plan and up.

Exploitation Conditions

Exploitation requires all three of the following conditions to be simultaneously true: (1) the target application uses @hapi/inert version 4.0.0-7.1.0 with a directory or file route handler with confine: true (the default) or h.file() with relativeTo set; (2) a sibling directory exists on the server file system at the same parent level as the configured serve path, whose name begins with the exact same character sequence as the served directory name - for example, serve root /app/static and sibling /app/static-data or /app/static-secret; (3) the files within that sibling directory are readable by the operating system user account running the Node.js process. The attack is bounded to file reads only - no write or code execution capability is provided. Applications that serve from a directory with no matching-prefix sibling, regardless of their @hapi/inert version, are entirely unaffected by this vulnerability. Exploitation is further limited to files the server process can read, so OS-level permissions on the sibling directory remain an effective secondary control.

Impact

The vendor-assigned CVSS 3.1 score of 5.3 Medium (AV:N/AC:L/PR:N/UI:N/S:U/C:L/I:N/A:N) accurately reflects the network-accessible, unauthenticated, low-complexity nature of the flaw, but the AC:L rating is somewhat optimistic - real-world exploitation requires the attacker to know or successfully guess that a sibling directory with a matching name prefix exists at the application's deployment path. This is a significant real-world constraint that the CVSS base score does not fully capture. This CVE does not appear in CISA KEV and no public exploit code was identified, indicating no confirmed active exploitation at time of analysis. EPSS score data was not supplied in the source intelligence and cannot be assessed. The vulnerability is confidentiality-only (C:L), with no integrity or availability impact, and the blast radius is bounded by what files the Node.js server process can read inside the sibling directory. For applications where this precondition is met - a sibling directory exists and holds sensitive material (environment files, credentials, certificates) readable by the server process - the risk is concrete and the attack requires no prior access. Applications with no matching-prefix sibling are entirely unaffected.

Exploit ScenarioDerived

An attacker probes a hapi.js application serving files from /app/static and, by observing deployment artifacts or guessing common naming conventions, determines that /app/static-config exists alongside it. The attacker sends GET /..%2fstatic-config/.env to the server; @hapi/inert resolves the path to /app/static-config/.env, the flawed string-prefix check accepts it as confined under /app/static, and the server returns the plaintext environment file containing database credentials. No authentication is required and no exploitation framework or specialized tooling is needed beyond a standard HTTP client.

This Month Plan within 30 days. Why: MEDIUM severity (CVSS 4.0-6.9).
Patch available 0.1% exploitation probability (EPSS)

Get an e-mail when this CVE is exploited, patched or re-scored. Free account.

Alert me

AnalysisAIv1 – Jun 11, 2026

Static file confinement bypass in @hapi/inert (npm, versions 4.0.0-7.1.0) allows remote unauthenticated attackers to read arbitrary files from sibling directories when those directories share a string prefix with the configured serve path. The flaw is a classic CWE-22 path traversal rooted in a faulty string-prefix comparison that fails to enforce a directory separator boundary, meaning a path like /app/static-secret incorrectly passes the confinement check for a serve root of /app/static. No public exploit code has been identified and this CVE is not in CISA KEV, but the attack itself - a single URL-encoded traversal request - is trivially simple once the precondition of a matching-prefix sibling directory is confirmed.

RemediationAI

Upgrade @hapi/inert to version 7.1.1 using npm install @hapi/inert@7.1.1 or yarn add @hapi/inert@7.1.1; this is the vendor-released patch confirmed by commit a65e5b271b5c3405af463469959c5e052eb23a62 and advisory GHSA-rcvq-m9j9-6f4g. For deployments that cannot upgrade immediately, the vendor-recommended workaround is a file system rename: ensure no sibling directory at the same parent level shares a string prefix with the served directory - for example, rename static-secret/ to secret/ or relocate it to a different parent path. This eliminates the exploitable precondition without any code change, but it requires corresponding updates to any application configuration or tooling that references the sibling path. There is no in-process configuration option within @hapi/inert itself that mitigates this flaw short of the naming workaround or upgrading. Patch and diff: https://github.com/hapijs/inert/pull/176.

Affected Packages

npm @hapi/inert fix: 7.1.1

Source: OSV (Open Source Vulnerabilities)

Affects your stack

Affects 1 package in npm

Checking this CVE against your own stacks and servers is part of the Basic plan and up.

Technical ContextAI · show details

@hapi/inert is the canonical static file serving plugin for the hapi.js Node.js web framework, distributed as the npm package @hapi/inert (CPE: pkg:npm/@hapi_inert). It exposes directory and file route handlers and an h.file() response toolkit method, each governed by a confine option (default: true) intended to restrict file resolution to the configured base path. The defective code in lib/file.js used path.lastIndexOf(confineDir, 0) ! 0 as its confinement gate - a raw string-prefix test that checks only whether the resolved absolute path begins with the confine directory string, without verifying that the next character is a path separator. This is a classic CWE-22 (Improper Limitation of a Pathname to a Restricted Directory) implementation error: the absence of a separator boundary means any sibling directory whose name starts with the same characters (e.g., /app/static-secret alongside serve root /app/static) is accepted as confined. The fix in commit a65e5b271b5c3405af463469959c5e052eb23a62 (PR #176) replaces the check with path ! confineDir && !path.startsWith(confineDir + Path.sep), correctly enforcing the boundary.

Know when the next one hits your stack

  • Watch products and get an email when something new is published
  • Check this CVE against your own stack and servers
  • Exploit and PoC references, threat intelligence from 22 sources

No credit card · 7-day full trial

Severity by source

Vendor (https://github.com/hapijs/inert) PRIMARY 5.3 MEDIUM
AV:N/AC:L/PR:N/UI:N/S:U/C:L/I:N/A:N
vuln.today AI 5.3 MEDIUM

Network-reachable with no authentication; confidentiality impact limited to server-readable files in same-prefix sibling directories; no integrity or availability impact.

3.1 AV:N/AC:L/PR:N/UI:N/S:U/C:L/I:N/A:N
4.0 AV:N/AC:L/AT:P/PR:N/UI:N/VC:L/VI:N/VA:N/SC:N/SI:N/SA:N

Primary rating from Vendor (https://github.com/hapijs/inert).

CVSS VectorVendor: https://github.com/hapijs/inert

Attack Vector
Network
Attack Complexity
Low
Privileges Required
None
User Interaction
None
Scope
Unchanged
Confidentiality
Low
Integrity
None
Availability
None

DescriptionCVE.org

Impact

@hapi/inert serves static files from a directory configured with path (in the directory / file handlers) or relativeTo (for h.file()), with confinement enforced by the confine option (default true). Before the patch, the confinement check compared the resolved absolute path against the confine directory using a raw string-prefix test, so a sibling directory whose absolute path begins with the same characters as the confine directory (eg. /app/static-secret next to a served /app/static) was incorrectly accepted as confined. An unauthenticated remote attacker who knows or guesses such a sibling name can read any file inside it via a request like /..%2fstatic-secret/secret.txt, provided the file is readable by the server process. Only applications that happen to have a sibling directory sharing a string prefix with the served directory are exploitable; applications with no such sibling are unaffected.

Patches

Upgrade to 7.1.1.

Workarounds

For users who cannot upgrade immediately: ensure the directory served via inert has no sibling whose name starts with the same characters (for example, rename static-secret/ to secret/, or move it to a different parent directory).

Resources

Pull Request: https://github.com/hapijs/inert/pull/176

Threat Intelligence Overview

EPSS Score
0.1%
Top 80% exploitable
Threat Intel
1
1 source
Data Quality
5 sources
Confidence: Medium
NVD CVE.org EPSS GHSA GitHub VulDB

How this decision was reached

The engine reads each signal below and applies a fixed list of rules from top to bottom. The first rule that matches sets the recommended action – like a statement, every line is shown.

SignalValue
Severity MEDIUM
CISA KEV No
Public POC No
EPSS 0.1%
Patch available Yes
Active threat No
Deciding rule
MEDIUM severity (CVSS 4.0-6.9)
What every action level means
Emergency Immediate action required. Criteria: CRITICAL + in CISA KEV (actively exploited) without patch, OR CRITICAL + EPSS > 30% without patch, OR CRITICAL + active threat signals without patch.
Act Now Prioritize within 24-48h. Criteria: in KEV with patch available, OR CRITICAL + public POC, OR HIGH + EPSS > 10%, OR CRITICAL + active threat, OR any CRITICAL severity.
This Week Schedule remediation this week. Criteria: HIGH severity (CVSS 7.0-8.9). Patch within normal change window.
This Month Plan within 30 days. Criteria: MEDIUM severity (CVSS 4.0-6.9), lower exploitation probability. Include in regular patch cycle.
Monitor Track and reassess. Criteria: LOW severity (CVSS 0.1-3.9), minimal exploitation risk. No immediate action needed.

SSVC AssessmentENISA

SSVC Decision· derived
Scheduled
Exploitation· derived
None
System Exposure· derived
Open
Automatable· derived
Yes
Human Impact· derived
Medium

Priority Score

26
Low Medium High Critical
KEV: 0
EPSS: 0
CVSS: +26
PoC: 0
Weaponized: 0
Threat intel: 0
Gov advisory: 0

Attack Technique

Path traversal exploits occur when applications use user-controlled input to construct file system paths without proper validation.

Affected Products (CPE)CVE.org

pkg:npm/@hapi_inert

This site uses cookies essential for authentication and security. No tracking or analytics cookies are used. Privacy Policy