Skip to content

Xenia101/Network-Anomaly-Detection-System

Folders and files

NameName
Last commit message
Last commit date

Latest commit

ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 

Repository files navigation

Network Anomaly Detection System

Flow Based netwrok anomaly detection system

Configuration

./prototype โ†’ Main / function / prototype

./Web โ†’ Network Anomaly Detection System Web (processing..)

./RESTful โ†’ Example of Restful API (processing..)

Train / Test ๋ฐ์ดํ„ฐ ์ƒ์„ธ

  • Train Dataset

Local์—์„œ ๋ชจ์€ ์›น์„œํ•‘, ๊ฒŒ์ž„ ๋“ฑ ๊ธฐํƒ€ ์ž‘์—… ์‹œ์˜ ๋„คํŠธ์›Œํฌ ํŒจํ‚ท(.pcap)์— ๋Œ€ํ•œ 64,368๊ฐœ์˜ ์ •์ƒ ์„ธ์…˜ ๋ฐ์ดํ„ฐ(.csv)

  • Test Dataset

๋น„์ •์ƒ ์„ธ์…˜ ๋ฐ์ดํ„ฐ

File name Total number of Sessions Type Extension Source
Normal-1 81 Web surfing / Game .csv Local
Normal-2 80 Web surfing / Game .csv Local
Attack-1 418 http-flood .csv Link
Attack-2 609 Mirai malware .csv Link
Attack-3 896 The major fraud and hacking criminal case "B 8322-16" .csv Link
Attack-4 509 Packet Injection Attacks .csv Link

๋ฐ์ดํ„ฐ ์ˆ˜์ง‘ - CICFlowMeter๋กœ ๋‚˜์˜จ 84๊ฐœ์˜ Features.csv

Feature Importance

  • Random Forest Classifier๋ฅผ ์ด์šฉํ•œ Feature๋“ค์˜ ์ค‘์š”๋„ ๊ณ„์‚ฐ ๊ฒฐ๊ณผ

Feature ์„ ์ •

  • CICFlowMeter๋กœ ๋‚˜์˜จ 84๊ฐœ์˜ Feature ์ค‘ ์•„๋ž˜ 78๊ฐœ์˜ Features ์‚ฌ์šฉ
Flow duration Total Fwd Packet Total Bwd Packets Total Length of Fwd Packet Total Length of Bwd Packet Fwd Packet Length Min
Fwd Packet Length Max Fwd Packet Length Mean Fwd Packet Length Std Bwd Packet Length Min Bwd Packet Length Max Bwd Packet Length Mean
Bwd Packet Length Std Flow Bytes/s Flow Packets/s Flow IAT Mean Flow IAT Std Flow IAT Max
Flow IAT Min Fwd IAT Min Fwd IAT Max Fwd IAT Mean Fwd IAT Std Fwd IAT Total
Bwd IAT Min Bwd IAT Max Bwd IAT Mean Bwd IAT Std Bwd IAT Total Fwd PSH flags
Bwd PSH Flags Fwd URG Flags Bwd URG Flags Fwd Header Length Bwd Header Length FWD Packets/s
Bwd Packets/s Packet Length Min Packet Length Max Packet Length Mean Packet Length Std Packet Length Variance
FIN Flag Count SYN Flag Count RST Flag Count PSH Flag Count ACK Flag Count URG Flag Count
CWE Flag Count ECE Flag Count down/Up Ratio Average Packet Size Fwd Segment Size Avg Bwd Segment Size Avg
Fwd Bytes/Bulk Avg Fwd Packet/Bulk Avg Fwd Bulk Rate Avg Bwd Bytes/Bulk Avg Bwd Packet/Bulk Avg Bwd Bulk Rate Avg
Subflow Fwd Packets Subflow Fwd Bytes Subflow Bwd Packets Subflow Bwd Bytes Fwd Init Win bytes Bwd Init Win bytes
Fwd Act Data Pkts Fwd Seg Size Min Active Min Active Mean Active Max Active Std
Idle Min Idle Mean Idle Max Idle Std

๋ฐ์ดํ„ฐ ์ „์ฒ˜๋ฆฌ

  • ์ž๋ฃŒ์˜ ์˜ค๋ฒ„ํ”Œ๋กœ์šฐ ๋˜๋Š” ์–ธ๋”ํ”Œ๋กœ์šฐ๋ฅผ ๋ฐฉ์ง€ ํ•˜๊ธฐ ์œ„ํ•ด Standard Scaler๋ฅผ ์ˆ˜ํ–‰ํ•˜์—ฌ ์ „์ฒด ๋ฐ์ดํ„ฐ์˜ ๋ถ„ํฌ๋ฅผ ํ‰๊ท  0, ๋ถ„์‚ฐ 1์ด ๋˜๋„๋ก ๋ฐ์ดํ„ฐ ์ „์ฒ˜๋ฆฌ

Local Outlier Factor

  • Anomaly Detection์„ ์œ„ํ•œ LOF ์ˆ˜ํ–‰ ๊ณผ์ •

  • ํ•™์Šต๋ฐ์ดํ„ฐ(์ •์ƒ)์— ๋Œ€ํ•ด Local Outlier Factor ์ˆ˜ํ–‰ ๊ฒฐ๊ณผ(.csv)

  • ํ•™์Šต๋ฐ์ดํ„ฐ(์ •์ƒ)์— ๋Œ€ํ•ด ํ…Œ์ŠคํŠธ๋ฐ์ดํ„ฐ(๋น„์ •์ƒ) ์ถ”๊ฐ€ ํ›„ Local Outlier Factor ์ˆ˜ํ–‰ ๊ฒฐ๊ณผ(.csv)

Latent Dirichlet Allocation

์‹œํ—˜ ๊ฒฐ๊ณผ

File name Total number of Sessions Number of inliner Number of outlier outlier percentage
Normalโ€“1 81 68 13 16.04%
Normalโ€“2 80 67 13 16.25%
Attackโ€“1 418 169 249 59.56%
Attackโ€“2 609 297 312 51.23%
Attackโ€“3 896 377 519 57.92%
Attack-4 509 31 478 93.90%
File name Type Source
Normalโ€“1 Web surfing / Game Local
Normalโ€“2 Web surfing / Game Local
Attackโ€“1 http-flood Link
Attackโ€“2 Mirai malware Link
Attackโ€“3 The major fraud and hacking criminal case "B 8322-16". Link
Attack-4 Packet Injection Attacks Link

๊ฒฐ๋ก 

๋ณธ ๊ธฐ์ˆ ์—์„œ๋Š” ๋„คํŠธ์›Œํฌ๊ฐ€ ์ •์ƒ์ผ ๋•Œ, Flow๊ธฐ๋ฐ˜์œผ๋กœ IP๋ณ„ ๋„คํŠธ์›Œํฌ ์„ธ์…˜์„ ์ˆ˜์ง‘ํ•˜์—ฌ ํ•™์Šต ๋ฐ์ดํ„ฐ์…‹์„ ๋งŒ๋“ค์—ˆ๋‹ค.

์ด๋ฅผ ๋ฐ”ํƒ•์œผ๋กœ ๋ชจ๋ธ์„ ํ•™์Šต์‹œํ‚จ ํ›„, ํ…Œ์ŠคํŠธ ๋ฐ์ดํ„ฐ์ธ ๋น„์ •์ƒ ๋„คํŠธ์›Œํฌ ์„ธ์…˜์— ๋Œ€ํ•œ ์ด์ƒ ํ–‰์œ„ ํƒ์ง€๋ฅผ ์ˆ˜ํ–‰ํ•˜์˜€๋‹ค.

ํ•™์Šต์„ ์‹ค์‹œํ•˜๊ณ  ์„ฑ๋Šฅ์„ ๋ถ„์„ํ•ด ๋ณธ ๊ฒฐ๊ณผ ํ‰๊ท  86% ์˜ ์ •ํ™•๋„๋กœ ๋„คํŠธ์›Œํฌ ์ด์ƒํ–‰์œ„ ํƒ์ง€๊ฐ€ ๊ฐ€๋Šฅํ–ˆ๋‹ค.

๊ฒฐ๊ณผ๋ฌผ ํ™œ์šฉ ๋ฐฉ์•ˆ

  • ๋„คํŠธ์›Œํฌ์ƒ์˜ ๋ฐ์ดํ„ฐ ํ๋ฆ„์— ๋Œ€ํ•œ ํƒ์›”ํ•œ ๊ฐ€์‹œ์„ฑ ์ œ๊ณต์œผ๋กœ ํšจ์œจ์ ์ธ ๋ชจ๋‹ˆํ„ฐ๋ง ๊ฐ€๋Šฅ

  • ๋ชจ๋‹ˆํ„ฐ๋ง๊ณผ ๋”๋ถˆ์–ด ์‹ค์‹œ๊ฐ„ ํŒจํ‚ท ๋ถ„์„์„ ํ†ตํ•ด ์‹ ์†ํ•œ ๋Œ€์‘ ๊ฐ€๋Šฅ

  • ๋„คํŠธ์›Œํฌ IP๋ณ„ ํŒจํ‚ท์— ๋Œ€ํ•œ ๋ฐ์ดํ„ฐ๋ฅผ ํ•™์Šตํ•˜๊ณ  ์ด์ƒ ์ง•ํ›„ ํƒ์ง€ ๊ฐ€๋Šฅ

โ†’ ํ†ตํ•ฉ๋ณด์•ˆ๊ด€์ œ ์ ์šฉ์‹œ, ์‹ค์‹œ๊ฐ„ ์นจํ•ด ์ฒ˜๋ฆฌ, ๋ฒ”์œ„ ํ™•๋Œ€ ๋ฐ ์ธ๋ ฅ๊ณผ ์‹œ๊ฐ„ ๋‹จ์ถ•์„ ํ•  ์ˆ˜ ์žˆ์œผ๋ฉฐ, ์•Œ๋ ค์ง€์ง€ ์•Š์€ ์œ„ํ˜‘์— ๋Œ€ํ•ด์„œ๋„ ํƒ์ง€ ๋ฐ ๋Œ€์‘ ๊ฐ€๋Šฅ

์„ค์น˜ ๋ฐ ์šด์˜ ๋ฐฉ์•ˆ

  • ๊ฐ„๋‹จํ•˜๊ณ  ๋น ๋ฅธ ๊ฒฐ๊ณผ ๋ถ„์„ ๋ฐ ์ฆ‰๊ฐ์ ์ธ ํ”ผ๋“œ๋ฐฑ

  • ๋ณด๋‹ค ๋น ๋ฅธ ์—ฐ์‚ฐ์„ ์œ„ํ•ด GPU ์—ฐ์‚ฐ ์ˆ˜ํ–‰

  • ๋ฐ์ดํ„ฐ์˜ ์ˆ˜๊ฐ€ ๋ง‰๋Œ€ํ•  ๊ฒฝ์šฐ, Feature ์„ ํƒ์‹œ IP ์ฃผ์†Œ ์ถ”๊ฐ€

Feature & Descriptions

Flow duration Duration of the flow in Microsecond
total Fwd Packet Total packets in the forward direction
total Bwd packets Total packets in the backward direction
total Length of Fwd Packet Total size of packet in forward direction
total Length of Bwd Packet Total size of packet in backward direction
Fwd Packet Length Min Minimum size of packet in forward direction
Fwd Packet Length Max Maximum size of packet in forward direction
Fwd Packet Length Mean Mean size of packet in forward direction
Fwd Packet Length Std Standard deviation size of packet in forward direction
Bwd Packet Length Min Minimum size of packet in backward direction
Bwd Packet Length Max Maximum size of packet in backward direction
Bwd Packet Length Mean Mean size of packet in backward direction
Bwd Packet Length Std Standard deviation size of packet in backward direction
Flow Bytes/s Number of flow bytes per second
Flow Packets/s Number of flow packets per second
Flow IAT Mean Mean time between two packets sent in the flow
Flow IAT Std Standard deviation time between two packets sent in the flow
Flow IAT Max Maximum time between two packets sent in the flow
Flow IAT Min Minimum time between two packets sent in the flow
Fwd IAT Min Minimum time between two packets sent in the forward direction
Fwd IAT Max Maximum time between two packets sent in the forward direction
Fwd IAT Mean Mean time between two packets sent in the forward direction
Fwd IAT Std Standard deviation time between two packets sent in the forward direction
Fwd IAT Total Total time between two packets sent in the forward direction
Bwd IAT Min Minimum time between two packets sent in the backward direction
Bwd IAT Max Maximum time between two packets sent in the backward direction
Bwd IAT Mean Mean time between two packets sent in the backward direction
Bwd IAT Std Standard deviation time between two packets sent in the backward direction
Bwd IAT Total Total time between two packets sent in the backward direction
Fwd PSH flags Number of times the PSH flag was set in packets travelling in the forward direction (0 for UDP)
Bwd PSH Flags Number of times the PSH flag was set in packets travelling in the backward direction (0 for UDP)
Fwd URG Flags Number of times the URG flag was set in packets travelling in the forward direction (0 for UDP)
Bwd URG Flags Number of times the URG flag was set in packets travelling in the backward direction (0 for UDP)
Fwd Header Length Total bytes used for headers in the forward direction
Bwd Header Length Total bytes used for headers in the backward direction
FWD Packets/s Number of forward packets per second
Bwd Packets/s Number of backward packets per second
Packet Length Min Minimum length of a packet
Packet Length Max Maximum length of a packet
Packet Length Mean Mean length of a packet
Packet Length Std Standard deviation length of a packet
Packet Length Variance Variance length of a packet
FIN Flag Count Number of packets with FIN
SYN Flag Count Number of packets with SYN
RST Flag Count Number of packets with RST
PSH Flag Count Number of packets with PUSH
ACK Flag Count Number of packets with ACK
URG Flag Count Number of packets with URG
CWE Flag Count Number of packets with CWE
ECE Flag Count Number of packets with ECE
down/Up Ratio Download and upload ratio
Average Packet Size Average size of packet
Fwd Segment Size Avg Average size observed in the forward direction
Bwd Segment Size Avg Average number of bytes bulk rate in the backward direction
Fwd Bytes/Bulk Avg Average number of bytes bulk rate in the forward direction
Fwd Packet/Bulk Avg Average number of packets bulk rate in the forward direction
Fwd Bulk Rate Avg Average number of bulk rate in the forward direction
Bwd Bytes/Bulk Avg Average number of bytes bulk rate in the backward direction
Bwd Packet/Bulk Avg Average number of packets bulk rate in the backward direction
Bwd Bulk Rate Avg Average number of bulk rate in the backward direction
Subflow Fwd Packets The average number of packets in a sub flow in the forward direction
Subflow Fwd Bytes The average number of bytes in a sub flow in the forward direction
Subflow Bwd Packets The average number of packets in a sub flow in the backward direction
Subflow Bwd Bytes The average number of bytes in a sub flow in the backward direction
Fwd Init Win bytes The total number of bytes sent in initial window in the forward direction
Bwd Init Win bytes The total number of bytes sent in initial window in the backward direction
Fwd Act Data Pkts Count of packets with at least 1 byte of TCP data payload in the forward direction
Fwd Seg Size Min Minimum segment size observed in the forward direction
Active Min Minimum time a flow was active before becoming idle
Active Mean Mean time a flow was active before becoming idle
Active Max Maximum time a flow was active before becoming idle
Active Std Standard deviation time a flow was active before becoming idle
Idle Min Minimum time a flow was idle before becoming active
Idle Mean Mean time a flow was idle before becoming active
Idle Max Maximum time a flow was idle before becoming active
Idle Std Standard deviation time a flow was idle before becoming active

References