Data from Information Repositories
Adversaries may leverage information repositories to mine valuable information. Information repositories are tools that allow for storage of information, typically to facilitate collaboration or information sharing between users, and can store a wide variety of data that may aid adversaries in further objectives, such as Credential Access, Lateral Movement, or Defense Evasion. Targets include SharePoint, Confluence, code repositories, CRM systems, databases, and messaging platforms such as Slack and Microsoft Teams. Adversaries may harvest credentials, network diagrams, system architecture documentation, PII, or source code from these repositories. Cloud-native services (AWS RDS, ElasticSearch, Redis) may also be improperly secured, enabling unauthenticated access to sensitive data stores.
// Detect bulk document access / data mining from SharePoint, OneDrive, and Microsoft Teams
let BulkAccessThreshold = 50;
let SensitiveKeywords = dynamic(["password", "credential", "secret", "vpn", "firewall", "network diagram",
"architecture", "api key", "token", "private key", "ssn", "social security",
"salary", "payroll", "customer data", "pii", "database", "connection string"]);
let TimeWindow = 1h;
// Branch 1: Bulk file access / download from SharePoint or OneDrive
let BulkAccess =
OfficeActivity
| where TimeGenerated > ago(24h)
| where Workload in ("SharePoint", "OneDrive")
| where Operation in ("FileDownloaded", "FileSyncDownloadedFull", "FileAccessed", "FilePreviewed", "FileSyncUploadedFull")
| summarize
OperationCount = count(),
UniqueFiles = dcount(OfficeObjectId),
UniqueExtensions = dcount(tostring(split(OfficeObjectId, ".")[-1])),
Operations = make_set(Operation, 10),
SourceIPs = make_set(ClientIP, 10),
SiteUrls = make_set(Site_Url, 10),
EarliestAccess = min(TimeGenerated),
LatestAccess = max(TimeGenerated)
by UserId, bin(TimeGenerated, TimeWindow)
| where OperationCount >= BulkAccessThreshold
| extend AccessDurationMinutes = datetime_diff('minute', LatestAccess, EarliestAccess)
| extend FilesPerMinute = iff(AccessDurationMinutes > 0, toreal(UniqueFiles) / toreal(AccessDurationMinutes), toreal(UniqueFiles))
| extend DetectionType = "BulkFileAccess"
| project TimeGenerated, UserId, DetectionType, OperationCount, UniqueFiles, FilesPerMinute, Operations, SourceIPs, SiteUrls;
// Branch 2: Sensitive keyword searches in SharePoint
let SensitiveSearch =
OfficeActivity
| where TimeGenerated > ago(24h)
| where Workload == "SharePoint"
| where Operation == "SearchQueryPerformed"
| where tolower(tostring(SearchQuery)) has_any (SensitiveKeywords)
| summarize
SearchCount = count(),
UniqueQueries = dcount(SearchQuery),
QuerySamples = make_set(SearchQuery, 5),
SourceIPs = make_set(ClientIP, 5)
by UserId, bin(TimeGenerated, TimeWindow)
| extend DetectionType = "SensitiveKeywordSearch"
| extend OperationCount = SearchCount
| project TimeGenerated, UserId, DetectionType, OperationCount, UniqueQueries, QuerySamples, SourceIPs;
// Branch 3: External sharing of documents from SharePoint/OneDrive
let ExternalSharing =
OfficeActivity
| where TimeGenerated > ago(24h)
| where Workload in ("SharePoint", "OneDrive")
| where Operation in ("SharingInvitationCreated", "AnonymousLinkCreated", "SecureLinkCreated", "AddedToSecureLink")
| extend IsExternalShare = ExternalAccess == true or Operation == "AnonymousLinkCreated"
| where IsExternalShare == true
| summarize
ShareCount = count(),
UniqueFiles = dcount(OfficeObjectId),
TargetAccounts = make_set(TargetUserOrGroupName, 10),
SiteUrls = make_set(Site_Url, 5)
by UserId, bin(TimeGenerated, TimeWindow)
| where ShareCount >= 5
| extend DetectionType = "BulkExternalSharing"
| extend OperationCount = ShareCount
| project TimeGenerated, UserId, DetectionType, OperationCount, UniqueFiles, TargetAccounts, SiteUrls;
// Union all branches
BulkAccess
| union SensitiveSearch
| union ExternalSharing
| sort by OperationCount desc Data Sources
Required Tables
False Positives
- Migration projects — IT teams or contractors using tools like ShareGate or AvePoint to migrate SharePoint content generate extremely high file access counts
- Backup and archival solutions — tools like Veeam, AvePoint Backup, or native SharePoint backup solutions download all files regularly
- Legitimate enterprise search indexing — search crawlers or content indexing services authorized by IT generate bulk FileAccessed events
- Legal eDiscovery — compliance officers performing court-ordered or internal investigation eDiscovery searches may access large volumes of documents and use sensitive keywords
- Data loss prevention (DLP) scanning tools — DLP platforms that scan SharePoint for sensitive content will trigger both bulk access and sensitive keyword detections
References (10)
- https://attack.mitre.org/techniques/T1213/
- https://learn.microsoft.com/en-us/microsoft-365/compliance/search-the-audit-log-in-security-and-compliance
- https://learn.microsoft.com/en-us/microsoft-365/compliance/use-sharing-auditing?view=o365-worldwide
- https://support.office.com/en-us/article/configure-audit-settings-for-a-site-collection-a9920c97-38c0-44f2-8bcb-4cf1e2ae22d2
- https://confluence.atlassian.com/confkb/how-to-enable-user-access-logging-182943.html
- https://learn.microsoft.com/en-us/graph/teams-list-all-teams
- https://www.mitiga.io/blog/how-mitiga-found-pii-in-exposed-amazon-rds-snapshots
- https://www.trendmicro.com/en_us/research/20/d/exposed-redis-instances-abused-for-remote-code-execution-cryptocurrency-mining.html
- https://github.com/redcanaryco/atomic-red-team/blob/master/atomics/T1213/T1213.md
- https://learn.microsoft.com/en-us/defender-cloud-apps/what-is-defender-for-cloud-apps
Unlock Pro Content
Get the full detection package for T1213 including response playbook, investigation guide, and atomic red team tests.