장치, 전자 메일, 앱 및 ID에 대한 위협 검색

적용 대상:

  • Microsoft Defender XDR

Microsoft Defender XDR 고급 헌팅을 사용하면 다음에서 위협을 사전에 헌팅할 수 있습니다.

  • 엔드포인트용 Microsoft Defender 관리되는 디바이스
  • Microsoft 365에서 처리한 전자 메일
  • Microsoft Defender for Cloud Apps 및 Microsoft Defender for Identity 추적되는 클라우드 앱 활동, 인증 이벤트 및 도메인 컨트롤러 활동

이러한 수준의 가시성을 통해 전자 메일 또는 웹에 도착하는 정교한 침입, 로컬 권한 상승, 권한 있는 도메인 자격 증명 획득, 디바이스 간에 횡적 이동 등 네트워크의 섹션을 트래버스하는 위협을 신속하게 검색할 수 있습니다.

다음은 이러한 정교한 위협을 헌팅할 때 쿼리를 생성하는 방법을 탐색하는 데 도움이 되는 다양한 헌팅 시나리오를 기반으로 하는 일반적인 기술 및 샘플 쿼리입니다.

엔터티 정보 가져오기

이러한 쿼리를 사용하여 사용자 계정, 디바이스 및 파일에 대한 정보를 빠르게 가져오는 방법을 알아봅니다.

전자 메일 주소에서 사용자 계정 가져오기

장치와 전자 메일을 포함하는 테이블에서 쿼리를 생성할 때 보낸 사람 또는 받는 사람 전자 메일 주소에서 사용자 계정 이름을 확인해야 할 수 있습니다. 일반적으로 전자 메일 주소의 로컬 호스트 를 사용하여 받는 사람 또는 보낸 사람 주소에 대해 이 작업을 수행할 수 있습니다.

아래 코드 조각에서는 tostring() Kusto 함수를 사용하여 열RecipientEmailAddress의 받는 사람 전자 메일 주소 바로 앞에 @ 있는 로컬 호스트를 추출합니다.

//Query snippet showing how to extract the account name from an email address
AccountName = tostring(split(RecipientEmailAddress, "@")[0])

아래 쿼리는 이 코드 조각을 사용하는 방법을 보여줍니다.

EmailEvents
| where Timestamp > ago(7d)
| project RecipientEmailAddress, AccountName = tostring(split(RecipientEmailAddress, "@")[0]);

IdentityInfo 테이블 병합

IdentityInfo 테이블을 병합하거나 조인하여 계정 이름 및 기타 계정 정보를 가져올 수 있습니다. 아래 쿼리는 EmailEvents 테이블에서 피싱 및 맬웨어 검색 목록을 가져온 다음 해당 정보를 테이블과 IdentityInfo 조인하여 각 수신자에 대한 자세한 정보를 가져옵니다.

EmailEvents
| where Timestamp > ago(7d)
//Get email processing events where the messages were identified as either phishing or malware
| where ThreatTypes has "Malware" or ThreatTypes has "Phish"
//Merge email events with identity info to get recipient details
| join (IdentityInfo | distinct AccountUpn, AccountDisplayName, JobTitle,
Department, City, Country) on $left.RecipientEmailAddress == $right.AccountUpn
//Show important message and recipient details
| project Timestamp, NetworkMessageId, Subject, ThreatTypes,
SenderFromAddress, RecipientEmailAddress, AccountDisplayName, JobTitle,
Department, City, Country

Kusto 쿼리 언어 사용하여 테이블을 조인하는 방법을 알아보려면 이 짧은 비디오를 시청하세요.

디바이스 정보 가져오기

고급 헌팅 스키마는 다양한 테이블에서 광범위한 디바이스 정보를 제공합니다. 예를 들어 DeviceInfo 테이블 은 정기적으로 집계되는 이벤트 데이터를 기반으로 하는 포괄적인 디바이스 정보를 제공합니다. 이 쿼리는 잠재적으로 손상된 사용자(<account-name>)가 모든 디바이스에 로그온한 다음 해당 디바이스에서 트리거된 경고를 나열하는 경우 테이블을 사용하여 DeviceInfo 검사.

이 쿼리는 를 사용하여 kind=inner 에 대한 왼쪽 값의 중복 제거를 방지하는 내부 조인을 지정합니다 DeviceId.

DeviceInfo
//Query for devices that the potentially compromised account has logged onto
| where LoggedOnUsers contains '<account-name>'
| distinct DeviceId
//Crosscheck devices against alert records in AlertEvidence and AlertInfo tables
| join kind=inner AlertEvidence on DeviceId
| project AlertId
//List all alerts on devices that user has logged on to
| join AlertInfo on AlertId
| project AlertId, Timestamp, Title, Severity, Category

파일 이벤트 정보 가져오기

다음 쿼리를 사용하여 파일 관련 이벤트에 대한 정보를 가져옵니다.

DeviceInfo
| where Timestamp > ago(1d)
| where ClientVersion startswith "20.1"
| summarize by DeviceId
| join kind=inner (
    DeviceFileEvents
    | where Timestamp > ago(1d)
) on DeviceId
| take 10

네트워크 이벤트 정보 가져오기

다음 쿼리를 사용하여 네트워크 관련 이벤트에 대한 정보를 가져옵니다.

DeviceInfo
| where Timestamp > ago(1d)
| where ClientVersion startswith "20.1"
| summarize by DeviceId
| join kind=inner (
    DeviceNetworkEvents
    | where Timestamp > ago(1d)
) on DeviceId
| take 10

디바이스 에이전트 버전 정보 가져오기

다음 쿼리를 사용하여 디바이스에서 실행되는 에이전트의 버전을 가져옵니다.

DeviceInfo
| where Timestamp > ago(1d)
| where ClientVersion startswith "20.1"
| summarize by DeviceId
| join kind=inner (
    DeviceNetworkEvents
    | where Timestamp > ago(1d)
) on DeviceId
| take 10

macOS 디바이스에 대한 쿼리 예제

다음 예제 쿼리를 사용하여 Catalina보다 이전 버전의 macOS를 실행하는 모든 디바이스를 확인합니다.

DeviceInfo
| where Timestamp > ago(1d)
| where OSPlatform == "macOS" and  OSVersion !contains "10.15" and OSVersion !contains "11."
| summarize by DeviceId
| join kind=inner (
    DeviceInfo
    | where Timestamp > ago(1d)
) on DeviceId
| take 10

디바이스 상태 정보 가져오기

다음 쿼리를 사용하여 디바이스의 상태 가져옵니다. 다음 예제에서 쿼리는 디바이스가 온보딩되었는지 확인합니다.

DeviceInfo
| where Timestamp > ago(1d)
| where OnboardingStatus != "Onboarded"
| summarize by DeviceId
| join kind=inner (
    DeviceInfo
    | where Timestamp > ago(1d)
) on DeviceId
| take 10

헌팅 시나리오

성공적으로 삭제되지 않은 전자 메일을 받은 사용자의 로그온 활동 나열

ZAP(0시간 자동 제거) 는 악성 전자 메일이 수신된 후 주소를 지정합니다. ZAP가 실패하면 악성 코드가 결국 디바이스에서 실행되어 계정이 손상될 수 있습니다. 이 쿼리는 ZAP에서 성공적으로 처리되지 않은 전자 메일 수신자가 수행한 로그온 작업을 확인합니다.

EmailPostDeliveryEvents
| where Timestamp > ago(7d)
//List malicious emails that were not zapped successfully
| where ActionType has "ZAP" and ActionResult == "Error"
| project ZapTime = Timestamp, ActionType, NetworkMessageId , RecipientEmailAddress
//Get logon activity of recipients using RecipientEmailAddress and AccountUpn
| join kind=inner IdentityLogonEvents on $left.RecipientEmailAddress == $right.AccountUpn
| where Timestamp between ((ZapTime-24h) .. (ZapTime+24h))
//Show only pertinent info, such as account name, the app or service, protocol, the target device, and type of logon
| project ZapTime, ActionType, NetworkMessageId , RecipientEmailAddress, AccountUpn,
LogonTime = Timestamp, AccountDisplayName, Application, Protocol, DeviceName, LogonType

자격 증명 도난의 대상이 되는 도메인 계정의 로그온 시도 가져오기

이 쿼리는 먼저 테이블의 모든 자격 증명 액세스 경고를 식별합니다 AlertInfo . 그런 다음 대상 계정의 이름을 구문 분석하고 도메인에 가입 AlertEvidence 된 계정에 대해서만 필터링하는 테이블을 병합하거나 조인합니다. 마지막으로 도메인에 가입된 대상 계정으로 모든 로그온 활동을 가져오기 위해 테이블을 확인 IdentityLogonEvents 합니다.

AlertInfo
| where Timestamp > ago(30d)
//Get all credential access alerts
| where Category == "CredentialAccess"
//Get more info from AlertEvidence table to get the SID of the target accounts
| join AlertEvidence on AlertId
| extend IsJoined=(parse_json(AdditionalFields).Account.IsDomainJoined)
| extend TargetAccountSid=tostring(parse_json(AdditionalFields).Account.Sid)
//Filter for domain-joined accounts only
| where IsJoined has "true"
//Merge with IdentityLogonEvents to get all logon attempts by the potentially compromised target accounts
| join kind=inner IdentityLogonEvents on $left.TargetAccountSid == $right.AccountSid
//Show only pertinent info, such as account name, the app or service, protocol, the accessed device, and type of logon
| project AccountDisplayName, TargetAccountSid, Application, Protocol, DeviceName, LogonType

알려진 악의적인 보낸 사람의 파일이 장치에 있는지 확인

악성 파일(MaliciousSender@example.com)을 보내는 전자 메일 주소를 알고 있다고 가정하면 이 쿼리를 실행하여 이 보낸 사람의 파일이 디바이스에 있는지 확인할 수 있습니다. 예를 들어 이 쿼리를 사용하여 맬웨어 배포 캠페인의 영향을 받는 디바이스를 식별할 수 있습니다.

EmailAttachmentInfo
| where SenderFromAddress =~ "MaliciousSender@example.com"
//Get emails with attachments identified by a SHA-256
| where isnotempty(SHA256)
| join (
//Check devices for any activity involving the attachments
DeviceFileEvents
| project FileName, SHA256, DeviceName, DeviceId
) on SHA256
| project Timestamp, FileName , SHA256, DeviceName, DeviceId,  NetworkMessageId, SenderFromAddress, RecipientEmailAddress

악의적인 전자 메일을 받은 후에 로그온 시도를 검토합니다.

이 쿼리는 알려진 악의적인 전자 메일을 받은 후 30분 이내에 전자 메일 받는 사람이 수행한 10개의 최신 로그온을 찾습니다. 이 쿼리를 사용하여 전자 메일 받는 사람의 계정이 노출되었는지 확인할 수 있습니다.

//Define new table for malicious emails
let MaliciousEmails=EmailEvents
//List emails detected as malware, getting only pertinent columns
| where ThreatTypes has "Malware"
| project TimeEmail = Timestamp, Subject, SenderFromAddress, AccountName = tostring(split(RecipientEmailAddress, "@")[0]);
MaliciousEmails
| join (
//Merge malicious emails with logon events to find logons by recipients
IdentityLogonEvents
| project LogonTime = Timestamp, AccountName, DeviceName
) on AccountName
//Check only logons within 30 minutes of receipt of an email
| where (LogonTime - TimeEmail) between (0min.. 30min)
| take 10

알려진 악의적인 보낸 사람의 전자 메일을 수신 후 PowerShell 활동 검토

악의적인 전자 메일에는 종종 추가 페이로드를 전달하기 위해 PowerShell 명령을 실행하는 문서 및 특수하게 조작된 기타 첨부 파일이 포함 됩니다. 알려진 악의적인 보낸 사람(MaliciousSender@example.com)에서 오는 전자 메일을 알고 있는 경우 이 쿼리를 사용하여 보낸 사람으로부터 전자 메일을 받은 후 30분 이내에 발생한 PowerShell 활동을 나열하고 검토할 수 있습니다.

//Define new table for emails from specific sender
let EmailsFromBadSender=EmailEvents
| where SenderFromAddress =~ "MaliciousSender@example.com"
| project TimeEmail = Timestamp, Subject, SenderFromAddress, AccountName = tostring(split(RecipientEmailAddress, "@")[0]);
//Merge emails from sender with process-related events on devices
EmailsFromBadSender
| join (
DeviceProcessEvents
//Look for PowerShell activity
| where FileName =~ "powershell.exe"
//Add line below to check only events initiated by Outlook
//| where InitiatingProcessParentFileName =~ "outlook.exe"
| project TimeProc = Timestamp, AccountName, DeviceName, InitiatingProcessParentFileName, InitiatingProcessFileName, FileName, ProcessCommandLine
) on AccountName
//Check only PowerShell activities within 30 minutes of receipt of an email
| where (TimeProc - TimeEmail) between (0min.. 30min)

더 자세히 알아보고 싶으신가요? 기술 커뮤니티: Microsoft Defender XDR Tech Community의 Microsoft 보안 커뮤니티와 Engage.