Skip to main content
CVE Vulnerability Database
Vulnerability Database/CVE-2024-42845

CVE-2024-42845: InVesalius DICOM Parser RCE Vulnerability

CVE-2024-42845 is an eval injection flaw in InVesalius DICOM parser that enables attackers to execute arbitrary code through malicious DICOM files. This article covers the technical details, affected versions, and mitigation strategies.

Published:

CVE-2024-42845 Overview

CVE-2024-42845 is an eval injection vulnerability in the invesalius/reader/dicom.py component of InVesalius, an open-source 3D medical imaging reconstruction application. Versions 3.1.99991 through 3.1.99998 are affected. Attackers can execute arbitrary code by tricking a user into loading a crafted DICOM medical imaging file. The flaw is categorized under CWE-94: Improper Control of Generation of Code.

Critical Impact

A maliciously crafted DICOM file can achieve arbitrary code execution in the context of the InVesalius user, compromising confidentiality, integrity, and availability of the workstation processing medical images.

Affected Products

  • InVesalius 3.1.99991
  • InVesalius versions 3.1.99992 through 3.1.99997
  • InVesalius 3.1.99998

Discovery Timeline

  • 2024-08-23 - CVE-2024-42845 published to the National Vulnerability Database
  • 2026-06-17 - Last updated in NVD database

Technical Details for CVE-2024-42845

Vulnerability Analysis

InVesalius parses DICOM (Digital Imaging and Communications in Medicine) files to reconstruct 3D medical imagery. The dicom.py reader passes attacker-controllable string content from DICOM metadata into a Python eval call. Because eval executes any valid Python expression, a crafted DICOM tag can trigger arbitrary code execution when the file is opened. Exploitation requires user interaction, since the target must load the malicious file, but no privileges beyond a standard user session are needed. Successful exploitation yields code execution in the user's context, enabling data theft, tampering with imaging results, and lateral movement inside clinical or research environments.

Root Cause

The root cause is unsafe dynamic evaluation of untrusted input. Instead of parsing DICOM field values with a safe, typed deserializer, the reader constructs a Python expression from file-supplied data and evaluates it. Any DICOM tag whose value reaches the eval sink becomes a code execution primitive. See the PartyWaveSec CVE-2024-42845 analysis for the affected code path.

Attack Vector

The attacker crafts a DICOM file whose metadata contains a Python expression payload. The file is delivered by email, shared storage, a PACS (Picture Archiving and Communication System) study, or any other channel from which a clinician or researcher would open imaging data. When InVesalius reads the file, the payload is passed through eval and executes. Additional context is available in the PartyWave research write-up.

// No verified proof-of-concept code is reproduced here.
// Refer to the PartyWaveSec repository for the technical
// details of the vulnerable code path and payload structure.

Detection Methods for CVE-2024-42845

Indicators of Compromise

  • Unexpected child processes spawned by the InVesalius Python interpreter after a DICOM file is opened, such as cmd.exe, powershell.exe, /bin/sh, or python subshells.
  • Outbound network connections originating from the InVesalius process to non-clinical destinations shortly after file load.
  • DICOM files containing Python syntax (for example, __import__, os.system, backticks, or lambda expressions) inside string-valued tags.

Detection Strategies

  • Inspect DICOM files at ingest for suspicious metadata patterns using YARA or content-inspection rules focused on Python expression syntax in tag values.
  • Monitor process ancestry on workstations running InVesalius and alert when the interpreter spawns shells or scripting engines.
  • Correlate file-open events for .dcm files with subsequent process creation and outbound network activity.

Monitoring Recommendations

  • Enable command-line and process-creation logging on endpoints used for medical imaging analysis.
  • Forward endpoint telemetry to a centralized data lake to allow retrospective hunting once new payload indicators are published.
  • Track InVesalius version inventory to identify hosts still running 3.1.99991 through 3.1.99998.

How to Mitigate CVE-2024-42845

Immediate Actions Required

  • Upgrade InVesalius to a version later than 3.1.99998 that removes the eval sink in invesalius/reader/dicom.py. Track fixes on the InVesalius releases page.
  • Restrict DICOM file ingestion to trusted sources and validated PACS pipelines until the upgrade is complete.
  • Warn clinicians and researchers not to open DICOM files received from untrusted senders.

Patch Information

Refer to the InVesalius GitHub repository and the releases page for the current patched build. Confirm the fixed version in the changelog before deployment and validate that invesalius/reader/dicom.py no longer invokes eval on file-derived values.

Workarounds

  • Run InVesalius under a low-privileged, sandboxed user account with no access to sensitive shares or credentials.
  • Apply application allow-listing to prevent the Python interpreter used by InVesalius from spawning shells or scripting hosts.
  • Perform DICOM metadata sanitization at the gateway, stripping or rejecting tags containing non-conforming string values before files reach analyst workstations.
bash
# Example: block InVesalius Python process from spawning shells (Linux, AppArmor-style pseudo-config)
# Deny execution of common shells and interpreters as children of the invesalius process
deny /bin/sh mrix,
deny /bin/bash mrix,
deny /usr/bin/python3 mrix,

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

Default Legacy - Prefooter | Experience the World’s Most Advanced Cybersecurity Platform

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.