Skip to content

Gateway Network

Overview

Cloudflare is a global network designed to make everything you connect to the Internet secure, private, fast, and reliable.

In this documentation, you will learn how to collect and send Gateway Network logs to Sekoia.io.

Warning

Important note - This format is currently in beta. We highly value your feedback to improve its performance.

The following Sekoia.io built-in rules match the intake Cloudflare Gateway Network [BETA]. 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 Cloudflare Gateway Network [BETA] on ATT&CK Navigator

Burp Suite Tool Detected

Burp Suite is a cybersecurity tool. When used as a proxy service, its purpose is to intercept packets and modify them to send them to the server. Burp Collaborator is a network service that Burp Suite uses to help discover many kinds of vulnerabilities (vulnerabilities scanner)

  • Effort: intermediate
Potential DNS Tunnel

Detects domain name which is longer than 95 characters. Long domain names are distinctive of DNS tunnels.

  • Effort: advanced
SEKOIA.IO Intelligence Feed

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

  • Effort: elementary
Telegram Bot API Request

Detects suspicious DNS queries to api.telegram.org used by Telegram Bots of any kind

  • Effort: advanced

Event Categories

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

Data Source Description
Network device logs The network is logged by cloudflare gateway
Network protocol analysis The network is inspected by cloudflare gateway

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

Name Values
Kind event
Category network
Type ``

Event Samples

Find below few samples of events and how they are normalized by Sekoia.io.

{
    "message": "{\"AccountID\":\"1d1e650b3385b95db72bba7cfb1287e9\",\"Action\":\"allowedOnNoRuleMatch\",\"Datetime\":\"2023-02-24T16:33:05Z\",\"DestinationIP\":\"104.244.42.193\",\"DestinationPort\":443,\"DeviceID\":\"\",\"DeviceName\":\"\",\"Email\":\"\",\"OverrideIP\":\"\",\"OverridePort\":0,\"PolicyID\":\"\",\"PolicyName\":\"\",\"SNI\":\"www.twitter.com\",\"SessionID\":\"1725de7a2d0000215517735400000001\",\"SourceIP\":\"15.188.186.81\",\"SourcePort\":34080,\"Transport\":\"tcp\",\"UserID\":\"\"}",
    "event": {
        "action": "allowedOnNoRuleMatch",
        "category": [
            "network"
        ],
        "dataset": "gateway_network",
        "kind": "event",
        "type": [
            "allowed"
        ]
    },
    "@timestamp": "2023-02-24T16:33:05Z",
    "cloud": {
        "account": {
            "id": "1d1e650b3385b95db72bba7cfb1287e9"
        }
    },
    "cloudflare": {
        "OverridePort": 0,
        "SessionID": "1725de7a2d0000215517735400000001"
    },
    "destination": {
        "address": "104.244.42.193",
        "domain": "www.twitter.com",
        "ip": "104.244.42.193",
        "port": 443
    },
    "network": {
        "transport": "tcp"
    },
    "observer": {
        "type": "proxy",
        "vendor": "Cloudflare"
    },
    "related": {
        "hosts": [
            "www.twitter.com"
        ],
        "ip": [
            "104.244.42.193",
            "15.188.186.81"
        ]
    },
    "source": {
        "address": "15.188.186.81",
        "ip": "15.188.186.81",
        "port": 34080
    },
    "tls": {
        "client": {
            "server_name": "www.twitter.com"
        }
    }
}
{
    "message": "{\"AccountID\":\"1d1e650b3385b95db72bba7cfb1287e9\",\"Action\":\"allowedOnNoRuleMatch\",\"Datetime\":\"2023-05-02T16:24:20Z\",\"DestinationIP\":\"104.18.5.35\",\"DestinationPort\":443,\"DeviceID\":\"b72ac397-e5c3-913e-11ed-03face9f2b6b\",\"DeviceName\":\"DESKTOP-ABCDEF\",\"Email\":\"john.doe@test.com\",\"OverrideIP\":\"\",\"OverridePort\":0,\"PolicyID\":\"\",\"PolicyName\":\"\",\"SNI\":\"commandandcontrolandbotnet.testcategory.com\",\"SessionID\":\"187ee08b7d00003d0d8e47f400000001\",\"SourceIP\":\"15.188.186.81\",\"SourceInternalIP\":\"\",\"SourcePort\":54945,\"Transport\":\"tcp\",\"UserID\":\"2c46cdd9-92e3-5e5f-b3cf-67965d7c33e3\"}",
    "event": {
        "action": "allowedOnNoRuleMatch",
        "category": [
            "network"
        ],
        "dataset": "gateway_network",
        "kind": "event",
        "type": [
            "allowed"
        ]
    },
    "@timestamp": "2023-05-02T16:24:20Z",
    "cloud": {
        "account": {
            "id": "1d1e650b3385b95db72bba7cfb1287e9"
        }
    },
    "cloudflare": {
        "OverridePort": 0,
        "SessionID": "187ee08b7d00003d0d8e47f400000001"
    },
    "destination": {
        "address": "104.18.5.35",
        "domain": "commandandcontrolandbotnet.testcategory.com",
        "ip": "104.18.5.35",
        "port": 443
    },
    "device": {
        "id": "b72ac397-e5c3-913e-11ed-03face9f2b6b"
    },
    "host": {
        "hostname": "DESKTOP-ABCDEF",
        "name": "DESKTOP-ABCDEF"
    },
    "network": {
        "transport": "tcp"
    },
    "observer": {
        "type": "proxy",
        "vendor": "Cloudflare"
    },
    "related": {
        "hosts": [
            "DESKTOP-ABCDEF",
            "commandandcontrolandbotnet.testcategory.com"
        ],
        "ip": [
            "104.18.5.35",
            "15.188.186.81"
        ]
    },
    "source": {
        "address": "15.188.186.81",
        "ip": "15.188.186.81",
        "port": 54945
    },
    "tls": {
        "client": {
            "server_name": "commandandcontrolandbotnet.testcategory.com"
        }
    },
    "user": {
        "email": "john.doe@test.com",
        "id": "2c46cdd9-92e3-5e5f-b3cf-67965d7c33e3"
    }
}
{
    "message": "{\"AccountID\":\"1d1e650b3385b95db72bba7cfb1287e9\",\"Action\":\"allowedOnNoRuleMatch\",\"Datetime\":\"2023-02-24T16:33:05Z\",\"DestinationIP\":\"104.244.42.193\",\"DestinationPort\":443,\"DeviceID\":\"\",\"DeviceName\":\"\",\"Email\":\"\",\"OverrideIP\":\"\",\"OverridePort\":0,\"PolicyID\":\"\",\"PolicyName\":\"\",\"SNI\":\"\",\"SessionID\":\"1725de7a2d0000215517735400000001\",\"SourceIP\":\"15.188.186.81\",\"SourcePort\":34080,\"Transport\":\"tcp\",\"UserID\":\"\"}",
    "event": {
        "action": "allowedOnNoRuleMatch",
        "category": [
            "network"
        ],
        "dataset": "gateway_network",
        "kind": "event",
        "type": [
            "allowed"
        ]
    },
    "@timestamp": "2023-02-24T16:33:05Z",
    "cloud": {
        "account": {
            "id": "1d1e650b3385b95db72bba7cfb1287e9"
        }
    },
    "cloudflare": {
        "OverridePort": 0,
        "SessionID": "1725de7a2d0000215517735400000001"
    },
    "destination": {
        "address": "104.244.42.193",
        "ip": "104.244.42.193",
        "port": 443
    },
    "network": {
        "transport": "tcp"
    },
    "observer": {
        "type": "proxy",
        "vendor": "Cloudflare"
    },
    "related": {
        "ip": [
            "104.244.42.193",
            "15.188.186.81"
        ]
    },
    "source": {
        "address": "15.188.186.81",
        "ip": "15.188.186.81",
        "port": 34080
    }
}

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.
cloud.account.id keyword The cloud account or organization id.
cloudflare.InternalSourceIP keyword Local LAN IP of the device. Only available when connected via a GRE/IPsec tunnel on-ramp.
cloudflare.OverrideIP keyword Overriden IP of the network session, if any.
cloudflare.OverridePort number Overriden port of the network session, if any.
cloudflare.PolicyID keyword Identifier of the policy/rule that was applied, if any.
cloudflare.PolicyName keyword The name of the gateway policy applied to the request, if any.
cloudflare.SessionID keyword The session identifier of this network session.
destination.address keyword Destination network address.
destination.domain keyword The domain name of the destination.
destination.ip ip IP address of the destination.
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.dataset keyword Name of the dataset.
event.kind keyword The kind of the event. The highest categorization field in the hierarchy.
event.type keyword Event type. The third categorization field in the hierarchy.
host.hostname keyword Hostname of the host.
network.transport keyword Protocol Name corresponding to the field iana_number.
observer.type keyword The type of the observer the data is coming from.
observer.vendor keyword Vendor name of the observer.
source.ip ip IP address of the source.
source.port long Port of the source.
tls.client.server_name keyword Hostname the client is trying to connect to. Also called the SNI.
user.email keyword User email address.
user.id keyword Unique identifier of the user.

Configuration

Create the intake on Sekoia.io

Go to the intake page and create a new intake from the format Cloudflare.

Configure events forwarding on Cloudflare

Retrieve necessary information

First, you will have to retrieve configuration information. Connect to Cloudflare Console to collect the following :

  1. Cloudflare API Token

    • Go to My Profile, then on the left panel, click on API Tokens.
    • Click on the Create Token button and select the Create Custom Token entry.
    • Give a name to your token and set the following permissions:
    Scope Group Level
    Account Account Analytics Read
    Account Logs Read
    Account Logs Edit
    Zone Logs Read
    Zone Logs Edit
    • If you want zerotrust logs you should also add:
    Scope Group Level
    Account Zero Trust Read

    see the Cloudflare documentation

  2. Cloudflare Zone ID :

    • This information is specific to a Website.
    • On the left panel, click on Websites and select the Website you want.
    • On the right panel, there is an API section where you can retrieve the Zone ID.

Create a Logpush job

Configure a Logpush job with the following destination:

https://intake.sekoia.io/plain/batch?header_X-SEKOIAIO-INTAKE-KEY=<YOUR_INTAKE_KEY>

To do so, you can manage Logpush with cURL:

$ curl -X POST https://api.cloudflare.com/client/v4/accounts/<CLOUDFLARE_ACCOUNT_ID>/logpush/jobs \
-H "Authorization: Bearer <CLOUDFLARE_API_TOKEN>" \
-H "Content-Type: application/json" \
--data '{
    "dataset": "gateway_network",
    "enabled": true,
    "max_upload_bytes": 5000000,
    "max_upload_records": 1000,
    "logpull_options":"fields=AccountID,Action,Datetime,DestinationIP,DestinationPort,DeviceID,DeviceName,Email,OverrideIP,OverridePort,PolicyID,PolicyName,SNI,SessionID,SourceIP,SourceInternalIP,SourcePort,Transport,UserID&timestamps=rfc3339",
    "destination_conf": "https://intake.sekoia.io/plain/batch?header_X-SEKOIAIO-INTAKE-KEY=<YOUR_INTAKE_KEY>"
}' # (1)
  1. will return
    {
      "errors": [],
      "messages": [],
      "result": {
        "id": <ID>,
        "dataset": "gateway_network",
        "frequency": "high",
        "kind": "",
        "max_upload_bytes": 5000000,
        "max_upload_records": 1000,
        "enabled": true,
        "name": null,
        "logpull_options": "fields=<LIST_OF_FIELDS>",
        "destination_conf": "https://intake.sekoia.io/plain/batch?header_X-SEKOIAIO-INTAKE-KEY=<YOUR_INTAKE_KEY>",
        "last_complete": null,
        "last_error": null,
        "error_message": null,
        "time_created": "<TIMESTAMP>"
      },
      "success": true
    }
    

Important

Replace :

  • <YOUR_INTAKE_KEY> with the Intake key you generated in the Create the intake on Sekoia.io step.
  • <CLOUDFLARE_ACCOUNT_ID> with the ACCOUNT_ID found on the overview page
  • <CLOUDFLARE_API_TOKEN> with the API Token you generated
Useful Cloudflare API endpoints

On their documentation, Cloudflare provides a list API endpoints you can use. Find below some useful endpoints:

  • https://api.cloudflare.com/client/v4/accounts/<ACCOUNT_ID>/logpush/jobs/<JOB_ID> to verify the job you previously created is correct (you need to specify the JOB_ID)
  • https://api.cloudflare.com/client/v4/accounts/<ACCOUNT_ID>/logpush/datasets/<DATASET>/jobs to get all the jobs for a specific dataset (dns_log, firewalls_events or http_requests in our case)
  • https://api.cloudflare.com/client/v4/accounts/<ACCOUNT_ID>/logpush/jobs/<JOB_ID> to update a job if you noticed a mistake after the creation of the job (wrong fields, wrong SEKOIA API Key...)