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

Cybersecurity

2 readers
14 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@sh.itjust.works 41 points 2 months 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.

[–] Aganim@lemmy.world 12 points 2 months ago* (last edited 2 months ago) (2 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.

[–] colin@mastodon.colincogle.name 1 points 2 months ago

@Aganim @Jerry Correct. DMARC alignment only requires a single thing to pass. A forwarded email or newsletter might fail SPF but pass DKIM, and that’s acceptable.

#DMARC

[–] Jerry@hear-me.social 1 points 2 months ago (1 children)

@Aganim@lemmy.world
I'm not an expert on this (it's a career), but I know it's not that simple.

If I get an unforwarded email, I definitely want both DKIM and SPF to pass. I want only email from an authorized server, and I want an email that is not modified and is properly signed. No exceptions. Both must pass.

If I get email from a mailing list that is sending email to me on behalf of a different domain, I want SPF to pass in that I want to know that the mailing list provider's server is authorized to send email on behalf of the original domain. But, in this case, the original DKIM will fail because the mailing list provider will have changed the email. But, I expect the new DKIM to be correct, or I won't accept it. So, here, a failure on the original DKIM can be acceptable.

If someone forwards an email to me, the original DKIM will fail. I will accept it. But, I want the SPF of the forwarding server to pass, and the new DKIM for the changed email to pass.

There's also email redirection and forwards that happen at the server vs. the client and there can be separate rules for this.

The records can get complicated if you truly want to control different scenarios.

But, you don't always want to accept an email if only 1 check passes.

At least, this is my understading of it all.

[–] Aganim@lemmy.world 1 points 2 months ago* (last edited 2 months ago)

You are of course free to do with email what you want if you run your own email server. It's simply that the DMARC RFC states that only one mechanism has to pass, so if you rely on your server's DMARC implementation you won't get what you want.

Edit: reworded a bit, I made it sound as if only one pass is allowed by DMARC.

[–] krelvar@lemmy.world 9 points 2 months 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@sh.itjust.works 3 points 2 months ago* (last edited 2 months 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.

[–] krelvar@lemmy.world 3 points 2 months ago

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

[–] Ruaphoc@mstdn.games 6 points 2 months ago (1 children)

@Jerry@hear-me.social

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).

[–] Jerry@hear-me.social 1 points 2 months ago

@Ruaphoc@mstdn.games
Thanks for this! This is on my list to look at this weekend. Thank you!

[–] pmevzek@framapiaf.org 5 points 2 months ago

@Jerry@hear-me.social 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.

[–] purelinux@social.tchncs.de 5 points 2 months ago

@Jerry@hear-me.social 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.

[–] pteryx@dice.camp 3 points 2 months ago (5 children)

@Jerry@hear-me.social 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!

[–] kitnaht@lemmy.world 3 points 2 months ago* (last edited 2 months 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.

[–] Jerry@hear-me.social 2 points 2 months ago (4 children)

@pteryx@dice.camp I set up my own email server on DigitalOcean and instantly got blacklisted by Spamhaus because it was a new domain, and then by another company because the IP address belonged to DigitalOcean.

Most mail servers also flagged it as spam because the domain was less than 60 days old and because it was a .online TLD. For a long time, some of my emails were immediately bounced back or went to spam folders because of all these reasons.

I also believe that every home IP address is automatically blacklisted, which makes it worse for your roommate.

You can eventually overcome it by letting the domain reputation slowly develop and then doing a direct appeal to the blacklist companies. But, it takes a long time.

It's amazing any spam gets delivered.

load more comments (4 replies)
load more comments (3 replies)
[–] cosmicspittle@ecoevo.social 3 points 2 months ago

@Jerry@hear-me.social Thank you for this

[–] tychotithonus@infosec.exchange 3 points 2 months ago

@Jerry@hear-me.social No-email domains can also set a null MX:

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

MX 10 "."

[–] whophd@ioc.exchange 3 points 2 months ago

@Jerry@hear-me.social @nopatience@swecyb.com This is a gold nugget of a tip. Partly because it’s timeless. One of us should build a directory page full of #infosectips

[–] dotslashme@infosec.pub 2 points 2 months ago

Very good tip! Thank you.

[–] timjclevenger@infosec.exchange 2 points 2 months ago

@Jerry@hear-me.social This is especially true if you defensively registered a bunch of lookalike domains.

[–] nimi@norrebro.space 2 points 2 months ago (1 children)

@Jerry@hear-me.social 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?

[–] Jerry@hear-me.social 1 points 2 months ago

@nimi@norrebro.space
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.

[–] b3lt3r@mastodon.b3lt3r.com 2 points 2 months ago (2 children)

@Jerry@hear-me.social 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 name@xxxxx.com is forwarded to name@gmail.com 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.

load more comments (2 replies)
[–] freddieleeman@infosec.exchange 2 points 2 months ago

@Jerry@hear-me.social 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

[–] idoubtit@mstdn.social 2 points 2 months ago (2 children)

@Jerry@hear-me.social I have this problem! But I also use my domain for sending post notifications via MailPoet. What are my options?

load more comments (2 replies)
[–] SkunkWorkz@lemmy.world 2 points 2 months 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

[–] adingbatponder@fosstodon.org 2 points 2 months ago (1 children)

@Jerry@hear-me.social How in practice can I do this for my site if dynu.com does the dns, and not a dns server I control?

[–] Jerry@hear-me.social 2 points 2 months ago

@adingbatponder@fosstodon.org
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.

[–] jirirbr@mastodonczech.cz 2 points 2 months ago

@Jerry@hear-me.social @_elena@mastodon.social Thank you for sharing this.

[–] ellypony@lemmy.world 1 points 2 months 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.

[–] MystikIncarnate@lemmy.ca 1 points 2 months ago

Right. I should do this.

[–] frikkelgard@troet.cafe 1 points 2 months ago

@Jerry@hear-me.social That's how it's done. Short and clear writeup. Thank you!

[–] daniel@masto.doserver.top 1 points 2 months ago (1 children)

@Jerry@hear-me.social Can you undo this later without consequence?

[–] Jerry@hear-me.social 1 points 2 months ago (1 children)

@daniel@masto.doserver.top
Should be able to.

[–] daniel@masto.doserver.top 1 points 2 months ago (1 children)

@Jerry@hear-me.social (Just thinking from a cache perspective)

[–] Jerry@hear-me.social 1 points 2 months ago

@daniel@masto.doserver.top
I've never had issues making changes, so I think it wouldn't be an issue. The caches should recognize they need updating.

[–] al1r4d@pegelinux.top 1 points 2 months ago

@Jerry@hear-me.social thank you sir

[–] Fonkisifou@mamot.fr 1 points 2 months ago

@Jerry@hear-me.social
@yunohost@toot.aquilenet.fr I think it is ok:
https://doc.yunohost.org/fr/dns_config

But in case of ⬆️

[–] jack@social.jacklinke.com 1 points 1 month ago

@Jerry@hear-me.social 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!

[–] pasmac@atmasto.com 1 points 2 months ago

@Jerry@hear-me.social arghh forgot to up date the IP address …. 🤬
Good tip

[–] simrob@social.wub.site 1 points 2 months ago

@Jerry@hear-me.social 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?

[–] Char@noc.social 1 points 2 months ago

@Jerry@hear-me.social
#email
If it helps anyone as an example of a domain w/o email, I have a domain 'hack-char.dev' that has those records configured. Never knew about the null mx, and will put one in today.

As a side note, I've seen someone try to spoof a different domain of mine and for some reason gmail sends a bounce to my domain, without rua set. I was wondering if it was an attempt to get a phish through in a bounce, but I don't see how that would be successful.

[–] RobynNuthall@mastodon.nz 1 points 2 months ago

@Jerry@hear-me.social

Thank you!!!

[–] troy@opencoaster.net 1 points 2 months ago

@Jerry@hear-me.social 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.

[–] Xitnelat@wue.social 1 points 2 months ago

There's an article at gov.uk also covering DKIM and null-records:
https://www.gov.uk/guidance/protect-domains-that-dont-send-email
@Jerry@hear-me.social

[–] MacBalance@mstdn.games 1 points 2 months ago

@Jerry@hear-me.social @pluralistic@mamot.fr

[–] esplovago@mastodon.uno 1 points 2 months ago (1 children)

@Jerry@hear-me.social great advice. One question: does this config protect also subdomains?

load more comments (1 replies)
[–] scottwilson@infosec.exchange 1 points 2 months ago

@Jerry@hear-me.social Thanks for sharing! I didn’t even think about this and it’s on my To Do list now. 🫡

load more comments
view more: next ›