Email Authentication and Security
Email Security Challenges
- Email was designed without authentication
- Easy to spoof sender addresses
- Vulnerable to interception
- Phishing and spam problems
SPF (Sender Policy Framework)
Purpose: Verify sender's IP address is authorized to send email for the domain.
How SPF Works
- Domain owner publishes SPF record in DNS
- Receiving server checks if sending IP is in SPF record
- Email accepted or rejected based on policy
SPF Record Example
v=spf1 ip4:192.0.2.0/24 include:_spf.google.com -all
v=spf1: SPF versionip4:192.0.2.0/24: Authorized IP rangeinclude:_spf.google.com: Include another domain's SPF-all: Reject if not matched
SPF Results
- Pass: IP is authorized
- Fail: IP is not authorized
- SoftFail: Probably not authorized
- Neutral: No policy
- None: No SPF record
DKIM (DomainKeys Identified Mail)
Purpose: Cryptographically verify email hasn't been tampered with.
How DKIM Works
- Sending server signs email with private key
- Public key published in DNS
- Receiving server verifies signature with public key
DKIM Signature Header
DKIM-Signature: v=1; a=rsa-sha256; d=example.com; s=selector;
h=from:to:subject; bh=base64hash;
b=signature
DKIM DNS Record
selector._domainkey.example.com TXT "v=DKIM1; k=rsa; p=publickey"
DMARC (Domain-based Message Authentication, Reporting & Conformance)
Purpose: Policy framework for SPF and DKIM, with reporting.
How DMARC Works
- Combines SPF and DKIM results
- Applies policy (none, quarantine, reject)
- Sends reports to domain owner
DMARC Record Example
_dmarc.example.com TXT "v=DMARC1; p=reject; pct=100; rua=mailto:reports@example.com"
p=reject: Policy (none/quarantine/reject)pct=100: Apply to 100% of emailsrua: Aggregate report addressruf: Forensic report address
Email Encryption
1. TLS (Transport Layer Security)
- Encrypts connection between mail servers
- Protects email in transit
- Opportunistic or enforced
2. S/MIME (Secure/MIME)
- End-to-end encryption
- Requires certificates
- Built into most email clients
3. PGP/GPG (Pretty Good Privacy)
- End-to-end encryption
- Public/private key pairs
- Requires key exchange
Security Best Practices
- Enable SPF, DKIM, and DMARC for your domain
- Use TLS for server connections
- Verify sender before clicking links
- Be cautious of unexpected attachments
- Enable 2FA on email accounts
- Use strong passwords
- Regular security audits
Common Attack Vectors
- Phishing: Fake emails to steal credentials
- Spoofing: Forging sender address
- Man-in-the-Middle: Intercepting unencrypted email
- Email Bombing: Overwhelming inbox
- Malware: Malicious attachments