Anomaly detection — technical reference
Corelog runs 11 heuristics against the loaded audit log. Each heuristic is mapped to a MITRE ATT&CK technique. Below are their exact detection criteria.
Impossible Travel
HighFires when two consecutive SIGN-IN events for the same user originate from countries whose geographic centroids are more than 1,000 km apart and are separated by less than 1 hour. The distance is calculated using the Haversine formula against ISO-3166-1 alpha-2 country codes. A single flag is raised on both the earlier and later event. Only interactive authentication counts as evidence of where a person was — UserLoggedIn, UserLoginFailed, SignInEvent, PasswordLogonInitialAuthUsingPassword, TeamsSessionStarted and EmailAuthOTPAuthenticationSucceeded. File and mail operations are excluded because their IP is routinely Microsoft infrastructure acting on the user behalf (background sync, indexing, mobile push), which would otherwise make every mailbox appear to teleport between datacenters. The country is resolved from the client IP against an offline database; Purview GeoLocation field is only used when it genuinely contains a country code, since for SharePoint it carries the multi-geo datacenter region instead. Indicates a credential being used from two physically incompatible locations — typically stolen credentials or a VPN/proxy masking the true origin.
Off-Hours Access
MediumFires on every event whose UTC creation timestamp falls in the window 22:00–06:00. No user baseline is required; the rule is applied uniformly. The window is fixed in UTC to avoid timezone-dependent false negatives in global tenants. Unusually high off-hours activity — especially involving data access or deletion operations — is a common indicator of an attacker operating from a different timezone or an insider threat acting outside monitored hours.
Bulk Operations
High / CriticalFires when the same user performs the same operation ≥20 times within a 60-second sliding window. A sliding-window algorithm (two-pointer) is used to avoid O(n²) complexity. If the operation belongs to the Deletion category the flag maps to T1485 (Data Destruction, Critical); otherwise it maps to T1567 (Exfiltration Over Web Service, High). Typical triggers: mass file downloads, bulk deletion of mailbox items, or automated scripts creating many sharing links.
Unmanaged Device
MediumFires when an event with isManagedDevice === false involves a sensitive operation. Sensitive operations are: FileDownloaded, FileSyncDownloadedFull, FileSyncUploadedFull, FileRecycled, FileDeleted, AnonymousLinkCreated, SharingInvitationCreated, CompanyLinkCreated, SharingSet — or any event in the Deletion, Sharing, or Modification category. Unmanaged devices bypass Conditional Access policies and MDM controls, making them a common pivot point for both external attackers and malicious insiders.
New Geography
MediumFires on the first SIGN-IN where a user is seen from a country not previously observed for that user in the dataset. Events are processed in chronological order; the first event from each country establishes the baseline, so only subsequent first-appearances raise a flag. It uses the same evidence rule as Impossible Travel — only interactive authentication events count, because background service access originating in a Microsoft datacenter is not the user appearing in a new country. The country is resolved from the client IP against an offline database. A single new-geography event is low signal on its own; combined with off-hours or bulk-operations flags it is a strong indicator of account compromise.
First-Time Application
LowFires the first time a user generates events attributed to an application (appDisplayName or clientAppName) not previously seen for that user in the dataset. Events are processed chronologically. The flag is not raised for the very first application a user uses — only for subsequent new ones. Attacker tooling (e.g. AADInternals, ROADtools) often authenticates as uncommon or undocumented application IDs, making this a useful low-noise signal when combined with other anomalies.
New Device
MediumFires the first time a user generates events from a device identifier (machineId or deviceName) not previously observed for that user in the dataset. Events are processed chronologically. The device is only considered 'new' if the user has at least one prior event on a different known device. A new device appearing alongside off-hours or impossible-travel flags strongly suggests account compromise or an attacker operating with cloned credentials on a fresh machine.
External Sharing Burst
HighFires when a user creates or modifies ≥5 sharing links or invitations within a 10-minute sliding window. Tracked operations: AnonymousLinkCreated, SharingSet, CompanyLinkCreated, SharingInvitationCreated, AddedToSecureLink. A two-pointer sliding window groups events per user. This pattern is characteristic of pre-exfiltration staging, where an attacker bulk-creates anonymous or guest sharing links to move data out of the tenant without triggering DLP policies designed for direct downloads.
Mailbox Forwarding Rule
CriticalFires when a New-InboxRule or Set-InboxRule operation is found and the raw AuditData JSON contains any of the following keywords (case-insensitive): forwardto, forwardasattachmentto, redirectto, forwardsmssto. This heuristic detects the creation or modification of inbox rules that silently copy or redirect incoming mail to an external address — a textbook Business Email Compromise (BEC) persistence technique that survives password resets.
Audit Log Tamper
CriticalFires when Set-AdminAuditLogConfig, Set-MailboxAuditBypassAssociation, or Set-OrganizationConfig is executed and the raw AuditData JSON contains disable-intent keywords such as UnifiedAuditLogIngestionEnabled, AdminAuditLogEnabledOption, AuditBypass, or JSON fields with enabled: false / adminAuditEnabled: false / mailboxAuditEnabled: false. Disabling audit logging is a defence-evasion technique used by sophisticated attackers to suppress evidence of subsequent actions.
Authentication Anomaly Cluster
HighFires when ≥10 distinct source IP addresses generate authentication events (UserLoggedIn, UserLoginFailed, PasswordLogonInitial) within a 5-minute global sliding window across all users. The window is not user-scoped: it looks at the full tenant. A high count of distinct IPs performing authentication in a short window is the canonical signature of a password-spray attack, where the adversary rotates source IPs to evade per-IP rate limiting.
Behavior Shifts
Behavior Shifts is a separate, complementary detection layer that runs alongside the rule-based heuristics. Instead of looking for specific known-bad actions, it uses statistical change-point detection to ask: did this user's overall activity pattern change significantly at some point in the dataset? A shift does not automatically indicate malicious activity, but it narrows the investigation window — you know exactly when the pattern changed and can review events around that bucket.
The engine uses Binary Segmentation with an F-statistic significance test (p < 0.05). For each user, it aggregates events into time buckets, then recursively splits the series at the point that maximises the reduction in sum-of-squared residuals. Each candidate split is validated with an F-test (H0: single mean across the whole segment; H1: two distinct means). Splits that do not meet the significance threshold are discarded. Recursion continues on both halves until no more significant splits are found or the segment is too short (minimum 3 buckets per side). Each detected change point is then reclassified into one of three types and assigned a confidence level (low / medium / high) derived from the F-test p-value.
Level Shift
F-test: F = MSR / MSE where MSR = SSR_full − SSR_split (df=1), MSE = SSR_split / (n−2). Magnitude = ((μ_after − μ_before) / μ_before) × 100. Confidence from p-value threshold: high p<0.001, medium p<0.01, low p<0.05.
The mean activity count changed sustainably between two consecutive segments — e.g. a user who averaged 5 events/bucket suddenly sustains 40 events/bucket. Magnitude is expressed as the signed percentage change between the two means: ((afterMean − beforeMean) / beforeMean) × 100. A negative magnitude means the user went quiet; positive means a spike. This is the most common shift type and covers both exfiltration ramp-ups and sudden account dormancy after a password reset.
Trend Change
Welch's t-test on slopes: t = |b_before − b_after| / √(SE_before² + SE_after²) where b = least-squares slope and SE = slope standard error. Reclassified from level_shift when slopeDiff > levelDiff and p < 0.05.
Rather than a step change in the mean, the slope of the series changed direction or acceleration. After Binary Segmentation identifies a candidate split, a Welch's t-test compares the linear regression slopes on either side. If the slope difference dominates the level difference and is statistically significant, the point is reclassified from level_shift to trend_change. Typical examples: a steady linear ramp-up in data access that suddenly reverses (V-shape), or an accelerating download rate that abruptly plateaus.
Volatility Shift
F = Var(after) / Var(before) — two-tailed F-test for equality of variances (Levene-style). Confidence from p-value threshold: high p<0.001, medium p<0.01, low p<0.05.
The mean activity is similar on both sides of the split but the variance changed significantly — the user became either erratic (bursty) or unusually consistent. Detected with an F-test for equality of variances (Levene-style) across adjacent segments identified by Binary Segmentation. To avoid false positives on noisy low-activity series, volatility shifts are only reported when the level difference is less than 30% of the segment mean. Magnitude is expressed as the variance ratio: afterVariance / beforeVariance.
Spike
z = (x_i − μ) / σ — where μ and σ are the mean and standard deviation of the full user series. Threshold: z ≥ 2.5. Confidence: high z≥4, medium z≥3, low z≥2.5. p-value approximated via Abramowitz & Stegun normal survival function.
Flags isolated buckets where activity is unusually high relative to the user's baseline, without requiring a sustained change. The z-score measures how many standard deviations above the user's overall mean the bucket falls. To avoid double-flagging, spikes are suppressed if a level_shift or other change point already exists within ±1 bucket. Magnitude is the z-score itself. This type is complementary to level_shift: it catches one-off events (mass download, sudden exfiltration attempt) that do not alter the long-term mean.