File size: 8,903 Bytes
ebf59f3
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
b2b10b4
 
 
 
 
 
 
 
3f275a4
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
b2b10b4
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
---
dataset_info:
  features:
  - name: flow_id
    dtype: string
  - name: features
    struct:
    - name: src_port
      dtype: float32
    - name: dst_port
      dtype: float32
    - name: protocol
      dtype: float32
    - name: flow_duration
      dtype: float32
    - name: total_fwd_packet
      dtype: float32
    - name: total_bwd_packets
      dtype: float32
    - name: total_length_of_fwd_packet
      dtype: float32
    - name: total_length_of_bwd_packet
      dtype: float32
    - name: fwd_packet_length_max
      dtype: float32
    - name: fwd_packet_length_min
      dtype: float32
    - name: fwd_packet_length_mean
      dtype: float32
    - name: fwd_packet_length_std
      dtype: float32
    - name: bwd_packet_length_max
      dtype: float32
    - name: bwd_packet_length_min
      dtype: float32
    - name: bwd_packet_length_mean
      dtype: float32
    - name: bwd_packet_length_std
      dtype: float32
    - name: flow_bytes_per_s
      dtype: float32
    - name: flow_packets_per_s
      dtype: float32
    - name: flow_iat_mean
      dtype: float32
    - name: flow_iat_std
      dtype: float32
    - name: flow_iat_max
      dtype: float32
    - name: flow_iat_min
      dtype: float32
    - name: fwd_iat_total
      dtype: float32
    - name: fwd_iat_mean
      dtype: float32
    - name: fwd_iat_std
      dtype: float32
    - name: fwd_iat_max
      dtype: float32
    - name: fwd_iat_min
      dtype: float32
    - name: bwd_iat_total
      dtype: float32
    - name: bwd_iat_mean
      dtype: float32
    - name: bwd_iat_std
      dtype: float32
    - name: bwd_iat_max
      dtype: float32
    - name: bwd_iat_min
      dtype: float32
    - name: fwd_psh_flags
      dtype: float32
    - name: bwd_psh_flags
      dtype: float32
    - name: fwd_urg_flags
      dtype: float32
    - name: bwd_urg_flags
      dtype: float32
    - name: fwd_header_length
      dtype: float32
    - name: bwd_header_length
      dtype: float32
    - name: fwd_packets_per_s
      dtype: float32
    - name: bwd_packets_per_s
      dtype: float32
    - name: packet_length_min
      dtype: float32
    - name: packet_length_max
      dtype: float32
    - name: packet_length_mean
      dtype: float32
    - name: packet_length_std
      dtype: float32
    - name: packet_length_variance
      dtype: float32
    - name: fin_flag_count
      dtype: float32
    - name: syn_flag_count
      dtype: float32
    - name: rst_flag_count
      dtype: float32
    - name: psh_flag_count
      dtype: float32
    - name: ack_flag_count
      dtype: float32
    - name: urg_flag_count
      dtype: float32
    - name: cwr_flag_count
      dtype: float32
    - name: ece_flag_count
      dtype: float32
    - name: down_per_up_ratio
      dtype: float32
    - name: average_packet_size
      dtype: float32
    - name: fwd_segment_size_avg
      dtype: float32
    - name: bwd_segment_size_avg
      dtype: float32
    - name: fwd_bytes_per_bulk_avg
      dtype: float32
    - name: fwd_packet_per_bulk_avg
      dtype: float32
    - name: fwd_bulk_rate_avg
      dtype: float32
    - name: bwd_bytes_per_bulk_avg
      dtype: float32
    - name: bwd_packet_per_bulk_avg
      dtype: float32
    - name: bwd_bulk_rate_avg
      dtype: float32
    - name: subflow_fwd_packets
      dtype: float32
    - name: subflow_fwd_bytes
      dtype: float32
    - name: subflow_bwd_packets
      dtype: float32
    - name: subflow_bwd_bytes
      dtype: float32
    - name: fwd_init_win_bytes
      dtype: float32
    - name: bwd_init_win_bytes
      dtype: float32
    - name: fwd_act_data_pkts
      dtype: float32
    - name: fwd_seg_size_min
      dtype: float32
    - name: active_mean
      dtype: float32
    - name: active_std
      dtype: float32
    - name: active_max
      dtype: float32
    - name: active_min
      dtype: float32
    - name: idle_mean
      dtype: float32
    - name: idle_std
      dtype: float32
    - name: idle_max
      dtype: float32
    - name: idle_min
      dtype: float32
  - name: semantic_flags
    struct:
    - name: high_packet_rate
      dtype: int8
    - name: one_way_traffic
      dtype: int8
    - name: syn_ack_imbalance
      dtype: int8
    - name: uniform_packet_size
      dtype: int8
    - name: long_idle_c2
      dtype: int8
  - name: label
    dtype:
      class_label:
        names:
          '0': benign
          '1': attack
  splits:
  - name: train
    num_bytes: 248127049
    num_examples: 671088
  - name: validation
    num_bytes: 62032886
    num_examples: 167772
  - name: test
    num_bytes: 77540185
    num_examples: 209715
  download_size: 119245598
  dataset_size: 387700120
configs:
- config_name: default
  data_files:
  - split: train
    path: data/train-*
  - split: validation
    path: data/validation-*
  - split: test
    path: data/test-*
task_categories:
- tabular-classification
language:
- en
tags:
- cybersecurity
size_categories:
- 1M<n<10M
---
# CICFlow Binary Intrusion Detection Dataset

## Overview

This dataset provides a **binary network intrusion detection (IDS) benchmark** derived from **CICFlowMeter flow-level features**.

The task is to determine whether a given network flow is **benign** or **malicious**, making this dataset suitable for:

* Practical IDS research
* Rule-based and hybrid ML systems
* High-imbalance classification experiments
* Explainable security modeling

---

## Task

**Binary classification**

> *Given a network flow represented by CICFlowMeter features, predict whether it corresponds to an attack.*

---

## Labels

| Label ID | Name | Description |
| -------: | ------ | ----------------------------------------------- |
| 0 | benign | Normal network traffic |
| 1 | attack | Any malicious traffic (all attack types merged) |

### Label construction

The binary label was derived by collapsing a multiclass IDS taxonomy:

* `benign``0`
* all attack categories → `1`

No other transformations were applied to the labels.

---

## Dataset Structure

```text
DatasetDict({
train,
validation,
test
})
```

Each split contains records with the following schema:

```text
flow_id: string
features: dict[str, float]
semantic_flags: dict[str, int]
label: ClassLabel (benign / attack)
```

---

## Feature Description

### 1. Raw Numeric Features (`features`)

The `features` field contains **flow-level statistics extracted by CICFlowMeter**.

These include:

#### Traffic volume & direction

* `total_fwd_packets`, `total_bwd_packets`
* `total_length_of_fwd_packets`
* `total_length_of_bwd_packets`
* `down_up_ratio`

#### Packet size statistics

* `packet_length_min`, `packet_length_max`
* `packet_length_mean`, `packet_length_std`, `packet_length_variance`
* Forward and backward packet length metrics

#### Timing & inter-arrival times

* `flow_duration`
* `flow_iat_mean`, `flow_iat_std`, `flow_iat_max`, `flow_iat_min`
* Forward and backward IAT statistics
* `active_*`, `idle_*` features

#### Rate-based features

* `flow_bytes_per_s`
* `flow_packets_per_s`
* `fwd_packets_per_s`, `bwd_packets_per_s`

#### TCP flag counters

* `syn_flag_count`, `ack_flag_count`, `rst_flag_count`
* `fin_flag_count`, `psh_flag_count`, `urg_flag_count`
* `cwr_flag_count`, `ece_flag_count`

#### Bulk and subflow statistics

* `*_bulk_*` features
* `subflow_fwd_*`, `subflow_bwd_*`

> **Note:** Some CICFlowMeter features are conditionally emitted.
> Missing or undefined numeric values were **filled with `0.0`**, which semantically indicates *absence of that behavior*.

---

### 2. Semantic Flags (`semantic_flags`)

Each flow includes deterministic, interpretable indicators derived from numeric features:

| Flag | Meaning |
| --------------------- | --------------------------------------------------------- |
| `high_packet_rate` | Extremely high packets per second |
| `one_way_traffic` | Forward-only traffic (no backward response) |
| `syn_ack_imbalance` | Large SYN/ACK imbalance |
| `uniform_packet_size` | Low packet size variance |
| `long_idle_c2` | Long idle periods (possible command-and-control behavior) |

These flags are:

* Deterministic
* Stable across dataset versions
* Suitable for rule-based IDS and hybrid systems

---

## Preprocessing Summary

The dataset was generated using a **fully deterministic preprocessing pipeline**:

* Column name normalization
* Conversion of `NaN` / `±Infinity` → `0.0`
* Explicit label normalization
* No row removal due to missing numeric values
* Stratified train/validation/test splits
* Explicit Hugging Face feature schemas

No rebalancing, oversampling, or augmentation was applied.

---

## Class Imbalance

The dataset is **highly imbalanced**, with benign traffic dominating.

This reflects **real-world network conditions** and is intentional.

Users are encouraged to:

* Use **precision, recall, F1, PR-AUC**
* Apply **class weighting** or cost-sensitive learning
* Avoid relying on accuracy alone

---