r/PowerShell • • Oct 29 '17

Warn Office 365 users when an external sender has the same display name as an internal user in all customer tenants

https://gcits.com/knowledge-base/warn-users-external-email-arrives-display-name-someone-organisation/
160 Upvotes

22 comments sorted by

13

u/[deleted] Oct 29 '17

This looks really like something I have looked for.

But if I understand correctly if 2 people are named John Smith for example this rule will trigger?

5

u/fbsau Oct 29 '17

Yes that’s right, if you have a user with a common name in your company, you’ll probably get a lot of warnings. This rule is probably better suited to smbs than larger organisations 🙂

5

u/[deleted] Oct 29 '17

But if I have for example 20 key users that work in finance etc. I could use this to create a rule and just replace the display name attribute with their specific display names?

Then if someone tries to email the org with those display names anyone in the company will get the warning right?

3

u/fbsau Oct 29 '17

Yep that’d work. The display name object is just an array of strings. You could also make it a bit less manual by filtering the get-mailbox cmdlet by an attribute shared by the finance team. That would return only those display names.

2

u/274Below Oct 29 '17

I can see some performance issues as well. For example, what if you load 100k+ display names into this rule? Would it bring your transport layer to a halt? Would it reject the rule?

It looks like O365 has a limit of 20KB of data for matching display names, so at least in the O365 model, that's the end of that...

1

u/fbsau Oct 29 '17

You’re right, this is probably best suited to smaller orgs, or only added to a specific subset of users.

2

u/chrislehr Oct 30 '17

You can target rules to specific users or groups or ous. Be aware that on exchange on prem the time out for refreshing a group membership was four hours or so. Exo is undocumented afaik

7

u/markekraus Community Blogger Oct 29 '17

I had something similar up and running, but it ended up causing a ton of problems. The HTML warning was getting applied to legitimate emails and then completely ruining the original encoding. For english, everything was fine, but for many other languages, this was resulting in complete gibberish emails. It was becoming a burdensome task to constantly make exceptions to the rule and in some cases, exceptions just weren't possible without accepting more risk. ultimately, management decided it was a bad idea and we had to remove it.

This probably works real well in a single language org with a small number of employees. I wouold caution against this in larger orgs or multi-nationals.

1

u/fbsau Oct 29 '17

Thanks for the heads up. I’ll add an option to modify the subject instead, or add a plain text warning in the next couple of days.

2

u/Hellman109 Oct 29 '17

The biggest risk here is money right? So only do it for finance people receiving emails from any manager? If reciever is finance and the matched sender has a direct report in AD flag it?

Doesn't fix the language issue but does minimise the pain

5

u/markekraus Community Blogger Oct 29 '17

The biggest risk here is money right?

Nope. In a company the size of my employer, the people who deal with money have very strict controls in addition to the technology insulation provided by IT that protect money pretty well. They also have mandatory quarterly phishing training. Many of their workflows make an email asking for money a huge red flag.

The bigger risks are IP and any strategic data. That's something that can't be targeted well. Not one person or group has all the data, but cast a wide enough net and you can get it.

Ultimately, applying it to a small group has about the same effect as applying it to no one at all and the result is a lot of effort with almost no gain.

1

u/ssnani Oct 29 '17

We add the same experience with HTML . We ended up appending the subject with a warning message. Not so pretty but get the job done

2

u/markekraus Community Blogger Oct 29 '17

Appending the subject is a neat idea. I started to look into a required add-in that will provide warnings to users in OWA and Outlook based on the presence of a header. That way new rules could be added that just add a header and then let the add-in warn the user.

2

u/bradleywyatt Oct 29 '17 edited Oct 29 '17

Great article. I really enjoy the write ups from this site

2

u/800oz_gorilla Oct 29 '17

Just an fyi, mimecast has an add on called targeted threat protection that does this in a more advanced way. No, I don't work for them but I love the product

3

u/bradleywyatt Oct 30 '17

It goes against best practice to put anything (like a spam filter) in front of Office 365.

-2

u/KingPhisherTheFirst Oct 30 '17

best practice

If you're only using EOP then you know nothing about security or best practices

3

u/bradleywyatt Oct 30 '17

I’m not even going to waste my time with this one

0

u/KingPhisherTheFirst Oct 31 '17

Probably because you need the time to deal with all the garbage getting through #BoomRoasted

1

u/Reverb001 Oct 29 '17

This is awesome. Going to bring to me boss on Monday.

1

u/DangerDylan Dec 07 '17

Any thoughts on including SPF verification as an additional parameter?

E.g. we some times send e-mail through external SMTP servers, and these are of course flagged.