imgproxy: Out-of-bounds heap write in ICO loader
An out-of-bounds heap write vulnerability in the imgproxy ICO loader allows unauthenticated attackers to trigger a deterministic worker crash (DoS) by supplying a crafted image file.
Triage facts
Revision 1- Applicability
- imgproxy (>= 3.3.0, < 4.0.17)
- Evidence
- Unknown
- Severity
- High
- Action
- Elevated
- Sources
- 1 public source
- Freshness
- Revision 1Nov 1, 02:45 UTC
- Detection
- 1 IOC
- Source quality
- A1Likely
imgproxy versions 3.3.0 through 4.0.15 contain an out-of-bounds heap write vulnerability in the ICO loader (vips/icoload.c). When processing an ICO file with a small declared image data size, the loader performs OOB reads and writes while reconstructing the BMP header. This causes memory corruption in the heap, specifically overwriting the size field of adjacent heap chunks. This corruption leads to a glibc munmap_chunk() error, causing the Go worker to abort (SIGABRT) and exit (exit code 2).
Attack Chain
- Attacker crafts a malicious ICO file containing a small
data_sizeand specific header parameters. - Attacker sends an HTTP request to an exposed imgproxy endpoint to process the malicious ICO.
- imgproxy passes the request to the underlying
vipslibrary. - The
vips_foreign_load_ico_headerfunction allocates a small heap buffer based on the maliciousdata_size. - The loader performs OOB reads from the malformed header and performs OOB writes during BMP reconstruction.
- The size field of the following heap chunk is corrupted during the OOB write.
- The application invokes
free()on the corrupted chunk. - The glibc allocator detects the corruption and triggers
munmap_chunk(): invalid pointer, leading to worker termination.
Impact
Successful exploitation results in a persistent denial of service (DoS) for the specific worker process. Since a single request can trigger the abort, an attacker can crash workers at a rate proportional to the volume of requests sent to the vulnerable endpoint.
Recommendation
- Upgrade to imgproxy version 4.0.17 or later to incorporate the patch for the ICO loader heap memory corruption.
- Implement request size limits and file validation filters to block unknown or suspicious ICO files before they reach the processing layer.
- Deploy monitoring for worker process exit codes; alert on high frequencies of exit code 2 in imgproxy worker pods.
Immediate actions
Upgrade imgproxy to 4.0.17
Threat Hunt
Identify repeated imgproxy worker restarts or exit code 2 in orchestrator logs
Data: Kubernetes container status / logs, imgproxy standard error logs
Mitigations
Upgrade imgproxy to 4.0.17
imgproxy ICO loader OOB write
Indicators of compromise
1
hash_sha256
| Type | Value |
|---|---|
| hash_sha256 | 075f3b5e97242573d32a1b7612672a438b3b24c8fa718e3967305bd65e6151e1 |