[Bug] OpenAI API allows unbounded video frame selection, causing memory-exhaustion DoS
I maintainer di solito rispondono entro 2 giorni
Nessuno ha ancora preso questa issue.
Valutazione
- Difficoltà
- 4/5
- Tempo stimato
- 3-5 giorni
- Idoneità per principianti
- 57/100
Direzione di ricerca
Start with lmdeploy/vl/media/video_loader.py lines 29–44, then trace how request media_io_kwargs reaches VideoMediaIO through the protocol and multimodal processor. Check the video loader tests and add coverage for caller-controlled frame selection and resource limits. Done means requests cannot trigger unbounded frame decoding and the tests cover the reported high-frame-count case.
Scritto dal modello di indicizzazione a partire dal testo della issue.
Descrizione
Checklist
- 1. I have searched related issues but cannot get the expected help.
- 2. The bug has not been fixed in the latest version.
- 3. Please note that if the bug-related issue you submitted lacks corresponding environment info and a minimal reproducible demo, it will be challenging for us to reproduce and resolve the issue, reducing the likelihood of receiving feedback.
Describe the bug
Summary
LMDeploy's OpenAI-compatible chat API accepts caller-controlled media_io_kwargs.video. When num_frames is negative, the video loader keeps every frame in the source video; a very large fps does not reduce the selection. A 4.3 MiB, 1200-frame AVI can therefore be expanded into roughly 792 MiB of retained decoded frames with four concurrent requests. Under a 1024 MiB cgroup limit, repeated formal runs were killed by the kernel OOM killer, while an otherwise identical 8-frame control completed successfully.
Affected component
LMDeploy multimodal request parsing and video loading:
lmdeploy/serve/openai/protocol.py:229andlmdeploy/serve/openai/protocol.py:616exposemedia_io_kwargs.lmdeploy/serve/processors/multimodal.py:172passes the request dictionary intoVideoMediaIO.lmdeploy/vl/media/video.py:89forwards it to the selected backend.lmdeploy/vl/media/video_loader.py:29-44treats negativenum_framesas "sample all frames" and only lowers the count whennum_frames > 0orfps > 0; there is no absolute decoded-byte/frame budget.
Impact
An authenticated API caller, or an unauthenticated caller when the service has no API key, can force a small video upload to be decoded into an attacker-controlled amount of CPU memory before inference. Concurrent requests can exhaust the service process/cgroup and terminate or restart the server. The tested 4-worker case exhausted a 1024 MiB parser-only environment; the amount of memory and number of requests needed in a production deployment depend on video dimensions, duration, backend, concurrency, model/runtime baseline, and any reverse-proxy body limits.
Reproduction
Preconditions
The attacker can submit a multimodal chat completion request.
The service exposes a video-capable multimodal model. This is not true for every model adapter: Qwen2-VL-2B rejected the parsed video downstream, while Qwen3.5-0.8B accepted it end to end.
No reverse-proxy body limit or other front-end guard blocks the base64 media payload.
Tested environment
Target: LMDeploy 0.18.0 Linux cp312 wheel.
Wheel SHA-256:
fcef7cf0d210d766e02e2e6df025378d2f8ae36080400b2818eb9a34ef3392dc.Host: Ubuntu 22.04, Linux 6.8.0-149-generic, x86_64.
GPU test: one NVIDIA GPU only.
Real HTTP model:
/mnt/sdb18t/ljp/models/Qwen3.5-0.8B, PyTorch backend, 65536-token session.Parser-only OOM test: no GPU, no model weights, 1024 MiB cgroup memory/swap,
--network none, 2 CPUs, 128 PIDs.Test date: 2026-12-04 .
Proof of concept
The request used a 320x180, 30 fps, 40-second, 1200-frame AVI encoded as data:video/avi;base64,....
{
"media_io_kwargs": {
"video": {
"num_frames": -1,
"fps": 1000000,
"max_duration": 1
}
},
"mm_processor_kwargs": {
"video": {
"min_pixels": 3136,
"max_pixels": 3136
}
},
"messages": [
{
"role": "user",
"content": [
{"type": "video_url", "video_url": {"url": "data:video/avi;base64,..."}},
{"type": "text", "text": "Reply with OK."}
]
}
]
}The control used the same source video, processor limits, concurrency, fps, and max_duration, changing only num_frames from -1 to 8.
Results
Parser-only controlled OOM campaign:
Case | num_frames | Memory limit | Result -- | -- | -- | -- Attack | -1 | 1024 MiB | Kernel OOM kill, Docker exit 137, repeated Matched control | 8 | 1024 MiB | 4/4 completed, oom=0, oom_kill=0 Attack completion control | -1 | 1280 MiB | 4/4 completed; retained decoded outputs totaled 829,440,000 bytesThe HTTP test shows that the caller-controlled loader is reachable from the OpenAI endpoint and increases downstream model input by 103x per request. It is not, by itself, a production HTTP load test; the availability claim is supported by the controlled parser-path OOM campaign.
Environment
Python: 3.12.3 (main, Jul 15 2026, 23:46:41) [GCC 13.3.0]
CUDA available: True
GPU 0: NVIDIA 80GB PCIe
CUDA_HOME: /usr/local/cuda
NVCC: Cuda compilation tools, release 13.0, V13.0.88
CUDA Driver Version: 590.48.01
PyTorch: 2.13.0+cu130
flashinfer_python: 0.6.18
flashinfer_cubin: 0.6.18
flashinfer_jit_cache: 0.6.18+cu130
triton: 3.7.1
transformers: 5.12.1
numpy: 2.3.5
aiohttp: 3.14.3
fastapi: 0.141.1
huggingface_hub: 1.30.0
interegular: 0.3.3
modelscope: 1.39.1
orjson: 3.12.0
outlines: 0.1.11
packaging: 26.3
psutil: 7.2.2
pydantic: 2.13.5
python-multipart: 0.0.32
pyzmq: 27.2.0
uvicorn: 0.52.4
uvloop: 0.22.1
xgrammar: 0.2.1
openai: 2.6.1
tiktoken: 0.14.0
torchcodec: 0.15.0+cu130
ulimit soft: 1024
Error traceback
- Lingua principale
- Python
- Stelle
- 8.2k
- Fork
- 797
- Merge medio
- 3g 15h
- PR unite (30g)
- 52
Preparare l'ambiente
- Nessun Dockerfile né file Docker Compose
- Ha un modello di pull request
- Leggi la guida per i contributori
Come iniziare
- Leggi tutta la issue e poi la guida ai contributi del progetto.
- Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
- Fai un fork del repository e lavora su un branch.
- Apri una pull request che faccia riferimento al numero della issue.
Altre issue di InternLM/lmdeploy
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 79/100
I maintainer di solito rispondono entro 2 giorni
-
[Bug] apply_rotary_pos_emb: leaves output tails unwritten with partial rotationForse già presa @shotsan l’ha presa 15 giorni fa. Aperta
Difficoltà 2/5 1-3 ore Idoneità per principianti 78/100
I maintainer di solito rispondono entro 2 giorni
-
[Bug] PyTorch engine ignores use_rslora, so rsLoRA adapters run sqrt(r) times too weakForse già presa @Andreas-Hum l’ha presa 25 giorni fa. Aperta
Difficoltà 2/5 1-3 ore Idoneità per principianti 78/100
I maintainer di solito rispondono entro 2 giorni
-
[Feature] Expose `max_model_len` (session_len) in `/v1/models` model cardForse già presa @FOWEPJF255 l’ha presa 37 giorni fa. Aperta
Difficoltà 2/5 1-3 ore Idoneità per principianti 85/100
I maintainer di solito rispondono entro 2 giorni
-
Difficoltà 4/5 3-5 giorni Idoneità per principianti 48/100
I maintainer di solito rispondono entro 2 giorni
Tutte le issue di InternLM/lmdeploy
Issue simili
-
Difficoltà 1/5 Meno di un'ora Idoneità per principianti 92/100
Techiebutler/freeframe#687 ·
I maintainer di solito rispondono entro 1 giorno
-
bug verbose GC
Difficoltà 2/5 1-3 ore Idoneità per principianti 74/100
IBM/javacore-analyser#677 ·
I maintainer di solito rispondono entro 1 giorno
-
area/config comp/plugins P1 platform/qqbot tool/file type/bug
Difficoltà 2/5 1-3 ore Idoneità per principianti 75/100
NousResearch/hermes-agent#163932 · 1 commento ·
I maintainer di solito rispondono entro 1 giorno
-
plugins/dsh: todayStr() computes UTC but is documented as local — journal entries written 00:00–08:00 local land in the previous day's fileForse già presa @Beehtrix l’ha presa oggi. Apertabug
Difficoltà 2/5 1-3 ore Idoneità per principianti 82/100
zilliztech/memsearch#907 · 1 commento ·
I maintainer di solito rispondono entro 1 giorno
-
[integration]: SynapCoresApertaexternal
Difficoltà 2/5 1-3 ore Idoneità per principianti 72/100
langchain-ai/docs#8386 ·
I maintainer di solito rispondono entro 1 giorno