← Back to SOC feed Coverage →

Suspicious sign-in attempts from QR code phishing campaigns

kql MEDIUM Azure-Sentinel
T1566
CloudAppEvents
huntingmicrosoftofficialphishing
This rule was pulled from an open-source repository and enriched with AI. Validate in a test environment before deploying to production.
View original rule at Azure-Sentinel →
Retrieved: 2026-05-17T11:00:00Z · Confidence: medium

Hunt Hypothesis

Adversaries may be using QR code phishing campaigns to trick users into accessing malicious content, leading to compromised credentials and risky sign-in attempts from untrusted devices. SOC teams should proactively hunt for this behavior in Azure Sentinel to identify and mitigate potential credential theft and lateral movement in phishing-based attacks.

KQL Query

let successfulRiskySignIn = materialize(AADSignInEventsBeta
| where Timestamp > ago(1d)
| where isempty(DeviceTrustType)
| where IsManaged != 1
| where IsCompliant != 1
| where RiskLevelDuringSignIn in (50, 100)
| project Timestamp, ReportId, IPAddress, AccountUpn, AccountObjectId, SessionId, Country, State, City
);
let suspiciousSignInUsers = successfulRiskySignIn
| distinct AccountObjectId;
let suspiciousSignInIPs = successfulRiskySignIn
| distinct IPAddress;
let suspiciousSignInCities = successfulRiskySignIn
| distinct City;
CloudAppEvents
| where Timestamp > ago(1d)
| where ActionType == "MailItemsAccessed"
| where AccountObjectId in (suspiciousSignInUsers)
| where IPAddress !in (suspiciousSignInIPs)
| where City !in (suspiciousSignInCities)
| join kind=inner successfulRiskySignIn on AccountObjectId
| where AccountObjectId in (suspiciousSignInUsers)
| where (Timestamp - Timestamp1) between (-5min .. 5min)
| extend folders = RawEventData.Folders
| mv-expand folders
| extend items = folders.FolderItems
| mv-expand items
| extend InternetMessageId = tostring(items.InternetMessageId)
| project Timestamp, ReportId, IPAddress, InternetMessageId, AccountObjectId, SessionId, Country, State, City

Analytic Rule Definition

id: 3131d0ba-32c9-483e-a25c-82e26a07e116
name: Suspicious sign-in attempts from QR code phishing campaigns
description: |
  This detection approach correlates a user accessing an email with image/document attachments and a risky sign-in attempt from non-trusted devices.
description-detailed: |
  This detection approach correlates a user accessing an email with image/document attachments and a risky sign-in attempt from non-trusted devices in closer proximity and validates if the location from where the email item was accessed is different from the location of sign-in attempt.
  Reference - https://techcommunity.microsoft.com/t5/microsoft-defender-for-office/hunting-and-responding-to-qr-code-based-phishing-attacks-with/ba-p/4074730 
requiredDataConnectors:
- connectorId: MicrosoftThreatProtection
  dataTypes:
  - CloudAppEvents
  - AADSignInEventsBeta
tactics:
  - InitialAccess
relevantTechniques:
  - T1566
query: |
  let successfulRiskySignIn = materialize(AADSignInEventsBeta
  | where Timestamp > ago(1d)
  | where isempty(DeviceTrustType)
  | where IsManaged != 1
  | where IsCompliant != 1
  | where RiskLevelDuringSignIn in (50, 100)
  | project Timestamp, ReportId, IPAddress, AccountUpn, AccountObjectId, SessionId, Country, State, City
  );
  let suspiciousSignInUsers = successfulRiskySignIn
  | distinct AccountObjectId;
  let suspiciousSignInIPs = successfulRiskySignIn
  | distinct IPAddress;
  let suspiciousSignInCities = successfulRiskySignIn
  | distinct City;
  CloudAppEvents
  | where Timestamp > ago(1d)
  | where ActionType == "MailItemsAccessed"
  | where AccountObjectId in (suspiciousSignInUsers)
  | where IPAddress !in (suspiciousSignInIPs)
  | where City !in (suspiciousSignInCities)
  | join kind=inner successfulRiskySignIn on AccountObjectId
  | where AccountObjectId in (suspiciousSignInUsers)
  | where (Timestamp - Timestamp1) between (-5min .. 5min)
  | extend folders = RawEventData.Folders
  | mv-expand folders
  | extend items = folders.FolderItems
  | mv-expand items
  | extend InternetMessageId = tostring(items.InternetMessageId)
  | project Timestamp, ReportId, IPAddress, InternetMessageId, AccountObjectId, SessionId, Country, State, City
version: 1.0.0 

Required Data Sources

Sentinel TableNotes
CloudAppEventsEnsure this data connector is enabled

MITRE ATT&CK Context

References

False Positive Guidance

Original source: https://github.com/Azure/Azure-Sentinel/blob/main/Hunting Queries/Microsoft 365 Defender/Email and Collaboration Queries/QR code/Suspicious sign-in attempts from QR code phishing campaigns.yaml