RFC 7208 — SPF

Sender Policy Framework (SPF) — email authentication protocol that allows domain owners to specify which mail servers are authorized to send email on behalf of their domain.

Standards Track April 2014 ISO 27001

1. Introduction

▶

SPF allows domain owners to publish DNS records that specify which IP addresses and hostnames are authorized to send email for their domain. Receiving mail servers check SPF records to detect unauthorized senders — a key anti-spoofing control.

ISO 27001 Relevance: A.8.12 (Data Leakage Prevention) — prevents spoofed emails that could trick recipients into leaking data. A.8.21 (Security of Network Services) — email service authentication.

2. SPF Record Syntax

▶
  blacklabs.team IN TXT "v=spf1 ip4:54.173.81.58 include:_spf.google.com -all"

  Mechanisms:
    ip4:x.x.x.x/prefix    — Allow specific IPv4 address/range
    ip6:x::x/prefix        — Allow specific IPv6 address/range
    a                      — Allow domain's A record IPs
    mx                     — Allow domain's MX record IPs
    include:domain         — Include another domain's SPF
    all                    — Match everything (default)

  Qualifiers:
    + Pass (default)       - Fail
    ~ SoftFail             ? Neutral

3. Check Process

▶

When a receiving MTA gets a message:

  1. Extract MAIL FROM (envelope sender) domain
  2. Query DNS for SPF TXT record of that domain
  3. Evaluate mechanisms against connecting IP
  4. Return result: Pass, Fail, SoftFail, Neutral, None, TempError, PermError

Results feed into DMARC (RFC 7489) policy evaluation.

4. Security Considerations

▶
  • Use -all: Hard fail (-all) is RECOMMENDED over soft fail (~all) to reject unauthorized senders
  • DNS lookup limit: SPF evaluation is limited to 10 DNS lookups to prevent denial of service
  • Forwarding: SPF breaks with email forwarding — use SRS (Sender Rewriting Scheme) or rely on DKIM
  • Combination: SPF alone is insufficient — deploy with DKIM and DMARC for comprehensive protection
  • Monitoring: Use DMARC aggregate reports to monitor SPF alignment