Showing posts with label Microsoft 365. Show all posts
Showing posts with label Microsoft 365. Show all posts

Friday, 8 March 2024

Mastering Threat Detection with Microsoft 365 Defender Advanced Hunting: Queries and Strategies for Proactive Cybersecurity

Microsoft 365 Defender Advanced Hunting is a powerful, query-based threat hunting tool that allows security professionals to proactively search for threats across their organization's digital environment. This capability is part of Microsoft Defender XDR and enables you to inspect events across devices, emails, applications, and identities within your network by leveraging up to 30 days of raw data. Advanced Hunting is designed to help you identify both known and potential threats through unconstrained searching, using the Kusto Query Language (KQL) for crafting queries.

The tool supports two modes: guided and advanced. If you're new to KQL or prefer a more structured approach, the guided mode offers a query builder to assist you. For those more experienced with KQL, the advanced mode allows for direct query crafting from scratch. It's also possible to use the queries developed during hunting to create custom detection rules, which can then automatically monitor for similar threat patterns and respond to them as needed.

Advanced hunting covers data from various sources within the Microsoft ecosystem, including Microsoft Defender for Endpoint, Office 365, Cloud Apps, and Identity, providing a comprehensive view of your organization's security posture. It's crucial to have the appropriate roles and permissions to access this feature, and data freshness is maintained rigorously with event data being available almost immediately and entity data updated every 15 minutes​​.

Several practical examples showcase the flexibility and power of Advanced Hunting:

Identify Devices with a Specific File:

This query checks if devices have files from a known malicious sender, useful for identifying devices affected by a malware distribution campaign.

EmailAttachmentInfo
| where SenderFromAddress =~ "MaliciousSender@example.com"
| where isnotempty(SHA256)
| join (
    DeviceFileEvents
    | project FileName, SHA256, DeviceName, DeviceId
) on SHA256

Monitor Specific PowerShell Activities:

This example targets PowerShell processes and searches for suspicious commands that could indicate exploitation attempts.

DeviceProcessEvents
| where FileName in~ ("powershell.exe", "powershell_ise.exe")
| where ProcessCommandLine has_any("WebClient", "DownloadFile", "DownloadData", "DownloadString", "WebRequest", "Shellcode", "http", "https")
| project Timestamp, DeviceName, InitiatingProcessFileName, InitiatngProcessCommandLine, FileName, ProcessCommandLine

Logon Events Post-Receiving a Malicious File:

This query investigates logon events occurring within a short timeframe after receiving a malicious file, helping to identify potential breaches.

EmailEvents
| where Timestamp > ago(7d)
| where ThreatTypes has "Malware"
| project EmailReceivedTime = Timestamp, Subject, SenderFromAddress, AccountName = tostring(split(RecipientEmailAddress, "@")[0])
| join (
    DeviceLogonEvents
    | where Timestamp > ago(7d)
    | project LogonTime = Timestamp, AccountName, DeviceName
) on AccountName
| where (LogonTime - EmailReceivedTime) between (0min .. 30min)

Activities from Specific Cloud Apps:

A query to monitor activities from cloud apps, like Microsoft SharePoint Online, involving specific users or IP addresses.

CloudAppEvents
| where Application == "Microsoft SharePoint Online"
| take 100

Investigate Cloud App File Uploads:

For tracking file uploads to SharePoint Online, this modified query adapts to the new CloudAppEvents table.

CloudAppEvents
| where ActionType == "FileUploaded" and Application == "Microsoft SharePoint Online"
| where ObjectType == "File" and ObjectName endswith ".xlsx"
| project Timestamp, ActionType, Application, ObjectName, AccountObjectId, AccountDisplayName, IPAddress, CountryCode

Investigate Defender Folder Access Control

This tracks processes that have been blocked

DeviceEvents
| where ActionType in ('ControlledFolderAccessViolationAudited','ControlledFolderAccessViolationBlocked')

Each of these queries utilizes the Kusto Query Language (KQL) to interrogate various datasets available through Microsoft 365 Defender, from endpoint activities to cloud application events. They demonstrate how flexible and powerful Advanced Hunting can be when identifying, investigating, and responding to potential security threats across an organization's Microsoft 365 environment​​​​​​​

Tuesday, 5 December 2023

Enhancing Email Security with First Contact Safety Tip in Microsoft 365

Email security is paramount. Microsoft 365 offers a feature called the First Contact Safety Tip, which is part of the anti-phishing policies in Microsoft Defender for Office 365. This safety tip is a proactive measure to alert users when they receive an email from a sender they haven’t interacted with before. 

To enable this feature and why it’s beneficial.
  1. Access the Microsoft 365 Defender Portal: Go to “https://security.microsoft.com/”.

  2. Navigate to ‘Policies & Rules’: In the left-hand menu, select ‘Policies & Rules’.

  3. Go to ‘Threat Policies’: Here, you’ll find various options for managing your security policies.

  4. Select ‘Anti-Phishing’: Under the ‘Email & Collaboration’ section, click on ‘Anti-phishing’.

  5. Edit or Create a Policy: You can choose to edit the default policy or create a new one by clicking ‘+ Create’.

  6. Enable the Safety Tip: In the policy settings, find and turn on the ‘Show first contact safety tip’ setting.

Benefits of Enabling First Contact Safety Tip:
  • Increased Awareness: Users are made aware of new contacts, which encourages vigilance against potential phishing attempts.

  • Prevent Impersonation: It helps prevent attackers from impersonating trusted contacts.

  • User Empowerment: Empowers users to make informed decisions about the legitimacy of new email contacts.

  • Easy Implementation: The feature is simple to enable and can be applied organization-wide.

By implementing the First Contact Safety Tip, organizations can add an extra layer of security to their email communication, helping to protect against phishing and other email-based threats. It’s a small step that can make an impact on your organization’s cybersecurity posture.

Remember, staying ahead of security threats is a continuous process, and features like the First Contact Safety Tip are valuable tools in your defence arsenal.

Monday, 4 December 2023

Microsoft 365: Send a copy of suspicious outbound emails

If you’re a Global Admin in Microsoft 365, you might have noticed an influx of emails sent from other users within your organization appearing in your inbox without any clear explanation. This could be due to a specific setting within the Outbound Spam Policies that’s designed to alert you of potential spam activities.

The feature in question is the option to “Send a copy of suspicious outbound emails that exceed these limits to these users and groups” found in the Microsoft Defender portal1. When this setting is enabled, it forwards emails that are deemed suspicious by the system’s criteria to the specified users or groups, which often includes the Global Admins.

This mechanism serves as a precautionary measure to identify and mitigate the risk of compromised accounts sending out spam. However, it can lead to confusion if there’s a lack of clarity on why these emails are being forwarded.

To address this, Global Admins can review and adjust the setting by accessing the Anti-spam policies section in the Microsoft Defender portal1. If you find that the feature is causing more confusion than clarity, you can simply untick the option to stop receiving copies of these suspicious outbound emails.

It’s important to note that while disabling this option may reduce the clutter in your inbox, it also means you won’t be proactively notified of potential spam activities. Therefore, it’s crucial to weigh the benefits of being alerted against the inconvenience of receiving these emails before making any changes to the policy.

Remember, maintaining the balance between security and usability is key to effective spam management in Microsoft 365.

For Global Admins looking to modify this setting, here’s a quick guide:

  1. Navigate to the Microsoft Defender portal at security.microsoft.com.
  2. Go to the Anti-spam policies section.
  3. Locate the policy called "Anti-Spam inbound policy".
  4. Uncheck the option to “Send a copy of suspicious outbound emails”.
  5. Save your changes.

By following these steps, you can customize the Outbound Spam Policies to better suit the needs of your organization.

Sunday, 25 June 2023

Setting your out of office in Microsoft 365

When you're going to be away from the office for an extended period, it's important to let people know. One way to do this is by setting up an out of office message. Here's how to do it in Microsoft 365:

Step 1: Sign in to Your Account

Go to the Microsoft 365 sign-in page and enter your email address and password.

Step 2: Access the Outlook Web App

Once you're signed in, click on the "Outlook" icon. This will take you to the Outlook Web App.

Step 3: Access the Settings Menu

In the upper-right corner of the screen, click on the gear icon. This will open the Settings menu.

Step 4: Set Your Out of Office Message

In the Settings menu, click on "View all Outlook settings" at the bottom of the list. This will open the full settings menu.

In the settings menu, click on "Mail" in the left-hand menu. Then click on "Automatic replies" in the center panel.

Here you can set up your out of office message. You can choose to only send the message during a specific time period or to all incoming messages. You can also set different messages for people inside and outside of your organization.

Step 5: Save Your Changes

After you've set up your out of office message, click "Save" at the bottom of the page.

That's it! Your out of office message is now set up in Microsoft 365.

Wednesday, 8 February 2023

PowerShell to block sign in to shared mailboxes on Microsoft 365

First you will need to connect to the following 365 services and bypass the security in powershell for the process

Set-ExecutionPolicy -Scope Process -ExecutionPolicy Bypass

Connect-ExchangeOnline
Connect-MsolService

Then run this

Get-EXOMailbox -Filter {recipienttypedetails -eq "SharedMailbox"} | get-MsolUser | Select-Object UserPrincipalName,blockcredential | Where {$_.BlockCredential -eq $False} | ForEach-Object { Set-MsolUser -UserPrincipalName $_.UserPrincipalName -BlockCredential $true}

Wednesday, 3 August 2022

PowerShell Exchange 365 Output Archive sizes and Quota

$table = New-Object System.Data.DataTable
$table.Columns.Add("Name", "System.String")
$table.Columns.add("Archive_Size", "System.String")
$table.Columns.add("Archive_Quoted", "System.String")
$table.Columns.add("AutoExpand", "System.String")

Foreach ($i in (Get-Mailbox -Archive | sort Name)) {
    $archive = $i | Get-MailboxStatistics -Archive
    $row = $table.NewRow()
    $row.Name = $i.Name
    $row.Archive_Quoted = $i.ArchiveQuota
    $row.Archive_Size = $archive.TotalItemSize
    $row.AutoExpand = $i.AutoExpandingArchiveEnabled
    $table.rows.add($row)
}

cls
$table | Format-Table

Tuesday, 15 June 2021

Exclaimer Cloud and Microsoft 365 - Internal Emails sent to distribution groups send external to come back in again

An issue with Exclaimer Cloud and Microsoft 365 where an internal email sent to an internal distribution group ends up getting sent via the MX records.

This can lead to internal emails hitting external spam filters and getting blocked.

The fix is to set ReportToOriginator to TRUE.  this can be done via the AD users and groups but if they are a number of groups PowerShell the way to go.

Get-ADGroup -Filter * | where GroupCategory -eq Distribution | Set-ADGroup -Replace @{ReportToOriginator=$true}


Tuesday, 1 June 2021

Office Deployment Tool - Rolling out Office 365 on to clients and remote hosts

ODT is good tool if you are manual installing Office 365 applications on to clients and or remote desktop hosts.

Office 365 applications are supported on remote desktop hosts with the right Microsoft 365 license (Office 365 E3, Microsoft 365 E5, Microsoft 365 Business Premium)

Users can also manual install Office from the www.office.com portal again with the right license, but a global admin could limit this if they wish to keep office on company only devices.  If this is the case then each device needs to have Office preinstalled which can be done with ODT.

The ODT tool as can be downloaded from here or from the link in the Overview below, encase they move it and the blog is outdated.

It comes with a few options but the ones we need are download and configuration, both need an XML file

The XML file can be sorted via the Office Customization Tool found here which helps build the XML file

Overview of the Office Deployment Tool - Deploy Office | Microsoft Docs

Overview of shared computer activation for Microsoft 365 Apps - Deploy Office | Microsoft Docs

Configuration options for the Office Deployment Tool - Deploy Office | Microsoft Docs

Overview of the Office Customization Tool - Deploy Office | Microsoft Docs

Tuesday, 23 March 2021

Enable Microsoft 365 Message Encryption

This is a great feature for sending secure emails and is easy to set up.  First the users need to use the feature will need one of the following:

  • Azure Information Protection for Office 365
  • Azure Information Protection Premium P1
  • Azure Information Protection Premium P2
Once you have the right subscription you can enable the option via PowerShell with the following commands.

Import-Module ExchangeOnlineManagement
Import-Module AIPService
Connect-AipService
Connect-ExchangeOnline -UserPrincipalName <Admin Account>
Set-IRMConfiguration -AzureRMSLicensingEnabled $True

#Confirm Not NULL
$RDM = Get-AadrmConfiguration
$Uri = $RDM.LicensingIntranetDistributionPointUrl

Set-IRMConfiguration -LicensingLocation $Uri
Set-IRMConfiguration -InternalLicensingEnabled $true

Once its all set up you can confirm its working with the below Powershell command

Test-IRMConfiguration -Sender <Email address>

Once this is done the option will appear in OWA and Outlook can install the Azure rights management software but this can take a few hours.  you can also make a mail flow in Exchange 365 admin to encrypt on a keyword.  

Pricing – Information Protection | Microsoft Azure

Message Encryption - Microsoft 365 Compliance | Microsoft Docs

Set up new Message Encryption capabilities - Microsoft 365 Compliance | Microsoft Docs

Configure and manage templates for Azure Information Protection - AIP | Microsoft Docs

 

Tuesday, 9 February 2021

Microsoft 365 the basic of audit logs

 At the moment the audit logs can be found at Audit log search - Security & Compliance (office.com) (09/02/2021) with a user that at a minimum needs View-Only Audit Logs role but this needs to be assigned via Exchange on-line as the underlaying commands are exchange related.

This is the old way to see them and it is moving over to Audit - Microsoft 365 compliance which will have more powerful tools rolled out to it as this is were Microsoft will be putting in the dev work.

Audit logs are a great place to start when you need to track a users activity or a file / email but if you are looking for a breach and you believe its recent then the Azure User AD | Sign in logs and activity will give you a quicker over view of what's been happening with the users which you can then use in the audit logs too get more information.

Search the audit log in the Security & Compliance Center - Microsoft 365 Compliance | Microsoft Docs

Log Retention
Log retention is a mixed bag.  by default most logs are only retained for 90 days but some are kept for 1 year such as AzureActiveDirectory, Exchange, or SharePoint for the Workload property.  You can change this with custom rentention policy which can be set in the following location Audit - Microsoft 365 compliance under the Audit section.

You will need Organization Configuration role role to carry this out.  but as a side note you can go lower then the default but if you wish to go longer then each user will need the correct Microsoft 365 license either Office 365 E5 or Microsoft 365 E5 license or have a Microsoft 365 E5 Compliance or E5 eDiscovery and Audit add-on license, these license will need to be assigned to each user where you require over 90 days of audit logs.

Manage audit log retention policies - Microsoft 365 Compliance | Microsoft Docs

Monday, 16 November 2020

A program is trying to send an e-mail message on your behalf warning in Outlook

 If you are using a Remote Desktop host and Outlook, you may come across an issue with 3rd party applications trying to send email.

Outlook will give you an warning saying that "A program is trying to send an e-mail message on your behalf"

The quick fix is to add a reg key (DWARD) setting the ObjectModelGuard to 2 as outlined in the following

https://docs.microsoft.com/en-us/outlook/troubleshoot/security/a-program-is-trying-to-send-an-email-message-on-your-behalf

The location changes based on if you have Office MSI, click to run, and 32 bit or 64 bit installed but its also in the following key

Office\<x.0>\Outlook\Security

x being the version of Outlook installed.

If this does not work you can also try the following keys in the same location

"promptsimplemapisend"=dword:00000002
"promptsimplemapinameresolve"=dword:00000002
"promptsimplemapiopenmessage"=dword:00000002
"promptoomsend"=dword:00000002
"promptoommeetingtaskrequestresponse"=dword:00000002
"promptoomaddressinformationaccess"=dword:00000002
"promptoomsaveas"=dword:00000002
"promptoomformulaaccess"=dword:00000002
"promptoomaddressbookaccess"=dword:00000002
"adminsecuritymode"=dword:00000003

But this was the older way to do it and ObjectModelGuard should be the go to at first.


Friday, 13 November 2020

Microsoft Support and Recovery Assistant

 

Microsoft Support and recovery assistant is a nice tool to help with Office applications, Microsoft 365, and Outlook issues.

Its a nice first step if you are having an issue with a device or an account.

https://support.microsoft.com/en-us/office/about-the-microsoft-support-and-recovery-assistant-e90bb691-c2a7-4697-a94f-88836856c72f

Tuesday, 20 October 2020

Microsoft 365 Office Applications on a Shared computer (EG Remote Desktop Host)

 Microsoft 365 Office application can be installed on to a Remote Desk Host and set to allow shared activation.

This requires the user to have one of the following Microsoft 365 license.

  • Office E3
  •  Microsoft 365 Business Premium

You can confirm its worked by going to the following registry key

HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Office\ClickToRun\Configuration. 

There should be a value for SharedComputerLicensing with a setting of 1

Monday, 7 September 2020

Decommission your on-premises Exchange servers after using hybrid migration

 As of writing (07/09/2020)  the short answer is:

  1. Don't, at least not fully if you are keeping AD FS or AD Sync.

But basically if you fully remove the Exchange system while still keeping AD Sync which is a requirement for AD FS too then your user admin tasks for Exchange 365 becomes more tricky as you will have no EMC on-perm but all the Exchange settings are still stored there and not be done via Microsoft 365.

Friday, 28 August 2020

Recommend Steps for Deleting Microsoft 365 User

  1. Confirm OneDrive retention is right for the company at default its 30 days
    https://docs.microsoft.com/en-us/onedrive/set-retention
  2. Decide who is getting access to the users OneDrive and emails
  3. Depending on if the account is AD synced or Cloud only do one of the following
    1. AD Sync
      1. Delete user in AD and force a delta
      2. Confirm user has been related out of Microsoft 365
      3. Restore user in 365 and reassign its license.

        It will now be a cloud only account with no sync back to On-Prem, form here can follow cloud only
    2. Cloud Only
      1. Select user in Active users and delete (Follow recommend flow)
      2. Give access to users OneDrive as needed
      3. Give Access to users Emails as needed

        If you are doing this from a recently broken synced account it may take a few minutes and a page refresh for the right options to appear in delete options.
        https://docs.microsoft.com/en-us/microsoft-365/admin/add-users/delete-a-user?view=o365-worldwide 
This is a secure and clean way to handle user deletion while keeping on-prem AD clean while also fixing an issue with hybrid exchange set ups / migrations which can result in shared mailboxes getting deleted from Microsoft 365 if they once where a private mailbox moved from on-prem exchange 

Convert a user mailbox to a shared mailbox

Side note
Quick consideration when converting to a shared mailbox,  this can be done to free up the license as long as the mailbox is under 50GB, any larger and it will still need a license.

Friday, 14 August 2020

Search for OneDrive files that have been cached on local device

  1. Install Everything Search by Voidtools
    https://www.voidtools.com/
  2. Set Everything to index attributes by going too Tools > Options > Indexes
  3. Put the folder location in to the search bar using " quotations and then put the following at the end " !attrib:d !attrib:h !attrib:o"
This is based off testing but files with the P and O attribute appear to always be available online only, while files without always appear to be available offline.

Tuesday, 11 August 2020

Reset OneDrive desktop sync app

1.  Run the Following

%localappdata%\Microsoft\OneDrive\onedrive.exe /reset

If you get an error try this

C:\Program Files (x86)\Microsoft OneDrive\onedrive.exe /reset

2. Restart OneDrive

https://support.microsoft.com/en-us/office/reset-onedrive-34701e00-bf7b-42db-b960-84905399050c

Tuesday, 4 August 2020

M365 SharePoint OneDrive considerations

When you are setting up your M365 SharePoint sites and looking at the Document Libraries,  one of the things you will need to think about is are you going to allow OneDrive to sync it.

If so there are somethings you need to plan and think about if you do.  the first being that if a single Library is over 100K files this will greatly impact performance on OneDrive (and is also not recommended) and if the Total number of Libraries synced to the client is over 300K files again it will massively impact performance.

OneDrive Sync is there for offline file access not a replacement for a servers file share if you do wish to use it like this, do so via the Web interface with Office hooked in to it will give better mileage.

For the libraries that you allow to be cached offline keep them below 100K files and use non offline libraries for most of you data.

Also  even if you just sync a folder within the Library it does not matter the whole Library is taken in to account when syncing.

https://docs.microsoft.com/en-us/office365/servicedescriptions/sharepoint-online-service-description/sharepoint-online-limits

Teams Error Code: 80070003

If you get this error code 80070003 just after the user logs in, the fix is the delete the following folder after shutting teams down 

%appdata%\Microsoft Teams
%appdata%\Microsoft\Teams

We tried reinstalling Teams and the issue persisted until we delete them folders and then it works fine.