CVE-2026-48049
JSON

5.3medium

@hapi/inert: Static-file confinement bypass via sibling-prefix path

Severity
5.3medium CVSS:3.1 by GitHub_M
Exploit likelihood
0.59% (higher than 42% of CVEs)
Published
Last changed
Assigned by
GitHub_M
Also known as
GHSA-rcvq-m9j9-6f4g

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.

Affected

Product or packageVersionsReported by
hapijs inert>= 4.0.0, < 7.1.1CVE List
@hapi/inert (npm)from 4.0.0 before 7.1.1GitHub Advisory Database

All scores

GitHub_M5.3medium CVSS:3.1CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:L/I:N/A:N
GitHub5.3medium CVSS:3.1CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:L/I:N/A:N

Classification

CWE-22

SSVC (CISA-ADP): exploitation none, automatable yes, technical impact partial.

What each source says

CVE List

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

GitHub Advisory Database
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

NVD (es)

@hapi/inert proporciona manejadores de archivos estáticos y directorios para hapi.js. Desde la versión 4.0.0 hasta la 7.1.0, @hapi/inert sirve archivos estáticos desde un directorio configurado con ’path’ en los manejadores de directorio o archivo, o con ’relativeTo’ para h.file(), con el confinamiento aplicado por la opción ’confine’, pero la verificación de confinamiento comparó la ruta absoluta resuelta con el directorio de confinamiento utilizando una prueba de prefijo de cadena en bruto, por lo que un directorio hermano como /app/static-secret junto a /app/static fue aceptado incorrectamente y podría permitir a un atacante remoto no autenticado leer archivos a través de /..%2fstatic-secret/secret.txt. Este problema está solucionado en la versión 7.1.1.

References

Sources

SourceRecordLicence
CVE ListCVE-2026-48049 changed 2026-07-21CVE Terms of Use
GitHub Advisory DatabaseGHSA-rcvq-m9j9-6f4g changed 2026-09-10CC-BY-4.0
NVDCVE-2026-48049 changed 2026-10-24Public domain