Exchange Server: Prevent mail spoofing

Mail spoofing is often used to persuade users to open dangerous attachments in emails. The aim is to make it look as if the e-mail is coming from a colleague or a device such as a scanner or Fax2Mail. Mail spoofing is used to falsify the sender's address so that it looks to the user as if the email came from an internal sender.

Here is an example:

It looks as if scanner@frankysweb.de has sent an e-mail to frank@frankysweb.de. The attachment appears to be a PDF document.

Mail spoofing

At this point, the user does not recognize that the mail is not coming from an internal printer/scanner and that a colleague has perhaps only sent him a document. The attachment, in this case the PDF, is usually an infected document that contains or downloads the virus/Trojan.

If the user receives such an e-mail, the upstream security mechanisms have already failed. Only the e-mail header shows that the e-mail was sent to the user via a mail server from the Internet:

E-mail header

As shown above, this is only a simulation. However, if you configure the Exchange Server directly to receive mails from the Internet, i.e. MX-Record points to the public IP and a router forwards port 25 unfiltered to the Exchange Server, you should check whether the configuration enables mail spoofing:

Is the mail arriving? If yes, then fix it!

The setting can be found on the Exchange receiving connectors. In the default setting, Exchange allows anonymous users to send mails to the authoritative e-mail domains if the authorization group "Anonymous users" is activated on the receiving connector:

Receive connector

It is controlled via a corresponding authorization in the Active Directory:

Get-ReceiveConnector | Get-ADPermission -user "NT-Authority\Anonymous-Login" | where {$_.ExtendedRights -like "ms-exch-smtp-accept-authoritative-domain-sender"}

Receive connector
If the receive connector is listed here, which also accepts mails from the Internet, as is the case here, the right can be removed using the Exchange Management Shell. On a German-language server, the command is as follows:

Get-ReceiveConnector "Name of the receive connector from the Internet" | Get-ADPermission -user "NT-Authority\Anonymous-Logon" | where {$_.ExtendedRights -like "ms-exch-smtp-accept-authoritative-domain-sender"} | Remove-ADPermission

And on a server with an English operating system:

Get-ReceiveConnector "Name of the receive connector from the direction of the Internet" | Get-ADPermission -user "NT AUTHORITY\ANONYMOUS LOGON" | where {$_.ExtendedRights -like "ms-exch-smtp-accept-authoritative-domain-sender"} | Remove-ADPermission

Now you can test once again whether the problem has been resolved and mail spoofing is no longer possible.

11 thoughts on “Exchange Server: Mailspoofing verhindern”

  1. Hey Franky,

    ich wollte nur kurz ergänzen, dass in manchen Fällen auf jeden Fall bei jedem „Abwählen“ des „NT-Autorität\Anonymous-Anmeldung“ geguckt werden sollte.

    !Explizit bitte vorsichtig bei Nachrichtenfluss -> Empfangsconnectors → Default Frontend
    Wenn hier abgewählt, können keine E-Mails mehr empfangen werden. (Zumindest in allen von meinen Fällen)

    Immer den Mailfluss ein- & ausgehend testen!

    Auch wichtig: Prüft bitte eure DNS SPF Einträge:

    Sollte gar nichts konfiguriert sein, nutzt ein Tool wie z.B. https://www.spf-record.de/generator
    Im Defaultfall, sollte ein solcher Eintrag für eine Domain mit Exchange-Server etwa so aussehen:
    Hauptdomain -> TXT Eintrag
    „v=spf1 a mx -all“
    bzw.
    „frankysweb.de. IN TXT „v=spf1 a mx -all““

    Gruß
    Max

    Reply
  2. jeder fremde Benutzer aus dem Internet ist doch ein anonymer Benutzer. Von daher würde diese Einstellung Absender, die nicht zur Exchange-Organisation gehören blocken und niemand könnte mir eine Mail zustellen.
    Wenn man nun das Spoofing verhindern möchte, kann man ein wenig über die Transportregeln erreichen. Dort kann man eine Regel schreiben welche verhindert, dass die Absenderadresse aus dem Internet auf dem Envelope keine autorisierte Domain ist. Leider kann man so nur den Envelope auf Spoofing testen. Wenn nun der Absender das From-Feld im Body fälscht funktioniert das nicht. Wir machen daher beide Prüfungen (Envelope und Body) auf einem Mailrelay vor dem Exchange System und können damit Spoofing ausschließen.

    Gruß
    Wolfgang

    Reply
  3. Hallo Frank,

    wir haben vor dem Exchange eine Securepoint UTM. Gibt es eine Lösung für dieses Szenario. Wir nehmen von unserer Homepage über ein Web-Formular Mails von event@unseredomain.de an. Die Mails kommen natürlich nicht an.

    Viele Grüße

    Veli Wegner

    Reply
    • Hi,
      ich kenne Securepoint UTM nicht, wenn das Produkt einen SPAM Filter beinhaltet, sollte die Filterung an der UTM durchgeführt werden.
      Gruß, Frank

      Reply
  4. Hallo,

    nachedm ich so vorgegangen bin erhalten wir leider nun garkeien Externen Mails mehr.

    Die meisten erhalten nun smtp 530 5.7.1 client was not authenticated.

    Reply
  5. Hallo Frank,

    unser Exchange-System empfängt Mails aus dem Internet über ein vorgelagertes Mailrelay. Wenn ich aber nun anonyme Benutzer sperre, könnte mich auch kein „externer“ Benutzer mehr erreichen, was doch aber gewollt ist, wenn der MX-Record auf eine öffentliche IP zeigt.
    Oder habe ich in deinem Beitrag etwas falsch verstanden?

    Gruß
    Wolfgang

    Reply

Leave a Comment