Selected work · Detection engineering

Patient files, downloaded in bulk. Contained within the hour.

A Microsoft Sentinel detection and automated response for patient data leaving SharePoint and OneDrive, built and tested end to end in our lab tenant.

Lab case study

A stolen session looks like a normal user.

Attackers who phish a password or steal a session token sign in as a real member of staff. From there, pulling patient records out of SharePoint or OneDrive looks like ordinary clinical work until the volume and the network give it away.

We wrote a scheduled analytics rule that alerts when one account downloads 50 or more distinct files from patient-data locations, from network addresses that account has never signed in from. A playbook then revokes the account's sign-in sessions and records what it did on the incident.

Tested in our own Microsoft 365 lab tenant with a test account and synthetic patient files, 20 to 24 November 2026. Not a client engagement. Designed, deployed and tested by Rabiatu Mohammed, founder.

24 November, with no manual steps

  1. The test account downloads 60 synthetic patient files through a VPN.

  2. The SharePoint audit records reach the Sentinel workspace.

  3. The hourly rule raises a High alert and Sentinel opens an incident.

  4. The playbook revokes the account's sessions. Microsoft Graph confirms it, and Entra ID logs the change independently.

Download to containment: 55 minutes. The playbook itself ran in 2.07 seconds; the rest was audit delay and the hourly schedule. A repeat test that evening took about 27 minutes. Times are West Africa Time.

Unfamiliar is measured per person.

Each account is compared with its own 14 days of successful sign-ins, interactive and non-interactive. The baseline stops one day short of now, so an attacker's own recent sign-in can never make their address look familiar.

Files, not events.

Sync clients download the same files again and again. The rule counts distinct files, and only those taken from unfamiliar addresses, so a busy laptop does not look like data theft.

Late records still count.

In testing, one SharePoint audit record arrived 674 minutes after the download. The rule selects records by when they reached the workspace, not when the event happened, so a late record is still checked rather than falling outside the window.

Containment that keeps clinics running.

On a High alert the playbook revokes sign-in sessions, which ends a stolen token's access. It does not disable the account. Locking a clinician out mid-shift is its own patient-safety risk, so that decision stays with a person.

Tested before it was trusted.

A synthetic harness of nine users runs the rule unchanged in any Log Analytics workspace. The first version of the rule, once patched so it would run at all, caught none of the four attacker scenarios and alerted on sync noise. The current version catches all four, raises Medium for a new address in a familiar country, and stays quiet on the four harmless cases.

Will this rule fire?

Pick one of the nine synthetic users from the test harness, or set up a download of your own. The answer follows the rule's logic: distinct files from patient-data locations, counted only from addresses the account has never signed in from.

Where the files are
Where the download came from

Your own scenario

High alert

  • 60 distinct patient files came from an unfamiliar address, which meets the threshold of 50.
  • High, because the download came from a country never seen for this user.

A simplified model of the rule for illustration. It runs in your browser and queries no data. The results for the nine harness users match the rule's output in the test harness published on GitHub.

Stated plainly

What the lab proved, and what it did not.

Proved

The full chain worked twice on live lab data: detection, incident, playbook, session revocation and an independent Entra ID audit record. The second run exercised the watchlist path and the automation for a repeat alert on an open incident. The rule is mapped to NIST CSF 2.0 (DE.CM-03, DE.AE-02, DE.AE-03) and to the HIPAA Security Rule requirements for audit controls and activity review.

Not yet tested

This is one small lab tenant with test accounts and synthetic files, not a production environment. The comment the playbook posts when a revoke fails has not been tested with a real failure, and escalation from Medium to High has not been tested. In a client tenant, the rule should first run for 14 days with incident creation turned off, so the threshold reflects real clinical download patterns.

Discuss detection testing

The work is published.

The rule, its Sentinel export, the playbook template, the synthetic test harness and 28 redacted screenshots from the lab runs are in a public repository, alongside the full technical write-up. Review prerequisites and test them in your own environment before use.