Firewall events
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 Firewall events to Sekoia.io.
Related Built-in Rules
Benefit from SEKOIA.IO built-in rules and upgrade Cloudflare WAF events with the following detection capabilities out-of-the-box.
SEKOIA.IO x Cloudflare WAF events on ATT&CK Navigator
Bazar Loader DGA (Domain Generation Algorithm)
Detects Bazar Loader domains based on the Bazar Loader DGA
- Effort: elementary
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
Nimbo-C2 User Agent
Nimbo-C2 Uses an unusual User-Agent format in its implants.
- Effort: intermediate
Potential Azure AD Phishing Page (Adversary-in-the-Middle)
Detects an HTTP request to an URL typical of the Azure AD authentication flow, but towards a domain that is not one the legitimate Microsoft domains used for Azure AD authentication.
- Effort: intermediate
Potential Bazar Loader User-Agents
Detects potential Bazar loader communications through the user-agent
- Effort: elementary
Potential DNS Tunnel
Detects domain name which is longer than 95 characters. Long domain names are distinctive of DNS tunnels.
- Effort: advanced
Potential Lemon Duck User-Agent
Detects LemonDuck user agent. The format used two sets of alphabetical characters separated by dashes, for example "User-Agent: Lemon-Duck-[A-Z]-[A-Z]".
- Effort: elementary
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 |
---|---|
Web application firewall logs |
Cloudflare protect web application with its web application firewall |
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": "{\"Action\":\"block\",\"ClientIP\":\"113.206.179.28\",\"ClientRequestHost\":\"foo-bar-baz.xyz\",\"ClientRequestMethod\":\"GET\",\"ClientRequestPath\":\"/static/favicon.ico\",\"ClientRequestQuery\":\"\",\"Datetime\":1657630626219000000,\"EdgeResponseStatus\":403,\"RayID\":\"7299f155dda47d6b\"}",
"event": {
"action": "block",
"kind": "event",
"category": [
"network"
],
"dataset": "firewall-events",
"type": [
"denied"
]
},
"source": {
"ip": "113.206.179.28",
"address": "113.206.179.28"
},
"@timestamp": "2022-07-12T12:57:06.219000Z",
"destination": {
"domain": "foo-bar-baz.xyz",
"address": "foo-bar-baz.xyz",
"top_level_domain": "xyz",
"registered_domain": "foo-bar-baz.xyz"
},
"http": {
"request": {
"method": "GET"
},
"response": {
"status_code": 403
}
},
"url": {
"domain": "foo-bar-baz.xyz",
"path": "/static/favicon.ico",
"top_level_domain": "xyz",
"registered_domain": "foo-bar-baz.xyz"
},
"observer": {
"vendor": "Cloudflare",
"type": "firewall"
},
"cloudflare": {
"EdgeResponseStatus": 403,
"RayID": "7299f155dda47d6b"
},
"related": {
"hosts": [
"foo-bar-baz.xyz"
],
"ip": [
"113.206.179.28"
]
}
}
{
"message": "{\"Action\":\"block\",\"ClientASN\":4562,\"ClientASNDescription\":\"PERFORMIVE\",\"ClientCountry\":\"us\",\"ClientIP\":\"10.6.12.26\",\"ClientIPClass\":\"noRecord\",\"ClientRefererHost\":\"\",\"ClientRefererPath\":\"\",\"ClientRefererQuery\":\"\",\"ClientRefererScheme\":\"\",\"ClientRequestHost\":\"foo-bar-baz.xyz\",\"ClientRequestMethod\":\"GET\",\"ClientRequestPath\":\"/.env\",\"ClientRequestProtocol\":\"HTTP/1.1\",\"ClientRequestQuery\":\"\",\"ClientRequestScheme\":\"http\",\"ClientRequestUserAgent\":\"Mozilla/5.0 (Linux; U; Android 4.4.2; en-US; HM NOTE 1W Build/KOT49H) AppleWebKit/534.30 (KHTML, like Gecko) Version/4.0 UCBrowser/11.0.5.850 U3/0.8.0 Mobile Safari/534.30\",\"Datetime\":1669858111716000000,\"EdgeColoCode\":\"EWR\",\"EdgeResponseStatus\":403,\"Kind\":\"firewall\",\"MatchIndex\":0,\"Metadata\":{\"group\":\"cloudflare_specials\",\"rule_message\":\"Version Control - Information Disclosure\"},\"OriginResponseStatus\":0,\"OriginatorRayID\":\"00\",\"RayID\":\"77280bee38a6c461\",\"RuleID\":\"100016\",\"Source\":\"waf\"}",
"event": {
"action": "block",
"kind": "event",
"category": [
"network"
],
"dataset": "firewall-events",
"type": [
"denied"
],
"module": "cloudflare.waf"
},
"source": {
"ip": "10.6.12.26",
"geo": {
"country_name": "us"
},
"address": "10.6.12.26"
},
"@timestamp": "2022-12-01T01:28:31.716000Z",
"destination": {
"domain": "foo-bar-baz.xyz",
"address": "foo-bar-baz.xyz",
"top_level_domain": "xyz",
"registered_domain": "foo-bar-baz.xyz"
},
"http": {
"request": {
"method": "GET"
},
"version": "HTTP/1.1",
"response": {
"status_code": 403
}
},
"url": {
"domain": "foo-bar-baz.xyz",
"path": "/.env",
"scheme": "http",
"top_level_domain": "xyz",
"registered_domain": "foo-bar-baz.xyz"
},
"user_agent": {
"original": "Mozilla/5.0 (Linux; U; Android 4.4.2; en-US; HM NOTE 1W Build/KOT49H) AppleWebKit/534.30 (KHTML, like Gecko) Version/4.0 UCBrowser/11.0.5.850 U3/0.8.0 Mobile Safari/534.30",
"device": {
"name": "XiaoMi HM NOTE 1W"
},
"name": "UC Browser",
"version": "11.0.5",
"os": {
"name": "Android",
"version": "4.4.2"
}
},
"network": {
"protocol": "HTTP/1.1"
},
"observer": {
"vendor": "Cloudflare",
"type": "firewall"
},
"cloudflare": {
"ClientIPClass": "noRecord",
"ClientRefererHost": "",
"ClientRefererPath": "",
"ClientRefererQuery": "",
"ClientRefererScheme": "",
"EdgeColoCode": "EWR",
"EdgeResponseStatus": 403,
"Kind": "firewall",
"OriginResponseStatus": 0,
"OriginatorRayID": "00",
"RayID": "77280bee38a6c461",
"source": "waf"
},
"related": {
"hosts": [
"foo-bar-baz.xyz"
],
"ip": [
"10.6.12.26"
]
}
}
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. |
cloudflare.ClientIPClass |
string |
The classification of the visitor’s IP address, possible values are: unknown |
cloudflare.ClientRefererHost |
string |
The referer host |
cloudflare.ClientRefererPath |
string |
The referer path requested by visitor |
cloudflare.ClientRefererQuery |
string |
The referer query-string was requested by the visitor |
cloudflare.ClientRefererScheme |
string |
The referer URL scheme requested by the visitor |
cloudflare.EdgeColoCode |
string |
IATA airport code of data center that received the request |
cloudflare.EdgeResponseStatus |
number |
HTTP status code returned by Cloudflare to the client |
cloudflare.Kind |
string |
The dataset of the event |
cloudflare.OriginResponseStatus |
number |
status returned by the origin server |
cloudflare.OriginatorRayID |
string |
The RayID of the request that issued the challenge/jschallenge |
cloudflare.RayID |
string |
ID of the request |
cloudflare.clientASNDescription |
keyword |
The ASN of the visitor as string |
cloudflare.matchIndex |
number |
Rules match index in the chain |
cloudflare.metadata |
object |
Additional product-specific information. Metadata is organized in key:value pairs. Key and Value formats can vary by Cloudflare security product and can change over time |
cloudflare.source |
keyword |
The Cloudflare security product triggered by this request |
destination.domain |
keyword |
The domain name 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.module |
keyword |
Name of the module this data is coming from. |
http.request.bytes |
long |
Total size in bytes of the request (body and headers). |
http.request.method |
keyword |
HTTP request method. |
http.request.referrer |
keyword |
Referrer for this HTTP request. |
http.response.status_code |
long |
HTTP response status code. |
http.version |
keyword |
HTTP version. |
network.protocol |
keyword |
Application protocol name. |
observer.type |
keyword |
The type of the observer the data is coming from. |
observer.vendor |
keyword |
Vendor name of the observer. |
rule.description |
keyword |
Rule description |
rule.id |
keyword |
Rule ID |
rule.reference |
keyword |
Rule reference URL |
rule.ruleset |
keyword |
Rule ruleset |
source.as.number |
long |
Unique number allocated to the autonomous system. |
source.geo.country_name |
keyword |
Country name. |
source.ip |
ip |
IP address of the source. |
source.port |
long |
Port of the source. |
tls.cipher |
keyword |
String indicating the cipher used during the current connection. |
tls.version_protocol |
keyword |
Normalized lowercase protocol name parsed from original string. |
url.domain |
keyword |
Domain of the url. |
url.path |
wildcard |
Path of the request, such as "/search". |
url.query |
keyword |
Query string of the request. |
url.scheme |
keyword |
Scheme of the url. |
user_agent.original |
keyword |
Unparsed user_agent string. |
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 :
-
Cloudflare API Token
- Go to
My Profile
, then on the left panel, click onAPI Tokens
. - Click on the
Create Token
button and select theCreate 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 - Go to
-
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 theZone 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/zones/<CLOUDFLARE_ZONE_ID>/logpush/jobs \
-H "Authorization: Bearer <CLOUDFLARE_API_TOKEN>" \
-H "Content-Type: application/json" \
--data '{
"dataset": "firewall_events",
"enabled": true,
"max_upload_bytes": 5000000,
"max_upload_records": 1000,
"logpull_options":"fields=Action,ClientASN,ClientASNDescription,ClientCountry,ClientIP,ClientIPClass,ClientRefererHost,ClientRefererPath,ClientRefererQuery,ClientRefererScheme,ClientRequestHost,ClientRequestMethod,ClientRequestPath,ClientRequestProtocol,ClientRequestQuery,ClientRequestScheme,ClientRequestUserAgent,Datetime,EdgeColoCode,EdgeResponseStatus,Kind,MatchIndex,Metadata,OriginResponseStatus,OriginatorRayID,RayID,RuleID,Source×tamps=unix",
"destination_conf": "https://intake.sekoia.io/plain/batch?header_X-SEKOIAIO-INTAKE-KEY=<YOUR_INTAKE_KEY>"
}' # (1)
- will return
{ "errors": [], "messages": [], "result": { "id": 147, "dataset": "firewall_events", "enabled": false, "name": "<DOMAIN_NAME>", "logpull_options": "fields=<LIST_OF_FIELDS>×tamps=rfc3339", "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 }, "success": true }
Important
Replace :
<YOUR_INTAKE_KEY>
with the Intake key you generated in the Create the intake on Sekoia.io step.<CLOUDFLARE_API_TOKEN>
with the API Token you generated<CLOUDFLARE_ZONE_ID>
with the Zone ID you grabbed
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/zones/<ZONE_ID>/logpush/jobs/<JOB_ID>
to verify the job you previously created is correct (you need to specify theJOB_ID
)https://api.cloudflare.com/client/v4/zones/<ZONE_ID>/logpush/datasets/<DATASET>/jobs
to get all the jobs for a specific dataset (dns_log
,firewalls_events
orhttp_requests
in our case)https://api.cloudflare.com/client/v4/zones/<ZONE_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...)