MITRE ATT&CK coverage
| Tactic | Techniques |
|---|---|
| Collection | T1039 Data from Network Shared Drive |
Rule body yaml
AnalysisType: rule
Description: Document shared externally
DisplayName: "Microsoft365 External Document Sharing"
Enabled: true
Filename: microsoft365_external_sharing.py
Reports:
MITRE ATT&CK:
- TA0009:T1039 # Collection - Data from Network Shared Drive
Runbook: Check the document metadata to ensure it is not a sensitive document.
Reference: https://support.microsoft.com/en-us/topic/manage-sharing-with-external-users-in-microsoft-365-small-business-2951a85f-c970-4375-aa4f-6b0d7035fe35#:~:text=Top%20of%20Page-,Turn%20external%20sharing%20on%20or%20off,-The%20ability%20to
Severity: Low
Tests:
- ExpectedResult: false
Log:
AppAccessContext:
AADSessionId: aa-bb-cc
CorrelationId: dd-ee-ff
ClientIP: 1.2.3.4
CreationTime: "2022-12-12 19:31:41"
EventData: <Type>Edit</Type><MembersCanShareApplied>False</MembersCanShareApplied>
EventSource: SharePoint
Id: 111-aa-234
ItemType: File
ObjectId: https://yourorg.sharepoint.com/personal/user_yourorg/Documents/importantsecrets.docx
Operation: AddedToSecureLink
OrganizationId: 11-22-abc
RecordType: 14
Site: aa-bb-dd-ee-ff
SiteUrl: https://yourorg.sharepoint.com/personal/user_yourorg
SourceFileExtension: docx
SourceFileName: importantsecrets.docx
SourceRelativeUrl: Documents/importantsecrets.docx
TargetUserOrGroupName: OUTSIDER@ALLOWEDDOMAIN.COM
TargetUserOrGroupType: Guest
UserAgent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/108.0.0.0 Safari/537.36
UserId: my.user@yourorg.onmicrosoft.com
UserKey: i:0h.f|membership|12345@live.com
UserType: 0
Workload: OneDrive
Name: Allowed Domain
- ExpectedResult: false
Log:
AppAccessContext:
AADSessionId: aa-bb-cc
CorrelationId: dd-ee-ff
ClientIP: 1.2.3.4
CreationTime: "2022-12-12 19:31:41"
EventData: <Type>Edit</Type><MembersCanShareApplied>False</MembersCanShareApplied>
EventSource: SharePoint
Id: 111-aa-234
ItemType: File
ObjectId: https://yourorg.sharepoint.com/personal/user_yourorg/Documents/External/public.docx
Operation: AddedToSecureLink
OrganizationId: 11-22-abc
RecordType: 14
Site: aa-bb-dd-ee-ff
SiteUrl: https://yourorg.sharepoint.com/personal/user_yourorg
SourceFileExtension: docx
SourceFileName: public.docx
SourceRelativeUrl: Documents/External/public.docx
TargetUserOrGroupName: MARKETING@SAAS.COM
TargetUserOrGroupType: Guest
UserAgent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/108.0.0.0 Safari/537.36
UserId: my.user@yourorg.onmicrosoft.com
UserKey: i:0h.f|membership|12345@live.com
UserType: 0
Workload: OneDrive
Name: Allowed Folder
- ExpectedResult: false
Log:
AppAccessContext:
AADSessionId: aa-bb-cc
CorrelationId: dd-ee-ff
ClientIP: 1.2.3.4
CreationTime: "2022-12-12 19:31:41"
EventData: <Type>Edit</Type><MembersCanShareApplied>False</MembersCanShareApplied>
EventSource: SharePoint
Id: 111-aa-234
ItemType: File
ObjectId: https://yourorg.sharepoint.com/personal/user_yourorg/Documents/importantsecrets.docx
Operation: AddedToSecureLink
OrganizationId: 11-22-abc
RecordType: 14
Site: aa-bb-dd-ee-ff
SiteUrl: https://yourorg.sharepoint.com/personal/user_yourorg
SourceFileExtension: docx
SourceFileName: importantsecrets.docx
SourceRelativeUrl: Documents/importantsecrets.docx
TargetUserOrGroupName: EXCEPTION@OUTSIDER.COM
TargetUserOrGroupType: Guest
UserAgent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/108.0.0.0 Safari/537.36
UserId: my.user@yourorg.onmicrosoft.com
UserKey: i:0h.f|membership|12345@live.com
UserType: 0
Workload: OneDrive
Name: Allowed User
- ExpectedResult: true
Log:
AppAccessContext:
AADSessionId: aa-bb-cc
CorrelationId: dd-ee-ff
ClientIP: 1.2.3.4
CreationTime: "2022-12-12 19:31:41"
EventData: <Type>Edit</Type><MembersCanShareApplied>False</MembersCanShareApplied>
EventSource: SharePoint
Id: 111-aa-234
ItemType: File
ObjectId: https://yourorg.sharepoint.com/personal/user_yourorg/Documents/importantsecrets.docx
Operation: AddedToSecureLink
OrganizationId: 11-22-abc
RecordType: 14
Site: aa-bb-dd-ee-ff
SiteUrl: https://yourorg.sharepoint.com/personal/user_yourorg
SourceFileExtension: docx
SourceFileName: importantsecrets.docx
SourceRelativeUrl: Documents/importantsecrets.docx
TargetUserOrGroupName: OUTSIDER@EXTERNAL.IO
TargetUserOrGroupType: Guest
UserAgent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/108.0.0.0 Safari/537.36
UserId: my.user@yourorg.onmicrosoft.com
UserKey: i:0h.f|membership|12345@live.com
UserType: 0
Workload: OneDrive
Name: External user
- ExpectedResult: false
Log:
AppAccessContext:
AADSessionId: aa-bb-cc
CorrelationId: dd-ee-ff
ClientIP: 1.2.3.4
CreationTime: "2022-12-12 19:31:41"
EventData: <Type>Edit</Type><MembersCanShareApplied>False</MembersCanShareApplied>
EventSource: SharePoint
Id: 111-aa-234
ItemType: File
ObjectId: https://yourorg.sharepoint.com/personal/user_yourorg/Documents/importantsecrets.docx
Operation: AddedToSecureLink
OrganizationId: 11-22-abc
RecordType: 14
Site: aa-bb-dd-ee-ff
SiteUrl: https://yourorg.sharepoint.com/personal/user_yourorg
SourceFileExtension: docx
SourceFileName: importantsecrets.docx
SourceRelativeUrl: Documents/importantsecrets.docx
TargetUserOrGroupName: ANOTHERUSER@MYCOMPANY.COM
TargetUserOrGroupType: NotGuest
UserAgent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/108.0.0.0 Safari/537.36
UserId: my.user@yourorg.onmicrosoft.com
UserKey: i:0h.f|membership|12345@live.com
UserType: 0
Workload: OneDrive
Name: Internal Share
DedupPeriodMinutes: 60
LogTypes:
- Microsoft365.Audit.SharePoint
RuleID: "Microsoft365.External.Document.Sharing"
Threshold: 1
Detection logic
Condition
(Operation eq "AnonymousLinkCreated" and not (SourceRelativeUrl wildcard "*/External/*" or SourceRelativeUrl wildcard "External/*")) or (Operation eq "AddedToSecureLink" and not (SourceRelativeUrl wildcard "*/External/*" or SourceRelativeUrl wildcard "External/*") and TargetUserOrGroupName not in "exception@outsider.com")
This rule also runs imperative logic the parser cannot express as a filter; the conditions above are the structured part it could extract.
Indicators
Each row is a field, operator, and value that the rule matches. The corpus column counts how many other rules in the catalog look for the same combination: high numbers point to widely-used, community-vetted indicators. Blank or 1 shows that the indicator is specific to this rule.
| Field | Kind | Values |
|---|---|---|
Operation | eq |
|
Output fields
Fields the rule emits when it matches. Chronicle authors list these in the outcome block; they appear on the detection and $risk_score drives alerting. Sentinel / Defender XDR rules build them up through project / summarize / extend stages. Sentinel maps these into alert fields via entityMappings and customDetails; Defender XDR custom detections surface them as alert fields directly.
| Field | Source |
|---|---|
operation | Operation |
organization_id | OrganizationId |
client_ip | ClientIp |
extended_properties | ExtendedProperties |
modified_properties | ModifiedProperties |
application | Application |
actor | Actor |
SourceRelativeUrl | |
UserId |