Description
@hapi/inert provides static file and directory handlers for hapi.js. From 4.0.0 to 7.1.0, @hapi/inert serves static files from a directory configured with path in the directory or file handlers or relativeTo for h.file(), with confinement enforced by the confine option, but the confinement check compared the resolved absolute path against the confine directory using a raw string-prefix test, so a sibling directory such as /app/static-secret next to /app/static was incorrectly accepted and could allow an unauthenticated remote attacker to read files via /..%2fstatic-secret/secret.txt. This issue is fixed in version 7.1.1.
Published: 2026-07-17
Score: 5.3 Medium
EPSS: < 1% Very Low
KEV: No
Impact: n/a
Action: n/a
AI Analysis

Impact

@hapi/inert, used for serving static files in hapi.js applications, had a flaw in its confinement mechanism in versions 4.0.0 through 7.1.0. The check that verified requested file paths against the configured base directory performed a raw string‑prefix comparison on the resolved absolute path. This allowed an attacker to reference a sibling directory outside the intended confinement area, such as /app/static-secret, and read files within it via an encoded request like "/..%2fstatic-secret/secret.txt". The result is an unauthenticated path traversal (CWE‑22) exposing sensitive files without authentication.

Affected Systems

Any application that relies on @hapi/inert versions between 4.0.0 and 7.1.0, including both directory and file handlers as well as the h.file() relativeTo option, is vulnerable. The issue occurs when the confine option is enabled, and it can be exploited in any deployment where a sibling directory resides adjacent to the served static root. The fix is available in version 7.1.1 and later.

Risk and Exploitability

The CVSS score of 5.3 indicates moderate severity, and the EPSS score of <1% shows a very low probability of real‑world exploitation. The vulnerability is not listed in the CISA KEV catalog. An attacker can trigger the flaw by making a standard HTTP request to a path resolved under a sibling directory, without the need for authentication or elevated privileges. The nature of the attack makes it simple to perform once the service is reachable over the network.

Generated by OpenCVE AI on July 30, 2026 at 23:21 UTC.

Remediation

No vendor fix or workaround currently provided.

OpenCVE Recommended Actions

  • Upgrade @hapi/inert to version 7.1.1 or newer.
  • If an immediate upgrade is not possible, audit the deployed directory configuration to ensure that no sibling directories exist beside the configured static roots, or disable dynamic prefix checks and enforce strict absolute paths only.
  • Apply additional input validation on request paths, rejecting any attempt to resolve directories outside the intended confinement area.

Generated by OpenCVE AI on July 30, 2026 at 23:21 UTC.

Tracking

Sign in to view the affected projects.

Advisories
Source ID Title
Github GHSA Github GHSA GHSA-rcvq-m9j9-6f4g @hapi/inert has a static-file confinement bypass via sibling-prefix path
History

Tue, 28 Jul 2026 20:45:00 +0000

Type Values Removed Values Added
First Time appeared Hapi
Hapi inert
Vendors & Products Hapi
Hapi inert

Tue, 21 Jul 2026 03:30:00 +0000

Type Values Removed Values Added
Metrics ssvc

{'options': {'Automatable': 'yes', 'Exploitation': 'none', 'Technical Impact': 'partial'}, 'version': '2.0.3'}


Fri, 17 Jul 2026 21:30:00 +0000

Type Values Removed Values Added
Description @hapi/inert provides static file and directory handlers for hapi.js. From 4.0.0 to 7.1.0, @hapi/inert serves static files from a directory configured with path in the directory or file handlers or relativeTo for h.file(), with confinement enforced by the confine option, but the confinement check compared the resolved absolute path against the confine directory using a raw string-prefix test, so a sibling directory such as /app/static-secret next to /app/static was incorrectly accepted and could allow an unauthenticated remote attacker to read files via /..%2fstatic-secret/secret.txt. This issue is fixed in version 7.1.1.
Title @hapi/inert: Static-file confinement bypass via sibling-prefix path
Weaknesses CWE-22
References
Metrics cvssV3_1

{'score': 5.3, 'vector': 'CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:L/I:N/A:N'}


cve-icon MITRE

Status: PUBLISHED

Assigner: GitHub_M

Published:

Updated: 2026-07-21T02:26:04.404Z

Reserved: 2026-05-20T18:15:53.578Z

Link: CVE-2026-48049

cve-icon Vulnrichment

Updated: 2026-07-21T02:25:58.780Z

cve-icon NVD

No data.

cve-icon Redhat

No data.

cve-icon OpenCVE Enrichment

Updated: 2026-07-30T23:30:08Z

Weaknesses
  • CWE-22

    Improper Limitation of a Pathname to a Restricted Directory ('Path Traversal')