Query Details

NetAPI Compromised Domains (malware and phishing, listed in the last 24 hours)

TI Feed Net API Compromised Domains

Query

let ThreatIntelFeed = externaldata(Domain: string)[@"https://netapi.com/api2/?method=compromised&dataset_type=url"] with (format="txt", ignoreFirstRecord=True);
let MalwareDomains = materialize (
     ThreatIntelFeed
     | extend Domain = tolower(trim(@"\s", Domain))
     | where isnotempty(Domain)
     | distinct Domain
     );
DeviceNetworkEvents
| where isnotempty(RemoteUrl)
| extend Host = tolower(tostring(parse_url(iff(RemoteUrl has "://", RemoteUrl, strcat("http://", RemoteUrl))).Host))
| extend Host = trim_start(@"www\.", Host)
| where Host in (MalwareDomains)
| project TimeGenerated, RemoteUrl, RemoteIP, DeviceName, InitiatingProcessCommandLine, InitiatingProcessFileName, InitiatingProcessAccountDomain, InitiatingProcessAccountName

About this query

NetAPI Compromised Domains (malware and phishing, listed in the last 24 hours)

Source: NetAPI

Feed information: https://netapi.com/compromised-urls/

Feed link: https://netapi.com/api2/?method=compromised&dataset_type=url

Defender XDR

let ThreatIntelFeed = externaldata(Domain: string)[@"https://netapi.com/api2/?method=compromised&dataset_type=url"] with (format="txt", ignoreFirstRecord=True);
let MalwareDomains = materialize (
     ThreatIntelFeed
     | extend Domain = tolower(trim(@"\s", Domain))
     | where isnotempty(Domain)
     | distinct Domain
     );
DeviceNetworkEvents
| where isnotempty(RemoteUrl)
| extend Host = tolower(tostring(parse_url(iff(RemoteUrl has "://", RemoteUrl, strcat("http://", RemoteUrl))).Host))
| extend Host = trim_start(@"www\.", Host)
| where Host in (MalwareDomains)
| project Timestamp, RemoteUrl, RemoteIP, DeviceName, InitiatingProcessCommandLine, InitiatingProcessFileName, InitiatingProcessAccountDomain, InitiatingProcessAccountName

Sentinel

Explanation

This query is designed to identify network events involving compromised domains related to malware and phishing activities, as listed in the last 24 hours. It uses data from the NetAPI feed to detect these domains. Here's a simplified breakdown of what the query does:

  1. Data Source: It pulls a list of compromised domains from the NetAPI feed, which provides information about URLs associated with malware and phishing.

  2. Data Processing:

    • The query retrieves the list of compromised domains and processes it to ensure all domain names are in lowercase and free of any leading or trailing spaces.
    • It filters out any empty entries and ensures that each domain is unique.
  3. Network Event Analysis:

    • The query examines network events from a dataset called DeviceNetworkEvents.
    • It checks if the RemoteUrl field in these events is not empty.
    • It extracts the host part of the URL, converting it to lowercase and removing any "www." prefix for consistency.
    • It then checks if these hosts match any of the domains in the list of compromised domains.
  4. Output:

    • For any network events involving these compromised domains, the query outputs relevant details such as the timestamp, URL, IP address, device name, and information about the process that initiated the network connection.

The query is structured similarly for both Defender XDR and Sentinel, with minor differences in the field names used for timestamps (Timestamp in Defender XDR and TimeGenerated in Sentinel).