1. Home
  2. Knowledge Base
  3. Microsoft
  4. Exchange
  5. Preventing email spoofing – SPF, DKIM and DMARC in detail
  1. Home
  2. Knowledge Base
  3. Microsoft
  4. Microsoft Defender
  5. Preventing email spoofing – SPF, DKIM and DMARC in detail

Preventing email spoofing – SPF, DKIM and DMARC in detail

Mail spoofing is a serious threat in the digital world, affecting both large organizations and individuals. When attackers are able to spoof the sender address in emails, they open the door to a variety of fraudulent activities, including phishing and malware distribution. Robust authentication and validation mechanisms are required to ward off such attacks and ensure the integrity of e-mail communication. This is where technologies such as SPF (Sender Policy Framework), DKIM (DomainKeys Identified Mail) and DMARC (Domain-based Message Authentication, Reporting, and Conformance) come into play. These technologies are crucial for preventing mail spoofing and creating a secure email environment. There are also other measures and best practices that can help improve email security, especially in environments such as Exchange Online and M365 Defender.

Tools such as“mxtoolbox.com” can be a great help in analyzing the current configurations.

SPF (Sender Policy Framework):

Identifying the mail servers: First you need to identify all mail servers that are authorized to send emails for your domain. This includes your primary and secondary mail servers as well as any third-party services you may use.

Creating the SPF record: Create a TXT record in your DNS zone. The data record always begins with the version (v=spf1), followed by the IP addresses of the authorized mail servers and a concluding policy.

Example:

v=spf1 ip4:203.0.113.42/24 ip4:198.51.100.123 a:mail.example.com -all

SPF Qualifiers: You can use qualifiers to specify how recipients should handle mismatched emails:

  • + Passport (accepts the e-mail)
  • - Fail (rejects the e-mail)
  • ~ SoftFail (accepts the e-mail, but marks it)
  • ? Neutral (no action)

SPF mechanisms: Use different mechanisms to specify your mail servers:

  • ip4: or ip6: for IP addresses
  • a: for DNS names
  • mx: for Mail Exchanger
  • include: for other domains’ SPF records

Testing the SPF dataset: After publishing your SPF record, you should check that it works correctly by using SPF validation tools online.

DKIM (DomainKeys Identified Mail):

Create a key pair: Create a public-private key pair with a DKIM key generator.

Publish the public key: The public key is published in a TXT record in your DNS zone. The data set is combined with a selector that identifies the key and your domain.

Example:

selector1._domainkey.example.com. 3600 IN TXT "v=DKIM1; k=rsa; p=MIGfMA0GCSqGSIb3DQEBA..."

Configure the mail server: Configure your mail server so that it signs outgoing emails with the private key.

Testing the DKIM configuration: Send test emails and use DKIM validation tools to ensure that your emails are signed correctly.

DMARC (Domain-based Message Authentication, Reporting, and Conformance):

Creating the DMARC record: The DMARC record is created as a TXT record in your DNS zone. The DMARC policy defines how recipients should handle unauthenticated emails.

Example:

_dmarc.example.com. 3600 IN TXT "v=DMARC1; p=reject; rua=mailto:[email protected]"

Select a DMARC policy:

  • p=none for no special treatment
  • p=quarantine to mark e-mails as spam
  • p=reject to reject unauthenticated e-mails

Set reporting options: You can set reporting options to receive feedback on DMARC reviews.

Testing the DMARC configuration: Send test emails and check the DMARC reports to make sure your configuration is correct.

Further measures to prevent mail spoofing:

In addition to SPF, DKIM and DMARC, there are other measures you can take to prevent mail spoofing:

  • Authenticated SMTP relays: Use authenticated SMTP relays to ensure that only authorized users and systems can send emails.
  • Regularly check mail server configurations: Review your mail server configurations regularly to ensure they are up to date with the latest security best practices.
  • End user training: Train users in your network on the dangers of phishing and how to recognize suspicious emails.

Best practices for Exchange Online and M365 Defender:

Configuration and best practices:

    1. Configure anti-phishing policy in Microsoft 365 Defender:
      • Define an anti-phishing policy that is specifically tailored to your organization to protect you from phishing attacks and mail spoofing. Go to Microsoft 365-Sicherheitszentrum > Richtlinien & Regeln > Threat Policies > Anti-Phishing.
      • You can also add custom domains to be protected and configure the actions to be taken when phishing attempts are detected.
        1. Security guidelines for e-mail flow in Exchange Online:
          • Create mail flow rules (also known as transport rules) to control the delivery of emails and detect and block potential spoofing attempts. Go to Exchange Admin Center > Mail Flow > Rules.
          • These rules can be based on various criteria, including sender domain, IP address and specific content within the email.
        2. Activate Microsoft Threat Protection:
          • Enable Microsoft Threat Protection to get a comprehensive view of threats across email, identity and other vectors. Go to Microsoft 365 Sicherheitszentrum > Microsoft 365 Defender.
        3. Improvement of user information:
          • Provide training materials and conduct regular phishing simulations to improve awareness and detection of phishing and spoofing attempts. You can do this via Microsoft 365 Sicherheitszentrum > Angriffssimulator.
        4. Automated examinations and reactions:
          • Use the automated investigation and response capabilities in Microsoft 365 to respond to and remediate suspicious activity, reducing the time between threat detection and remediation. Go to Microsoft 365 Sicherheitszentrum > Automatisierte Untersuchung & Reaktion.
        5. Configure Office 365 Advanced Threat Protection (ATP):
          • Configure Office 365 ATP safe attachment and safe link policies to provide additional protection against malicious attachments and links. You can find these options at Microsoft 365 Sicherheitszentrum > Richtlinien & Regeln > Threat Policies > ATP Safe Attachments and ATP Safe Links.
        6. Reporting and analysis:
          • Use the reporting tools and dashboard in Exchange Online and Microsoft 365 Defender to gain insights into email flow, phishing attempts and the effectiveness of your security measures. Go to Microsoft 365 Sicherheitszentrum > Berichte.
        7. Analyze external e-mail header:
          • Explain to your users how they can analyze email headers to verify the original source of an email and encourage the use of the suspicious message reporting tool in Outlook.

        Consistently applying and reviewing these best practices and using the built-in security features of Exchange Online and Microsoft 365 Defender can go a long way toward minimizing the risk of mail spoofing and improving overall email security.

Dieser Beitrag ist auch verfügbar auf: Deutsch (German)

Was this article helpful?

Related Articles

Submit a Comment

Your email address will not be published. Required fields are marked *

Skip to content