@hapi/inert CVE-2026-48049
MEDIUMAttack ChainAIDerived
Hypothetical attack flow derived from CVE metadata – not a confirmed exploit chain
-
AccessIdentify hapi.js app using @hapi/inert
-
DeliveryEnumerate or guess sibling directory with matching name prefix
-
ExploitCraft URL-encoded path traversal request
-
ExecutionBypass confinement via string-prefix flaw
-
ImpactRead 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. |
Get an e-mail when this CVE is exploited, patched or re-scored. Free account.
Alert meAnalysisAIv1 – 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
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
AV:N/AC:L/PR:N/UI:N/S:U/C:L/I:N/A:N
Network-reachable with no authentication; confidentiality impact limited to server-readable files in same-prefix sibling directories; no integrity or availability impact.
Primary rating from Vendor (https://github.com/hapijs/inert).
CVSS VectorVendor: https://github.com/hapijs/inert
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
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.
What every action level means
SSVC AssessmentENISA
Priority Score
Attack Technique
Path traversal exploits occur when applications use user-controlled input to construct file system paths without proper validation.
GHSA-rcvq-m9j9-6f4g
NVD
CVE.org
EPSS
VulDB
Exploit-DB