CVE-2023-33466 - Exploiting Healthcare Servers with Polyglot Files
Orthanc before 1.12.0 has an endpoint that allows authenticated users to overwrite arbitrary files, and by overwriting the configuration file with a DICOM polyglot, an attacker can enable Lua execution and achieve remote code execution.
Orthanc is an open source software to manage, exchange and visualize medical imaging data. In versions < 1.12.0, it is affected by an arbitrary file overwrite vulnerability (CVE-2023-33466) that might allow an authenticated attacker to obtain RCE on the system.
The full write-up lives on its author's site
It belongs to its author, so we link to it rather than copy it. The other two tabs are our own rewrites, checked against it.
Not written yet. The AI write-up for this write-up has not been written yet. The Original tab links to the source.
How it worked
Root cause
The application exposes an API endpoint that writes user-supplied DICOM files to arbitrary filesystem paths without restricting the target path, and the configuration file can be overwritten to enable dangerous features.
Impact
An authenticated attacker might overwrite the configuration file and enable Lua execution, potentially leading to remote code execution on the server.
What the attacker needed
Valid credentials (default orthanc:orthanc); knowledge of configuration file path; ability to upload DICOM files
The fix
The vulnerability was fixed in Orthanc 1.12.0 by disabling the file export endpoint by default and introducing a configuration option to enable it.
How it was found
- Create a DICOM file that is also a valid Orthanc JSON configuration by replacing the first bytes with a JSON payload and appending a null byte.
- Call GET /instances to list currently uploaded instances.
- Upload the crafted file through the UI upload functionality.
- Call GET /instances again and compare to find the new instance ID.
- Call POST /instances/{instance_id}/export with the target configuration path in the POST body.
- Trigger a restart via POST /tools/reset.
Explained by bugbounty.wiki with AI from the original and checked against quotes from it; it can still be wrong. Read the original before relying on a detail.
Not written yet. The AI write-up for this write-up has not been written yet. The Original tab links to the source.
Orthanc is a server for medical images. A logged-in user could abuse a feature that writes files to the server's disk to replace a configuration file with a specially crafted image that also works as a configuration. This let the attacker turn on a scripting feature and run commands on the server.
What is File upload?
An upload feature accepts a file that the server or other users' browsers then treat as code or as something trusted.