---
id: "GHSA-hff9-5pqw-6w9f"
kind: "vulnerability"
aliases: ["GHSA-hff9-5pqw-6w9f"]
title: "imgproxy has integer overflow in imgproxy ICO loader that causes denial of service and may permit remote code execution"
severity: "critical"
cvss: 9.8
epss: null
exploited: false
status: "open"
category: "package"
products: [{"name": "github.com/imgproxy/imgproxy/v3", "fixed": ["4.0.16"], "affected": ">= 4.0.0, < 4.0.16", "ecosystem": "go"}, {"name": "github.com/imgproxy/imgproxy/v2", "fixed": ["4.0.16"], "affected": ">= 4.0.0, < 4.0.16", "ecosystem": "go"}, {"name": "github.com/imgproxy/imgproxy", "fixed": ["4.0.16"], "affected": ">= 4.0.0, < 4.0.16", "ecosystem": "go"}]
ecosystems: ["go"]
tags: ["cwe-122", "cwe-190", "go", "imgproxy", "libvips", "package", "self-hosted"]
not_affected_if: ["fixed-version", "trusted-input-only"]
published_at: "2026-10-30T22:57:00+00:00"
first_seen_at: "2026-10-30T23:02:03+00:00"
updated_at: "2026-10-30T23:02:45+00:00"
sources: [{"source": "ghsa", "url": "https://github.com/advisories/GHSA-hff9-5pqw-6w9f", "first_seen_at": "2026-10-30T23:02:03+00:00"}]
---

# imgproxy has integer overflow in imgproxy ICO loader that causes denial of service and may permit remote code execution

imgproxy's ICO image loader computes a wrapped 32-bit allocation size from an attacker-supplied field, then writes source data past a tiny buffer. A remote client who submits a crafted ICO image can crash the imgproxy process or potentially corrupt the heap to run code.

_Summary, check and fix written by a model from the sources; labelled as such._

## Affected

- go:github.com/imgproxy/imgproxy/v3 affected >= 4.0.0, < 4.0.16 fixed 4.0.16
- go:github.com/imgproxy/imgproxy/v2 affected >= 4.0.0, < 4.0.16 fixed 4.0.16
- go:github.com/imgproxy/imgproxy affected >= 4.0.0, < 4.0.16 fixed 4.0.16

## How to check

- Check the imgproxy version: run `imgproxy -v` or inspect the Go module version with `go list -m github.com/imgproxy/imgproxy/v3` (or v2 / the root module, depending on how it is built)
- Confirm whether the image processing endpoint accepts ICO input from remote clients (look for `ico` in allowed formats in the imgproxy configuration)

## Fix

- imgproxy `4.0.16` (affected: `>= 4.0.0, < 4.0.16`)

## Timeline

- 2026-10-30T23:02:03+00:00 ghsa https://github.com/advisories/GHSA-hff9-5pqw-6w9f

## Documents

- [advisory] Maintainer's advisory: api.github.com https://api.github.com/repos/imgproxy/imgproxy/security-advisories/GHSA-hff9-5pqw-6w9f
- [advisory] Maintainer's advisory: github.com https://github.com/imgproxy/imgproxy/security/advisories/GHSA-hff9-5pqw-6w9f
- [fix] Patch: github.com https://github.com/imgproxy/imgproxy/commit/a821b6a4cb07a1bf2bb9077431d1c1e734d79917
- [fix] Release: github.com https://github.com/imgproxy/imgproxy/releases/tag/v4.0.16

## From the sources

## 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.

---

_Free to read at a human pace. An API with keys and an MCP server are in preparation; early access: hello@infrastack.ai_
