this post was submitted on 15 Dec 2024
349 points (100.0% liked)

Cybersecurity

23 readers
15 users here now

An umbrella community for all things cybersecurity / infosec. News, research, questions, are all welcome!

Rules

Community Rules

founded 2 years ago
MODERATORS
 

Important reminder, if you own a domain name and don't use it for sending email.

There is nothing to stop scammers from sending email claiming to be coming from your domain. And the older it gets, the more valuable it is for spoofing. It could eventually damage your domain's reputation and maybe get it blacklisted, unless you take the steps to notify email servers that any email received claiming to come from your domain should be trashed.

Just add these two TXT records to the DNS for your domain:
TXT v=spf1 -all
TXT v=DMARC1; p=reject;

The first says there is not a single SMTP server on earth authorized to send email on behalf of your domain. The second says that any email that says otherwise should be trashed.

If you do use your domain for sending email, be sure to add 3 records:
SPF record to indicate which SMTP server(s) are allowed to send your email.
DKIM records to add a digital signature to emails, allowing the receiving server to verify the sender and ensure message integrity.
DMARC record that tells the receiving email server how to handle email that fails either check.

You cannot stop scammers from sending email claiming to be from your domain, any more than you can prevent people from using your home address as a return address on a mailed letter. But, you can protect both your domain and intended scam victims by adding appropriate DNS records.

UPDATE: The spf and the dmarc records need to be appropriately named. The spf record should be named "@", and the dmarc record name should be "_dmarc".

Here's what I have for one domain.

One difference that I have is that I'm requesting that email providers email me a weekly aggregated report when they encounter a spoof. gmail and Microsoft send them, but most providers won't, but since most email goes to Gmail, it's enlightening when they come.

#cybersecurity #email #DomainSpoofing #EmailSecurity #phishing

top 50 comments
sorted by: hot top controversial new old
[–] themoonisacheese 46 points 1 month ago

This is overall best practices and overall correct (as in: you should probably do this, and it will never hurt), but realistically any domain that doesn't at least have an SPF record will be already treated as unable to send mail at all by any properly configured receiving server, especially ones that would report you to a blocklist.

This isn't bad advice regardless, just a bit redundant.

[–] [email protected] 12 points 1 month ago* (last edited 1 month ago) (3 children)

DMARC record that tells the receiving email server how to handle email that fails either check.

Could be that I misunderstood you, but: It tells what to do if no mechanism (DKIM or SPF) results in a pass. DMARC actually only requires one mechanism to pass. So an email with a DKIM fail, but an SPF pass is considered OK. And vice-versa.

Edit: good advice by the way regarding protecting your domain reputation, I'll check our non-email domains at work first thing tomorrow.

load more comments (3 replies)
[–] [email protected] 9 points 1 month ago (1 children)

There is nothing admin-wise I hate more than dealing with email security. Fucking google is horrible. At least when Microsoft randomly decides the half dozen family members on my personal domain are bulk email spammers, there's a form to reach out. Google is a piece of shit in this way just like in so many other ways.

[–] Anon518 3 points 1 month ago* (last edited 1 month ago) (1 children)

Google is much better. They send much less legitimate email to spam than Outlook & Hotmail. They also do have a bulk sender form. https://support.google.com/mail/contact/gmail_bulk_sender_escalation

As well as a "send feedback" option on most pages.

[–] [email protected] 3 points 1 month ago

I'll try that link next time they cut off my email for no reason, thanks.

[–] [email protected] 6 points 1 month ago (1 children)

@[email protected]

While you are securing your domain, 3 more good ideas:

  1. Enable DNSSEC. This will sign the dns query responses to help ensure your DKIM and TLSA can be trusted.

  2. Configure CAA records with only your TLS certificate issuer so any other certificates are not trusted.

  3. Configure DANE TLSA records with a hash of the public keys for your email server and websites. Also be sure to configure the “mta-sts.@“ subdomain to serve the correct text file. This will provide an additional chain of trust for your email server (and websites server).

load more comments (1 replies)
[–] [email protected] 5 points 1 month ago

@[email protected] Nitpick: SPF record is not named "@", it just needs to be at apex of zone. @ is often a shorthand to say apex in zonefiles, but doesn't exist as such really in DNS queries and answers. Also, if you want to fully protect your domain, you can have a null MX record (RFC 7505) and for other matters than email, but also still important, a null CAA record to prevent any rogue certificates issued for it.

[–] [email protected] 3 points 1 month ago

@[email protected] @[email protected] This is a gold nugget of a tip. Partly because it’s timeless. One of us should build a directory page full of #infosectips

[–] [email protected] 3 points 1 month ago

@[email protected] Personally, i also add this as a wildcard for the domain. Not sure if its really required, but better safe than sorry. Due to a standardized function i built for myself in my #dnscontrol files, its no additional work.

[–] [email protected] 3 points 1 month ago

@[email protected] No-email domains can also set a null MX:

https://www.rfc-editor.org/rfc/rfc7505.html

MX 10 "."

[–] [email protected] 3 points 1 month ago
[–] [email protected] 2 points 1 month ago
[–] [email protected] 2 points 1 month ago (7 children)

@[email protected] Last I knew, my roommate who ran a homebrew server was frustrated that they can't run an email server because outgoing email was assumed to be spam anyway. It would be nice if there were an actual way out of this!

[–] [email protected] 3 points 1 month ago* (last edited 1 month ago)

Anything from a residential IP is going to be marked as spam.

There is an actual way out of this, and it's through a reverse tunnel.

[–] [email protected] 1 points 1 month ago (1 children)
[–] [email protected] 1 points 1 month ago (1 children)

@amberage @pteryx
Your points, I think, are very valid. And I live with the fear that I will end up with the same fate.

[–] [email protected] 1 points 1 month ago

@[email protected] @[email protected] not my points, just someone else's article that I found quite informative the first and last time I thought "how hard can it be to host my own email?"

load more comments (5 replies)
[–] [email protected] 2 points 1 month ago (1 children)

@[email protected] I have this problem! But I also use my domain for sending post notifications via MailPoet. What are my options?

[–] [email protected] 1 points 1 month ago (1 children)

@[email protected]
Mailpoet is a Wordpress plugin? You should still have appropriate SPF, DKIM, and DMARC records.

If you gave Mailpoet the right to use your email's SMTP server (is this how it works?) then you're fine because it's using your credentials and SPF will pass as the SMTP server is authorized to send email for your credentials.

load more comments (1 replies)
[–] [email protected] 2 points 1 month ago (1 children)

@[email protected] would adding those txt records cause any issue to a wildcard redirect I use for myself?

I have xxxxx.com and an auto redirect by my dns provider so that anything sent to [email protected] is forwarded to [email protected] so when I give out the address I can see if it's been shared.

I like the idea of protecting against unauthorized use but wouldn't want to lose my throwaway capability.

I find email servers to be akin to dark arts so am at a loss here tbh.

[–] [email protected] 1 points 1 month ago (1 children)

@[email protected] I'm far from an expert, but if your redirect is at the server, and your server adds a ".forward" to the email, and does not alter anything, you should be fine because your SPF and DKIM should pass.

If your redirect is via an email client, or the server doesn't add a .forward, it may alter the email slightly, but in a way sufficient for DKIM to fail because the hash won't match any longer. But, I think in this case, if SPF passes, your email client would still accept it since the original DKIM passed before the forwarding.

It gets really complicated. Suggest you try it.

And this is based on my understanding, which, who knows?

[–] [email protected] 1 points 1 month ago

@[email protected] ok - I'll try it on a less critical domain first, thank you.

I run most of my own services from here to avoid any cloud usage but the one thing I do not dare to host is email - I can't see any refinement in configuration/management has happened since the '70s :-)

[–] [email protected] 2 points 1 month ago (1 children)

@[email protected] How in practice can I do this for my site if dynu.com does the dns, and not a dns server I control?

[–] [email protected] 2 points 1 month ago

@[email protected]
Can you open a support ticket for help? Or, maybe, they've already done it for you. You can check at https://www.dnsdomainlookup.com/ and pick dns summary from the dropdown.

If you see the spf, dkim, and dmarc records, then you're all set.

[–] [email protected] 2 points 1 month ago

@[email protected] This is especially true if you defensively registered a bunch of lookalike domains.

[–] [email protected] 2 points 1 month ago

@[email protected] The M3AAWG provides best practices for parked domains, including the recommendation to implement a wildcard DKIM signature.

*._domainkey.example.com TXT “v=DKIM1; p=”

https://www.m3aawg.org/sites/default/files/m3aawg_parked_domains_bp-2015-12.pdf

[–] [email protected] 2 points 1 month ago (1 children)

@[email protected] If I change my mind and I want to send e-mails from the domain: Can I expect that this will work, if I change the DNS records file again and wait for TTL seconds? Or will this take considerably longer?

[–] [email protected] 1 points 1 month ago

@[email protected]
Hi,

Depending on the ISP, after making the changes, it usually takes up to 15 minutes for the changes to get distributed to all the DNS servers worldwide. It's pretty quick.

[–] [email protected] 2 points 1 month ago

Yeah I regularly get DMARC reports for domains I’m not using. For ease I just added them as an alias to an Google workspace account I already have and use the DKIM, DMARC etc that Google provides. In case I ever need to send an email with that domain

[–] [email protected] 1 points 1 month ago (1 children)

@[email protected] great advice. One question: does this config protect also subdomains?

[–] [email protected] 1 points 1 month ago

@[email protected]
Yep.

If you want to have different rules for subdomains, then the records get much more complicated. but "v=spf1 -all" pertains to the domain and subdomains.

[–] [email protected] 1 points 1 month ago
[–] [email protected] 1 points 1 month ago
[–] [email protected] 1 points 1 month ago

@[email protected] Interesting. I own two domains (one I plan to use, one I use to connect to things remotely) and maybe I should set this up.

[–] [email protected] 1 points 4 weeks ago

@[email protected] Thank you for sharing this. I've had it bookmarked for weeks, but finally sat down and updated all of my domains today. Feels good to have that little task done!

[–] [email protected] 1 points 1 month ago
[–] [email protected] 1 points 1 month ago

@[email protected] thank you for this post!

I've set up email servers using iRedMail and mailcow successfully with dmarc, etc., but this post really tied it all together for me.

now i have some dns to ... improve

[–] [email protected] 1 points 1 month ago

@[email protected] also good idea while you’re in there to make sure you don’t have any old records pointing to servers you don’t own anymore.

[–] [email protected] 1 points 1 month ago

@[email protected] thanks for sharing this. It was boosted into my neck of the woods and I don’t actually know who you are - is there a semi-authoritative place this advice is documented that I can 1) double check, because that seems like a good idea at least in principle with security related stuff like this and 2) pass on to others?

[–] [email protected] 1 points 1 month ago

This is such thoughtfully written advice even though I’m not in CSI I’m still going to save it for later. Who knows. Thank you.

[–] [email protected] 1 points 1 month ago

Very good tip! Thank you.

[–] [email protected] 1 points 1 month ago

Right. I should do this.

[–] [email protected] 1 points 1 month ago

@[email protected] That's how it's done. Short and clear writeup. Thank you!

load more comments
view more: next ›