← Back to CVE Explorer

CVE-2026-47667

Full vulnerability record from the local CVENow database.

Description

CImg Library is a C++ library for image processing. Prior to version 4.0.0 in `_load_analyze()`, the header_size field is read as an `unsigned int` from the first 4 bytes of an Analyze/NIfTI file and passed directly to `new unsigned char[header_size]` without being bounded against the actual file size. A value up to ~4 GB is accepted. If the subsequent `fread` returns `short` as it will for any malformed file), the function throws a `CImgIOException` and the allocated buffer is never freed. A 6-byte crafted file is sufficient to trigger an allocation of ~1.3 GB per call, with the full allocation leaked on every error path. The issue is reachable via `load_analyze()` and the generic `load()` when the file extension is .hdr, .img, or .nii. Version 4.0.0 fixes the issue.

Severity
HIGH
CVSS score
7.5 (v3.1)
Vulnerability status
Deferred
Source identifier
Published
2026-07-21 20:17:01.323000
Last modified
2026-10-24 19:10:00.127000
View original CVE JSON
{
  "id": "CVE-2026-47667",
  "sourceIdentifier": "[email protected]",
  "published": "2026-07-21T20:17:01.323",
  "lastModified": "2026-10-24T19:10:00.127",
  "vulnStatus": "Deferred",
  "cveTags": [],
  "descriptions": [
    {
      "lang": "en",
      "value": "CImg Library is a C++ library for image processing. Prior to version 4.0.0 in `_load_analyze()`, the header_size field is read as an `unsigned int` from the first 4 bytes of an Analyze/NIfTI file and passed directly to `new unsigned char[header_size]` without being bounded against the actual file size. A value up to ~4 GB is accepted. If the subsequent `fread` returns `short`  as it will for any malformed file), the function throws a `CImgIOException` and the allocated buffer is never freed. A 6-byte crafted file is sufficient to trigger an allocation of ~1.3 GB per call, with the full allocation leaked on every error path. The issue is reachable via `load_analyze()` and the generic `load()` when the file extension is .hdr, .img, or .nii. Version 4.0.0 fixes the issue."
    },
    {
      "lang": "es",
      "value": "La Biblioteca CImg es una biblioteca de C++ para procesamiento de imágenes. Antes de la versión 4.0.0 en ’_load_analyze()’, el campo header_size se lee como un ’unsigned int’ de los primeros 4 bytes de un archivo Analyze/NIfTI y se pasa directamente a ’new unsigned char[header_size]’ sin ser acotado contra el tamaño real del archivo. Se acepta un valor de hasta ~4 GB. Si el ’fread’ subsiguiente devuelve ’short’ (como ocurrirá para cualquier archivo malformado), la función lanza una ’CImgIOException’ y el búfer asignado nunca se libera. Un archivo manipulado de 6 bytes es suficiente para activar una asignación de ~1.3 GB por llamada, con la asignación completa filtrada en cada ruta de error. El problema es alcanzable a través de ’load_analyze()’ y el ’load()’ genérico cuando la extensión del archivo es .hdr, .img o .nii. La versión 4.0.0 soluciona el problema."
    }
  ],
  "affected": [
    {
      "source": "[email protected]",
      "affectedData": [
        {
          "vendor": "GreycLab",
          "product": "CImg",
          "versions": [
            {
              "version": "< 4.0.0",
              "status": "affected"
            }
          ]
        }
      ]
    }
  ],
  "metrics": {
    "cvssMetricV31": [
      {
        "source": "[email protected]",
        "type": "Secondary",
        "cvssData": {
          "version": "3.1",
          "vectorString": "CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:N/I:N/A:H",
          "baseScore": 7.5,
          "baseSeverity": "HIGH",
          "attackVector": "NETWORK",
          "attackComplexity": "LOW",
          "privilegesRequired": "NONE",
          "userInteraction": "NONE",
          "scope": "UNCHANGED",
          "confidentialityImpact": "NONE",
          "integrityImpact": "NONE",
          "availabilityImpact": "HIGH"
        },
        "exploitabilityScore": 3.9,
        "impactScore": 3.6
      }
    ],
    "ssvcV203": [
      {
        "source": "134c704f-9b21-4f2e-91b3-4a467353bcc0",
        "ssvcData": {
          "timestamp": "2026-07-23T14:12:55.547375Z",
          "id": "CVE-2026-47667",
          "options": [
            {
              "exploitation": "poc"
            },
            {
              "automatable": "yes"
            },
            {
              "technicalImpact": "partial"
            }
          ],
          "role": "CISA Coordinator",
          "version": "2.0.3"
        }
      }
    ]
  },
  "weaknesses": [
    {
      "source": "[email protected]",
      "type": "Secondary",
      "description": [
        {
          "lang": "en",
          "value": "CWE-401"
        },
        {
          "lang": "en",
          "value": "CWE-789"
        },
        {
          "lang": "en",
          "value": "CWE-1284"
        }
      ]
    }
  ],
  "references": [
    {
      "url": "https://github.com/GreycLab/CImg/commit/6a69bf725ffd111a4c7dc61cc15e3661abd158ee",
      "source": "[email protected]"
    },
    {
      "url": "https://github.com/GreycLab/CImg/issues/480",
      "source": "[email protected]"
    },
    {
      "url": "https://github.com/GreycLab/CImg/security/advisories/GHSA-rmfc-grgj-qwhv",
      "source": "[email protected]"
    },
    {
      "url": "https://github.com/GreycLab/CImg/issues/480",
      "source": "134c704f-9b21-4f2e-91b3-4a467353bcc0"
    }
  ]
}