
# dicom_server_sim.py - DICOM C-STORE SCP with no AE title check
from pynetdicom import AE, evt, AllStoragePresentationContexts
def handle_store(event):
ds = event.dataset
# No authentication, accepts any image from any remote
ds.save_as(f"/tmp/{ds.SOPInstanceUID}.dcm")
return 0x0000
handlers = [(evt.EVT_C_STORE, handle_store)]
ae = AE()
ae.supported_contexts = AllStoragePresentationContexts
ae.start_server(('', 11112), evt_handlers=handlers)
医学影像服务器(PACS)在未进行身份验证的情况下接受来自任何远程主机的 DICOM 图像。医院网络上的攻击者可以注入包含恶意像素数据或患者信息的伪造图像,从而导致误诊或下游系统受损。
pip install pynetdicom
python dicom_server_sim.py
python exploit_dicom_inject.py
该文件会出现在 /tmp 中。