Summary
OHIF's dicom-pdf extension can treat attacker-controlled DICOM document data as HTML when creating a Blob for display. If a victim opens a malicious Encapsulated PDF DICOM object, embedded script may run in the OHIF origin and access same-origin data or make authenticated requests.
Affected context
The issue occurs in OHIF's dicom-pdf extension when it handles Encapsulated PDF SOP Class objects. The extension uses the DICOM MIMETypeOfEncapsulatedDocument value as the Blob media type, then embeds the resulting Blob URL in an object element. Risk depends on an attacker being able to supply or modify a DICOM object that a user later opens, such as through a local file, shared PACS, or DICOMweb source.
Exploit preconditions
- Attack surface: The OHIF dicom-pdf extension's handling and display of Encapsulated PDF DICOM objects
- Required access: Ability to provide or influence a DICOM object and its MIME type and encapsulated bytes
- Trigger point: A victim opens the malicious object in OHIF
- Why exploitation is possible: The attacker-controlled MIME type can cause the Blob to be interpreted as HTML, and its URL inherits the OHIF origin despite the object element's PDF hint
Why this happens
The application uses an untrusted DICOM metadata value to determine how attacker-controlled document bytes are interpreted by the browser. When those bytes are rendered as active HTML in a Blob URL associated with the application's origin, script can execute with access to that origin's privileges. This maps to CWE-79: Improper Neutralization of Input During Web Page Generation, because untrusted content is allowed to become executable page content.
Potential impact
- Embedded script may access session storage or authentication tokens available to the OHIF origin
- Script may make authenticated requests to same-origin PACS services
- A victim's session or accessible imaging data could be exposed or misused
- The application's integrity could be affected through actions available to the victim's session
General mitigation guidance
Defensive patterns focus on preventing untrusted document data from becoming active content in the application's origin.
- Use a strict allowlist for accepted document media types and set the type independently of attacker-controlled metadata.
- Validate that the document content and declared type are consistent before rendering.
- Prefer a secure, isolated rendering context for documents, with sandboxing and a separate origin where practical.
- Apply restrictive content security policies and avoid exposing sensitive tokens to browser-accessible storage.
- Limit PACS and application permissions to the minimum required for the user and viewer workflow.
How teams detect issues like this
- Use static analysis and code review to find flows where DICOM metadata controls Blob types, document rendering, or embedded object content.
- Review whether user-controlled document bytes can be rendered as active HTML and whether the rendering context shares the application origin.
- Add tests and policy checks requiring media types to come from a fixed allowlist and document viewers to use an appropriately isolated context.
- Monitor for unexpected HTML document rendering in workflows intended for PDF content; automated code review tools may help identify risky data flows.

