Prerequisites
- Target system, dependencies and environment configured.
Usage
Purpose
The easiest phishing is the one that comes from your own domain — an email that appears to be from your CEO or your IT department, because email by default lets anyone claim any From address. SPF, DKIM, and DMARC are the three records that let receiving servers verify a message genuinely came from your domain and reject the ones that don't. This skill covers configuring them to stop attackers spoofing your domain, closing a major phishing vector.
When to use it
Hardening your organisation's email against domain spoofing, and as a defensive follow-up whenever phishing analysis (that skill) shows your domain being spoofed. It's a high-value, foundational anti-phishing control that many organisations still have misconfigured.
The three mechanisms (how they work together)
- SPF (Sender Policy Framework) — a DNS record listing which servers are allowed to send mail for your domain. Receivers check whether the sending server is on the list.
- DKIM (DomainKeys Identified Mail) — a cryptographic signature added to outgoing mail; receivers verify it against a public key in your DNS, proving the message wasn't forged or altered.
- DMARC — ties SPF and DKIM to the visible From address (alignment), tells receivers what to do with mail that fails (none/quarantine/reject), and provides reporting. DMARC is what actually enforces the anti-spoofing — SPF and DKIM alone don't tell receivers to reject failures.
Procedure
- Publish an SPF record listing all legitimate sending sources (your mail servers, and any third parties that send as you — marketing platforms, ticketing systems). An incomplete SPF breaks legitimate mail; a too-permissive one (
+all) authorises anyone. End with -all (hard fail) once you're confident the list is complete:dig TXT example.com | grep spf # v=spf1 include:... -all
- Set up DKIM signing on your outgoing mail, publishing the public key in DNS. Every legitimate message gets signed; forged ones can't be.
- Publish a DMARC record with alignment and a policy — this is what enforces anti-spoofing. Start at
p=none (monitor only, collect reports) to see what's sending as you without breaking anything, then move to p=quarantine and finally p=reject once legitimate mail is passing:dig TXT _dmarc.example.com # v=DMARC1; p=reject; rua=mailto:...
- Use DMARC reports to find all your legitimate senders. The
rua reports show every source sending as your domain — including forgotten third parties and the spoofing attempts. Use them to complete SPF/DKIM before enforcing, and to see spoofing of your domain.
- Progress to enforcement (
p=reject) — the goal. p=none monitors but doesn't stop spoofing; only quarantine/reject actually block spoofed mail. Many organisations stall at p=none and remain spoofable. Getting to reject is what closes the vector.
- Cover all your domains, including parked/unused ones — attackers spoof any domain you own, and unused domains that can't send mail should have a restrictive policy so they can't be abused.
Cheatsheet
email lets ANYONE claim any From -> easiest phishing = FROM YOUR OWN DOMAIN
SPF + DKIM + DMARC = receivers verify mail really came from you, reject what doesn't
SPF DNS list of servers allowed to send for your domain ; end with -all (hard fail)
(incomplete = breaks legit mail ; +all = authorises anyone)
DKIM crypto signature on outgoing mail, verified vs public key in DNS (unforgeable)
DMARC ties SPF/DKIM to visible From (alignment) + policy (none/quarantine/REJECT) + reporting
-> DMARC is what ENFORCES anti-spoofing (SPF/DKIM alone don't tell receivers to reject)
rollout
1. SPF: list ALL legit senders (+ third parties) -> -all when complete
2. DKIM signing + public key in DNS
3. DMARC p=none (monitor, collect rua reports) -> find all senders + see spoofing
4. complete SPF/DKIM from reports -> p=quarantine -> p=REJECT (the goal)
(stalling at p=none = still spoofable — the common failure)
5. cover ALL domains incl. PARKED (restrictive policy so they can't be abused)
Reading the configuration
- DMARC at
p=none (or no DMARC) = your domain is spoofable; monitoring doesn't stop spoofing, only quarantine/reject does. Many organisations stall here and remain vulnerable — getting to reject is the goal and the most common gap.
- No DMARC at all = SPF/DKIM without DMARC don't enforce alignment or tell receivers to reject failures; the domain can still be spoofed. DMARC is the enforcing layer.
- SPF
+all or overly permissive = authorises anyone to send as you; effectively no SPF. Use -all with a complete sender list.
- Incomplete SPF/DKIM breaking legitimate mail = why you monitor with
p=none and DMARC reports first — to find all legitimate senders before enforcing. Rushing to reject breaks mail.
- Parked/unused domains without a restrictive policy = spoofable domains you own but forgot; attackers use them. Set a reject policy on domains that shouldn't send mail.
p=reject with complete SPF/DKIM across all domains = the goal state; your domains can't be spoofed, closing a major phishing vector.
Pitfalls
- Stalling at
p=none. Monitoring mode doesn't stop spoofing; the domain remains spoofable. The whole point is reaching quarantine/reject. This is the most common failure.
- No DMARC, only SPF/DKIM. Without DMARC, there's no alignment enforcement and no instruction to reject failures; the domain is still spoofable. DMARC is what enforces.
- Rushing to
reject with incomplete SPF/DKIM. It breaks legitimate mail (forgotten third-party senders fail). Monitor with reports first, complete the sender list, then enforce.
- Overly permissive SPF (
+all). Authorises anyone; use -all with a complete list.
- Forgetting parked domains. Attackers spoof any domain you own; unused domains need a restrictive policy so they can't be abused.
References
- SPF (RFC 7208), DKIM (RFC 6376), DMARC (RFC 7489) specifications
- The phishing-email-analysis skill (spoofing detection) and M3AAWG email authentication best practices
- DMARC deployment guides and reporting analysers
- The bec-detection skill (email authentication is a partial BEC defence)
Inputs
- Relevant source code, logs, network traces, or system specifications.
Outputs
- Analysis findings, security audit report, or generated code artifacts.
1---2name: spf-dkim-dmarc3description: Use when configuring email authentication to stop spoofing of your domain — SPF, DKIM, and DMARC, the records that keep attackers from sending mail as you.4---5678## Prerequisites9- Target system, dependencies and environment configured.1011## Usage12### Purpose1314The easiest phishing is the one that comes *from your own domain* — an email that appears to be from your CEO or your IT department, because email by default lets anyone claim any From address. SPF, DKIM, and DMARC are the three records that let receiving servers verify a message genuinely came from your domain and reject the ones that don't. This skill covers configuring them to stop attackers spoofing your domain, closing a major phishing vector.1516### When to use it1718Hardening your organisation's email against domain spoofing, and as a defensive follow-up whenever phishing analysis (that skill) shows your domain being spoofed. It's a high-value, foundational anti-phishing control that many organisations still have misconfigured.1920### The three mechanisms (how they work together)2122- **SPF (Sender Policy Framework)** — a DNS record listing which servers are allowed to send mail for your domain. Receivers check whether the sending server is on the list.23- **DKIM (DomainKeys Identified Mail)** — a cryptographic signature added to outgoing mail; receivers verify it against a public key in your DNS, proving the message wasn't forged or altered.24- **DMARC** — ties SPF and DKIM to the visible From address (alignment), tells receivers what to do with mail that fails (none/quarantine/reject), and provides reporting. DMARC is what actually enforces the anti-spoofing — SPF and DKIM alone don't tell receivers to reject failures.2526### Procedure27281. **Publish an SPF record** listing all legitimate sending sources (your mail servers, and any third parties that send as you — marketing platforms, ticketing systems). An incomplete SPF breaks legitimate mail; a too-permissive one (`+all`) authorises anyone. End with `-all` (hard fail) once you're confident the list is complete:29 ```30 dig TXT example.com | grep spf # v=spf1 include:... -all31 ```322. **Set up DKIM signing** on your outgoing mail, publishing the public key in DNS. Every legitimate message gets signed; forged ones can't be.333. **Publish a DMARC record with alignment and a policy** — this is what enforces anti-spoofing. Start at `p=none` (monitor only, collect reports) to see what's sending as you without breaking anything, then move to `p=quarantine` and finally `p=reject` once legitimate mail is passing:34 ```35 dig TXT _dmarc.example.com # v=DMARC1; p=reject; rua=mailto:...36 ```374. **Use DMARC reports to find all your legitimate senders.** The `rua` reports show every source sending as your domain — including forgotten third parties and the spoofing attempts. Use them to complete SPF/DKIM before enforcing, and to see spoofing of your domain.385. **Progress to enforcement (`p=reject`) — the goal.** `p=none` monitors but doesn't stop spoofing; only `quarantine`/`reject` actually block spoofed mail. Many organisations stall at `p=none` and remain spoofable. Getting to `reject` is what closes the vector.396. **Cover all your domains**, including parked/unused ones — attackers spoof any domain you own, and unused domains that can't send mail should have a restrictive policy so they can't be abused.4041### Cheatsheet4243```44email lets ANYONE claim any From -> easiest phishing = FROM YOUR OWN DOMAIN45 SPF + DKIM + DMARC = receivers verify mail really came from you, reject what doesn't4647SPF DNS list of servers allowed to send for your domain ; end with -all (hard fail)48 (incomplete = breaks legit mail ; +all = authorises anyone)49DKIM crypto signature on outgoing mail, verified vs public key in DNS (unforgeable)50DMARC ties SPF/DKIM to visible From (alignment) + policy (none/quarantine/REJECT) + reporting51 -> DMARC is what ENFORCES anti-spoofing (SPF/DKIM alone don't tell receivers to reject)5253rollout54 1. SPF: list ALL legit senders (+ third parties) -> -all when complete55 2. DKIM signing + public key in DNS56 3. DMARC p=none (monitor, collect rua reports) -> find all senders + see spoofing57 4. complete SPF/DKIM from reports -> p=quarantine -> p=REJECT (the goal)58 (stalling at p=none = still spoofable — the common failure)59 5. cover ALL domains incl. PARKED (restrictive policy so they can't be abused)60```6162### Reading the configuration6364- **DMARC at `p=none` (or no DMARC)** = your domain is spoofable; monitoring doesn't stop spoofing, only `quarantine`/`reject` does. Many organisations stall here and remain vulnerable — getting to `reject` is the goal and the most common gap.65- **No DMARC at all** = SPF/DKIM without DMARC don't enforce alignment or tell receivers to reject failures; the domain can still be spoofed. DMARC is the enforcing layer.66- **SPF `+all` or overly permissive** = authorises anyone to send as you; effectively no SPF. Use `-all` with a complete sender list.67- **Incomplete SPF/DKIM** breaking legitimate mail = why you monitor with `p=none` and DMARC reports first — to find all legitimate senders before enforcing. Rushing to `reject` breaks mail.68- **Parked/unused domains without a restrictive policy** = spoofable domains you own but forgot; attackers use them. Set a reject policy on domains that shouldn't send mail.69- **`p=reject` with complete SPF/DKIM across all domains** = the goal state; your domains can't be spoofed, closing a major phishing vector.7071### Pitfalls7273- **Stalling at `p=none`.** Monitoring mode doesn't stop spoofing; the domain remains spoofable. The whole point is reaching `quarantine`/`reject`. This is the most common failure.74- **No DMARC, only SPF/DKIM.** Without DMARC, there's no alignment enforcement and no instruction to reject failures; the domain is still spoofable. DMARC is what enforces.75- **Rushing to `reject` with incomplete SPF/DKIM.** It breaks legitimate mail (forgotten third-party senders fail). Monitor with reports first, complete the sender list, then enforce.76- **Overly permissive SPF (`+all`).** Authorises anyone; use `-all` with a complete list.77- **Forgetting parked domains.** Attackers spoof any domain you own; unused domains need a restrictive policy so they can't be abused.7879### References8081- SPF (RFC 7208), DKIM (RFC 6376), DMARC (RFC 7489) specifications82- The phishing-email-analysis skill (spoofing detection) and M3AAWG email authentication best practices83- DMARC deployment guides and reporting analysers84- The bec-detection skill (email authentication is a partial BEC defence)8586## Inputs87- Relevant source code, logs, network traces, or system specifications.8889## Outputs90- Analysis findings, security audit report, or generated code artifacts.