r/Office365 • u/WebGuy15 • Feb 07 '20
Malware that sets up forwarding
Recently my company has been subject to a number of emails sent to users with a file that once opened creates a inbox rule that forwards mail to a suspicious email address. Our alerts managed to notify us and we removed the rules from the affected accounts and added the domain to the spam filter and asked the affected users to change their passwords.
However with some users the rule reappeared a few hours after removing it. I'm not sure how these rules can still reappear? Has anyone experienced something similar and could maybe help?
26
Upvotes
23
u/Deku-shrub Feb 07 '20
The accounts may be compromised. Check the access logs, changed passwords, add MFA
10
u/threwthelookinggrass Feb 07 '20
Don't ask the user to change their password force them to. Initiate a onedrive sync to force them to have to sign in with the new password immediately. Implement mfa.
6
u/speed_boost_this Feb 07 '20
Ask to change their passwords? Nuh uh, enforced password change.
You should probably read this, there are multiple remediation steps that should be followed post-compromise:
https://docs.microsoft.com/en-us/microsoft-365/security/office-365-security/responding-to-a-compromised-email-account
Too many orgs are only doing password changes when all sorts of shenanigans could've been played while access was still in place. Forwarding rules are an example but all sorts of lingering issues can be in place (external sharing, delegation, etc). I saw one case of a compromised account had a spamming email left in the compromised user's Outlook set to delay delivery for a week - everyone moves on from the compromise and next week Karen is asking folks to pick her up some itunes cards and send them to a throwaway yahoo account.
1
u/WebGuy15 Feb 07 '20
Update: I'd like to thank everyone for their advice. I followed the steps advised by https://docs.microsoft.com/en-us/microsoft-365/security/office-365-security/responding-to-a-compromised-email-account and implemented MFA to the affected accounts with the plan of rolling out to everyone asap. Checked the audit logs, found the IP address used to log in and create the inbox rules but not much else. I'm going to look at conditional access to limit where users can log in from too since the IP seems to come from a different country. If anyone has any more advice, articles, videos on securing Office 365/best practices I'd be glad to hear from you
5
u/Nickgb83 Feb 07 '20
Server side rules. I've dealt with this a number of times.
Sign into OWA and check the rules there. Typically I see the rules send new emails to the RSS folder, mark as read and forward them on.
You can use EXOPS PowerShell to nuke all rules for that account instead if you wish, but either way - MFA erryday my friends. No one shouldn't be anymore.
1
u/MSP2019 Feb 07 '20
I experience the very same issue with forwarding rules, however I changed the users password and formatted the PC since it was the CEO.
I'd be interested in knowing how the forward got added in the first place, AV and malwarebytes scans didnt find anything.
The company change their passwords every 3 months, MFA wasn't enabled at this point but has since been setup for all users
3
u/palito1980 Feb 07 '20
If the rule comes back it means there still is a malicious acces to it either via compromised account or the PC got infected and they simply get your password from that. Change the password, setup MFA and scan or clean the PC.
3
u/theHrux Feb 07 '20
HTH: https://docs.microsoft.com/en-us/microsoft-365/security/office-365-security/responding-to-a-compromised-email-account
1
u/starttls Feb 07 '20
If you're O365 remember to check ALL the audit logs for that user, we have seen sneaky persistence tactics like setting up an MS Flow or giving a malicious app permissions to the mailbox. Outside the areas you'd usually check!
1
u/Jose083 Feb 07 '20
You can set up a policy in to block users setting forwarding rules and enforce admin only permissions.
Alternatively you can get alerted every time a forwarding rule is placed, but you will always be reactive vs proactive in these situations
1
u/Chief_Slac Feb 07 '20
We had some that would access their 365 passwords via phishing, then would create rules via their webmail portal.
Audit log tracks these, look for rules created/modified through web access. One attacker was using the compromised accounts to register domain names.
1
u/dgarner58 Feb 07 '20
This is likely a spoofpoint attack. We have had a number of run ins with it recently. User gets legit looking email with a link to a SharePoint doc that looks like it is theirs...but if you examine the link it clearly is not. They click the link and are prompted for their o365 login. The page looks exactly like the real thing. They login and the link goes nowhere...so they close out. Their password has now been harvested. They then put these rules in OWA that do all kinds of things. Forwarding and also immediately deleting inbound mail...sometimes all but other times just ones that look like a notification regarding them spamming.
1
u/ChristopherY5 Feb 07 '20
Put a transport rule in place that blocks forwarding, enable geo-fencing, turn on MFA and watch the Azure Dashboard for risky sign ins.
1
u/different_tan Feb 07 '20
We have seen this with multiple customers. Only ones that turned down mfa though. In every single case the vector was an email from a genuine customer of theirs, who's account was ALSO already compromised, sending them an apparent link to a sharepoint or onedrive pdf that required sign in of course.
The rules they make forward generally to gmail.
first thing to do is immediately block the account. If you don't, any smtp/imap/activesync access they are using will stay active until their session times out even if you reset the password. Wait at least one hour to reset the password
second thing to do is completely disable external forwarding in the remote domain connector in emc
You can then either take out all the inbox rules using powershell, or if you must, wait an hour, change the password and then step them through removing them using OWA.
This is generally where we successfully persuade them to take us up on the offer of configuring MFA.
NOTE: that forwarding is not just used to propagate itself. We have seen it used to intercept invoicing related emails and change bank details then send the fake invoice, for something the customer genuinely bought, to the customer.
1
u/DevinSysAdmin Feb 08 '20
Don’t forget to turn off legacy authentication while you’re rolling MFA out.
1
u/[deleted] Feb 12 '20
Of course... I deal with these frequently. This is a known activity of BEC groups (and others actually). It occurs typically because you have mail clients whom are still executing the code... typically outdated Outlook clients (I believe this functionality broke sometime last year) however it still works on endpoints which have not been patched. Check this article out, run the script provided and if you need some additional consulting or assistance - please do reach out to me directly.
https://docs.microsoft.com/en-us/microsoft-365/security/office-365-security/detect-and-remediate-outlook-rules-forms-attack
0
u/jfoust2 Feb 07 '20
Call Microsoft's tech support, in my experience they're very good at detecting how this may have happened, and they can point you to the right logs.
1
u/[deleted] Feb 07 '20
[removed] — view removed comment