Skip to main content
Vulnerability Database/CVE-2026-112202

CVE-2026-112202: Imager::File::GIF Information Disclosure

CVE-2026-112202 is an information disclosure flaw in Imager::File::GIF for Perl that allows out-of-bounds reads when consolidating GIF images. Attackers can expose heap memory through crafted files. This post covers technical details, affected versions, impact assessment, and mitigation strategies.

Published:

Disclaimer: This content was generated using AI. While we strive for accuracy, please verify critical information with official sources.

Sources: National Vulnerability Database, CISA KEV, Exploit-DB

CVE-2026-112202 Overview

CVE-2026-112202 is an out-of-bounds read vulnerability [CWE-125] in Imager::File::GIF versions before 1.006 for Perl. The flaw also ships bundled in the Imager distribution before version 1.040. When gif_consolidate => 1 is set, the i_readgif_low routine uses palette indices from a GIF image without validating them against the colour table bounds. The reader copies bytes from beyond the heap allocation into the decoded output pixels. The default GIF reader is not affected.

Critical Impact

An attacker supplying a crafted GIF can disclose adjacent heap memory through decoded pixel output and may crash the process consuming the image.

Affected Products

  • Imager::File::GIF for Perl versions before 1.006
  • Imager distribution versions before 1.040 (bundled GIF code)
  • Applications invoking the Imager GIF reader with the gif_consolidate => 1 option

Discovery Timeline

  • 2026-10-20 - CVE-2026-112202 published to the National Vulnerability Database (NVD)
  • 2026-10-21 - Advisory posted to the Openwall oss-security mailing list
  • 2026-10-22 - Last updated in NVD database

Technical Details for CVE-2026-112202

Vulnerability Analysis

The vulnerability lives in the i_readgif_low routine inside GIF/imgif.c. When callers request GIF consolidation through gif_consolidate => 1, the routine processes palette indices from the compressed image data and resolves them against the GIF colour table. The code performs no bounds check on those indices before indexing the colour map. A crafted GIF can supply palette indices larger than the declared colour table size.

The reader then dereferences memory past the end of the colour table allocation on the heap. Those out-of-bounds bytes are copied into the output pixel buffer returned to the caller. Processes that read untrusted GIFs through consolidation expose adjacent heap memory to any consumer of the decoded image. Depending on heap layout, the invalid read can also fault and crash the host process. The default (non-consolidating) GIF reader path validates indices and is not affected.

Root Cause

The root cause is missing input validation on palette indices prior to colour table lookup. The GIF format allows indices up to 255, but a specific image's local or global colour table may declare fewer entries. The consolidation path trusted the index as supplied rather than clamping or rejecting out-of-range values before the array access.

Attack Vector

Exploitation requires an application that calls Imager::File::GIF with the gif_consolidate option enabled on an attacker-controlled GIF. Web services, image converters, thumbnailers, and CPAN modules that wrap Imager are typical attack surfaces. The attacker crafts a GIF with palette indices that exceed the colour table size and submits it through any workflow that reaches the vulnerable routine.

c
   GifColorType *ColorMapEntry;
   i_color col;
   int error;
+  i_color black; /* substitute for invalid indexes */
+
+  for (i = 0; i < MAXCHANNELS; ++i)
+    black.channel[i] = 0;
 
   mm_log((1,"i_readgif_low(GifFile %p, colour_table %p, colours %p)\n", GifFile, colour_table, colours));

Source: GitHub Patch Commit dec96f1. The patch introduces a zero-initialized blacki_color value used as a substitute whenever an index falls outside the colour table, preventing the out-of-bounds read.

Detection Methods for CVE-2026-112202

Indicators of Compromise

  • Repeated crashes or SIGSEGV signals in Perl processes that call Imager::File::GIF while handling user-uploaded images
  • Decoded GIF output containing anomalous pixel runs that do not correlate with the input image's declared palette
  • GIF uploads that trigger AddressSanitizer or Valgrind heap-buffer-overflow reports in test or staging builds

Detection Strategies

  • Inventory Perl environments for installed versions of Imager and Imager::File::GIF using cpan -l or perl -MImager::File::GIF -e 'print Imager::File::GIF->VERSION'
  • Grep application and CPAN module source for gif_consolidate => 1 to identify code paths that reach the vulnerable branch
  • Monitor image-processing workers for abnormal exit codes and core dumps shortly after GIF ingestion

Monitoring Recommendations

  • Forward image-worker logs, process-exit telemetry, and web-upload metadata to a centralized log pipeline for correlation
  • Alert on spikes in GIF decode failures tied to a single uploader, IP range, or tenant
  • Capture file hashes of GIFs that precede worker crashes for offline analysis

How to Mitigate CVE-2026-112202

Immediate Actions Required

  • Upgrade Imager::File::GIF to version 1.006 or later from CPAN
  • Upgrade the bundled Imager distribution to version 1.040 or later where the fix also ships
  • Audit application code and remove or guard any gif_consolidate => 1 call sites until patches are deployed
  • Rebuild container images and redeploy any long-running Perl workers so the patched module is loaded

Patch Information

The fix is commit dec96f12b3d8a7fd94e86264953a5e4919dd6036 in the tonycoz/imager repository. It initializes a blacki_color and substitutes it whenever a palette index is out of range. The patched releases are Imager-File-GIF-1.006 and Imager-1.040. See the GitHub Security Advisory GHSA-v4hp-5h6w-9897, the MetaCPAN Imager::File::GIF changes, and the MetaCPAN Imager changes for release notes.

Workarounds

  • Disable GIF consolidation by removing the gif_consolidate => 1 option and relying on the default GIF reader, which is not affected
  • Reject GIF uploads at the application boundary until the patched module is in place
  • Run image-processing workers under seccomp or systemd sandboxing so a crash from a crafted GIF cannot pivot to the host
bash
# Upgrade the patched modules from CPAN
cpan Imager::File::GIF
cpan Imager

# Verify installed versions
perl -MImager::File::GIF -e 'print Imager::File::GIF->VERSION, "\n"'
perl -MImager -e 'print Imager->VERSION, "\n"'

Disclaimer: This content was generated using AI. While we strive for accuracy, please verify critical information with official sources.

Sources: National Vulnerability Database, CISA KEV, Exploit-DB

Experience the Most Advanced Cybersecurity Platform

See how the world’s most intelligent, autonomous cybersecurity platform can protect your organization today and into the future.