Some Hot Dicom Polyglot Action

Danny Hetzel

CypherCon 9.0 (2026)

Overview

In his CypherCon talk, "Some Hot Dicom Polyglot Action," medical device specialist Danny Hetzel exposes critical vulnerabilities within the DICOM (Digital Imaging and Communications in Medicine) standard, specifically its Part 10 file format, that allow for the creation of sophisticated polyglot files. Hetzel, drawing from his experience in product security and FDA 510k submissions, demonstrates how DICOM's design, intended for flexibility and interoperability, inadvertently creates a "perfect breeding ground" for these multi-format files. A polyglot is a single byte sequence that is semantically valid under multiple file format specifications and can be meaningfully processed by more than one independent parser.

Watch on YouTube

Visual summary for Some Hot Dicom Polyglot Action by Danny Hetzel
Visual summary for Some Hot Dicom Polyglot Action by Danny Hetzel

Key moments

  1. 2:00 Speaker intro and DICOM file format overview
  2. 4:00 Defining polyglot files and their evasion capabilities
  3. 9:00 DICOM's inherent vulnerabilities: preamble and private tags
  4. 10:00 Simple bash script polyglot using DICOM's preamble
  5. 13:00 Strategy for embedding a Windows executable into DICOM
  6. 26:00 DICOM transfer methods, persistence, and evasion techniques
  7. 28:00 Automated exploit generation and industry's resistance to fix

Some Hot Dicom Polyglot Action

Speakers: Danny Hetzel, Medical Device Specialist

Conference: CypherCon

YouTube: https://www.youtube.com/watch?v=13ibJUGOVNk

Overview

In his CypherCon talk, "Some Hot Dicom Polyglot Action," medical device specialist Danny Hetzel exposes critical vulnerabilities within the DICOM (Digital Imaging and Communications in Medicine) standard, specifically its Part 10 file format, that allow for the creation of sophisticated polyglot files. Hetzel, drawing from his experience in product security and FDA 510k submissions, demonstrates how DICOM's design, intended for flexibility and interoperability, inadvertently creates a "perfect breeding ground" for these multi-format files. A polyglot is a single byte sequence that is semantically valid under multiple file format specifications and can be meaningfully processed by more than one independent parser.

The talk highlights how these DICOM polyglots can be used to bypass conventional security controls, smuggle malicious payloads (such as bash scripts or Windows Portable Executables), and achieve persistence within medical imaging pipelines. Hetzel underscores the implicit trust assumptions inherent in healthcare systems, where DICOM files often traverse multiple tools and services, each parsing the file differently. This talk is a crucial warning to the medical industry, revealing a known exploit (dating back to 2019) that remains largely unaddressed, with automation and enhanced evasion techniques now on the horizon.

Background

▶ Watch: Speaker intro and DICOM file format overview (2:00)

The DICOM standard is the ubiquitous protocol for handling, storing, printing, and transmitting information in medical imaging. A DICOM file (specifically Part 10) typically contains medical images—like MRI slices—along with extensive metadata. While designed for robust interoperability and flexibility, Hetzel argues that certain architectural choices within the DICOM file format make it uniquely susceptible to polyglot attacks.

A polyglot file is a security artifact that is simultaneously valid under two or more different file formats. For instance, a single file might be recognized as a valid image by an image viewer, but also as an executable by an operating system. This duality allows attackers to evade detection mechanisms that typically rely on file extension, header signatures, or basic content validation. Hetzel details how polyglots can survive:

  • Format validation: The file appears valid for one format.
  • Content inspection: Tools like VirusTotal may or may not detect the embedded payload, depending on the polyglot's construction.
  • Signature checks: The file's primary format signature remains intact.
  • File type enforcement: It passes as the intended file type.

The speaker notes that even advanced systems, including those leveraging AI, often make implicit trust assumptions that polyglots can exploit. This isn't a theoretical threat; Hetzel references several recent, real-world polyglot attacks, including the Sensosa backdoor (2024-2025) using Zip/Portable Executable polyglots, the Phantom Pyramid Headmare (2025) with Zinc/Zip/Executable, and Locust Harvest (2025) leveraging the Hanoi Thief. These examples underscore that polyglot attacks are a current and evolving threat, not just an academic curiosity. The medical imaging pipeline, with its multiple parsing stages and cross-domain transfers, presents an ideal environment for such sophisticated evasion techniques.

Key Findings

▶ Watch: DICOM's inherent vulnerabilities: preamble and private tags (9:00)

Danny Hetzel's core discovery, building upon prior work by Dort in 2019, is that the DICOM Part 10 file format possesses specific structural characteristics that render it exceptionally vulnerable to polyglot techniques. These vulnerabilities stem from design decisions intended to enhance flexibility and third-party vendor interoperability, but which inadvertently create ideal spaces for embedding malicious code without invalidating the DICOM file itself.

The two primary "breeding grounds" for polyglots within DICOM are:

  1. The Preamble: The DICOM Part 10 file begins with a 128-byte preamble followed by a 4-byte prefix. Critically, this 128-byte preamble is often "nothing"—blank, empty space that almost no DICOM imaging parsers actually examine. Hetzel identifies this as a "terrible decision design idea," providing attackers with a readily available 128-byte buffer at the very beginning of the file to embed initial payload components.
  1. Private Tags within Data Elements: Beyond the preamble, DICOM files contain various data elements which hold image information, metadata, and instructions. These data elements are identified by "tags." DICOM has a feature where parsers are designed to ignore data elements designated as "private tags," which are typically odd-numbered tags. This mechanism, intended to allow third-party vendors to embed proprietary information without breaking standard DICOM viewers, provides "massive amounts of room" for attackers. By using private tags, an attacker can embed substantial portions of a secondary file format (e.g., a Portable Executable) within the DICOM structure, confident that standard DICOM parsers will simply skip over this data.

Together, the unexamined 128-byte preamble and the ignored private tags provide attackers with ample space and a robust evasion mechanism. The consequence is that a single file can appear as a perfectly valid medical image to a DICOM viewer, while simultaneously functioning as an executable or a script when processed by a different system component (e.g., an operating system shell or a Windows loader). Hetzel emphasizes that this six-to-seven-year-old exploit has not been fully addressed within the medical health industry, and with the advent of automated generation tools (developed by Caleb from the Biohacking Village) and advanced evasion techniques (pioneered by Michael Vega), the threat is rapidly escalating to an "undetectable" and "automated" level.

Technical Deep Dive

▶ Watch: Simple bash script polyglot using DICOM's preamble (10:00)

Creating a DICOM polyglot leverages the structural peculiarities identified by Hetzel. The process can range from remarkably simple for basic scripts to significantly more complex for embedding full executables. The speaker outlines the necessary tools: a hex editor (like HXD), a DICOM imaging tool to verify file validity, and a target environment (Windows or Linux, depending on the payload).

Basic Bash Script Polyglot (Linux)

This method exploits the 128-byte DICOM preamble directly:

  1. Obtain a Valid DICOM File: Start with any functional DICOM file.
  2. Embed Bash Script: Using a hex editor, prepend a short bash script directly into the first 128 bytes of the DICOM file's preamble.
  3. Execution: When this modified file is treated as a script in a Linux environment, the bash interpreter will execute the embedded script. When opened by a DICOM parser, the preamble is ignored, and the file still renders as a valid medical image. This simplicity highlights the fundamental flaw in DICOM's design regarding this empty space.

Portable Executable (PE) Polyglot (Windows)

Embedding a Windows Portable Executable (PE) is considerably more involved, requiring precise manipulation of byte offsets and pointers. The goal is to interleave the PE structure within the DICOM file such that both formats remain valid. This technique was first discovered by Dort in 2019.

The process involves:

  1. Prepare a DICOM Host: Start with a valid DICOM file.
  2. Extract MS-DOS Stub: A standard PE begins with an MS-DOS stub, which is exactly 128 bytes long. This stub is a legacy component that typically prints an error message like "This program cannot be run in DOS mode."
  3. Embed MS-DOS Stub into Preamble: The 128-byte MS-DOS stub is perfectly inserted into the 128-byte DICOM preamble. This maintains the DICOM's validity while providing the necessary initial PE component.
  4. Embed PE Core into Private Tags: The main body of the PE, starting with the PE signature (hex 50 45 00 00, ASCII "PE\0\0"), is then placed into private data elements within the DICOM file. These private tags (identified by odd-numbered tags, e.g., 09xx) are explicitly ignored by DICOM parsers, providing a safe haven for the executable code.
  5. Adjust e_lfanew Pointer: Within the MS-DOS stub (now in the DICOM preamble), there is a crucial pointer known as e_lfanew. This pointer normally points to the start of the PE signature. Since the PE signature has been moved deep into the private tags, the e_lfanew pointer must be updated to reflect the new file offset of the PE signature within the DICOM file. This creates a functional chain for the Windows loader.
  6. Identify PE Section Information: To correctly re-align the PE, several pieces of information from the PE header are needed:
  • Number of Sections: Found 2 bytes after the PE magic word (read in little-endian).
  • Size of Headers: Found 80 bytes after the PE magic word.
  • Size of File Alignment: Found 56 bytes after the PE magic word. This value dictates the byte multiples for proper section alignment.
  1. Relocate Pointers to Raw Data and Re-align:
  • The PE's section tables contain pointers to raw data for each section (e.g., .text, .rdata, .data). Each section entry is 40 bytes long, and the pointer to raw data is typically 16 bytes after the PE magic word.
  • Due to the insertion of DICOM data between the MS-DOS stub and the PE core, the offsets of these sections shift. The attacker must calculate the new offset (padding) and then update each of the "pointers to raw data" by this exact amount. For example, if the file shifted by 0x200 bytes, 0x200 must be added to every pointer.
  • If necessary, adjust padding within the DICOM file or modify the Size of File Alignment value to ensure all PE sections align correctly according to their original alignment requirements.

Once these meticulous hex manipulations are complete, the resulting file functions as a DICOM image when opened by an imaging tool, yet executes the embedded PE payload when invoked by the operating system. This sophisticated technique demonstrates a profound understanding of both file formats and parser behavior, turning DICOM's intended flexibility into a significant security liability.

Demo / Proof of Concept

▶ Watch: DICOM transfer methods, persistence, and evasion techniques (26:00)

While the presentation did not feature a live, interactive demonstration, Danny Hetzel provided a detailed, step-by-step conceptual walkthrough of how to construct both the simple bash script polyglot and the more intricate Portable Executable polyglot using a hex editor. His explanation of the specific byte manipulations, offsets, and pointer adjustments for the PE polyglot serves as a clear proof of concept, illustrating the feasibility and methodology of the attack.

Hetzel explicitly states the outcome: "Again, if you run this through a parser, it will open as a [DICOM] file. If you run it as an executable, it will run it. it'll run the portable executable as a executable file. It's just matters in the context of how you want to run it. It'll run and work." This confirms that the described technical steps yield a functional polyglot. He used the HXD hex editor as the primary tool for illustrating the byte-level changes required to interleave the different file formats. The talk essentially walks the audience through the "how-to" of building these polyglots, providing sufficient detail for someone with technical expertise to replicate the process.

Defensive Implications

▶ Watch: Automated exploit generation and industry's resistance to fix (28:00)

The existence and increasing sophistication of DICOM polyglots present significant challenges for defenders in the healthcare sector. The talk highlights several critical defensive implications:

  1. Challenge Implicit Trust Assumptions: Healthcare systems often operate on a high degree of implicit trust, especially when receiving files from "trusted" sources like satellite clinics or internal systems. This talk unequivocally demonstrates that such trust is misplaced when dealing with inherently flexible file formats like DICOM. Defenders must assume that any incoming file, regardless of its apparent type or source, could harbor hidden malicious payloads.
  1. Bypass of Traditional Security Controls: Polyglots are designed to evade standard security measures:
  • File Type Validation: They appear as valid DICOM files, passing initial checks.
  • Signature-Based Antivirus: Depending on the polyglot's construction and evasion techniques (which are being actively developed), existing AV signatures may fail to detect the embedded executable.
  • Content Inspection: Basic content scanners might overlook the payload hidden in ignored sections like the preamble or private tags.
  1. Vulnerability of DICOMweb (STOW-RS): Hetzel points out a critical distinction in transfer protocols. While DICOM SCP transfer will strip the 128-byte preamble (potentially neutralizing simple bash script polyglots or the MS-DOS stub of a PE polyglot), the STOW-RS format (part of DICOMweb) performs a byte-for-byte transfer. This means that polyglots transferred via STOW-RS will remain intact and fully functional on the receiving end, representing a significant and often overlooked attack vector.
  1. Persistence and Hidden Payloads: Even if an embedded executable isn't immediately triggered, a DICOM polyglot can serve as a persistent, hidden storage mechanism for malicious code. An attacker can plant such a file on a medical system, waiting for a later opportunity to trigger it, bypassing data exfiltration concerns.
  1. Urgent Need for DICOM Standard Review: The "legacy capability" argument, frequently cited as a reason not to update DICOM or enforce encryption, is actively hindering security progress. The industry's resistance to closing these known gaps, despite the 6-7 year old nature of this exploit, is creating an environment ripe for exploitation. With automated polyglot generation tools and advanced, undetectable evasion techniques emerging, the window for proactive defense is rapidly closing.

Defenders need to move beyond superficial file checks and implement deeper, context-aware content analysis for DICOM files. This includes scrutinizing the preamble and private tags, understanding the behavior of different DICOM parsers in their pipeline, and re-evaluating the security implications of DICOMweb for file transfers. The security of medical devices and patient data hinges on addressing these fundamental architectural flaws in widely used protocols.

Key Takeaways

  • DICOM's Architecture is Vulnerable: The 128-byte preamble and the ability to define ignored "private tags" in DICOM Part 10 files create inherent weaknesses perfectly suited for polyglot attacks.
  • Polyglots Evade Standard Controls: DICOM polyglots can bypass conventional file type validation, signature-based detection, and basic content inspection, making them difficult to detect with traditional security tools.
  • Dual Attack Vectors: Simple bash scripts can be embedded in the preamble for Linux environments, while complex Windows Portable Executables can be interleaved across the preamble and private tags for Windows execution.
  • DICOMweb is a Critical Threat Vector: The STOW-RS transfer format (part of DICOMweb) transfers files byte-for-byte, preserving polyglot integrity, unlike DICOM SCP which strips the preamble.
  • Unaddressed and Escalating Threat: This 6-7 year old exploit remains largely unaddressed in the medical industry, and new automation tools and advanced evasion techniques are making these attacks increasingly potent and undetectable.
  • Implicit Trust is a Major Flaw: The medical sector's reliance on implicit trust in data pipelines, without robust verification at each stage, is a significant vulnerability that polyglots effectively exploit.

About the Speaker(s)

Danny Hetzel, also known as Danhammer Hzel, is a dedicated medical device specialist. He has worked for prominent companies within the healthcare and medical technology sectors, including BD (Becton Dickinson), Johnson & Johnson, Accuray, and Madison. His expertise lies in product security, where he focuses on ensuring the robustness and safety of medical devices, particularly in navigating complex regulatory processes such as FDA 510k submissions to meet critical industry standards. Hetzel's work emphasizes the intersection of medical technology, cybersecurity, and regulatory compliance.

Reviews

Dr. Zero (Offensive Security Researcher) — SOLID

Danny Hetzel resurrects Dort's 2019 DICOM polyglot research to remind us that healthcare architecture is still fundamentally broken. It's a competent hex-level walkthrough of embedding PEs into medical images, but the lack of a live demo and zero net-new research caps its ceiling. Solid refresher if you missed this trick half a decade ago.

Heather Calloway (CISO) — STRONG ACCEPT

If you operate a clinical network, this is mandatory viewing for your architecture and medical device security teams. Hetzel exposes how the DICOM standard's design flaws allow attackers to smuggle executables past traditional inspection tools, forcing a fundamental re-evaluation of how we trust and segment medical imaging pipelines.

→ Top-rated talks at CypherCon 9.0 (2026)

All talks from CypherCon 9.0 (2026)