VPC Flow Logs
Overview
Amazon VPC Flow Logs is a feature that provides the ability to capture information about IP network traffic as it enters or exits from network interface in your Amazon VPC (Amazon Virtual Private Cloud). VPC Flow Logs can help you with a number of tasks, such as:
- Diagnosing overly restrictive security group rules
- Monitoring the traffic that is reaching your instance
- Determining the direction of the traffic to and from the network interfaces
Related Built-in Rules
Benefit from SEKOIA.IO built-in rules and upgrade AWS VPC Flow Logs with the following detection capabilities out-of-the-box.
SEKOIA.IO x AWS VPC Flow Logs on ATT&CK Navigator
SEKOIA.IO Intelligence Feed
Detect threats based on indicators of compromise (IOCs) collected by SEKOIA's Threat and Detection Research team.
- Effort: elementary
Event Categories
The following table lists the data source offered by this integration.
Data Source | Description |
---|---|
Host network interface |
every packets passing through the AWS account are logged |
Netflow/Enclave netflow |
AWS Flow Logs are Netflow-like |
Network device logs |
packets logged by 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 | event |
Category | ["network"] |
Type | `` |
Event Samples
Find below few samples of events and how they are normalized by Sekoia.io.
{
"message": "2 424805057484 eni-0f06a40fc9be596f6 212.83.179.156 10.0.0.96 123 123 17 2 152 1599665193 1599665488 ACCEPT OK",
"event": {
"kind": "event",
"category": [
"network"
],
"start": "2020-09-09T15:26:33Z",
"end": "2020-09-09T15:31:28Z",
"action": "accept",
"type": [
"allowed"
]
},
"action": {
"outcome": "ok",
"type": "forward",
"name": "accept",
"target": "network-traffic"
},
"cloud": {
"provider": "aws",
"service": {
"name": "vpc"
},
"account": {
"id": "424805057484"
}
},
"destination": {
"port": 123,
"ip": "10.0.0.96",
"address": "10.0.0.96"
},
"network": {
"iana_number": "17",
"transport": "udp"
},
"observer": {
"ingress": {
"interface": {
"name": "eni-0f06a40fc9be596f6"
}
}
},
"source": {
"port": 123,
"bytes": 152,
"packets": 2,
"ip": "212.83.179.156",
"address": "212.83.179.156"
},
"user": {
"id": "424805057484"
},
"@timestamp": "2020-09-09T15:26:33Z",
"related": {
"ip": [
"10.0.0.96",
"212.83.179.156"
]
}
}
{
"message": "{\"version\":2,\"account_id\":\"424805057484\",\"interface_id\":\"eni-0f06a40fc9be596f6\",\"srcaddr\":\"5.6.7.8\",\"dstaddr\":\"1.2.3.4\",\"srcport\":4712,\"dstport\":53205,\"protocol\":6,\"packets\":12,\"bytes\":2610,\"start\":1661950735,\"end\":1661950746,\"action\":\"ACCEPT\",\"log_status\":\"OK\"}\n",
"event": {
"kind": "event",
"category": [
"network"
],
"start": "2022-08-31T12:58:55Z",
"end": "2022-08-31T12:59:06Z",
"action": "accept",
"type": [
"allowed"
]
},
"action": {
"outcome": "ok",
"type": "forward",
"name": "accept",
"target": "network-traffic"
},
"cloud": {
"provider": "aws",
"service": {
"name": "vpc"
},
"account": {
"id": "424805057484"
}
},
"destination": {
"port": 53205,
"ip": "1.2.3.4",
"address": "1.2.3.4"
},
"network": {
"iana_number": "6",
"transport": "tcp"
},
"observer": {
"ingress": {
"interface": {
"name": "eni-0f06a40fc9be596f6"
}
}
},
"source": {
"port": 4712,
"bytes": 2610,
"packets": 12,
"ip": "5.6.7.8",
"address": "5.6.7.8"
},
"user": {
"id": "424805057484"
},
"@timestamp": "2022-08-31T12:58:55Z",
"related": {
"ip": [
"1.2.3.4",
"5.6.7.8"
]
}
}
{
"message": "5 424805057484 eni-1235b8ca123456789 52.95.128.179 10.0.0.71 46945 53 17 1 73 1658131186 1658131216 ACCEPT OK vpc-abcdefab012345678 subnet-aaaaaaaa012345678 - 0 IPv4 52.95.128.179 10.0.0.71 eu-west-1 euw1-az3 - - - - egress 8",
"event": {
"kind": "event",
"category": [
"network"
],
"start": "2022-07-18T07:59:46Z",
"end": "2022-07-18T08:00:16Z",
"action": "accept",
"type": [
"allowed"
]
},
"action": {
"outcome": "ok",
"type": "forward",
"name": "accept",
"target": "network-traffic"
},
"cloud": {
"provider": "aws",
"service": {
"name": "vpc"
},
"account": {
"id": "424805057484"
}
},
"destination": {
"port": 53,
"ip": "10.0.0.71",
"address": "10.0.0.71"
},
"network": {
"iana_number": "17",
"transport": "udp"
},
"observer": {
"ingress": {
"interface": {
"name": "eni-1235b8ca123456789"
}
}
},
"source": {
"port": 46945,
"bytes": 73,
"packets": 1,
"ip": "52.95.128.179",
"address": "52.95.128.179"
},
"user": {
"id": "424805057484"
},
"@timestamp": "2022-07-18T07:59:46Z",
"related": {
"ip": [
"10.0.0.71",
"52.95.128.179"
]
}
}
{
"message": "2 123456789010 eni-1235b8ca123456789 2001:db8:1234:a100:8d6e:3477:df66:f105 2001:db8:1234:a102:3304:8879:34cf:4071 34892 22 6 54 8855 1477913708 1477913820 ACCEPT OK",
"event": {
"kind": "event",
"category": [
"network"
],
"start": "2016-10-31T11:35:08Z",
"end": "2016-10-31T11:37:00Z",
"action": "accept",
"type": [
"allowed"
]
},
"action": {
"outcome": "ok",
"type": "forward",
"name": "accept",
"target": "network-traffic"
},
"cloud": {
"provider": "aws",
"service": {
"name": "vpc"
},
"account": {
"id": "123456789010"
}
},
"destination": {
"port": 22,
"ip": "2001:db8:1234:a102:3304:8879:34cf:4071",
"address": "2001:db8:1234:a102:3304:8879:34cf:4071"
},
"network": {
"iana_number": "6",
"transport": "tcp"
},
"observer": {
"ingress": {
"interface": {
"name": "eni-1235b8ca123456789"
}
}
},
"source": {
"port": 34892,
"bytes": 8855,
"packets": 54,
"ip": "2001:db8:1234:a100:8d6e:3477:df66:f105",
"address": "2001:db8:1234:a100:8d6e:3477:df66:f105"
},
"user": {
"id": "123456789010"
},
"@timestamp": "2016-10-31T11:35:08Z",
"related": {
"ip": [
"2001:db8:1234:a100:8d6e:3477:df66:f105",
"2001:db8:1234:a102:3304:8879:34cf:4071"
]
}
}
{
"message": "2 123456789010 eni-1235b8ca123456789 - - - - - - - 1431280876 1431280934 - NODATA",
"event": {
"kind": "event",
"category": [
"network"
],
"start": "2015-05-10T18:01:16Z",
"end": "2015-05-10T18:02:14Z"
},
"action": {
"outcome": "nodata",
"type": "forward"
},
"cloud": {
"provider": "aws",
"service": {
"name": "vpc"
},
"account": {
"id": "123456789010"
}
},
"observer": {
"ingress": {
"interface": {
"name": "eni-1235b8ca123456789"
}
}
},
"user": {
"id": "123456789010"
},
"@timestamp": "2015-05-10T18:01:16Z"
}
{
"message": "2 424805057484 eni-0f06a40fc9be596f6 195.14.170.50 10.0.0.96 53996 20248 6 1 40 1599665374 1599665428 REJECT OK",
"event": {
"kind": "event",
"category": [
"network"
],
"start": "2020-09-09T15:29:34Z",
"end": "2020-09-09T15:30:28Z",
"action": "reject",
"type": [
"denied"
]
},
"action": {
"outcome": "ok",
"type": "forward",
"name": "reject",
"target": "network-traffic"
},
"cloud": {
"provider": "aws",
"service": {
"name": "vpc"
},
"account": {
"id": "424805057484"
}
},
"destination": {
"port": 20248,
"ip": "10.0.0.96",
"address": "10.0.0.96"
},
"network": {
"iana_number": "6",
"transport": "tcp"
},
"observer": {
"ingress": {
"interface": {
"name": "eni-0f06a40fc9be596f6"
}
}
},
"source": {
"port": 53996,
"bytes": 40,
"packets": 1,
"ip": "195.14.170.50",
"address": "195.14.170.50"
},
"user": {
"id": "424805057484"
},
"@timestamp": "2020-09-09T15:29:34Z",
"related": {
"ip": [
"10.0.0.96",
"195.14.170.50"
]
}
}
{
"message": "{\"version\":2,\"account_id\":\"424805057484\",\"interface_id\":\"eni-0f06a40fc9be596f6\",\"srcaddr\":\"1.2.3.4\",\"dstaddr\":\"5.6.7.8\",\"srcport\":53094,\"dstport\":2323,\"protocol\":6,\"packets\":1,\"bytes\":40,\"start\":1661950735,\"end\":1661950746,\"action\":\"REJECT\",\"log_status\":\"OK\"}\n",
"event": {
"kind": "event",
"category": [
"network"
],
"start": "2022-08-31T12:58:55Z",
"end": "2022-08-31T12:59:06Z",
"action": "reject",
"type": [
"denied"
]
},
"action": {
"outcome": "ok",
"type": "forward",
"name": "reject",
"target": "network-traffic"
},
"cloud": {
"provider": "aws",
"service": {
"name": "vpc"
},
"account": {
"id": "424805057484"
}
},
"destination": {
"port": 2323,
"ip": "5.6.7.8",
"address": "5.6.7.8"
},
"network": {
"iana_number": "6",
"transport": "tcp"
},
"observer": {
"ingress": {
"interface": {
"name": "eni-0f06a40fc9be596f6"
}
}
},
"source": {
"port": 53094,
"bytes": 40,
"packets": 1,
"ip": "1.2.3.4",
"address": "1.2.3.4"
},
"user": {
"id": "424805057484"
},
"@timestamp": "2022-08-31T12:58:55Z",
"related": {
"ip": [
"1.2.3.4",
"5.6.7.8"
]
}
}
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.name |
keyword |
The name of the action |
action.outcome |
keyword |
The outcome of the action |
action.target |
keyword |
The target of the action |
action.type |
keyword |
The type of the action |
cloud.account.id |
keyword |
The cloud account or organization id. |
cloud.provider |
keyword |
Name of the cloud provider. |
cloud.service.name |
keyword |
The cloud service name. |
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.end |
date |
event.end contains the date when the event ended or when the activity was last observed. |
event.kind |
keyword |
The kind of the event. The highest categorization field in the hierarchy. |
event.start |
date |
event.start contains the date when the event started or when the activity was first observed. |
network.iana_number |
keyword |
IANA Protocol Number. |
observer.ingress.interface.name |
keyword |
Interface name |
source.bytes |
long |
Bytes sent from the source to the destination. |
source.ip |
ip |
IP address of the source. |
source.packets |
long |
Packets sent from the source to the destination. |
source.port |
long |
Port of the source. |
user.id |
keyword |
Unique identifier of the user. |
Configure
VPC Flow Logs
As a prerequisite, you need an existing VPC, subnet or network interface (Elastic Load Balancing, Amazon RDS, Amazon ElastiCache, Amazon Redshift, Amazon WorkSpaces, NAT gateways, Transit gateways) to create a flow log. If you create a flow log for a subnet or VPC, each network interface in that subnet or VPC is monitored.
In the AWS console, navigate to: Services > VPC
. From there, select the resource for which you want to capture information. The flow logs are available on the following resources: VPC, subnet, or network interfaces.
For VPC and subnet:
- Select the specific resource to monitor
- Go to the tab
Flow logs
- Click on
Create flow log
- Set up the flow log: we recommend to capture all traffic (accepted and rejected).
Prerequisites
- An administator access to the Amazon console with the permission to create SQS queue and S3 notifications.
- A self managed AWS S3 bucket where events will be published prior to be consumed by Sekoia.io.
Create a SQS queue
This integration relies on S3 Event Notifications (SQS) to discover new S3 objects.
To enable the S3 Event Notification:
- Create a queue in the SQS service by following this guide
- In the Access Policy step, choose the advanced configuration and adapt this configuration sample with your own SQS Amazon Resource Name (ARN) (the main change is the Service directive allowing S3 bucket access):
{ "Version": "2008-10-17", "Id": "__default_policy_ID", "Statement": [ { "Sid": "__owner_statement", "Effect": "Allow", "Principal": { "Service": "s3.amazonaws.com" }, "Action": "SQS:*", "Resource": "arn:aws:sqs:XXX:XXX" } ] }
Note
Keep in mind that you have to create the SQS queue in the same region as the S3 bucket you want to watch.
Create a S3 Event Notification
Use the following guide to create S3 Event Notification and then:
- Select the notification for object creation in the Event type section
- As the destination, choose the SQS service
- Select the queue you created in the previous section
Create the intake
Go to the intake page and create a new intake from the format AWS Flowlogs
.
Pull events
To start to pull events, you have to:
- Go to the playbook page and create a new playbook with the AWS Fetch new logs on S3 connector.
- Set up the module configuration with the AWS Access Key, the secret key and the region name. Set up the trigger configuration with the name of the SQS queue and the intake key, from the intake previously created.
- Start the playbook and enjoy your events.