Integer overflow in imgproxy ICO loader leads to heap overflow
Key facts
- Attack vector
- —
- Privileges required
- —
- User interaction
- —
- Attack complexity
- —
- Impact type
- —
- Confidentiality · integrity · availability
- —
- Fix status
- Fixed
No CVSS vector from any source. Fix status from GitHub.
Summary
The imgproxy Go modules github.com/imgproxy/imgproxy/v3, github.com/imgproxy/imgproxy/v2 and github.com/imgproxy/imgproxy from 4.0.0 before 4.0.16 are affected. An integer overflow in the ICO loader (CWE-190) wraps a size calculation, so the allocated buffer is too small for the declared image data. A network client that sends a crafted ICO image can crash the imgproxy process and may be able to corrupt the heap and run code.
Written with Claude Haiku 5.5 from the sources below · 2026-10-30
Description from the GitHub advisory
## Summary The ICO loader allocates `data_size + BMP_FILE_HEADER_LEN` bytes after reading a 32-bit attacker-controlled `data_size`. For `data_size > UINT32_MAX - BMP_FILE_HEADER_LEN`, the addition wraps before allocation. imgproxy then writes the ICO prefix and reads up to the original declared size starting 14 bytes into the undersized allocation. A network client can turn this heap overflow into remote denial of service or remote code execution. ## Technical details The vulnerable path is in [`vips/icoload.c` at commit `f4fedbb`](https://github.com/imgproxy/imgproxy/blob/f4fedbb5c7f6684e7a8e0a9bb7e666773f3c40c0/vips/icoload.c#L154-L164): ```c uint32_t data_size = GUINT32_FROM_LE(largest_image_header.data_size); VipsPel *data = (VipsPel *) VIPS_MALLOC(NULL, data_size + BMP_FILE_HEADER_LEN); void *actual_data = data + BMP_FILE_HEADER_LEN; if (vips_foreign_load_read_full(ico->source, actual_data, data_size) <= 0) { vips_error("vips_foreign_load_ico_header", "unable to read ICO image data from the source"); return -1; } ``` The crafted directory entry contains: ```text data_size = 0xfffffff5 (4294967285) data_offset = 22 BMP header size = 14 32-bit result = (0xfffffff5 + 14) mod 2^32 = 3 ``` The allocation is therefore three bytes. `actual_data` points 14 bytes after the allocation base. The fixture contains 64 bytes after the ICO header, so the source callback copies those 64 bytes to an invalid destination before it can report that the declared multi-gigabyte payload is incomplete. The complete source-to-sink path is: 1. Attacker-controlled bytes begin with the ICO magic `00 00 01 00`. 2. imgproxy identifies the source as ICO and dispatches it to `vips_icoload_source_go`. 3. `vips_foreign_load_ico_header` reads the attacker-controlled `data_size`. 4. The 32-bit addition wraps, and `VIPS_MALLOC` receives the value three. 5. `vips_foreign_load_read_full` passes the original `data_size` to the Go source callback. 6. The callback writes the available source bytes through the invalid pointer, corrupting the process heap. ## Impact A crafted image can terminate the imgproxy process handling it or potentially lead to remote code execution due to heap corruption.
Why it matters now
SSVC decision points
Not available: CISA has not published SSVC decision points for this record.
Affected products
| Vendor | Product | Affected versions | Fixed in | Status | Source |
|---|---|---|---|---|---|
| — | github.com/imgproxy/imgproxy/v3 (Go) | 4.0.0 to before 4.0.16 | 4.0.16 | Patch available | GHSA-hff9-5pqw-6w9f |
| — | github.com/imgproxy/imgproxy/v2 (Go) | 4.0.0 to before 4.0.16 | 4.0.16 | Patch available | GHSA-hff9-5pqw-6w9f |
| — | github.com/imgproxy/imgproxy (Go) | 4.0.0 to before 4.0.16 | 4.0.16 | Patch available | GHSA-hff9-5pqw-6w9f |
- github.com/imgproxy/imgproxy/v3 (Go) Vendor— Affected 4.0.0 to before 4.0.16 Fixed in 4.0.16 Patch available GHSA-hff9-5pqw-6w9f
- github.com/imgproxy/imgproxy/v2 (Go) Vendor— Affected 4.0.0 to before 4.0.16 Fixed in 4.0.16 Patch available GHSA-hff9-5pqw-6w9f
- github.com/imgproxy/imgproxy (Go) Vendor— Affected 4.0.0 to before 4.0.16 Fixed in 4.0.16 Patch available GHSA-hff9-5pqw-6w9f
Remediation
Upgrade github.com/imgproxy/imgproxy/v3, github.com/imgproxy/imgproxy/v2 and github.com/imgproxy/imgproxy to 4.0.16, the fixed version listed for each of them.
Written with Claude Haiku 5.5 from the sources below · 2026-10-30
- Fix · GHSA-hff9-5pqw-6w9f github.com/imgproxy/imgproxy/v3 (Go) Fixed in 4.0.16 Advisory →
- Fix · GHSA-hff9-5pqw-6w9f github.com/imgproxy/imgproxy/v2 (Go) Fixed in 4.0.16 Advisory →
- Fix · GHSA-hff9-5pqw-6w9f github.com/imgproxy/imgproxy (Go) Fixed in 4.0.16 Advisory →
Timeline
- 2026-10-30 Threatist record created from GHSA-hff9-5pqw-6w9f
References
Sources
This product uses the NVD API but is not endorsed or certified by the NVD. Sources and licences