Skip to content

Audit logs

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 Cloudflare Audit logs to Sekoia.io.

The following Sekoia.io built-in rules match the intake Cloudflare Audit logs. 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 Audit logs on ATT&CK Navigator

Cryptomining

Detection of domain names potentially related to cryptomining activities.

  • Effort: master
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
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

Event Categories

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

Data Source Description
Authentication logs Cloudflare Access logs an authentication event whenever a user or service attempts to log in to an application, whether the attempt succeeds or not.

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

Name Values
Kind ``
Category network
Type access

Event Samples

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

{
    "message": "{\"ActionResult\":true,\"ActionType\":\"gateway_create\",\"ActorEmail\":\"john.doe@example.org\",\"ActorID\":\"042fb38530054d63921f9ca81a33d5d2\",\"ActorIP\":\"::ffff:78.197.123.35\",\"ActorType\":\"user\",\"ID\":\"f6773c1b-c332-4d33-8a5b-3e7f6fafde46\",\"Interface\":\"UI\",\"Metadata\":{\"account_id\":\"1d1e650b3385b95db72bba7cfb1287e9\",\"actor_email\":\"john.doe@example.org\"},\"NewValue\":{\"id\":\"09cec157-0de7-4143-8c08-d905c6e1be76\",\"name\":\"Redirect twitter\",\"description\":\"\",\"precedence\":14000,\"enabled\":true,\"action\":\"l4_override\",\"filters\":[\"l4\"],\"created_at\":\"2023-02-24T16:32:38Z\",\"updated_at\":\"2023-02-24T16:32:38Z\",\"deleted_at\":null,\"conditions\":[{\"id\":\"e588f14e-017b-4484-93e0-02a5746ededa\",\"type\":\"traffic\",\"expression\":{\"==\":{\"lhs\":\"net.dst.ip\",\"rhs\":{\"ip\":\"104.244.42.65\"}}},\"created_at\":\"2023-02-24T16:32:38Z\",\"updated_at\":\"2023-02-24T16:32:38Z\",\"deleted_at\":null}],\"traffic\":\"net.dst.ip == 104.244.42.65\",\"identity\":\"\",\"device_posture\":\"\",\"version\":1,\"rule_settings\":{\"block_page_enabled\":false,\"block_reason\":\"\",\"override_ips\":null,\"override_host\":\"\",\"l4override\":{\"ip\":\"145.239.192.199\"},\"biso_admin_controls\":{\"dp\":false,\"dcp\":false,\"dd\":false,\"du\":false,\"dk\":false,\"dcr\":false},\"add_headers\":{},\"ip_categories\":false,\"check_session\":null,\"insecure_disable_dnssec_validation\":false}},\"OldValue\":null,\"OwnerID\":\"1d1e650b3385b95db72bba7cfb1287e9\",\"ResourceID\":\"09cec157-0de7-4143-8c08-d905c6e1be76\",\"ResourceType\":\"gateway.rule\",\"When\":\"2023-02-24T16:32:38Z\"}",
    "event": {
        "action": "gateway_create",
        "category": [
            "network"
        ],
        "dataset": "audit_logs",
        "type": [
            "access"
        ]
    },
    "@timestamp": "2023-02-24T16:32:38Z",
    "cloud": {
        "account": {
            "id": "1d1e650b3385b95db72bba7cfb1287e9"
        }
    },
    "cloudflare": {
        "ActionResult": true,
        "ActorType": "user",
        "ID": "f6773c1b-c332-4d33-8a5b-3e7f6fafde46",
        "Interface": "UI",
        "ResourceID": "09cec157-0de7-4143-8c08-d905c6e1be76",
        "ResourceType": "gateway.rule"
    },
    "observer": {
        "type": "proxy",
        "vendor": "Cloudflare"
    },
    "related": {
        "ip": [
            "78.197.123.35"
        ]
    },
    "source": {
        "address": "78.197.123.35",
        "ip": "78.197.123.35"
    },
    "user": {
        "email": "john.doe@example.org",
        "id": "042fb38530054d63921f9ca81a33d5d2"
    }
}
{
    "message": "{\"ActionResult\":true,\"ActionType\":\"gateway_create_location\",\"ActorEmail\":\"john.doe@example.org\",\"ActorID\":\"042fb38530054d63921f9ca81a33d5d2\",\"ActorIP\":\"::ffff:78.197.123.35\",\"ActorType\":\"user\",\"ID\":\"5cd42473-600e-4610-a85e-ab194b8155ae\",\"Interface\":\"UI\",\"Metadata\":{\"Request\":{\"client_default\":false,\"linked_policies\":null,\"name\":\"AWS VM\",\"networks\":[{\"network\":\"15.188.186.81/32\"}]},\"account_id\":\"1d1e650b3385b95db72bba7cfb1287e9\",\"action_detail\":\"create gateway location\",\"actor_email\":\"john.doe@example.org\",\"location_name\":\"AWS VM\"},\"NewValue\":{\"name\":\"AWS VM\",\"networks\":[{\"network\":\"15.188.186.81/32\"}],\"linked_policies\":null,\"client_default\":false},\"OldValue\":{},\"OwnerID\":\"1d1e650b3385b95db72bba7cfb1287e9\",\"ResourceID\":\"a26c188f10c243338ed4c823fafa06f6\",\"ResourceType\":\"gateway.location\",\"When\":\"2023-02-24T15:09:53Z\"}",
    "event": {
        "action": "gateway_create_location",
        "category": [
            "network"
        ],
        "dataset": "audit_logs",
        "type": [
            "access"
        ]
    },
    "@timestamp": "2023-02-24T15:09:53Z",
    "cloud": {
        "account": {
            "id": "1d1e650b3385b95db72bba7cfb1287e9"
        }
    },
    "cloudflare": {
        "ActionResult": true,
        "ActorType": "user",
        "ID": "5cd42473-600e-4610-a85e-ab194b8155ae",
        "Interface": "UI",
        "ResourceID": "a26c188f10c243338ed4c823fafa06f6",
        "ResourceType": "gateway.location",
        "request_client_default": false,
        "request_name": "AWS VM",
        "request_networks": [
            {
                "network": "15.188.186.81/32"
            }
        ]
    },
    "observer": {
        "type": "proxy",
        "vendor": "Cloudflare"
    },
    "related": {
        "ip": [
            "78.197.123.35"
        ]
    },
    "source": {
        "address": "78.197.123.35",
        "ip": "78.197.123.35"
    },
    "user": {
        "email": "john.doe@example.org",
        "id": "042fb38530054d63921f9ca81a33d5d2"
    }
}
{
    "message": "{\"ActionType\":\"gateway_update\",\"ActorEmail\":\"john.doe@example.org\",\"ActorID\":\"042fb38530054d63921f9ca81a33d5d2\",\"ActorIP\":\"::ffff:78.197.123.35\",\"ActorType\":\"user\",\"ID\":\"3cca43bb-2fb4-4acf-bfe8-06f12e3cce84\",\"Interface\":\"UI\",\"Metadata\":{\"account_id\":\"1d1e650b3385b95db72bba7cfb1287e9\",\"actor_email\":\"john.doe@example.org\"},\"NewValue\":{\"settings\":{\"antivirus\":{\"enabled_download_phase\":true,\"enabled_upload_phase\":true,\"fail_closed\":true},\"tls_decrypt\":{\"enabled\":true},\"activity_log\":{\"enabled\":true},\"block_page\":null,\"fips\":{\"tls\":false}},\"created_at\":\"2023-02-17T08:38:16Z\",\"updated_at\":\"2023-02-24T16:17:11Z\"},\"OldValue\":null,\"OwnerID\":\"1d1e650b3385b95db72bba7cfb1287e9\",\"ResourceID\":\"1d1e650b3385b95db72bba7cfb1287e9\",\"ResourceType\":\"gateway.config\",\"When\":\"2023-02-24T16:17:10Z\"}",
    "event": {
        "action": "gateway_update",
        "category": [
            "network"
        ],
        "dataset": "audit_logs",
        "type": [
            "access"
        ]
    },
    "@timestamp": "2023-02-24T16:17:10Z",
    "cloud": {
        "account": {
            "id": "1d1e650b3385b95db72bba7cfb1287e9"
        }
    },
    "cloudflare": {
        "ActorType": "user",
        "ID": "3cca43bb-2fb4-4acf-bfe8-06f12e3cce84",
        "Interface": "UI",
        "ResourceID": "1d1e650b3385b95db72bba7cfb1287e9",
        "ResourceType": "gateway.config"
    },
    "observer": {
        "type": "proxy",
        "vendor": "Cloudflare"
    },
    "related": {
        "ip": [
            "78.197.123.35"
        ]
    },
    "source": {
        "address": "78.197.123.35",
        "ip": "78.197.123.35"
    },
    "user": {
        "email": "john.doe@example.org",
        "id": "042fb38530054d63921f9ca81a33d5d2"
    }
}
{
    "message": "{\"ActionResult\":true,\"ActionType\":\"job_create\",\"ActorEmail\":\"john.doe@example.org\",\"ActorID\":\"042fb38530054d63921f9ca81a33d5d2\",\"ActorIP\":\"::ffff:78.197.123.35\",\"ActorType\":\"user\",\"ID\":\"abc4831a-502a-4e05-a11f-7151dbce21a8\",\"Interface\":\"API\",\"Metadata\":{\"actor_email\":\"john.doe@example.org\"},\"NewValue\":{\"id\":184770,\"dataset\":\"casb_findings\",\"name\":\"\",\"logpull_options\":\"timestamps=rfc3339\\u0026fields=AssetDisplayName,AssetExternalID,AssetLink,AssetMetadata,DetectedTimestamp,FindingTypeDisplayName,FindingTypeID,FindingTypeSeverity,InstanceID,IntegrationDisplayName,IntegrationID,IntegrationPolicyVendor\",\"destination_conf\":\"https://intake.sekoia.io/plain/batch\",\"enabled\":true,\"frequency\":\"high\",\"kind\":\"\",\"max_upload_bytes\":5000000,\"max_upload_records\":1000},\"OldValue\":{},\"OwnerID\":\"1d1e650b3385b95db72bba7cfb1287e9\",\"ResourceID\":\"184770\",\"ResourceType\":\"logpush job\",\"When\":\"2023-02-24T14:51:23Z\"}",
    "event": {
        "action": "job_create",
        "category": [
            "network"
        ],
        "dataset": "audit_logs",
        "type": [
            "access"
        ]
    },
    "@timestamp": "2023-02-24T14:51:23Z",
    "cloud": {
        "account": {
            "id": "1d1e650b3385b95db72bba7cfb1287e9"
        }
    },
    "cloudflare": {
        "ActionResult": true,
        "ActorType": "user",
        "ID": "abc4831a-502a-4e05-a11f-7151dbce21a8",
        "Interface": "API",
        "ResourceID": "184770",
        "ResourceType": "logpush job"
    },
    "observer": {
        "type": "proxy",
        "vendor": "Cloudflare"
    },
    "related": {
        "ip": [
            "78.197.123.35"
        ]
    },
    "source": {
        "address": "78.197.123.35",
        "ip": "78.197.123.35"
    },
    "user": {
        "email": "john.doe@example.org",
        "id": "042fb38530054d63921f9ca81a33d5d2"
    }
}
{
    "message": "{\"ActionResult\":true,\"ActionType\":\"job_update\",\"ActorEmail\":\"john.doe@example.org\",\"ActorID\":\"042fb38530054d63921f9ca81a33d5d2\",\"ActorIP\":\"::ffff:78.197.123.35\",\"ActorType\":\"user\",\"ID\":\"90c1f5cb-f7e0-48bf-9021-14cb2102a2e1\",\"Interface\":\"UI\",\"Metadata\":{\"actor_email\":\"john.doe@example.org\",\"zone_name\":\"foo-bar-baz.xyz\",\"zone_tag\":\"284fc005c3dfd7e2f3c602aaa5dabac9\"},\"NewValue\":{\"id\":183719,\"dataset\":\"http_requests\",\"name\":\"\",\"logpull_options\":\"fields=ClientIP,ClientRequestHost,ClientRequestMethod,ClientRequestURI,EdgeEndTimestamp,EdgeResponseBytes,EdgeResponseStatus,EdgeStartTimestamp,RayID,BotDetectionIDs,BotScore,BotScoreSrc,BotTags,CacheCacheStatus,CacheReserveUsed,CacheResponseBytes,CacheResponseStatus,CacheTieredFill,ClientASN,ClientCountry,ClientDeviceType,ClientIPClass,ClientMTLSAuthCertFingerprint,ClientMTLSAuthStatus,ClientRegionCode,ClientRequestBytes,ClientRequestPath,ClientRequestProtocol,ClientRequestReferer,ClientRequestScheme,ClientRequestSource,ClientRequestUserAgent,ClientSSLCipher,ClientSSLProtocol,ClientSrcPort,ClientTCPRTTMs,ClientXRequestedWith,ContentScanObjResults,ContentScanObjTypes,Cookies,EdgeCFConnectingO2O,EdgeColoCode,EdgeColoID,EdgePathingOp,EdgePathingSrc,EdgePathingStatus,EdgeRateLimitAction,EdgeRateLimitID,EdgeRequestHost,EdgeResponseBodyBytes,EdgeResponseCompressionRatio,EdgeResponseContentType,EdgeServerIP,EdgeTimeToFirstByteMs,FirewallMatchesActions,FirewallMatchesRuleIDs,FirewallMatchesSources,JA3Hash,OriginDNSResponseTimeMs,OriginIP,OriginRequestHeaderSendDurationMs,OriginResponseBytes,OriginResponseDurationMs,OriginResponseHTTPExpires,OriginResponseHTTPLastModified,OriginResponseHeaderReceiveDurationMs,OriginResponseStatus,OriginResponseTime,OriginSSLProtocol,OriginTCPHandshakeDurationMs,OriginTLSHandshakeDurationMs,ParentRayID,RequestHeaders,ResponseHeaders,SecurityLevel,SmartRouteColoID,UpperTierColoID,WAFAction,WAFAttackScore,WAFFlags,WAFMatchedVar,WAFProfile,WAFRCEAttackScore,WAFRuleID,WAFRuleMessage,WAFSQLiAttackScore,WAFXSSAttackScore,WorkerCPUTime,WorkerStatus,WorkerSubrequest,WorkerSubrequestCount,WorkerWallTimeUs,ZoneName\\u0026timestamps=rfc3339\\u0026CVE-2021-44228=false\",\"destination_conf\":\"https://intake.sekoia.io/plain/batch\",\"enabled\":true,\"logstream\":true,\"frequency\":\"high\",\"kind\":\"\",\"max_upload_bytes\":5000000,\"max_upload_records\":1000},\"OldValue\":{\"id\":183719,\"dataset\":\"http_requests\",\"name\":\"\",\"logpull_options\":\"fields=ClientIP,ClientRequestHost,ClientRequestMethod,ClientRequestURI,EdgeEndTimestamp,EdgeResponseBytes,EdgeResponseStatus,EdgeStartTimestamp,RayID\\u0026timestamps=rfc3339\",\"destination_conf\":\"https://intake.sekoia.io/plain/batch\",\"enabled\":true,\"logstream\":true,\"frequency\":\"high\",\"kind\":\"\",\"max_upload_bytes\":5000000,\"max_upload_records\":1000},\"OwnerID\":\"1d1e650b3385b95db72bba7cfb1287e9\",\"ResourceID\":\"183719\",\"ResourceType\":\"logpush job\",\"When\":\"2023-02-24T17:00:39Z\"}",
    "event": {
        "action": "job_update",
        "category": [
            "network"
        ],
        "dataset": "audit_logs",
        "type": [
            "access"
        ]
    },
    "@timestamp": "2023-02-24T17:00:39Z",
    "cloud": {
        "account": {
            "id": "1d1e650b3385b95db72bba7cfb1287e9"
        }
    },
    "cloudflare": {
        "ActionResult": true,
        "ActorType": "user",
        "ID": "90c1f5cb-f7e0-48bf-9021-14cb2102a2e1",
        "Interface": "UI",
        "ResourceID": "183719",
        "ResourceType": "logpush job",
        "zone_name": "foo-bar-baz.xyz",
        "zone_tag": "284fc005c3dfd7e2f3c602aaa5dabac9"
    },
    "observer": {
        "type": "proxy",
        "vendor": "Cloudflare"
    },
    "related": {
        "ip": [
            "78.197.123.35"
        ]
    },
    "source": {
        "address": "78.197.123.35",
        "ip": "78.197.123.35"
    },
    "user": {
        "email": "john.doe@example.org",
        "id": "042fb38530054d63921f9ca81a33d5d2"
    }
}

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.ActionResult boolean Whether the action was successful.
cloudflare.ActorType keyword Type of user that started the audit trail.
cloudflare.ID keyword Unique identifier of an audit log.
cloudflare.Interface keyword Entry point or interface of the audit log.
cloudflare.ResourceID keyword Unique identifier of the resource within Cloudflare’s system.
cloudflare.ResourceType keyword The type of resource that was changed.
cloudflare.request_client_default boolean Additional audit log-specific information.
cloudflare.request_name keyword Additional audit log-specific information.
cloudflare.request_networks array Additional audit log-specific information.
cloudflare.zone_name keyword Additional audit log-specific information.
cloudflare.zone_tag keyword Additional audit log-specific information.
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.type keyword Event type. The third categorization field in the hierarchy.
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.
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" \
-d '{
    "dataset": "audit_logs",    
    "enabled": true,     
    "max_upload_bytes": 5000000,     
    "max_upload_records": 1000,
    "logpull_options":"fields=ActionResult,ActionType,ActorEmail,ActorID,ActorIP,ActorType,ID,Interface,Metadata,NewValue,OldValue,OwnerID,ResourceID,ResourceType,When&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": "audit_logs",
        "frequency":"high",
        "kind":"", 
        "max_upload_bytes": 5000000,     
        "max_upload_records": 1000, 
        "enabled": true,
        "name": "<DOMAIN_NAME>",
        "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...)