Urlencoded overflow still buffers one huge value in memory

Aperta
#41 0 commenti 0 reazioni 0 assegnatari Vedi su GitHub

Nessuno ha ancora preso questa issue.

Valutazione

Difficoltà
4/5
Tempo stimato
3-5 giorni
Idoneità per principianti
68/100
Tipo di issue
Bug
Chiarezza
Specificata chiaramente
Stato di attività
Attiva
Stack tecnologico
csharp

Direzione di ricerca

Start with MaxLib.WebServer/Post/UrlEncodedData.cs at lines 116-143 and 145-186. Trace how tokenBuffer grows, when MaximumCacheSize is checked, and how oversized data is written to a temp file. Done means a single oversized key=value token is streamed without creating the full decoded and re-encoded in-memory copies.

Scritto dal modello di indicizzazione a partire dal testo della issue.

Descrizione

bug security severity:medium

An unauthenticated urlencoded body between 50 MB and 100 MB (the default MaxContentLength) that is a single key=value token is buffered whole. The tokenizer only flushes tokenBuffer on a literal &, and the size check against MaximumCacheSize happens only after ToArray, the decoded strings and the re-encoded UTF-8 bytes exist. That is several hundred MB of heap per request on the path meant to avoid in-memory buffering, so a few concurrent requests can exhaust memory.

Location: MaxLib.WebServer/Post/UrlEncodedData.cs:116-143, MaxLib.WebServer/Post/UrlEncodedData.cs:145-186

Fix: Check tokenBuffer.Length against MaximumCacheSize while accumulating and stream the rest of an oversized token straight to a temp file, skipping the string round-trip.

Lingua principale
C#
Stelle
1
Fork
3
Merge medio
1g 9h
PR unite (30g)
4

Preparare l'ambiente

Questo progetto non fornisce container di sviluppo, Dockerfile né guida per i contributori, quindi l'ambiente è a tuo carico: parti dal suo README e consulta la nostra guida al primo contributo per i passaggi generali.

Come iniziare

  1. Leggi tutta la issue e poi la guida ai contributi del progetto.
  2. Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
  3. Fai un fork del repository e lavora su un branch.
  4. Apri una pull request che faccia riferimento al numero della issue.

Altre issue di Garados007/MaxLib.WebServer

Tutte le issue di Garados007/MaxLib.WebServer

Issue simili

Altre issue su C#

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.