Summary
imgproxy has integer overflow in imgproxy ICO loader that causes denial of service and may permit remote code execution
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:
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:
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:
- Attacker-controlled bytes begin with the ICO magic
00 00 01 00. - imgproxy identifies the source as ICO and dispatches it to
vips_icoload_source_go. vips_foreign_load_ico_headerreads the attacker-controlleddata_size.- The 32-bit addition wraps, and
VIPS_MALLOCreceives the value three. vips_foreign_load_read_fullpasses the originaldata_sizeto the Go source callback.- 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.
An arithmetic operation produces a value that exceeds the integer type's maximum, causing it to wrap to an unexpected small value. Typical impact: incorrect size calculations leading to heap overflows or logic errors.
GHSA-HFF9-5PQW-6W9F has a CVSS score of 9.8 (Critical). The vector is network-reachable, no privileges required, and no user interaction. A CVSS score reflects the worst-case severity of the vulnerability, not your specific exposure. Whether this affects your application depends on whether the vulnerable code is present and reachable in your environment. A fixed version is available (4.0.16); upgrading removes the vulnerable code path.
Affected versions
Security releases
Kodem intelligence
Severity tells you how bad this could be in the worst case. It does not tell you whether you are exposed. Exploitability and impact are functions of runtime truth: whether the vulnerable code is present, reachable, and actually executes in your application. A vulnerable package can sit in your dependency tree and never run.
Kodem, an Intelligent Application Security platform, uses runtime intelligence to reveal which vulnerabilities actually execute in production, so teams prioritize the ones that genuinely matter. Kodem's runtime-powered SCA identifies whether this CVE is reachable in your applications.
Already deployed Kodem?
See it in your environmentNew to Kodem? Get a demo →Remediation advice
github.com/imgproxy/imgproxy/v3 to 4.0.16 or later; github.com/imgproxy/imgproxy/v2 to 4.0.16 or later; github.com/imgproxy/imgproxy to 4.0.16 or later
Kodem Kai can prioritize this vulnerability in your dependency tree and generate a fix recommendation.
Frequently Asked Questions
- What is GHSA-HFF9-5PQW-6W9F? GHSA-HFF9-5PQW-6W9F is a critical-severity integer overflow or wraparound vulnerability in github.com/imgproxy/imgproxy/v3 (go), affecting versions >= 4.0.0, < 4.0.16. It is fixed in 4.0.16. An arithmetic operation produces a value that exceeds the integer type's maximum, causing it to wrap to an unexpected small value.
- How severe is GHSA-HFF9-5PQW-6W9F? GHSA-HFF9-5PQW-6W9F has a CVSS score of 9.8 (Critical). This score reflects the worst-case severity of the vulnerability, not your specific exposure. Whether it represents real risk in your environment depends on whether the vulnerable code is present and reachable.
- Which packages are affected by GHSA-HFF9-5PQW-6W9F?
github.com/imgproxy/imgproxy/v3(go) (versions >= 4.0.0, < 4.0.16)github.com/imgproxy/imgproxy/v2(go) (versions >= 4.0.0, < 4.0.16)github.com/imgproxy/imgproxy(go) (versions >= 4.0.0, < 4.0.16)
- Is there a fix for GHSA-HFF9-5PQW-6W9F? Yes. GHSA-HFF9-5PQW-6W9F is fixed in 4.0.16. Upgrade to this version or later.
- Is GHSA-HFF9-5PQW-6W9F exploitable, and should I be worried? Whether GHSA-HFF9-5PQW-6W9F is exploitable in your environment depends on whether the vulnerable code is present and reachable. A CVSS score is a worst-case rating; it does not account for your specific deployment, configuration, or usage patterns. Kodem, an Intelligent Application Security platform, uses runtime intelligence to show which vulnerabilities actually execute in production, so you can focus on the ones that represent real risk. Get a demo
- What actually determines whether GHSA-HFF9-5PQW-6W9F is exploitable, and how bad it is? Exploitability and impact are not fixed properties of a CVE. They depend on runtime truth: whether the vulnerable code is present, reachable, and actually executes in your application. A high CVSS score on a dependency that never runs is not the same as real risk. Kodem, an Intelligent Application Security platform, uses runtime intelligence to reveal which vulnerabilities actually execute in production, so teams prioritize the ones that genuinely matter.
- How do I fix GHSA-HFF9-5PQW-6W9F?
- Upgrade
github.com/imgproxy/imgproxy/v3to 4.0.16 or later - Upgrade
github.com/imgproxy/imgproxy/v2to 4.0.16 or later - Upgrade
github.com/imgproxy/imgproxyto 4.0.16 or later
- Upgrade