Skip to content

Azure Network Watcher (NSG flow logs)

Overview

Azure Network Watcher provides tools to monitor, diagnose, view metrics, and enable or disable logs for resources in an Azure virtual network. It also allows to log information about IP traffic flowing through a network security group: NSG flow logs.

  • Vendor: Microsoft Azure
  • Supported environment: SaaS
  • Detection based on: Telemetry
  • Supported application or feature: Host network interface, Netflow/Enclave netflow, Network device logs, Network protocol analysis

Configure

Please contact your support to discuss about the network security group to monitor in your Azure infrastructure in order to find the appropriate solution to forward your logs to Sekoia.io.

This setup guide will show you a method to enable and give us access to NSG flow logs produced by Azure Network Watcher service to Sekoia.io.

Enable NSG flow logs

The following instructions are provided for the Azure web portal (https://portal.azure.com).

As a prerequisite you need at least one virtual machine with a network security group, to enable Network Watcher and to register the Microsoft.Insights provider.

Navigate to the Network Watcher service, and select NSG flow logs under LOGS. From the list of NSGs, select your VM(s), and under Flow logs settings, select On to enable the NSG flow logs. Please, select the Version 2 NSG flow log format sample which is integrated to the Operations Center.

These instructions are illustrated and more detailled here.

Share access to logs

This part should be discussed with Sekoia.io people to find an appropriate solution to forward your flow logs to Sekoia.io.

A possible solution consists of sharing:

  • An access key for the Azure Blob Storage
  • A storage token associated with the resources to share
  • The name of the container where the NSG flow logs are stored

Info

We will be able to retrieve each PT1h.json blob which contains the flow logs.

Raw Events Samples

In this section, you will find examples of raw logs as generated natively by the source. These examples are provided to help integrators understand the data format before ingestion into Sekoia.io. It is crucial for setting up the correct parsing stages and ensuring that all relevant information is captured.

{
    "macAddress": "000D124564789",
    "operationName": "NetworkSecurityGroupFlowEvents",
    "resourceId": "/SUBSCRIPTIONS/12345674-1234-1234-1234-12345646546875/RESOURCEGROUPS/FOO/PROVIDERS/MICROSOFT.NETWORK/NETWORKSECURITYGROUPS/AZNTDC02-NSG",
    "time": "2024-03-18T13:21:42.6259228Z",
    "rule": "DefaultRule_AllowVnetInBound",
    "flow.0": "1710768066,1.1.1.1,2.2.2.2,35336,53,U,I,A,C,1,99,1,167"
}
{
    "flow_state": "begin",
    "resourceId": "/SUBSCRIPTIONS/13C8046C-DB72-4C35-9D71-60667ED9E869/RESOURCEGROUPS/INTEGRATION/PROVIDERS/MICROSOFT.NETWORK/NETWORKSECURITYGROUPS/TEST-NSG",
    "macAddress": "DB831EFEC376",
    "flow.0": "1493763938,1.2.3.4,5.6.7.8,35370,23,T,I,A,B,,,,",
    "rule": "DefaultRule_AllowVnetOutBound",
    "operationName": "NetworkSecurityGroupFlowEvents",
    "time": "2020-12-14T22:16:46.3528160Z",
    "version": "2"
}
{
    "flow_state": "end",
    "resourceId": "/SUBSCRIPTIONS/13C8046C-DB72-4C35-9D71-60667ED9E869/RESOURCEGROUPS/INTEGRATION/PROVIDERS/MICROSOFT.NETWORK/NETWORKSECURITYGROUPS/TEST-NSG",
    "macAddress": "DB831EFEC376",
    "flow.0": "1607984156,1.2.3.4,5.6.7.8,36422,8086,T,O,A,E,1,74,1,74",
    "rule": "DefaultRule_AllowVnetOutBound",
    "operationName": "NetworkSecurityGroupFlowEvents",
    "time": "2020-12-14T22:16:46.3528160Z",
    "version": "2"
}
{
    "flow_state": "begin",
    "source_addr": "1.3.4.2",
    "macAddress": "DB831EFEC376",
    "operationName": "NetworkSecurityGroupFlowEvents",
    "resourceId": "/SUBSCRIPTIONS/13C8046C-DB72-4C35-9D71-60667ED9E869/RESOURCEGROUPS/INTEGRATION/PROVIDERS/MICROSOFT.NETWORK/NETWORKSECURITYGROUPS/TEST-NSG",
    "time": "2021-03-24T10:55:03.0680749Z",
    "rule": "DefaultRule_AllowInternetOutBound",
    "flow.0": "1616583277,1.2.3.4,5.6.7.8,55486,443,T,O,A"
}

Detection section

The following section provides information for those who wish to learn more about the detection capabilities enabled by collecting this intake. It includes details about the built-in rule catalog, event categories, and ECS fields extracted from raw events. This is essential for users aiming to create custom detection rules, perform hunting activities, or pivot in the events page.

The following Sekoia.io built-in rules match the intake Azure Network Watcher. This documentation is updated automatically and is based solely on the fields used by the intake which are checked against our rules. This means that some rules will be listed but might not be relevant with the intake.

SEKOIA.IO x Azure Network Watcher on ATT&CK Navigator

Account Added To A Security Enabled Group

Detection in order to investigate who has added a specific Domain User in Domain Admins or Group Policy Creator Owners (Security event 4728)

  • Effort: master
Account Removed From A Security Enabled Group

Detection in order to investigate who has removed a specific Domain User in Domain Admins or Group Policy Creator Owners (Security event 4729)

  • Effort: master
Computer Account Deleted

Detects computer account deletion.

  • Effort: master
Cryptomining

Detection of domain names potentially related to cryptomining activities.

  • Effort: master
Domain Trust Created Or Removed

A trust was created or removed to a domain. An attacker could perform that in order to do lateral movement easily between domains or shutdown the ability of two domains to communicate.

  • Effort: advanced
Dynamic DNS Contacted

Detect communication with dynamic dns domain. This kind of domain is often used by attackers. This rule can trigger false positive in non-controlled environment because dynamic dns is not always malicious.

  • Effort: master
Exfiltration Domain

Detects traffic toward a domain flagged as a possible exfiltration vector.

  • Effort: master
Password Change On Directory Service Restore Mode (DSRM) Account

The Directory Service Restore Mode (DSRM) account is a local administrator account on Domain Controllers. Attackers may change the password to gain persistence.

  • Effort: intermediate
Possible Replay Attack

This event can be a sign of Kerberos replay attack or, among other things, network device configuration or routing problems.

  • Effort: intermediate
Potential RDP Connection To Non-Domain Host

Detects logons using NTLM to hosts that are potentially not part of the domain using RDP (TermSrv). Event ID 8001 corresponds to outgoing NTLM authentication traffic and TermSrv stands for RDP Terminal Services Server. Check if the contacted host is legitimate. To use this detection rule, enable logging of outbound NTLM authentications on all domain controllers, using the following Group Policy (GPO) - Computer Configuration > Policies > Windows Settings > Security Settings > Local Policies > Security Options > Network security: Restrict NTLM: Outgoing NTLM traffic to remote servers -> Define this policy setting: Audit all.

  • Effort: master
Remote Access Tool Domain

Detects traffic toward a domain flagged as a Remote Administration Tool (RAT).

  • Effort: master
SEKOIA.IO Intelligence Feed

Detect threats based on indicators of compromise (IOCs) collected by SEKOIA's Threat and Detection Research team.

  • Effort: elementary
Sekoia.io EICAR Detection

Detects observables in Sekoia.io CTI tagged as EICAR, which are fake samples meant to test detection.

  • Effort: master
TOR Usage Generic Rule

Detects TOR usage globally, whether the IP is a destination or source. TOR is short for The Onion Router, and it gets its name from how it works. TOR intercepts the network traffic from one or more apps on user’s computer, usually the user web browser, and shuffles it through a number of randomly-chosen computers before passing it on to its destination. This disguises user location, and makes it harder for servers to pick him/her out on repeat visits, or to tie together separate visits to different sites, this making tracking and surveillance more difficult. Before a network packet starts its journey, user’s computer chooses a random list of relays and repeatedly encrypts the data in multiple layers, like an onion. Each relay knows only enough to strip off the outermost layer of encryption, before passing what’s left on to the next relay in the list.

  • Effort: master
User Account Created

Detects user creation on windows servers, which shouldn't happen in an Active Directory environment. Apply this on your windows server logs and not on your DC logs. One default account defaultuser0 is excluded as only used during Windows set-up. This detection use Security Event ID 4720.

  • Effort: master
User Account Deleted

Detects local user deletion

  • Effort: master

Event Categories

The following table lists the data source offered by this integration.

Data Source Description
Host network interface every packets passing through the Network Security Group are logged
Netflow/Enclave netflow Azure Network Watcher NSG Flow Logs are Netflow-like
Network device logs packets logged by NSG Flow Logs
Network protocol analysis traffic analysis at levels 2/3/4

In details, the following table denotes the type of events produced by this integration.

Name Values
Kind ``
Category network
Type allowed, denied

Transformed Events Samples after Ingestion

This section demonstrates how the raw logs will be transformed by our parsers. It shows the extracted fields that will be available for use in the built-in detection rules and hunting activities in the events page. Understanding these transformations is essential for analysts to create effective detection mechanisms with custom detection rules and to leverage the full potential of the collected data.

{
    "message": "{\"macAddress\": \"000D124564789\", \"operationName\": \"NetworkSecurityGroupFlowEvents\", \"resourceId\": \"/SUBSCRIPTIONS/12345674-1234-1234-1234-12345646546875/RESOURCEGROUPS/FOO/PROVIDERS/MICROSOFT.NETWORK/NETWORKSECURITYGROUPS/AZNTDC02-NSG\", \"time\": \"2024-03-18T13:21:42.6259228Z\", \"rule\": \"DefaultRule_AllowVnetInBound\", \"flow.0\": \"1710768066,1.1.1.1,2.2.2.2,35336,53,U,I,A,C,1,99,1,167\"}",
    "event": {
        "action": "accept",
        "category": [
            "network"
        ],
        "code": "NetworkSecurityGroupFlowEvents",
        "outcome": "success",
        "start": "2024-03-18T13:21:42.625922Z",
        "type": [
            "allowed"
        ]
    },
    "@timestamp": "2024-03-18T13:21:42.625922Z",
    "action": {
        "name": "accept",
        "outcome": "success",
        "properties": {
            "FlowState": "continue",
            "OperationName": "NetworkSecurityGroupFlowEvents"
        },
        "target": "network-traffic",
        "type": "DefaultRule_AllowVnetInBound"
    },
    "destination": {
        "address": "2.2.2.2",
        "bytes": 167,
        "ip": "2.2.2.2",
        "packets": 1,
        "port": 53
    },
    "network": {
        "direction": "inbound",
        "transport": "udp"
    },
    "related": {
        "ip": [
            "1.1.1.1",
            "2.2.2.2"
        ]
    },
    "rule": {
        "name": "DefaultRule_AllowVnetInBound"
    },
    "source": {
        "address": "1.1.1.1",
        "bytes": 99,
        "ip": "1.1.1.1",
        "mac": "000D124564789",
        "packets": 1,
        "port": 35336
    }
}
{
    "message": "{\"flow_state\": \"begin\",\"resourceId\":\"/SUBSCRIPTIONS/13C8046C-DB72-4C35-9D71-60667ED9E869/RESOURCEGROUPS/INTEGRATION/PROVIDERS/MICROSOFT.NETWORK/NETWORKSECURITYGROUPS/TEST-NSG\",\"macAddress\":\"DB831EFEC376\",\"flow.0\":\"1493763938,1.2.3.4,5.6.7.8,35370,23,T,I,A,B,,,,\",\"rule\":\"DefaultRule_AllowVnetOutBound\",\"operationName\":\"NetworkSecurityGroupFlowEvents\",\"time\":\"2020-12-14T22:16:46.3528160Z\",\"version\":\"2\"}",
    "event": {
        "action": "accept",
        "category": [
            "network"
        ],
        "code": "NetworkSecurityGroupFlowEvents",
        "outcome": "success",
        "start": "2020-12-14T22:16:46.352816Z",
        "type": [
            "allowed"
        ]
    },
    "@timestamp": "2020-12-14T22:16:46.352816Z",
    "action": {
        "name": "accept",
        "outcome": "success",
        "properties": {
            "FlowState": "begin",
            "OperationName": "NetworkSecurityGroupFlowEvents",
            "Version": "2"
        },
        "target": "network-traffic",
        "type": "DefaultRule_AllowVnetOutBound"
    },
    "destination": {
        "address": "5.6.7.8",
        "ip": "5.6.7.8",
        "port": 23
    },
    "network": {
        "direction": "inbound",
        "transport": "tcp"
    },
    "related": {
        "ip": [
            "1.2.3.4",
            "5.6.7.8"
        ]
    },
    "rule": {
        "name": "DefaultRule_AllowVnetOutBound"
    },
    "source": {
        "address": "1.2.3.4",
        "ip": "1.2.3.4",
        "mac": "DB831EFEC376",
        "port": 35370
    }
}
{
    "message": "{\"flow_state\": \"end\", \"resourceId\":\"/SUBSCRIPTIONS/13C8046C-DB72-4C35-9D71-60667ED9E869/RESOURCEGROUPS/INTEGRATION/PROVIDERS/MICROSOFT.NETWORK/NETWORKSECURITYGROUPS/TEST-NSG\",\"macAddress\":\"DB831EFEC376\",\"flow.0\":\"1607984156,1.2.3.4,5.6.7.8,36422,8086,T,O,A,E,1,74,1,74\",\"rule\":\"DefaultRule_AllowVnetOutBound\",\"operationName\":\"NetworkSecurityGroupFlowEvents\",\"time\":\"2020-12-14T22:16:46.3528160Z\",\"version\":\"2\"}",
    "event": {
        "action": "accept",
        "category": [
            "network"
        ],
        "code": "NetworkSecurityGroupFlowEvents",
        "outcome": "success",
        "start": "2020-12-14T22:16:46.352816Z",
        "type": [
            "allowed"
        ]
    },
    "@timestamp": "2020-12-14T22:16:46.352816Z",
    "action": {
        "name": "accept",
        "outcome": "success",
        "properties": {
            "FlowState": "end",
            "OperationName": "NetworkSecurityGroupFlowEvents",
            "Version": "2"
        },
        "target": "network-traffic",
        "type": "DefaultRule_AllowVnetOutBound"
    },
    "destination": {
        "address": "5.6.7.8",
        "bytes": 74,
        "ip": "5.6.7.8",
        "packets": 1,
        "port": 8086
    },
    "network": {
        "direction": "outbound",
        "transport": "tcp"
    },
    "related": {
        "ip": [
            "1.2.3.4",
            "5.6.7.8"
        ]
    },
    "rule": {
        "name": "DefaultRule_AllowVnetOutBound"
    },
    "source": {
        "address": "1.2.3.4",
        "bytes": 74,
        "ip": "1.2.3.4",
        "mac": "DB831EFEC376",
        "packets": 1,
        "port": 36422
    }
}
{
    "message": "{\"flow_state\": \"begin\", \"source_addr\": \"1.3.4.2\", \"macAddress\": \"DB831EFEC376\", \"operationName\": \"NetworkSecurityGroupFlowEvents\", \"resourceId\": \"/SUBSCRIPTIONS/13C8046C-DB72-4C35-9D71-60667ED9E869/RESOURCEGROUPS/INTEGRATION/PROVIDERS/MICROSOFT.NETWORK/NETWORKSECURITYGROUPS/TEST-NSG\", \"time\": \"2021-03-24T10:55:03.0680749Z\", \"rule\": \"DefaultRule_AllowInternetOutBound\", \"flow.0\": \"1616583277,1.2.3.4,5.6.7.8,55486,443,T,O,A\"}",
    "event": {
        "action": "accept",
        "category": [
            "network"
        ],
        "code": "NetworkSecurityGroupFlowEvents",
        "outcome": "success",
        "start": "2021-03-24T10:55:03.068074Z",
        "type": [
            "allowed"
        ]
    },
    "@timestamp": "2021-03-24T10:55:03.068074Z",
    "action": {
        "name": "accept",
        "outcome": "success",
        "properties": {
            "FlowState": "begin",
            "OperationName": "NetworkSecurityGroupFlowEvents"
        },
        "target": "network-traffic",
        "type": "DefaultRule_AllowInternetOutBound"
    },
    "destination": {
        "address": "5.6.7.8",
        "ip": "5.6.7.8",
        "port": 443
    },
    "network": {
        "direction": "outbound",
        "transport": "tcp"
    },
    "related": {
        "ip": [
            "1.3.4.2",
            "5.6.7.8"
        ]
    },
    "rule": {
        "name": "DefaultRule_AllowInternetOutBound"
    },
    "source": {
        "address": "1.3.4.2",
        "ip": "1.3.4.2",
        "mac": "DB831EFEC376",
        "port": 55486
    }
}

Extracted Fields

The following table lists the fields that are extracted, normalized under the ECS format, analyzed and indexed by the parser. It should be noted that infered fields are not listed.

Name Type Description
@timestamp date Date/time when the event originated.
action.properties.FlowState keyword
action.properties.OperationName keyword
action.properties.Version keyword
action.target keyword The target of the action
destination.bytes long Bytes sent from the destination to the source.
destination.ip ip IP address of the destination.
destination.packets long Packets sent from the destination to the source.
destination.port long Port of the destination.
event.action keyword The action captured by the event.
event.category keyword Event category. The second categorization field in the hierarchy.
event.code keyword Identification code for this event.
event.start date event.start contains the date when the event started or when the activity was first observed.
event.type keyword Event type. The third categorization field in the hierarchy.
rule.name keyword Rule name
source.bytes long Bytes sent from the source to the destination.
source.ip ip IP address of the source.
source.mac keyword MAC address of the source.
source.packets long Packets sent from the source to the destination.
source.port long Port of the source.

For more information on the Intake Format, please find the code of the Parser, Smart Descriptions, and Supported Events here.

Further Readings