Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

MDE custom plugins #127

Open
wants to merge 12 commits into
base: main
Choose a base branch
from
Original file line number Diff line number Diff line change
@@ -0,0 +1,90 @@
Descriptor:
Name: MDEPlugandPlay
DisplayName: MDE Plug and Play
Description: Skills to query MDE device tables to get insights about plug and play (PnP) events

SkillGroups:
- Format: KQL
Skills:
- Name: GetPnPEventsFromDevice
DisplayName: Get PnP Events From Device
Description: Summarises the PnP connection events from a specific device over a set timeframe
ExamplePrompt:
- 'PnP'
- 'Plug and Play'
Inputs:
- Name: hourorday
Description: hours (h) or days (d)
Required: false
DefaultValue: d
- Name: unit
Description: number of hours or days
Required: false
DefaultValue: 7
- Name: devicename
Description: device name or id
Required: true
Settings:
Target: Defender
Template: |-
let Device = "{{devicename}}";
DeviceEvents
| where Timestamp >= ago({{unit}}{{hourorday}})
| where DeviceName =~ Device or DeviceId =~ Device
| where ActionType == "PnpDeviceConnected"
| extend ClassName=parse_json(AdditionalFields).ClassName, ClassId=parse_json(AdditionalFields).ClassId, PnPDeviceId=parse_json(AdditionalFields).DeviceId, DeviceDescription=parse_json(AdditionalFields).DeviceDescription, VendorIds=parse_json(AdditionalFields).VendorIds
| project Timestamp, DeviceName, InitiatingProcessAccountDomain, InitiatingProcessAccountName, ClassName, ClassId, PnPDeviceId, DeviceDescription, VendorIds
- Format: KQL
Skills:
- Name: GetPnPTop25Devices
DisplayName: Get PnP Top 25 Devices
Description: Fetches a count of the top 25 PnP devices across the estate
ExamplePrompt:
- 'PnP'
- 'Plug and Play'
Inputs:
- Name: hourorday
Description: hours (h) or days (d)
Required: false
DefaultValue: d
- Name: unit
Description: number of hours or days
Required: false
DefaultValue: 1
Settings:
Target: Defender
Template: |-
DeviceEvents
| where Timestamp >= ago({{unit}}{{hourorday}})
| where ActionType == "PnpDeviceConnected"
| extend ClassName=parse_json(AdditionalFields).ClassName, ClassId=parse_json(AdditionalFields).ClassId, PnPDeviceId=parse_json(AdditionalFields).DeviceId, DeviceDescription=parse_json(AdditionalFields).DeviceDescription, VendorIds=parse_json(AdditionalFields).VendorIds
| project ClassName, ClassId, PnPDeviceId, DeviceDescription, VendorIds
| summarize count() by tostring(ClassName), tostring(ClassId), tostring(PnPDeviceId), tostring(DeviceDescription), tostring(VendorIds)
| top 25 by count_
- Format: KQL
Skills:
- Name: GetPnPLeastCommonDevices
DisplayName: Get PnP Least Common Devices
Description: Fetches a count of the 25 least common PnP devices which could be anomalous
ExamplePrompt:
- 'PnP'
- 'Plug and Play'
Inputs:
- Name: hourorday
Description: hours (h) or days (d)
Required: false
DefaultValue: d
- Name: unit
Description: number of hours or days
Required: false
DefaultValue: 1
Settings:
Target: Defender
Template: |-
DeviceEvents
| where Timestamp >= ago({{unit}}{{hourorday}})
| where ActionType == "PnpDeviceConnected"
| extend ClassName=parse_json(AdditionalFields).ClassName, ClassId=parse_json(AdditionalFields).ClassId, PnPDeviceId=parse_json(AdditionalFields).DeviceId, DeviceDescription=parse_json(AdditionalFields).DeviceDescription, VendorIds=parse_json(AdditionalFields).VendorIds
| project ClassName, ClassId, PnPDeviceId, DeviceDescription, VendorIds
| summarize count() by tostring(ClassName), tostring(ClassId), tostring(PnPDeviceId), tostring(DeviceDescription), tostring(VendorIds)
| top 25 by count_ asc
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
# Copilot for Security Plugin: MDE Plug and Play (PnP)

### **This KQL plugin enables SOC analysts to get insights about external devices that have been connected to a device, based on the Defender for Endpoint DeviceEvents table.**

### Pre-requisites

- [Copilot for Security enabled](https://learn.microsoft.com/en-us/security-copilot/get-started-security-copilot#onboarding-to-microsoft-security-copilot)
- [Access to upload custom plugins](https://learn.microsoft.com/en-us/security-copilot/manage-plugins?tabs=securitycopilotplugin#managing-custom-plugins)

### Instructions

#### Upload the Custom Plugin

1. Obtain the file MDE_Plug_and_Plug.yaml from this directory.
2. Upload the custom plugin

#### Skills

- **GetPnPTop25Devices**: Fetches a count of the top 25 PnP devices across the estate
- **GetPnPLeastCommonDevices**: Featches a count of the 25 least common PnP devices which could be anomalous
- **GetPnPEventsFromDevice**: Summarises the PnP connection events from a specific device over a set timeframe

#### Example Usage

1. A SOC analyst is investigating a data exfiltration alert and requires further details on the methods used.
2. The GGetPnPEventsFromDevice skill is used to get a summary of the PnP devices connected to a laptop over the past 24 hours.
Original file line number Diff line number Diff line change
@@ -0,0 +1,159 @@
Descriptor:
Name: MDESmartScreen
DisplayName: MDE SmartScreen
Description: Skills to query MDE device tables to get insights about SmartScreen events

SkillGroups:
- Format: KQL
Skills:
- Name: GetSmartScreenEvents
DisplayName: Get SmartScreen Events
Description: Summarises SmartScreen events over a specified timeframe
ExamplePrompt:
- 'SmartScreen'
- 'Blocked Phishing URLs'
- 'Blocked Malware URLs'
- 'Untrusted URLs'
Inputs:
- Name: hourorday
Description: hours (h) or days (d)
Required: false
DefaultValue: d
- Name: unit
Description: number of hours or days
Required: false
DefaultValue: 7
Settings:
Target: Defender
Template: |-
DeviceEvents
| where Timestamp >= ago({{unit}}{{hourorday}})
| where ActionType contains "Smartscreen"
| project DeviceName, ActionType, RemoteUrl, InitiatingProcessFileName, InitiatingProcessCommandLine, InitiatingProcessAccountUpn, InitiatingProcessParentFileName, AdditionalFields
- Format: KQL
Skills:
- Name: GetSmartScreenWarningEvents
DisplayName: Get SmartScreen Warning Events
Description: Summarises SmartScreen warning events over a specified timeframe
ExamplePrompt:
- 'SmartScreen'
- 'SmartScreen Warning'
Inputs:
- Name: hourorday
Description: hours (h) or days (d)
Required: false
DefaultValue: d
- Name: unit
Description: number of hours or days
Required: false
DefaultValue: 7
Settings:
Target: Defender
Template: |-
DeviceEvents
| where Timestamp >= ago({{unit}}{{hourorday}})
| where ActionType == @"SmartScreenUrlWarning"
| project DeviceName, ActionType, RemoteUrl, InitiatingProcessFileName, InitiatingProcessCommandLine, InitiatingProcessAccountUpn, InitiatingProcessParentFileName, AdditionalFields
- Format: KQL
Skills:
- Name: GetSmartScreenBypassEvents
DisplayName: Get SmartScreen Bypass Events
Description: Summarises SmartScreen bypass events over a specified timeframe
ExamplePrompt:
- 'SmartScreen'
- 'SmartScreen User Override'
- 'SmartScreen Bypass'
Inputs:
- Name: hourorday
Description: hours (h) or days (d)
Required: false
DefaultValue: d
- Name: unit
Description: number of hours or days
Required: false
DefaultValue: 7
Settings:
Target: Defender
Template: |-
DeviceEvents
| where Timestamp >= ago({{unit}}{{hourorday}})
| where ActionType == @"SmartScreenUserOverride"
| project DeviceName, ActionType, RemoteUrl, InitiatingProcessFileName, InitiatingProcessCommandLine, InitiatingProcessAccountUpn, InitiatingProcessParentFileName, AdditionalFields
- Format: KQL
Skills:
- Name: GetSmartScreenEventsURL
DisplayName: Get SmartScreen Events URL
Description: Fetches a count of SmartScreen events grouped by URL
ExamplePrompt:
- 'SmartScreen'
- 'SmartScreen URLs'
Inputs:
- Name: hourorday
Description: hours (h) or days (d)
Required: false
DefaultValue: d
- Name: unit
Description: number of hours or days
Required: false
DefaultValue: 7
Settings:
Target: Defender
Template: |-
DeviceEvents
| where Timestamp >= ago({{unit}}{{hourorday}})
| where ActionType contains "SmartScreen"
| project ActionType, RemoteUrl
| summarize count() by ActionType, RemoteUrl
- Format: KQL
Skills:
- Name: GetSmartScreenWarningEventsURL
DisplayName: Get SmartScreen Warning Events URL
Description: Fetches a count of SmartScreen warning events grouped by URL
ExamplePrompt:
- 'SmartScreen'
- 'SmartScreen URLs'
- 'SmartScreen Warning'
Inputs:
- Name: hourorday
Description: hours (h) or days (d)
Required: false
DefaultValue: d
- Name: unit
Description: number of hours or days
Required: false
DefaultValue: 7
Settings:
Target: Defender
Template: |-
DeviceEvents
| where Timestamp >= ago({{unit}}{{hourorday}})
| where ActionType == @"SmartScreenUrlWarning"
| project ActionType, RemoteUrl
| summarize count() by ActionType, RemoteUrl
- Format: KQL
Skills:
- Name: GetSmartScreenBypassEventsURL
DisplayName: Get SmartScreen Bypass Events URL
Description: Fetches a count of SmartScreen bypass events grouped by URL
ExamplePrompt:
- 'SmartScreen'
- 'SmartScreen URLs'
- 'SmartScreen User Override'
- 'SmartScreen Bypass'
Inputs:
- Name: hourorday
Description: hours (h) or days (d)
Required: false
DefaultValue: d
- Name: unit
Description: number of hours or days
Required: false
DefaultValue: 7
Settings:
Target: Defender
Template: |-
DeviceEvents
| where Timestamp >= ago({{unit}}{{hourorday}})
| where ActionType == @"SmartScreenUserOverride"
| project ActionType, RemoteUrl
| summarize count() by ActionType, RemoteUrl
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
# Copilot for Security Plugin: MDE SmartScreen

### **This KQL plugin enables SOC analysts and engineers to get insights about SmartScreen warning pages and bypasses, using the Defender for Endpoint DeviceEvents table.**

### Pre-requisites

- [Copilot for Security enabled](https://learn.microsoft.com/en-us/security-copilot/get-started-security-copilot#onboarding-to-microsoft-security-copilot)
- [Access to upload custom plugins](https://learn.microsoft.com/en-us/security-copilot/manage-plugins?tabs=securitycopilotplugin#managing-custom-plugins)
- [Microsoft Defender SmartScreen settings configured](https://learn.microsoft.com/en-us/windows/security/operating-system-security/virus-and-threat-protection/microsoft-defender-smartscreen/available-settings)

### Instructions

#### Upload the Custom Plugin

1. Obtain the file MDE_SmartScreen.yaml from this directory.
2. Upload the custom plugin

#### Skills

- **GetSmartScreenEvents**: Summarises SmartScreen events over a specified timeframe
- **GetSmartScreenWarningEvents**: Summarises SmartScreen warning events over a specified timeframe
- **GetSmartScreenBypassEvents**: Summarises SmartScreen bypass events over a specified timeframe
- **GetSmartScreenEventsURL**: Fetches a count of SmartScreen events grouped by URL
- **GetSmartScreenWarningEventsURL**: Fetches a count of SmartScreen warning events grouped by URL
- **GetSmartScreenBypassEventsURL**: Fetches a count of SmartScreen bypass events grouped by URL

#### Example Usage

1. A desktop engineer is drafting a report for senior leadership about the organisation’s protection against phishing or malware websites and applications.
2. The GetSmartScreenEvents skill is used to get a summary of the SmartScreen events from the past 30 days.
3. The GetSmartScreenBypassEvents skill is used to identify users who are ignored the warning message and may require futher security education and awareness traning.
4. The Generic plugin is used to summarise the previous prompts and provide recommendations about changes to the current configuration.