Skip to main content
MediumEmailOWASP A05:2021CWE-1188

How to fix: MX record points at an IP address instead of a hostname

An MX record names an IP address literal as its exchange, which the standards forbid. RFC 1035 and RFC 2181 require the exchange to be a domain name that has an address record.

Why it matters

Standards-conforming senders resolve the exchange as a hostname, get NXDOMAIN, and defer or bounce the message, so inbound mail fails from some senders and works from others depending on how tolerant their MTA is. Because the failure is partial, it usually gets attributed to the sender rather than to the record.

Beyond the delivery failures, an address literal makes it impossible to present a certificate name matching the exchange, which breaks everything layered on top of the MX name: MTA-STS policies list permitted MX hostnames, SMTP certificate validation matches the exchange name, and DANE TLSA records are published under it.

How to fix it

  1. 1Create an A and AAAA record for a mail hostname and point the MX at that name.
  2. 2Make sure the mail server presents a certificate valid for that hostname.
  3. 3Re-check MTA-STS or DANE afterwards if either is in use, since both key on the exchange name.

Code examples

Correct MX configuration

DNS
mail.example.com. IN A     203.0.113.25
mail.example.com. IN AAAA  2001:db8::25
example.com.      IN MX 10  mail.example.com.

Check what is published

bash
dig +short MX example.com

References

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

See every email check

Questions

How severe is MX record points at an IP address instead of a hostname?
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-mx-ip-literal, which stays the same between runs so you can filter, diff, or gate CI on it.
Which standards does MX record points at an IP address instead of a hostname map to?
It maps to CWE-1188. In the OWASP Top 10 it falls under A05: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 mx record points at an ip address instead of a hostname

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

MX record points at an IP address instead of a hostname | VulnRadar