An oversized LSP Content-Length can terminate the server with an OOM panic
Los mantenedores suelen responder en 1 día
Nadie ha tomado este issue todavía.
Evaluación
- Dificultad
- 4/5
- Tiempo estimado
- 1-2 días
- Aptitud para principiantes
- 58/100
- Tipo de issue
- Error
- Claridad
- Bien especificado
- Estado de actividad
- Activo
- Área
- backend-api-design
Línea de trabajo
Start with src/Lean/Data/Lsp/Communication.lean, where the issue says Content-Length is parsed and passed to the JSON stream reader. Trace that read path and check how the length is represented and validated before allocation. Done means oversized and unrepresentable lengths are rejected safely; the issue also calls for boundary and truncated-body tests.
Escrito por el modelo de indexación a partir del texto del issue.
Descripción
An oversized LSP Content-Length can terminate the server with an OOM panic
Summary
The LSP frame reader accepts an attacker-controlled Content-Length without a protocol-level maximum before reading the body. A short header declaring an enormous body causes the server to panic with out-of-memory and exit.
Steps to reproduce
On a POSIX shell, pipe this header with no body to the reviewed lean executable:
printf 'Content-Length: 1000000000000000\r\n\r\n' | lean --server
Expected behavior
The server should reject an oversized frame as a protocol error and close the input cleanly. It should not attempt an effectively unbounded allocation or terminate with an OOM panic.
Actual behavior
On the reviewed 4.37.0-pre build, this 36-byte header triggered INTERNAL PANIC: out of memory and a non-zero exit in approximately 0.13 seconds. The same input path is present in master a2a6b48ad40269ecf6a27e7790c7e611e7bb55d4; relevant source files were unchanged since the reviewed commit.
Impact assessment
A peer that can write frames to lean --server can terminate the affected language-server process, interrupting editor services handled by that process. This demonstrates a process-availability failure; no data disclosure or code execution was observed. Exploitation requires access to the process input, such as through an exposed language-service proxy.
Root cause
src/Lean/Data/Lsp/Communication.lean parses the declared length and passes it to the JSON stream reader without enforcing a protocol-level maximum. The subsequent read path attempts to consume the declared amount and panics on resource exhaustion.
Suggested fix
Validate Content-Length before allocation or body reads. Reject values above a documented configurable limit and values that cannot be safely represented by the platform size type, using checked conversions and arithmetic. Return a protocol error where possible and close only the offending client connection. Add tests for oversized values, integer boundaries, and truncated bodies.
- Lenguaje dominante
- Lean
- Estrellas
- 10.3k
- Forks
- 1.1k
- Merge medio
- 19 h 8 min
- PR fusionados (30 d)
- 421
Preparar el entorno
- Sin Dockerfile ni archivo de Docker Compose
- Tiene una plantilla de pull request
- Leer la guía de contribución
Primeros pasos
- Lee el issue completo y luego la guía de contribución del proyecto.
- Comenta en el issue que vas a ocuparte — evita que dos personas hagan lo mismo.
- Haz un fork del repositorio y trabaja en una rama.
- Abre un pull request que haga referencia al número del issue.
Más de leanprover/lean4
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 72/100
leanprover/lean4#16681 ·
Los mantenedores suelen responder en 1 día
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 78/100
leanprover/lean4#16305 ·
Los mantenedores suelen responder en 1 día
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 86/100
leanprover/lean4#16299 ·
Los mantenedores suelen responder en 1 día
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 72/100
leanprover/lean4#16257 ·
Los mantenedores suelen responder en 1 día
-
`IO.FS.realPath` reports every failure as `noFileOrDirectory` instead of classifying by `errno`Abiertobug
Dificultad 2/5 1-3 horas Aptitud para principiantes 66/100
leanprover/lean4#15683 ·
Los mantenedores suelen responder en 1 día
Todos los issues de leanprover/lean4
Issues similares
-
External sources always come back in English: `lc` isn't passed to `/api/v3/external_sources`Posiblemente ocupada @Anurag1428 la tomó hoy. Abierto
Dificultad 2/5 1-3 horas Aptitud para principiantes 65/100
openfoodfacts/openfoodfacts-explorer#2264 · 1 comentario ·
Los mantenedores suelen responder en 1 día
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 74/100
EverMind-AI/Raven#1413 ·
Los mantenedores suelen responder en 1 día
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 80/100
cloudflare/workers-sdk#17139 ·
Los mantenedores suelen responder en 1 día
-
bug
Dificultad 2/5 1-3 horas Aptitud para principiantes 70/100
symposium-dev/symposium#530 ·
Los mantenedores suelen responder en 5 días
-
low-priority plugin:abstract source:discussion
Dificultad 2/5 1-3 horas Aptitud para principiantes 80/100
athola/claude-night-market#1306 ·
Los mantenedores suelen responder en 3 días