Skip to main content
MediumEmailOWASP A02:2021CWE-16

How to fix: MTA-STS policy does not cover every published MX host

The fetched MTA-STS policy file lists mx patterns that do not match one or more of the domain's published MX hostnames.

Why it matters

A sending server honouring an enforce-mode policy refuses to deliver to any MX host the policy does not list. Where the uncovered host is a backup MX, mail stops flowing to it during exactly the failover the backup exists for. Where it is a primary, inbound mail from MTA-STS-aware senders, which includes Gmail and Outlook, fails outright.

The mismatch normally appears after an MX change: a new provider is added or a backup MX is introduced, and the policy file is not updated alongside it, because the policy lives on a web server rather than in DNS and is maintained by a different process. Wildcards are permitted in the mx list and match exactly one label, so mx: *.mail.example.com covers a.mail.example.com but not mail.example.com itself.

How to fix it

  1. 1Add an mx: line for every published MX host, or a wildcard that covers them.
  2. 2Change the policy id in the _mta-sts TXT record whenever the file changes, so senders refetch instead of using the cached copy.
  3. 3Make updating the policy file part of whatever process changes MX records, so the two cannot drift again.

Code examples

Policy covering primary and backup

text
version: STSv1
mode: enforce
mx: mail.example.com
mx: mail2.example.com
max_age: 1209600

Compare policy against DNS

bash
diff <(curl -s https://mta-sts.example.com/.well-known/mta-sts.txt | grep -i '^mx:' | awk '{print tolower($2)}' | sort) \
     <(dig +short MX example.com | awk '{print tolower($2)}' | sed 's/\.$//' | sort)

References

Detected automatically by VulnRadar. The check id is email-mta-sts-mx-mismatch, stable across every scan so you can filter or diff on it.

See every email check

Questions

How severe is MTA-STS policy does not cover every published MX host?
VulnRadar rates this medium severity in the email category. The severity is fixed per check, not scored per site, so the same finding is the same severity on every scan.
Does VulnRadar check for this automatically?
Yes. It runs as part of every scan under the check id email-mta-sts-mx-mismatch, which stays the same between runs so you can filter, diff, or gate CI on it.
Which standards does MTA-STS policy does not cover every published MX host map to?
It maps to CWE-16. In the OWASP Top 10 it falls under A02:2021.

Missing a check?

The detection set is open. If you know a misconfiguration this does not catch, propose it: the issue template asks for the threat model, how to detect it, the false-positive risk, and a test fixture, which is the same thing a maintainer would have to work out anyway.

Propose a checkHow a check is built

Scan your own site for mta-sts policy does not cover every published mx host

VulnRadar runs this check and hundreds more against a URL in seconds. No agent to install, just paste a URL.

Or scan this site as a demoRead the docs

MTA-STS policy does not cover every published MX host | VulnRadar