[Bug] HTTP media loader buffers the full response without a size cap, causing OOM DoS
Maintainer thường phản hồi trong vòng 2 ngày
Chưa có ai nhận issue này.
Đánh giá
- Độ khó
- 2/5
- Thời gian dự kiến
- 1-3 giờ
- Mức phù hợp với người mới
- 79/100
Hướng nghiên cứu
Bắt đầu với lmdeploy/vl/media/connection.py, đặc biệt là _load_http_url() ở các dòng 57–93 và load_from_url() ở các dòng 125–137. Theo dõi cách phản hồi HTTP được đọc và truyền vào media_io.load_bytes(), sau đó kiểm tra xem đã có bài kiểm thử nào cho việc tải URL phương tiện và phản hồi quá lớn chưa. Hoàn thành khi các phản hồi vượt quá giới hạn kích thước được áp dụng bị từ chối trước khi được đệm không giới hạn, đồng thời có bài kiểm thử hồi quy cho hành vi đó.
Do mô hình lập chỉ mục viết ra từ nội dung của issue.
Mô tả
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 validates HTTP(S) media URLs and optionally checks an exact media-domain allowlist, but _load_http_url() then reads requests.Response.content before media decoding. There is no Content-Length, streamed-download, or post-download response-size cap. In a 2 GiB memory-limited container with normal global-IP validation enabled, a request for a URL serving 2 GiB caused the loader to buffer the response until the container was OOM-killed.
Affected component
lmdeploy/vl/media/connection.py:57-93:_load_http_url()performs scheme/domain/IP checks, then callsmedia_io.load_bytes(response.content).lmdeploy/vl/media/connection.py:125-137:load_from_url()dispatches HTTP URLs into the above path.
Impact
A small request body containing one URL can make the server allocate memory proportional to the attacker-controlled HTTP response. Concurrent or repeated requests can exhaust process/cgroup memory and terminate or restart the service. This is an independent availability issue from media decoding, because the OOM occurs while buffering the response before invoking a model-specific media loader.
Reproduction
Preconditions
- The attacker can submit an image/video/media URL to the OpenAI-compatible API.
- The target host can make outbound HTTP(S) connections to the attacker-controlled or otherwise reachable response endpoint.
- If
allowed_media_domainsis configured, the selected domain is included in that list. - The URL resolves to a globally routable IP, as required by the existing
_is_safe_url()guard.
Tested environment
- Target: LMDeploy 0.18.0 Linux cp312 wheel.
- Wheel SHA-256:
fcef7cf0d210d766e02e2e6df025378d2f8ae36080400b2818eb9a34ef3392dc. - Container:
--network none, 2 GiB memory, 2 GiB swap, 2 CPUs, 128 PID limit. - Network isolation: the loopback interface received
8.8.8.8/32, so LMDeploy's real global-IP validation passed while traffic remained local. - Response: HTTP 200,
Content-Length: 2147483648, streamed zeros. - Host: Ubuntu 22.04, Linux 6.8.0-149-generic, x86_64.
- Base image:
lmsysorg/sglang:v0.5.17. - Test date: 2026-12-04 (Asia/Shanghai).
Proof of concept
The PoC invoked the production _load_http_url() function directly with a FakeMediaIO receiver. The local HTTP server advertised exactly 2 GiB and streamed zero bytes. The PoC did not disable or bypass _is_safe_url().
Result
memory.peak = 2147483648
memory.events: oom=2, oom_kill=1
Docker State.OOMKilled = true
ExitCode = 137
elapsed = approximately 7 seconds
Environment
Python: 3.12.3 (main, Jul 15 2026, 23:46:41) [GCC 13.3.0]
CUDA available: True
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
- Ngôn ngữ chính
- Python
- Star
- 8.2k
- Fork
- 797
- Merge trung bình
- 3 ngày 15 giờ
- Pull request đã merge (30 ngày)
- 52
Chuẩn bị môi trường
- Không có Dockerfile hay tệp Docker Compose
- Có mẫu pull request
- Đọc hướng dẫn đóng góp
Bắt đầu từ đâu
- Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
- Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
- Fork repository và làm thay đổi trên một nhánh.
- Mở pull request có tham chiếu số hiệu của issue.
Issue khác của InternLM/lmdeploy
-
[Bug] apply_rotary_pos_emb: leaves output tails unwritten with partial rotationCó thể đã có người làm @shotsan đã nhận 15 ngày trước. Đang mở
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 78/100
Maintainer thường phản hồi trong vòng 2 ngày
-
[Bug] PyTorch engine ignores use_rslora, so rsLoRA adapters run sqrt(r) times too weakCó thể đã có người làm @Andreas-Hum đã nhận 25 ngày trước. Đang mở
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 78/100
Maintainer thường phản hồi trong vòng 2 ngày
-
[Feature] Expose `max_model_len` (session_len) in `/v1/models` model cardCó thể đã có người làm @FOWEPJF255 đã nhận 37 ngày trước. Đang mở
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 85/100
Maintainer thường phản hồi trong vòng 2 ngày
-
Độ khó 4/5 3-5 ngày Mức phù hợp với người mới 48/100
Maintainer thường phản hồi trong vòng 2 ngày
-
Độ khó 4/5 3-5 ngày Mức phù hợp với người mới 48/100
Maintainer thường phản hồi trong vòng 2 ngày
Tất cả issue của InternLM/lmdeploy
Issue tương tự
-
Độ khó 1/5 Dưới một giờ Mức phù hợp với người mới 92/100
Techiebutler/freeframe#687 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
bug verbose GC
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 74/100
IBM/javacore-analyser#677 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
area/config comp/plugins P1 platform/qqbot tool/file type/bug
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 75/100
NousResearch/hermes-agent#163932 · 1 bình luận ·
Maintainer thường phản hồi trong vòng 1 ngày
-
plugins/dsh: todayStr() computes UTC but is documented as local — journal entries written 00:00–08:00 local land in the previous day's fileCó thể đã có người làm @Beehtrix đã nhận hôm nay. Đang mởbug
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 82/100
zilliztech/memsearch#907 · 1 bình luận ·
Maintainer thường phản hồi trong vòng 1 ngày
-
[integration]: SynapCoresĐang mởexternal
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 72/100
langchain-ai/docs#8386 ·
Maintainer thường phản hồi trong vòng 1 ngày