跳到正文
FunCoding

email-security

DMARC/SPF/DKIM check, email spoofing, SMTP test, and security header analysis

Star
1,411
分类
安全
许可证
MIT
最近提交
2026年11月7日

recon/email-security/SKILL.md

在 GitHub 上查看

Email Security -- DMARC, SPF, DKIM

When to Use

  • During passive reconnaissance (Phase 1)
  • After initial DNS enumeration
  • DMARC p=none means DMARC enforcement is off; actual spoofability still depends on SPF/DKIM and the receiver's local policy
  • Critical for identifying phishing/business email compromise risks

Prerequisites

  • Explicit authorization, target boundaries, and rate limits for the target.
  • Tooling: dig, swaks.
  • A writable evidence directory: export OUTPUT_DIR="${OUTPUT_DIR:-./output}" && mkdir -p "$OUTPUT_DIR".
  • For any state-changing step (writes, uploads, credential attempts), obtain explicit confirmation immediately before the command.

How to Run

# SPF
dig +short TXT $target | grep "v=spf1"

# DMARC
dig +short TXT _dmarc.$target

# DKIM (common selector: google)
dig +short TXT google._domainkey.$target

# MX
dig +short MX $target

Procedure

The phases below are the procedure. Keep each probe bounded (--max-time), record evidence beneath OUTPUT_DIR, and stop at the stop-conditions listed in Pitfalls.

DMARC/SPF/DKIM Check Commands

# SPF
dig +short TXT $target | grep "v=spf1"

# DMARC
dig +short TXT _dmarc.$target

# DKIM (common selector: google)
dig +short TXT google._domainkey.$target

# MX
dig +short MX $target

Interpreting Results

ConfigMeaningRisk
v=spf1 ~all (softfail)SPF suggests blocking but doesnt enforceSpoofed emails may pass
v=spf1 ?all (neutral)SPF does nothingTotally permissive
v=spf1 include:amazonses.com ~allSES can send as domainAny AWS SES account can spoof
v=DMARC1; p=noneDMARC disabledZero spoofing protection
v=DMARC1; p=quarantineFailed emails go to spamPartial protection
v=DMARC1; p=rejectFailed emails rejectedFull protection
DKIM missingNo cryptographic signatureEmail can be forged

Email Spoofing via SMTP

# Test SMTP relay
timeout 3 bash -c 'exec 3<>/dev/tcp/TARGET/25; head -1 <&3'

# Send spoofed email via open relay (swaks)
swaks --to [email protected] --from [email protected]   --server TARGET --body "Spoofed email"

Headers That Indicate Security Level

HeaderValueMeaning
Authentication-Resultsspf=passSPF passed
Authentication-Resultsspf=failSPF failed
Authentication-Resultsdmarc=passDMARC passed
Authentication-Resultsdmarc=failDMARC failed
Authentication-Resultsdkim=passDKIM passed
Received-SPFPassSender authorized
Received-SPFSoftfailSender not fully authorized
Received-SPFFailSender not authorized
ARC-Authentication-ResultsAuthentication chain

AWS SES Spoofing (When SPF includes amazonses.com)

With v=spf1 include:amazonses.com ~all:

  1. Create AWS account
  2. Configure SES with your own domain (verified)
  3. Send email with From: [email protected]
  4. SPF PASSES (because of include:amazonses.com)
  5. DMARC p=none -- the receiver applies no DMARC policy; delivery then depends on SPF/DKIM and local filters

Real-World Cases

Field observation (reported as CRITICAL after delivery proof): an organization with DMARC p=none on both domains and SPF include:amazonses.com, where a message spoofed via a separate SES account was delivered to a controlled inbox. The inbox-delivery evidence, not the p=none record alone, justified the severity.

Pitfalls

IssueSolution
SPF lookup limitDNS has 10 lookup limit for SPF includes
DKIM selector unknownTry common selectors: google, selector1, selector2, 2022, 2023
DMARC reportingrua=mailto: may leak authentication results to third party

Verification

# Check the DMARC policy first
dig +short TXT _dmarc.target.com
# p=none means no DMARC enforcement — it does NOT by itself prove spoofing.
# Proof = a spoofed message actually delivered to an inbox you control:
swaks --to [email protected] --from [email protected] \
  --server <an-smtp-relay-you-control-or-localhost> --header-From "[email protected]"
# Then inspect the delivered message's Authentication-Results header:
# dmarc=none or dmarc=pass with an attacker-controlled source = confirmed.
# Reject/quarantine or spam-folder delivery = not demonstrated.

相似的 Skill

agent-security-hardening

AFaffaan-m/ECC315k近 7 天新增 3,503 个 star

精选

ponytail-audit

审计整个代码库,找出 bug、安全漏洞和性能瓶颈,获得按重要性排序的通俗报告。

DIDietrichGebert/ponytail203k近 7 天新增 4,226 个 star

gstack

GAgarrytan/gstack143k近 7 天新增 524 个 star

精选

security-and-hardening

按 OWASP Top 10 检查输入处理、登录和依赖,加固代码。

ADaddyosmani/agent-skills122k近 7 天新增 1,421 个 star

doubt-driven-development

ADaddyosmani/agent-skills122k近 7 天新增 1,421 个 star

ruview-advanced-sensing

RUruvnet/RuView106k近 7 天新增 596 个 star