Skip to main content



Spoofy

forthebadge forthebadge forthebadge

WHAT

Spoofy is a program that checks if a list of domains can be spoofed based on SPF and DMARC records. You may be asking, "Why do we need another tool that can check if a domain can be spoofed?"

Well, Spoofy is different and here is why:

  1. Custom, manually tested spoof logic (No guessing or speculating, real world test results)
  2. Standards-based record discovery: RFC 7208 SPF evaluation and the RFC 9989 DMARC tree walk, including sp/np for subdomains
  3. Accurate bulk lookups over a shared, caching resolver with failover (1.1.1.1, 8.8.8.8, 9.9.9.9)
  4. SPF DNS query and void lookup counter, plus detection of unregistered SPF include domains
  5. Optional DKIM selector enumeration via API

PASSING TESTS

Spoofy CI

HOW TO USE

Spoofy requires Python 3.9+. Install it from PyPI:

pip3 install spoofy
spoofy -d example.com

Or run it from a clone with pip3 install -r requirements.txt and ./spoofy.py in place of spoofy. Usage is shown below:

Usage:
    spoofy -d [DOMAIN] -o [stdout, xls or json] -t [NUMBER_OF_THREADS] [--dkim] [--dns-server IP]
    OR
    spoofy -iL [DOMAIN_LIST] -o [stdout, xls or json] -t [NUMBER_OF_THREADS] [--dkim] [--dns-server IP]

Options:
    -d            : Process a single domain.
    -iL           : Provide a file containing a list of domains to process (blank lines and # comments are skipped).
    -o            : Specify the output format: stdout (default), xls, or json.
    -t            : Set the number of threads to use (default: 4).
    --dkim        : Enable DKIM selector enumeration via API (optional).
    --dns-server  : Query this resolver instead of 1.1.1.1, 8.8.8.8 and 9.9.9.9.

Examples:
    spoofy -d example.com -t 10
    spoofy -d example.com --dkim
    spoofy -iL domains.txt -o xls
    spoofy -iL domains.txt -o json --dkim

HOW DO YOU KNOW ITS SPOOFABLE

(The spoofability table lists every combination of SPF and DMARC configurations that impact deliverability to the inbox, except for DKIM modifiers.) Download Here

Code Result SPOOFING_POSSIBLE
0 Spoofing possible true
1 Subdomain spoofing possible true
2 Organizational domain spoofing possible true
3 Spoofing might be possible (p=quarantine with pct < 100) null
4 Spoofing might be possible (mailbox dependent) null
5 Organizational domain spoofing might be possible (mailbox dependent) null
6 Subdomain spoofing might be possible (mailbox dependent) null
7 Subdomain spoofing possible, organizational domain spoofing might be possible true
8 Spoofing is not possible false
9 Unable to determine (a DNS lookup failed) null

The verdict is the tested code for the domain's SPF all mechanism and the DMARC p, sp and aspf tags as the record writes them. spoofy/master_table.py holds the spreadsheet as data (python3 -m spoofy.master_table rewrites it after the spreadsheet changes), and test.py checks that every row is reproduced. Inputs the table does not cover are handled as follows:

  • An enforcing p with aspf but no sp (24 untested combinations): sp defaults to p, so the tested row with sp written out is used.
  • A DMARC record inherited from a parent domain (a subdomain without its own _dmarc record): the subdomain outcome tested for the parent's SPF and DMARC records, with np in place of sp when the subdomain does not exist.
  • pct below 100 with p=quarantine: code 3, since the unsampled mail gets p=none. With p=reject the unsampled mail is still quarantined, so pct does not change the verdict.
  • t=y (RFC 9989 testing mode): the policy drops one level (reject to quarantine, quarantine to none) before the lookup.
  • A failed DNS lookup: code 9 instead of treating the record as missing.

METHODOLOGY

The creation of the spoofability table involved listing every relevant SPF and DMARC configuration, combining them, and then conducting SPF and DMARC information collection using an early version of Spoofy on a large number of US government domains. Testing if an SPF and DMARC combination was spoofable or not was done using the email security pentesting suite at emailspooftest using Microsoft 365. However, the initial testing was conducted using Protonmail and Gmail, but these services were found to utilize reverse lookup checks that affected the results, particularly for subdomain spoof testing. As a result, Microsoft 365 was used for the testing, as it offered greater control over the handling of mail.

After the initial testing using Microsoft 365, some combinations were retested using Protonmail and Gmail due to the differences in their handling of banners in emails. Protonmail and Gmail can place spoofed mail in the inbox with a banner or in spam without a banner, leading to some SPF and DMARC combinations being reported as "Mailbox Dependent" when using Spoofy. In contrast, Microsoft 365 places both conditions in spam. The testing and data collection process took several days to complete, after which a good master table was compiled and used as the basis for the Spoofy spoofability logic.

DISCLAIMER

This tool is only for testing and academic purposes and can only be used where strict consent has been given. Do not use it for illegal purposes! It is the end user’s responsibility to obey all applicable local, state and federal laws. Developers assume no liability and are not responsible for any misuse or damage caused by this tool and software.

LICENSE

This project is licensed under the Creative Commons Attribution-NonCommercial 4.0 International License - see the LICENSE file for details

Metadata

Release files for spoofy 1.1.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for spoofy 1.1.0
File Size Uploaded
spoofy-1.1.0.tar.gz 22.2 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for spoofy 1.1.0
File Interpreter ABI Platform
spoofy-1.1.0-py3-none-any.whl Python 3 none any Details

Total release size: 44.7 kB

Release files / spoofy-1.1.0.tar.gz

Download URL spoofy-1.1.0.tar.gz
Size 22.2 kB
Tags Source
SHA-256 checksum
How to use checksums
c2355505f0a16a0be3dff8ee7d6345ecf46da97be20bc860d6bfa9c260d13ad7
BLAKE2b-256 checksum
How to use checksums
34c1d618f7985abde5da6ebd48eb378a12e2fa7e2936681cb22072af9003964c
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.13.0rc2

Release files / spoofy-1.1.0-py3-none-any.whl

Download URL spoofy-1.1.0-py3-none-any.whl
Size 22.5 kB
Tags Python 3
SHA-256 checksum
How to use checksums
d9aa06533132bc7e73dd272bf13d6fcc3420ef94a4e13131edb709ec57cfae44
BLAKE2b-256 checksum
How to use checksums
bdd2d9df8a6dc0dc36124dfaa8d0d49d3e840f7b8374913c9714558f7c420cdf
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.13.0rc2

Release history Release notifications | RSS feed

This release

1.1.0 This release

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page