imgproxyのBMP読み込みで細工画像によりヒープ領域を超えて書き込まれる不具合
Summary
imgproxy v4.0.11のカスタムBMPローダーに、ヒープバッファオーバーフローの脆弱性があります。細工されたBMP画像を処理させると、プロセスが異常終了してサービスが停止する可能性があります。修正版はv4.0.12以降ですので、アップデートしてください。
AI summary
Written by an external AI model and may contain mistakes. Check the original description and references below before acting on it.
imgproxy v4.0.11のカスタムBMPローダーに、ヒープバッファオーバーフローの脆弱性があります。細工されたBMP画像を処理させると、プロセスが異常終了してサービスが停止する可能性があります。修正版はv4.0.12以降ですので、アップデートしてください。
Affected packages
| Ecosystem | Package | Affected | Fixed |
|---|---|---|---|
| go | github.com/imgproxy/imgproxy/v4 |
>= 4.0.0, <= 4.0.11 |
>= 4.0.12 |
Original description The description as published by the source.
The decoder accepts arbitrary BMP bit depths for uncompressed BI_RGB input, routes every value greater than or equal to 24 through its 24/32-bit row generator, allocates a row buffer sized for at most four bytes per pixel, and then reads a row sized from the attacker-controlled bit depth. The inconsistent allocation and read invariants allow source-image bytes to be written beyond the native heap allocation.
I confirmed the memory-safety defect by compiling the exact v4.0.11 loader with AddressSanitizer. At width 512, a valid 32-bpp BMP uses a 2,052-byte row buffer, reads 2,048 bytes, and completes normally. A matched 40-bpp input retains the same 2,052-byte allocation but performs a 2,560-byte write. ASan reports a 508-byte heap-buffer-overflow at the first byte after the allocation.
I separately reproduced terminal availability impact using the immutable official v4.0.11 container image and its documented HTTP processing route. One request for a crafted 65535-bpp BMP caused a fatal SIGSEGV in runtime.memmove, with the stack continuing through AsyncBuffer.ReadAt and vips.imgproxyReaderRead. The entire imgproxy process exited with status 2; both /health and processing of a safe image became unavailable. Restarting the same container restored normal processing. No live or third-party system was tested.
The overwrite bytes and length are attacker controlled. Two bounded, non-weaponized canonical-marker experiments against the unmodified official image did not dem…
Source: GitHub Repository Security Advisories (Game のスタック) GitHub Advisory OSV
References
- GITHUB_REPO_ADVISORY imgproxy/imgproxy