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

CVE-2026-44038: OFFIS DCMTK Buffer Overflow Vulnerability

CVE-2026-44038 is a buffer overflow in OFFIS DCMTK 3.7.0 Huffman decoder that enables attackers to read out-of-bounds memory through crafted JPEG streams. This post covers the technical details, affected versions, and mitigation.

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-44038 Overview

CVE-2026-44038 is an out-of-bounds read vulnerability in the Huffman decoder of the bundled Independent JPEG Group (IJG) libraries (libijg8, libijg12, libijg16) shipped with OFFIS DCMTK 3.7.0. The flaw exists in the dcmjpeg module, which decompresses JPEG-encoded Digital Imaging and Communications in Medicine (DICOM) images. A crafted DICOM file whose Huffman table defines a difference category above 15 causes the decoder to index past the extend_test[] and extend_offset[] tables. The result is incorrectly decoded pixel data or a process crash. Any application using DCMTK to decompress JPEG DICOM images, including the dcmdjpeg utility, is affected [CWE-125].

Critical Impact

Processing an attacker-supplied DICOM file triggers an out-of-bounds memory read that can crash medical imaging applications or corrupt decoded pixel output.

Affected Products

  • OFFIS DCMTK 3.7.0 (dcmjpeg module)
  • Bundled IJG JPEG libraries: libijg8, libijg12, libijg16
  • dcmdjpeg utility and any application linking DCMTK for JPEG DICOM decompression

Discovery Timeline

  • 2026-10-08 - CVE-2026-44038 published to the National Vulnerability Database
  • 2026-10-08 - Last updated in NVD database

Technical Details for CVE-2026-44038

Vulnerability Analysis

The IJG JPEG decoder uses two static lookup tables, extend_test[] and extend_offset[], to sign-extend Huffman-decoded coefficient differences. Both tables are sized for category values of 0 through 15, which matches the valid range defined in ISO 10918-1 Tables F.1 and F.6 for DCT-based coding. When a crafted Huffman table yields a symbol value s greater than 15, the decoder uses s directly as an index into these tables without validation. The result is a global out-of-bounds read.

The affected code paths include jdhuff.c, jdphuff.c, and jdlhuff.c in each of the three precision variants of the bundled IJG library. The strict validation path, enabled only via DCMTK_ENABLE_STRICT_HUFFMAN_TABLE_CHECK, is disabled by default. All default builds therefore accept malformed Huffman tables and reach the vulnerable code.

Root Cause

The root cause is missing range validation on Huffman symbol values before they are used as array indices. The ISO 10918-1 standard constrains the DC difference category SSSS to the range 0–15 (and the special lossless value 16), but the decoder trusted the Huffman table contents and did not enforce this constraint.

Attack Vector

An attacker crafts a DICOM file containing an embedded JPEG stream whose Huffman table emits symbol values above 15. When a radiologist, PACS workstation, or batch processing pipeline uses DCMTK to decompress the image, the Huffman decoder reads memory beyond the end of extend_test[] and extend_offset[]. The outcome is either corrupt pixel output rendered to the clinician or an application crash, resulting in denial of service for the imaging workflow.

c
/* Patch: dcmjpeg/libijg12/jdphuff.c */
/* Section F.2.2.1: decode the DC coefficient difference */
HUFF_DECODE(s, br_state, tbl, return FALSE, label1);
if (s) {
-    CHECK_BIT_BUFFER(br_state, s, return FALSE);
-    r = GET_BITS(s);
-    s = HUFF_EXTEND(r, s);
+    /* DC categories above 15 are undefined for DCT-based coding */
+    /* (ISO 10918-1 Tables F.1 and F.6) and would index extend_test[]/ */
+    /* extend_offset[] out of bounds; treat such a Huffman code as */
+    /* corrupt data instead of reading past the array. */
+    if (s > 15) {
+      WARNMS(cinfo, JWRN_HUFF_BAD_CODE);
+      s = 0;
+    } else {
+      CHECK_BIT_BUFFER(br_state, s, return FALSE);
+      r = GET_BITS(s);
+      s = HUFF_EXTEND(r, s);
+    }
}

Source: DCMTK commit d6ae1bc8

A parallel fix in jdlhuff.c adds the same guard to the lossless Huffman decoding path:

c
/* Patch: dcmjpeg/libijg12/jdlhuff.c */
/* Section H.2.2: decode the sample difference */
HUFF_DECODE(s, br_state, dctbl, return mcu_num, label1);
if (s) {
-  if (s == 16)  /* special case: always output 32768 */
+  if (s == 16)  /* lossless SSSS = 16: output 32768 (ISO 10918-1 Table H.2) */
     s = 32768;
+  else if (s > 15) {  /* SSSS > 16 is undefined and would overrun extend_test[] */
+    WARNMS(cinfo, JWRN_HUFF_BAD_CODE);
+    s = 0;
+  }
   else {    /* normal case: fetch subsequent bits */
     CHECK_BIT_BUFFER(br_state, s, return mcu_num);
     r = GET_BITS(s);

Source: DCMTK commit d6ae1bc8

Detection Methods for CVE-2026-44038

Indicators of Compromise

  • Unexpected crashes or SIGSEGV terminations in processes that invoke dcmdjpeg or link libdcmjpeg
  • DICOM files whose embedded JPEG Huffman tables produce DC category values greater than 15 (16 for lossless streams)
  • Rendered DICOM images containing visually corrupted or garbage pixel regions
  • Runtime warnings referencing JWRN_HUFF_BAD_CODE after applying the patch

Detection Strategies

  • Scan DICOM archives with a parser that validates embedded JPEG Huffman tables against ISO 10918-1 Tables F.1, F.6, and H.2
  • Fuzz test ingestion pipelines using AFL++ or libFuzzer harnesses against dcmdjpeg to surface additional malformed inputs
  • Enable DCMTK_ENABLE_STRICT_HUFFMAN_TABLE_CHECK at build time to force structured rejection of out-of-range Huffman symbols

Monitoring Recommendations

  • Monitor PACS, VNA, and viewer workstations for repeated process crashes correlated to specific DICOM study UIDs
  • Alert on externally sourced DICOM files (email, portable media, web upload) that fail JPEG decode validation
  • Log and review DCMTK stderr output for JWRN_HUFF_BAD_CODE warnings after patching

How to Mitigate CVE-2026-44038

Immediate Actions Required

  • Rebuild DCMTK from upstream main including commit d6ae1bc8d5b9ae9c7300013c8c85cc2ea0fd8cf5 and redeploy affected binaries
  • Audit downstream products that bundle DCMTK 3.7.0 and request vendor-updated builds
  • Restrict ingestion of DICOM files from untrusted sources until patched builds are deployed

Patch Information

The issue is fixed in DCMTK upstream commit d6ae1bc8d5b9ae9c7300013c8c85cc2ea0fd8cf5, which adds explicit range checks to the Huffman decoding routines in jdhuff.c, jdphuff.c, and jdlhuff.c across libijg8, libijg12, and libijg16. See the DCMTK commit on GitHub and the DCMTK issue tracker entry #1221 for upstream discussion.

Workarounds

  • Rebuild DCMTK with -DDCMTK_ENABLE_STRICT_HUFFMAN_TABLE_CHECK=ON to enforce Huffman table range validation at parse time
  • Isolate DICOM decompression in a sandboxed process with resource limits so a crash does not disrupt the host service
  • Pre-validate inbound DICOM files with an independent JPEG parser before passing them to DCMTK
bash
# Build DCMTK with strict Huffman table validation enabled
git clone https://github.com/DCMTK/dcmtk.git
cd dcmtk
git checkout d6ae1bc8d5b9ae9c7300013c8c85cc2ea0fd8cf5
mkdir build && cd build
cmake -DDCMTK_ENABLE_STRICT_HUFFMAN_TABLE_CHECK=ON ..
cmake --build . --config Release

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.