DMARC Alignment Gaps
DMARC requires SPF or DKIM to align with the From header, but implementation gaps allow attackers to exploit subdomain policies, relaxed alignment, and organizational misconfigurations.
MITRE ATT&CK: T1566.002Timeline: The Cat and Mouse
2012 β DMARC deployed β 2015 β Gaps discovered β 2021 β Exploitation continues β Present
The Evolution
| Phase | Period | What Happened |
|---|---|---|
| CONTEXT | 2012 | DMARC deployed but p=none common; no enforcement |
| GAPS | 2015-2017 | Subdomain handling gaps discovered; relaxed alignment exploited |
| RESPONSE | 2017 | Subdomain policy (sp=) added to close inheritance gaps |
| Β | 2018 | DMARC aggregate reporting enables visibility |
| EXPLOITATION | 2019+ | Subdomain takeover + relaxed alignment becomes attack vector |
| CURRENT | Present | ~40% of domains still at p=none; gaps remain exploitable |
Key Events with Sources
| Date | Event | Significance | Source |
|---|---|---|---|
| 2012 | DMARC published | Initial specification with alignment requirements | DMARC.org |
| 2015 | RFC 7489 | DMARC becomes IETF standard | RFC 7489 |
| 2017 | Subdomain exploitation documented | Researchers show relaxed alignment enables spoofing | USENIX Security |
| 2019 | Subdomain takeover attacks | Dangling DNS + DMARC gaps combine for impersonation | Detectify |
| 2024 | p=none still common | Many organizations never move beyond monitoring | DMARC Report |
Overview
DMARC (Domain-based Message Authentication, Reporting & Conformance) ties SPF and DKIM together, requiring at least one to βalignβ with the From header domain. However, implementation gaps in subdomain handling, relaxed vs strict alignment, and organizational misconfigurations create exploitable weaknesses.
The Attack
DMARC Alignment Explained
DMARC requires either:
- SPF alignment: The
MAIL FROMdomain matches theFrom:header domain - DKIM alignment: The
d=domain in the DKIM signature matches theFrom:header domain
From: security@bigbank.com β What user sees
MAIL FROM: bounce@bigbank.com β SPF checks this
DKIM d=bigbank.com β DKIM signs with this
If either SPF or DKIM aligns with "bigbank.com" β DMARC passes
Alignment Modes
| Mode | Requirement | Exploitability |
|---|---|---|
| Strict | Exact domain match | Harder to exploit |
| Relaxed | Organizational domain match | Subdomain abuse possible |
Relaxed alignment example:
From: security@bigbank.com
DKIM d=mail.bigbank.com β Subdomain
Relaxed: mail.bigbank.com β bigbank.com β PASS
Strict: mail.bigbank.com β bigbank.com β FAIL
Subdomain Policy Gaps
The sp= Tag Problem:
DMARC records can specify subdomain policy with sp=:
_dmarc.bigbank.com: v=DMARC1; p=reject; sp=none
This says:
p=rejectβ Reject spoofed mail frombigbank.comsp=noneβ Do nothing for subdomains likemail.bigbank.com
Attackers exploit this:
From: security@anything.bigbank.com β Spoofed subdomain
β sp=none means no enforcement!
Missing sp= Tag:
If sp= is not specified, subdomains inherit the parent policy. But many admins donβt realize this and leave subdomains unprotected during DMARC rollout.
Subdomain Takeover + DMARC
If an organization has:
- Dangling DNS records pointing to unclaimed resources
- DMARC with relaxed alignment
Attackers can:
- Claim the abandoned subdomain (e.g.,
old-campaign.bigbank.com) - Set up mail server with valid SPF/DKIM for that subdomain
- Send mail that passes DMARC due to relaxed alignment
From: security@bigbank.com
DKIM d=old-campaign.bigbank.com β Attacker controls this subdomain
Relaxed alignment: old-campaign.bigbank.com β bigbank.com β PASS
DMARC Record Misconfigurations
Common Mistakes:
# p=none β Monitoring only, no enforcement
v=DMARC1; p=none; rua=mailto:dmarc@company.com
# pct=0 β Policy applies to 0% of mail
v=DMARC1; p=reject; pct=0
# Missing record entirely
# (No _dmarc.domain.com TXT record)
Exploitation:
p=none: Attackers spoof freely, org just gets reportspct=0: Policy never enforced despite appearing strong- No record: No DMARC protection at all
Raw Email Headers (DMARC Gap Exploitation)
Exploiting relaxed alignment with a subdomain the attacker controls:
Return-Path: <bounce@compromised-sub.bigbank.com>
Received: from mail.attacker.com (mail.attacker.com [198.51.100.99])
by mx.victim.com (Postfix) with ESMTPS id DMARC01
for <target@victim.com>; Tue, 28 Jan 2025 09:30:15 -0500 (EST)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
d=compromised-sub.bigbank.com; s=attacker;
h=from:to:subject:date;
bh=subdomain123...;
b=attackersig456...
Authentication-Results: mx.victim.com;
dkim=pass header.d=compromised-sub.bigbank.com;
spf=pass smtp.mailfrom=bounce@compromised-sub.bigbank.com;
dmarc=pass (p=REJECT) header.from=bigbank.com
From: "BigBank Security" <security@bigbank.com>
To: target@victim.com
Subject: Urgent: Verify Your Account
Date: Tue, 28 Jan 2025 09:30:10 -0500
Message-ID: <gap-exploit-001@attacker.com>
MIME-Version: 1.0
Content-Type: text/html; charset=UTF-8
Please click here to verify your account...
Key observations:
dkim=passforcompromised-sub.bigbank.com(attacker controls)dmarc=passbecause relaxed alignment matches organizational domainFrom:header showssecurity@bigbank.com(what user sees)- Attacker only needed control of one subdomain to spoof the parent
Defenses
Strict Alignment
Configure DMARC for strict alignment:
v=DMARC1; p=reject; aspf=s; adkim=s
aspf=sβ Strict SPF alignmentadkim=sβ Strict DKIM alignment
Explicit Subdomain Policy
Always specify subdomain policy:
v=DMARC1; p=reject; sp=reject
Subdomain Inventory
Maintain inventory of all subdomains:
- Monitor for dangling DNS records
- Remove unused subdomain entries
- Audit third-party services using subdomains
DMARC Reporting Analysis
Analyze aggregate reports (RUA) for:
- Authentication failures from unexpected sources
- Subdomain usage you donβt recognize
- Gradual policy violations indicating testing
Current State
Status: Active
DMARC alignment gaps remain exploitable:
| Gap | Prevalence | Impact |
|---|---|---|
| Relaxed alignment | Very common | Subdomain abuse |
| sp=none | Common during rollout | Subdomain spoofing |
| p=none stuck | ~40% of domains | No enforcement |
| Subdomain takeover | Increasing | Full domain impersonation |
Detection Guidance
DMARC Record Audit
# Check DMARC record
dig +short TXT _dmarc.domain.com
# Look for:
# - p=none (no enforcement)
# - Missing sp= (subdomain gap)
# - pct<100 (partial enforcement)
# - aspf=r or adkim=r (relaxed alignment)
Email Header Analysis
Flag emails where:
dmarc.header.from.domain != dkim.domain
AND dmarc.result = pass
AND dkim.domain MATCHES subdomain pattern
Subdomain Monitoring
- Alert on new subdomains sending mail
- Monitor for subdomain takeover indicators
- Track third-party services claiming subdomains
What Killed It (or Weakened It)
| Defense | Introduced | Impact |
|---|---|---|
| DMARC Enforcement (p=reject) | 2015 | Organizations move from monitoring to enforcement mode |
| Subdomain Policy (sp=reject) | 2017 | Explicit subdomain policies close inheritance gaps |
| DMARC Aggregate Reporting | 2018 | Visibility into authentication failures enables tuning |