/static/codemoomoo2.png

บทที่ 2 — Network Protocols and Traffic Analysis (โปรโตคอลเครือข่ายและการวิเคราะห์ทราฟฟิก)

แนวคิด: ทำความเข้าใจโปรโตคอลและเครื่องมือวิเคราะห์ก่อนเรียนการป้องกัน การรู้จักโปรโตคอลในเชิงลึกทำให้เราสามารถระบุช่องโหว่และตรวจจับพฤติกรรมผิดปกติได้อย่างแม่นยำ


2.1 ทบทวน OSI Model และ TCP/IP Stack ในมุมมองด้านความมั่นคงปลอดภัย

2.1.1 OSI Model — ภาพรวมและความสัมพันธ์กับความมั่นคงปลอดภัย

OSI Model (Open Systems Interconnection Model) คือกรอบแนวคิดที่แบ่งกระบวนการสื่อสารเครือข่ายออกเป็น 7 ชั้น (Layer) แต่ละชั้นมีหน้าที่เฉพาะ และมีช่องโหว่ด้านความมั่นคงปลอดภัยที่แตกต่างกัน การเข้าใจ OSI Model จากมุมมองด้านความมั่นคงปลอดภัยช่วยให้เราสามารถระบุจุดโจมตี (Attack Surface) และออกแบบมาตรการป้องกันได้อย่างเป็นระบบ

graph TB
    subgraph OSI["OSI Model — มุมมองด้านความมั่นคงปลอดภัย"]
        direction TB
        L7["ชั้นที่ 7: Application Layer\n(ชั้นแอปพลิเคชัน)\nHTTP, FTP, SMTP, DNS\n⚠️ XSS, SQLi, Phishing"]
        L6["ชั้นที่ 6: Presentation Layer\n(ชั้นการนำเสนอ)\nSSL/TLS, MIME, Encoding\n⚠️ Man-in-the-Middle, SSL Stripping"]
        L5["ชั้นที่ 5: Session Layer\n(ชั้นการเชื่อมต่อ)\nSMB, RPC, NetBIOS\n⚠️ Session Hijacking, Replay Attack"]
        L4["ชั้นที่ 4: Transport Layer\n(ชั้นการส่งผ่าน)\nTCP, UDP, SCTP\n⚠️ SYN Flood, Port Scanning"]
        L3["ชั้นที่ 3: Network Layer\n(ชั้นเครือข่าย)\nIP, ICMP, OSPF, BGP\n⚠️ IP Spoofing, Route Hijacking"]
        L2["ชั้นที่ 2: Data Link Layer\n(ชั้นข้อมูล)\nEthernet, ARP, MAC\n⚠️ ARP Spoofing, MAC Flooding"]
        L1["ชั้นที่ 1: Physical Layer\n(ชั้นกายภาพ)\nสายเคเบิล, สัญญาณ\n⚠️ Wiretapping, Jamming"]
    end

    L7 --> L6 --> L5 --> L4 --> L3 --> L2 --> L1

    style L7 fill:#cc241d,color:#ebdbb2
    style L6 fill:#d65d0e,color:#ebdbb2
    style L5 fill:#d79921,color:#282828
    style L4 fill:#98971a,color:#ebdbb2
    style L3 fill:#458588,color:#ebdbb2
    style L2 fill:#b16286,color:#ebdbb2
    style L1 fill:#689d6a,color:#ebdbb2

2.1.2 TCP/IP Stack เทียบกับ OSI Model

TCP/IP Stack เป็นโมเดลที่ใช้งานจริงในอินเทอร์เน็ต ประกอบด้วย 4 ชั้น โดยรวมหลายชั้นของ OSI เข้าด้วยกัน

OSI Layer TCP/IP Layer โปรโตคอลหลัก ภัยคุกคามที่พบบ่อย
Application, Presentation, Session Application (แอปพลิเคชัน) HTTP, HTTPS, DNS, SMTP, SSH XSS, SQLi, DNS Poisoning
Transport Transport (การส่งผ่าน) TCP, UDP SYN Flood, UDP Flood
Network Internet (อินเทอร์เน็ต) IP, ICMP, ARP IP Spoofing, Smurf Attack
Data Link, Physical Network Access (การเข้าถึงเครือข่าย) Ethernet, Wi-Fi, ARP ARP Spoofing, Sniffing

2.1.3 เป้าหมายการโจมตีในแต่ละชั้น (Attack Targets per Layer)

ในมุมมองด้านความมั่นคงปลอดภัย ผู้โจมตีมักเลือกโจมตีชั้นที่ให้ผลได้สูงสุด:

ตัวอย่างการตรวจสอบ OSI Stack ด้วย Linux

# ดูข้อมูล Network Interface (Layer 1-2)
ip link show

# ดูตาราง ARP (Layer 2-3)
arp -n
ip neigh show

# ดูตาราง Routing (Layer 3)
ip route show
netstat -rn

# ดูการเชื่อมต่อ TCP/UDP ที่ใช้งานอยู่ (Layer 4)
ss -tulpn
netstat -tulpn

# ดูการเชื่อมต่อแอปพลิเคชัน (Layer 7)
ss -tulpn | grep LISTEN

ตัวอย่างผลลัพธ์ที่คาดหวัง:

# ip route show
default via 192.168.1.1 dev eth0 proto dhcp src 192.168.1.100 metric 100
192.168.1.0/24 dev eth0 proto kernel scope link src 192.168.1.100

# ss -tulpn
Netid State  Recv-Q Send-Q Local Address:Port
tcp   LISTEN 0      128    0.0.0.0:22     users:(("sshd",pid=1234,fd=3))
tcp   LISTEN 0      511    0.0.0.0:80     users:(("nginx",pid=5678,fd=6))

2.2 โปรโตคอลระดับ Network และ Transport Layer: IP, TCP, UDP, ICMP

2.2.1 Internet Protocol (IP) — ความมั่นคงปลอดภัยและช่องโหว่

IP (Internet Protocol) คือโปรโตคอลหลักของชั้น Network ทำหน้าที่ระบุที่อยู่และนำส่งแพ็กเก็ต (Packet) จากต้นทางไปยังปลายทาง

โครงสร้าง IPv4 Header

graph LR
    subgraph IPv4Header["IPv4 Header (20-60 bytes)"]
        direction LR
        A["Version\n4 bits"]
        B["IHL\n4 bits"]
        C["DSCP/ECN\n8 bits"]
        D["Total Length\n16 bits"]
        E["Identification\n16 bits"]
        F["Flags\n3 bits"]
        G["Fragment Offset\n13 bits"]
        H["TTL\n8 bits"]
        I["Protocol\n8 bits"]
        J["Header Checksum\n16 bits"]
        K["Source IP\n32 bits"]
        L["Destination IP\n32 bits"]
        M["Options\n(variable)"]
    end

    style A fill:#458588,color:#ebdbb2
    style K fill:#cc241d,color:#ebdbb2
    style L fill:#98971a,color:#ebdbb2
    style H fill:#d79921,color:#282828
    style I fill:#b16286,color:#ebdbb2

ฟิลด์สำคัญด้านความมั่นคงปลอดภัย:

ตัวอย่างการตรวจสอบ IP Header ด้วย Linux

# ส่ง ping พร้อมดู TTL
ping -c 4 8.8.8.8

# ตรวจสอบค่า TTL เพื่อประมาณระบบปฏิบัติการปลายทาง
# Linux: TTL=64, Windows: TTL=128, Cisco: TTL=255
ping -c 1 192.168.1.1 | grep ttl

# ดู Packet ด้วย tcpdump พร้อม IP Header
sudo tcpdump -i eth0 -v 'ip' | head -30

2.2.2 Transmission Control Protocol (TCP)

TCP (Transmission Control Protocol) คือโปรโตคอลที่เน้นความน่าเชื่อถือ (Reliable) ในชั้น Transport มีกระบวนการ Three-Way Handshake เพื่อสร้างการเชื่อมต่อ

กระบวนการ Three-Way Handshake และจุดอ่อน

sequenceDiagram
    participant C as Client (ไคลเอนต์)
    participant S as Server (เซิร์ฟเวอร์)
    participant A as Attacker (ผู้โจมตี)

    Note over C,S: การเชื่อมต่อปกติ (Normal Connection)
    C->>S: SYN (seq=x) — ขอเชื่อมต่อ
    S->>C: SYN-ACK (seq=y, ack=x+1) — ตอบรับ
    C->>S: ACK (ack=y+1) — ยืนยันการเชื่อมต่อ
    Note over C,S: ✅ เชื่อมต่อสำเร็จ (Connection Established)

    Note over A,S: SYN Flood Attack (การโจมตีแบบ SYN Flood)
    A->>S: SYN (src=1.2.3.4 ปลอม)
    A->>S: SYN (src=5.6.7.8 ปลอม)
    A->>S: SYN (src=9.10.11.12 ปลอม)
    Note over S: ❌ SYN Queue เต็ม — ปฏิเสธการเชื่อมต่อใหม่

โครงสร้าง TCP Flags:

Flag ค่า (Hex) ความหมาย การใช้ในการโจมตี
SYN 0x02 เริ่มการเชื่อมต่อ SYN Flood, SYN Scan
ACK 0x10 ตอบรับการรับข้อมูล ACK Scan (ผ่าน Stateless Firewall)
FIN 0x01 ปิดการเชื่อมต่อ FIN Scan
RST 0x04 รีเซ็ตการเชื่อมต่อ TCP RST Attack
PSH 0x08 ส่งข้อมูลทันที -
URG 0x20 ข้อมูลเร่งด่วน -
NULL 0x00 ไม่มี Flag NULL Scan

การคำนวณ TCP Sequence Number

Sequence Number ใช้ระบุลำดับข้อมูล และหากคาดเดาได้ อาจนำไปสู่การ Hijack Session

Sequence Number ถัดไป = Sequence Number ปัจจุบัน + ขนาดข้อมูลที่ส่ง (bytes)

ตัวอย่างการคำนวณ:

ตัวอย่างการวิเคราะห์ TCP ด้วย Linux

# ดู TCP Connection States ทั้งหมด
ss -tan

# ดูเฉพาะ SYN_RECV (อาจบ่งชี้ SYN Flood)
ss -tan | grep SYN_RECV | wc -l

# ดู TCP Statistics
cat /proc/net/netstat | grep -i syn

# ดู TCP Flags ด้วย tcpdump
sudo tcpdump -i eth0 'tcp[13] & 2 != 0' -n
# tcp[13] คือ byte ที่ 13 ของ TCP header = Flags byte
# 2 = SYN flag (binary: 00000010)

# นับจำนวน SYN ที่ไม่มี ACK (บ่งชี้ SYN Flood)
sudo tcpdump -i eth0 'tcp[tcpflags] == tcp-syn' -n -c 100 2>/dev/null

2.2.3 User Datagram Protocol (UDP)

UDP (User Datagram Protocol) เป็นโปรโตคอลที่ไม่เน้นความน่าเชื่อถือ (Connectionless) ส่งข้อมูลได้เร็วกว่า TCP แต่ไม่มีการตรวจสอบว่าข้อมูลถึงปลายทางหรือไม่ เหมาะกับงานที่ต้องการความเร็ว เช่น VoIP, DNS, Video Streaming

จุดอ่อนของ UDP:

การคำนวณ Amplification Factor

Amplification Factor = ขนาด Response (bytes) ขนาด Request (bytes)

ตัวอย่างการคำนวณ DNS Amplification:

หมายความว่า ผู้โจมตีใช้แบนด์วิดท์เพียง 1 Mbps สามารถสร้างทราฟฟิกโจมตีได้ถึง 107 Mbps

# ทดสอบ UDP port scanning ด้วย nmap
sudo nmap -sU -p 53,67,123,161 192.168.1.0/24

# ดู UDP connections
ss -uanp

# ตรวจสอบ UDP traffic ด้วย tcpdump
sudo tcpdump -i eth0 udp -n

2.2.4 Internet Control Message Protocol (ICMP)

ICMP (Internet Control Message Protocol) ใช้ส่งข้อความควบคุมและรายงานข้อผิดพลาดในชั้น Network เช่น ข้อความ "Destination Unreachable" หรือการตอบสนองต่อ ping

ประเภทของ ICMP Messages:

Type Code ความหมาย ความเสี่ยง
0 0 Echo Reply (ping ตอบกลับ) ใช้ใน Ping Sweep
3 0-15 Destination Unreachable เปิดเผยโครงสร้างเครือข่าย
5 0-3 Redirect ICMP Redirect Attack
8 0 Echo Request (ping) ใช้ใน Ping Sweep, Ping Flood
11 0 Time Exceeded (TTL=0) ใช้ใน Traceroute
30 0 Traceroute เปิดเผยเส้นทางเครือข่าย

การโจมตีผ่าน ICMP

# ทดสอบ ICMP พื้นฐาน
ping -c 4 -s 1400 192.168.1.1       # ระบุขนาด packet

# Traceroute ผ่าน ICMP
traceroute -I 8.8.8.8               # -I ใช้ ICMP
traceroute -T -p 80 8.8.8.8         # -T ใช้ TCP

# ตรวจสอบ ICMP ด้วย tcpdump
sudo tcpdump -i eth0 icmp -n

# บล็อก ICMP ด้วย iptables (ตัวอย่าง)
sudo iptables -A INPUT -p icmp --icmp-type echo-request -j DROP

# ดูสถิติ ICMP
cat /proc/net/snmp | grep Icmp

2.3 เครื่องมือวิเคราะห์เครือข่าย: Wireshark, tcpdump, nmap

2.3.1 tcpdump — เครื่องมือ Packet Capture บรรทัดคำสั่ง

tcpdump คือเครื่องมือ Command-line สำหรับดักจับและวิเคราะห์ Packet บน Linux/Unix ใช้ Library ชื่อ libpcap ในการจับข้อมูล

การติดตั้งและคำสั่งพื้นฐาน

# ติดตั้ง tcpdump
sudo apt install tcpdump          # Ubuntu/Debian
sudo pacman -S tcpdump            # Arch Linux / CachyOS

# ดูรายการ Network Interface
sudo tcpdump -D

# จับ Packet บน Interface eth0 แบบ Verbose
sudo tcpdump -i eth0 -v

# จับ Packet และบันทึกเป็นไฟล์ .pcap
sudo tcpdump -i eth0 -w capture.pcap

# อ่านไฟล์ .pcap ที่บันทึกไว้
sudo tcpdump -r capture.pcap -n

# จำกัดจำนวน Packet ที่จับ
sudo tcpdump -i eth0 -c 100 -w capture.pcap

BPF Filter (Berkeley Packet Filter) — การกรอง Packet

# กรองเฉพาะ Traffic จาก/ไปยัง Host เฉพาะ
sudo tcpdump -i eth0 host 192.168.1.100

# กรองเฉพาะ Traffic บน Port 80 (HTTP)
sudo tcpdump -i eth0 port 80

# กรอง TCP Traffic บน Port 443 (HTTPS)
sudo tcpdump -i eth0 tcp port 443

# กรอง Traffic จาก Source เฉพาะ
sudo tcpdump -i eth0 src host 10.0.0.1

# กรอง Traffic ไปยัง Destination เฉพาะ
sudo tcpdump -i eth0 dst host 8.8.8.8

# รวม Filter หลายเงื่อนไข
sudo tcpdump -i eth0 '(src host 192.168.1.100) and (dst port 80 or dst port 443)'

# กรอง DNS Traffic (UDP Port 53)
sudo tcpdump -i eth0 udp port 53

# ดู HTTP Request Headers
sudo tcpdump -i eth0 -A -s 0 'tcp port 80 and (((ip[2:2] - ((ip[0]&0xf)<<2)) - ((tcp[12]&0xf0)>>2)) != 0)'

# ตรวจจับ SYN Scan (nmap -sS)
sudo tcpdump -i eth0 'tcp[tcpflags] == tcp-syn' -n

ตัวอย่างการวิเคราะห์ที่นิยมใช้:

# สถานการณ์: สงสัยมีการ Scan ด้วย nmap
# ตรวจสอบ SYN ที่ไม่มี ACK ตอบกลับ (Half-Open Scan)
sudo tcpdump -i eth0 -n 'tcp[tcpflags] & (tcp-syn|tcp-ack) == tcp-syn' 2>/dev/null | head -20

# ตัวอย่างผลลัพธ์:
# 14:23:15.123456 IP 203.0.113.10.45678 > 192.168.1.100.22: Flags [S], seq 1234567890, win 1024, length 0
# 14:23:15.123789 IP 203.0.113.10.45679 > 192.168.1.100.23: Flags [S], seq 1234567891, win 1024, length 0
# 14:23:15.124012 IP 203.0.113.10.45680 > 192.168.1.100.25: Flags [S], seq 1234567892, win 1024, length 0
# สังเกต: IP เดียวกัน Port ปลายทางเพิ่มทีละ 1 = นี่คือสัญญาณของ Port Scan!

2.3.2 Wireshark — GUI Packet Analyzer

Wireshark คือเครื่องมือวิเคราะห์ Packet แบบ GUI ที่ทรงพลังที่สุด สามารถถอดรหัส (Decode) โปรโตคอลได้หลายร้อยชนิด

การติดตั้ง Wireshark บน Linux

# ติดตั้ง
sudo apt install wireshark          # Ubuntu/Debian
sudo pacman -S wireshark-qt         # Arch Linux / CachyOS

# อนุญาตให้ User ที่ไม่ใช่ root ใช้ Wireshark
sudo usermod -aG wireshark $USER
newgrp wireshark

# รัน Wireshark แบบ CLI (TShark)
sudo apt install tshark

TShark — Command-line Version ของ Wireshark

# จับ Packet ด้วย TShark
sudo tshark -i eth0 -c 100

# Filter HTTP Traffic และแสดง URL
sudo tshark -i eth0 -Y 'http.request' -T fields \
    -e ip.src -e http.host -e http.request.uri

# ตัวอย่างผลลัพธ์:
# 192.168.1.50    www.example.com    /index.html
# 192.168.1.50    api.service.com    /v1/users

# วิเคราะห์ไฟล์ .pcap
sudo tshark -r capture.pcap -Y 'tcp.flags.syn==1 && tcp.flags.ack==0' \
    -T fields -e ip.src -e tcp.dstport | sort | uniq -c | sort -rn | head -20

# หา DNS Queries ที่ผิดปกติ
sudo tshark -r capture.pcap -Y 'dns.qry.type==1' \
    -T fields -e ip.src -e dns.qry.name | sort | uniq -c | sort -rn

Display Filters ที่ใช้บ่อยใน Wireshark

Filter ความหมาย
ip.addr == 192.168.1.1 ทุก Packet ที่เกี่ยวกับ IP นี้
tcp.port == 80 TCP บน Port 80
http.request.method == "POST" HTTP POST Request
dns.qry.name contains "evil" DNS Query ที่มีคำว่า "evil"
tcp.flags.syn == 1 && tcp.flags.ack == 0 SYN Packet เท่านั้น
!(arp or icmp or dns) ไม่แสดง ARP, ICMP, DNS
frame.time_delta > 5 Packet ที่ใช้เวลา > 5 วินาที
tcp.analysis.retransmission TCP Retransmission (อาจบ่งชี้ปัญหาเครือข่าย)

2.3.3 nmap — Network Mapper

nmap เป็นเครื่องมือ Network Scanning ที่ทรงพลัง ใช้ทั้งในการ Penetration Testing และการตรวจสอบความมั่นคงปลอดภัย

graph TD
    subgraph nmap["nmap Scan Types — ประเภทการสแกน"]
        A["nmap Target"]
        B["Ping Scan\n-sn\nตรวจว่า Host ออนไลน์"]
        C["TCP SYN Scan\n-sS (Default)\nStealth Scan"]
        D["TCP Connect\n-sT\nFull Connection"]
        E["UDP Scan\n-sU\nตรวจ UDP Ports"]
        F["Version Detection\n-sV\nหาเวอร์ชันบริการ"]
        G["OS Detection\n-O\nหาระบบปฏิบัติการ"]
        H["Script Scan\n-sC / --script\nNSE Scripts"]
    end

    A --> B
    A --> C
    A --> D
    A --> E
    C --> F
    F --> G
    G --> H

    style A fill:#458588,color:#ebdbb2
    style C fill:#98971a,color:#ebdbb2
    style H fill:#cc241d,color:#ebdbb2

คำสั่ง nmap ที่ใช้บ่อยในการรักษาความมั่นคงปลอดภัย

# ติดตั้ง nmap
sudo apt install nmap

# สแกนหา Host ที่ออนไลน์ใน subnet
sudo nmap -sn 192.168.1.0/24

# สแกน Port พื้นฐาน (SYN Scan) — ต้องใช้ root
sudo nmap -sS 192.168.1.100

# สแกน Port เฉพาะ
sudo nmap -p 22,80,443,3306,8080 192.168.1.100

# สแกนทุก Port (1-65535)
sudo nmap -p- 192.168.1.100

# ตรวจหาเวอร์ชันบริการและ OS
sudo nmap -sV -O 192.168.1.100

# สแกนแบบครบถ้วน (Aggressive)
sudo nmap -A 192.168.1.100

# ใช้ NSE Script ตรวจหาช่องโหว่
sudo nmap --script=vuln 192.168.1.100

# ตรวจหา SMB ที่มีช่องโหว่ (EternalBlue)
sudo nmap --script=smb-vuln-ms17-010 192.168.1.0/24

# สแกนแบบเงียบ (Slow/Stealth) เพื่อหลีกเลี่ยง IDS
sudo nmap -sS -T1 --max-retries 1 192.168.1.100

# บันทึกผลลัพธ์เป็น XML
sudo nmap -sV -oX scan_result.xml 192.168.1.0/24

ตัวอย่างผลลัพธ์ nmap:

Starting Nmap 7.94 ( https://nmap.org )
Nmap scan report for 192.168.1.100
Host is up (0.00045s latency).

PORT     STATE SERVICE    VERSION
22/tcp   open  ssh        OpenSSH 8.9p1 Ubuntu
80/tcp   open  http       nginx 1.22.1
443/tcp  open  https      nginx 1.22.1
3306/tcp open  mysql      MySQL 8.0.33
8080/tcp closed http-proxy

OS details: Linux 5.15 - 6.1

2.4 Packet Inspection และ Deep Packet Inspection (DPI)

2.4.1 ระดับของ Packet Inspection

Packet Inspection คือกระบวนการตรวจสอบเนื้อหาของ Network Packet แบ่งระดับตามความลึกของการตรวจสอบ

graph LR
    subgraph levels["ระดับการตรวจสอบ Packet"]
        direction TB
        A["Shallow Packet Inspection\n(การตรวจสอบระดับตื้น)\n• IP Header\n• TCP/UDP Header\n• Port Number\n• เร็ว, ใช้ทรัพยากรน้อย"]
        B["Stateful Inspection\n(การตรวจสอบสถานะ)\n• ติดตาม Connection State\n• TCP Flags\n• Session Table\n• ปานกลาง"]
        C["Deep Packet Inspection (DPI)\n(การตรวจสอบระดับลึก)\n• Application Payload\n• Content/Keywords\n• Protocol Analysis\n• ช้า, ใช้ทรัพยากรมาก"]
    end

    A --> B --> C

    style A fill:#98971a,color:#ebdbb2
    style B fill:#d79921,color:#282828
    style C fill:#cc241d,color:#ebdbb2

2.4.2 Deep Packet Inspection (DPI)

DPI (Deep Packet Inspection) คือเทคนิคการตรวจสอบ Packet ที่วิเคราะห์ได้ถึงระดับ Application Layer Payload (เนื้อหาจริง) ไม่ใช่แค่ Header

การทำงานของ DPI:

  1. จับ Packet จาก Network Interface
  2. Reassemble TCP Segments ให้เป็นข้อมูลที่สมบูรณ์
  3. วิเคราะห์ Protocol ของ Application Layer
  4. ตรวจสอบเนื้อหาเทียบกับ Pattern/Signature
  5. ตัดสินใจว่าจะ Allow, Block, หรือ Log

กรณีการใช้งาน DPI:

เครื่องมือ DPI บน Linux

# ndpi — Open-source DPI Library
# ดาวน์โหลดและสร้าง nDPId
git clone https://github.com/ntop/nDPI
cd nDPI && ./autogen.sh && make
sudo make install

# ใช้ nfdump ร่วมกับ nDPI สำหรับ Flow Analysis
sudo apt install nfdump

# ใช้ Suricata (IDS ที่มี DPI ในตัว) สำหรับตรวจสอบ Traffic
sudo apt install suricata
sudo suricata -c /etc/suricata/suricata.yaml -i eth0

# ใช้ ntopng สำหรับ Network Traffic Monitoring พร้อม DPI
sudo apt install ntopng
sudo ntopng -i eth0 -w 3000
# เข้าใช้ผ่าน Browser: http://localhost:3000

2.4.3 ข้อพิจารณาด้านความเป็นส่วนตัว (Privacy)

ประเด็น รายละเอียด
ความเป็นส่วนตัว DPI สามารถอ่านเนื้อหาของ Packet ได้ หากไม่มีการเข้ารหัส
TLS/HTTPS DPI ไม่สามารถอ่านเนื้อหาได้หากใช้การเข้ารหัส แต่สามารถวิเคราะห์ Metadata ได้
SSL Inspection องค์กรบางแห่งทำ SSL Bump (MITM) เพื่อให้ DPI ทำงานกับ HTTPS ได้
กฎหมาย การใช้ DPI อาจต้องได้รับอนุญาตตามกฎหมาย พ.ร.บ. คอมพิวเตอร์ของไทย

2.5 Network Traffic Analysis และการตรวจจับความผิดปกติ

2.5.1 หลักการวิเคราะห์ Traffic เครือข่าย

Network Traffic Analysis (NTA) คือกระบวนการรวบรวม, วิเคราะห์ และตีความข้อมูล Traffic เครือข่าย เพื่อระบุพฤติกรรมปกติ (Baseline) และตรวจจับความผิดปกติ (Anomaly)

flowchart TB
    subgraph collect["1. รวบรวมข้อมูล - (Data Collection)"]
        direction LR
        C1~~~C2~~~C3~~~C4
        C1["SPAN/Mirror Port"]
        C2["NetFlow / sFlow"]
        C3["Packet Capture"]
        C4["Log Files"]
    end

    subgraph process["2. ประมวลผล - (Processing)"]
        direction LR
        P1~~~P2~~~P3
        P1["Flow Aggregation"]
        P2["Protocol Parsing"]
        P3["Metadata Extraction"]
    end

    subgraph analyze["3. วิเคราะห์ - (Analysis)"]
        direction LR
        A1~~~A2~~~A3~~~A4
        A1["Baseline Comparison\nเปรียบเทียบกับค่าปกติ"]
        A2["Statistical Analysis\nวิเคราะห์สถิติ"]
        A3["Signature Matching\nจับคู่ Signature"]
        A4["ML/AI Detection\nตรวจจับด้วย AI"]
    end

    subgraph respond["4. ตอบสนอง - (Response)"]
        direction LR
        R1~~~R2~~~R3
        R1["Alert / แจ้งเตือน"]
        R2["Block / บล็อก"]
        R3["Log / บันทึก"]
    end

    collect --> process --> analyze --> respond

    style collect fill:#458588,color:#ebdbb2
    style process fill:#98971a,color:#ebdbb2
    style analyze fill:#d79921,color:#282828
    style respond fill:#cc241d,color:#ebdbb2

2.5.2 การสร้าง Baseline Traffic

Baseline คือค่าปกติของ Traffic ที่ใช้เป็นเกณฑ์เปรียบเทียบ เพื่อตรวจจับความผิดปกติ

พารามิเตอร์สำคัญในการสร้าง Baseline:

การคำนวณค่าสถิติ Traffic

Bandwidth Utilization (%) = Traffic จริง (Mbps) Bandwidth สูงสุด (Mbps) × 100

ตัวอย่างการคำนวณ:

ค่าเบี่ยงเบนมาตรฐาน (σ) = i=1 n (xi-x¯) 2 n

หมายเหตุ: ค่า σ คือค่าเบี่ยงเบนมาตรฐาน, x̄ คือค่าเฉลี่ย, n คือจำนวนตัวอย่าง ใช้ตรวจจับ Traffic ที่ผิดปกติเกิน 2-3 σ

ตัวอย่างการคำนวณ:

2.5.3 NetFlow — การวิเคราะห์ Traffic ระดับ Flow

NetFlow คือโปรโตคอลจาก Cisco สำหรับรวบรวมข้อมูล IP Traffic เป็นข้อมูล Flow (กลุ่มของ Packet ที่มี 5-tuple เหมือนกัน: Src IP, Dst IP, Src Port, Dst Port, Protocol)

# ติดตั้ง nfdump (NetFlow Analyzer)
sudo apt install nfdump fprobe

# เริ่มต้นเก็บ NetFlow จาก Interface
sudo fprobe -i eth0 localhost:2055    # ส่ง Flow ไปยัง Collector ที่ Port 2055

# เริ่ม NetFlow Collector
sudo nfcapd -b 127.0.0.1 -p 2055 -l /var/cache/nfdump/

# วิเคราะห์ข้อมูล Flow
nfdump -r /var/cache/nfdump/nfcapd.current -s ip/bytes | head -20

# ดู Top 10 IP ที่ใช้ Bandwidth มากที่สุด
nfdump -r /var/cache/nfdump/nfcapd.current -s ip/bytes -n 10 -o line

# ดูเฉพาะ Traffic บน Port 80
nfdump -r /var/cache/nfdump/nfcapd.current 'dst port 80'

# สร้างกราฟด้วย nfexpire
nfexpire -e /var/cache/nfdump/ -s 1G   # จำกัดขนาด Storage ที่ 1GB

2.5.4 การตรวจจับความผิดปกติ (Anomaly Detection)

รูปแบบ Traffic ที่ผิดปกติที่พบบ่อย:

รูปแบบผิดปกติ สัญญาณที่ตรวจพบ ภัยคุกคามที่น่าสงสัย
PPS สูงผิดปกติ > เฉลี่ย + 3σ DDoS Attack
Port Scan SYN จาก 1 IP ไปหลาย Port Reconnaissance
Beaconing เชื่อมต่อออกนอกทุก N วินาที Malware C2 Communication
Large Upload Traffic ออกนอกสูงผิดปกติ Data Exfiltration
DNS Tunneling DNS Query ขนาดใหญ่/บ่อยผิดปกติ DNS Tunneling
Lateral Movement เชื่อมต่อระหว่าง Internal Host จำนวนมาก APT / Worm
# ตรวจจับ Port Scan ด้วย iptables log
sudo iptables -A INPUT -p tcp --tcp-flags ALL SYN -m recent --name PORTSCAN \
    --set -j LOG --log-prefix "PortScan: "
sudo iptables -A INPUT -p tcp --tcp-flags ALL SYN -m recent --name PORTSCAN \
    --rcheck --seconds 60 --hitcount 20 -j DROP

# ตรวจจับ Beaconing ด้วยการวิเคราะห์ Log
# (แสดงการเชื่อมต่อที่เกิดซ้ำๆ ทุก interval เท่าๆ กัน)
awk '{print $1}' /var/log/nginx/access.log | sort | uniq -c | sort -rn | head -20

# ใช้ ss เพื่อดู Connection ที่ผิดปกติ
ss -tan | awk '{print $5}' | cut -d: -f1 | sort | uniq -c | sort -rn | head -10

2.6 Multimedia Network Protocols: RTP, RTSP, VoIP Security

2.6.1 Real-time Transport Protocol (RTP)

RTP (Real-time Transport Protocol) เป็นโปรโตคอลมาตรฐาน (RFC 3550) สำหรับการส่ง Audio และ Video แบบ Real-time บนเครือข่าย IP ทำงานร่วมกับ RTCP (RTP Control Protocol) เพื่อตรวจสอบคุณภาพการส่ง

graph TB
    subgraph rtp_stack["RTP Protocol Stack"]
        APP["Application\nVoIP / Video Conferencing"]
        RTP["RTP (Real-time Transport Protocol)\nเลขลำดับ, Timestamp, Payload Type"]
        RTCP["RTCP (Control Protocol)\nสถิติคุณภาพ, Jitter, Packet Loss"]
        UDP["UDP (Transport Layer)\nPort 5004-5005 (RTP/RTCP)"]
        IP["IP Layer"]
    end

    APP --> RTP
    APP --> RTCP
    RTP --> UDP
    RTCP --> UDP
    UDP --> IP

    style RTP fill:#98971a,color:#ebdbb2
    style RTCP fill:#458588,color:#ebdbb2
    style UDP fill:#b16286,color:#ebdbb2

พารามิเตอร์ RTP สำคัญ:

การคำนวณ Jitter (ความผันแปรของ Delay)

Jitter = Jitter เดิม + | Transit Time ปัจจุบัน - Transit Time ก่อนหน้า | - Jitter เดิม 16

ตัวอย่างการคำนวณ Jitter:

2.6.2 Session Initiation Protocol (SIP) และ VoIP Security

SIP (Session Initiation Protocol) เป็นโปรโตคอลหลักสำหรับการสร้าง, แก้ไข และยกเลิก Multimedia Session (VoIP Calls, Video Calls) ทำงานที่ Port 5060 (UDP/TCP) และ 5061 (TLS)

sequenceDiagram
    participant UA1 as User Agent A\n(ผู้โทร)
    participant P1 as SIP Proxy\n(เซิร์ฟเวอร์)
    participant UA2 as User Agent B\n(ผู้รับสาย)

    Note over UA1,UA2: SIP Call Flow — การโทร VoIP
    UA1->>P1: INVITE sip:bob@example.com
    P1->>UA2: INVITE sip:bob@example.com
    UA2->>P1: 100 Trying
    P1->>UA1: 100 Trying
    UA2->>P1: 180 Ringing (กำลังดัง)
    P1->>UA1: 180 Ringing
    UA2->>P1: 200 OK (รับสาย)
    P1->>UA1: 200 OK
    UA1->>UA2: ACK (ยืนยัน)
    Note over UA1,UA2: 📞 RTP Stream เริ่มต้น (เสียง/วิดีโอ)
    UA1->>UA2: BYE (วางสาย)
    UA2->>UA1: 200 OK

การโจมตี VoIP ที่พบบ่อย:

การโจมตี คำอธิบาย วิธีป้องกัน
SIP Scanning สแกนหา SIP Server ซ่อน SIP Port, ใช้ Fail2ban
SIP Brute Force เดา Password Extension จำกัดจำนวนครั้งที่ Login
RTP Eavesdropping ดักฟัง Audio Stream ใช้ SRTP (Secure RTP)
SIP Injection แทรกคำสั่ง SIP ปลอม Validate และ Sanitize Input
Toll Fraud โทรออกผ่าน PBX โดยไม่ได้รับอนุญาต ACL, Auth ที่แข็งแกร่ง
VoIP Spam (SPIT) ส่ง INVITE จำนวนมาก Rate Limiting, CAPTCHA

2.6.3 SRTP (Secure RTP) — การเข้ารหัส VoIP

SRTP (Secure Real-time Transport Protocol) เพิ่มความมั่นคงปลอดภัยให้กับ RTP ด้วย:

# ทดสอบ SIP Server ด้วย sipsak
sudo apt install sipsak
sipsak -s sip:192.168.1.100 -v    # ตรวจสอบ SIP Server

# ดัก VoIP Traffic ด้วย tcpdump
sudo tcpdump -i eth0 -w voip_capture.pcap 'udp port 5060 or udp portrange 10000-20000'

# วิเคราะห์ VoIP ด้วย sngrep (SIP Message Viewer)
sudo apt install sngrep
sudo sngrep -i eth0 -L voip.pcap  # Capture และบันทึก
sudo sngrep -I voip.pcap          # อ่านจากไฟล์

# ตรวจสอบ SRTP ว่าใช้อยู่หรือไม่
sudo tcpdump -i eth0 -n 'udp portrange 10000-20000' | head -20
# SRTP Packet จะมี encryption ทำให้ดู payload ไม่ออก

2.6.4 RTSP (Real-Time Streaming Protocol)

RTSP (Real-Time Streaming Protocol) ใช้ควบคุม Streaming Media Server เช่น กล้อง IP, Streaming Platform ทำงานที่ Port 554 (RTSP) คล้ายกับ HTTP แต่สำหรับ Media Streaming

# ทดสอบ RTSP Stream (เช่น IP Camera)
sudo apt install ffmpeg

# ดู RTSP Stream จาก IP Camera (ตัวอย่าง)
ffmpeg -i rtsp://admin:password@192.168.1.200:554/stream1 -vcodec copy output.mp4

# สแกนหา RTSP Server ด้วย nmap
sudo nmap -sU -p 554 --script rtsp-url-brute 192.168.1.0/24

# ดัก RTSP Traffic
sudo tcpdump -i eth0 -w rtsp.pcap 'tcp port 554 or udp port 554'

2.7 โปรโตคอล DNS, DHCP และปัญหาความมั่นคงปลอดภัยที่เกี่ยวข้อง

2.7.1 DNS — หลักการทำงานและโครงสร้าง

DNS (Domain Name System) คือระบบแปลงชื่อโดเมน (Domain Name) เป็นหมายเลข IP ทำงานที่ Port 53 (UDP สำหรับ Query ปกติ, TCP สำหรับ Zone Transfer และ Response ขนาดใหญ่)

sequenceDiagram
    participant Client as Client\n(192.168.1.100)
    participant LocalDNS as Local DNS Resolver\n(192.168.1.1)
    participant Root as Root Name Server\n(.)
    participant TLD as TLD Name Server\n(.com)
    participant Auth as Authoritative NS\n(example.com)

    Client->>LocalDNS: ❓ www.example.com คือ IP อะไร?
    Note over LocalDNS: ตรวจสอบ Cache — ไม่พบ
    LocalDNS->>Root: ❓ www.example.com?
    Root->>LocalDNS: 💡 ไปถาม .com TLD Server ที่ 192.5.6.30
    LocalDNS->>TLD: ❓ www.example.com?
    TLD->>LocalDNS: 💡 ไปถาม NS ของ example.com ที่ 205.251.196.1
    LocalDNS->>Auth: ❓ www.example.com?
    Auth->>LocalDNS: ✅ www.example.com = 93.184.216.34 (TTL=3600)
    LocalDNS->>Client: ✅ 93.184.216.34
    Note over LocalDNS: บันทึก Cache TTL=3600 วินาที

ประเภทของ DNS Record:

Record Type ความหมาย ตัวอย่าง
A IPv4 Address example.com → 93.184.216.34
AAAA IPv6 Address example.com → 2606:2800:220:1:248:1893:25c8:1946
MX Mail Server example.com → mail.example.com (priority 10)
CNAME Canonical Name (Alias) www.example.com → example.com
NS Name Server example.com → ns1.example.com
TXT Text Record SPF, DKIM, DMARC records
PTR Reverse DNS (IP → Domain) 34.216.184.93.in-addr.arpa → example.com
SOA Start of Authority ข้อมูลหลักของ Zone

2.7.2 การโจมตี DNS

graph TD
    subgraph attacks["การโจมตี DNS — ประเภทหลัก"]
        A["DNS Cache Poisoning\n(การวางยาพิษ Cache)\nแทรก Record ปลอมใน Cache\nเพื่อเปลี่ยนเส้นทาง"]
        B["DNS Hijacking\n(การจี้ DNS)\nเปลี่ยน DNS Server\nของเหยื่อเป็น Server ปลอม"]
        C["DNS Amplification DDoS\n(การขยายการโจมตี)\nใช้ DNS เป็นอาวุธขยาย Traffic\nสูงสุด 100x"]
        D["DNS Tunneling\n(การสร้างอุโมงค์)\nซ่อน C2 Traffic ใน DNS Query\nหลีกเลี่ยง Firewall"]
        E["NXDOMAIN Attack\n(การโจมตีแบบ NXDOMAIN)\nส่ง Query Domain ที่ไม่มีจริง\nทำให้ Resolver ล้มเหลว"]
        F["DNS Zone Transfer\n(การดึงข้อมูล Zone)\nดึงข้อมูล DNS ทั้งหมด\nด้วย AXFR Request"]
    end

    style A fill:#cc241d,color:#ebdbb2
    style B fill:#d65d0e,color:#ebdbb2
    style C fill:#d79921,color:#282828
    style D fill:#98971a,color:#ebdbb2
    style E fill:#458588,color:#ebdbb2
    style F fill:#b16286,color:#ebdbb2

การทดลอง DNS ด้วย Linux Tools

# ===== การ Query DNS พื้นฐาน =====
# ค้นหา A Record
dig www.example.com A
nslookup www.example.com

# ค้นหา MX Record
dig example.com MX

# ค้นหา TXT Record (สำหรับ SPF, DKIM)
dig example.com TXT

# ค้นหา Reverse DNS
dig -x 8.8.8.8
host 8.8.8.8

# ===== ทดสอบ DNS Zone Transfer =====
# (ทดสอบเฉพาะกับ Domain ที่ตัวเองดูแล!)
dig @ns1.example.com example.com AXFR

# หากสำเร็จ แสดงว่า DNS Server ตั้งค่าไม่ถูกต้อง!
# ผลลัพธ์ที่ดีควรได้รับ: "Transfer failed" หรือ "REFUSED"

# ===== ตรวจสอบ DNS Cache =====
# ดู DNS Cache บน systemd-resolved
resolvectl statistics
resolvectl flush-caches     # ล้าง Cache

# ===== ตรวจสอบ DNS Traffic =====
# ดัก DNS Query
sudo tcpdump -i eth0 -n udp port 53

# ดู DNS Query ทั้งหมดพร้อม Domain Name
sudo tcpdump -i eth0 -n udp port 53 | grep -oP 'A\? \K[^\s]+'

# ===== ทดสอบ DNS over TLS (DoT) =====
kdig -d @1.1.1.1 +tls-ca example.com A    # ต้องติดตั้ง knot-dnsutils

ตัวอย่าง: ตรวจจับ DNS Tunneling

DNS Tunneling ซ่อนข้อมูลใน Subdomain ที่ยาวมาก เช่น:

# ตรวจจับ DNS Query ที่มี Subdomain ยาวผิดปกติ (> 50 chars)
sudo tcpdump -i eth0 -n udp port 53 -l 2>/dev/null | \
    awk '{
        for(i=1;i<=NF;i++) {
            if($i ~ /\?$/) {
                query=$(i-1)
                if(length(query) > 50) {
                    print "⚠️  Long DNS Query: " query
                }
            }
        }
    }'

# วิเคราะห์จำนวน DNS Query จาก Host เดียวกัน (> 1000/นาที = ผิดปกติ)
sudo tshark -i eth0 -Y 'dns.qry.type==1' -T fields -e ip.src \
    2>/dev/null | sort | uniq -c | sort -rn | head -10

2.7.3 DNSSEC — การเพิ่มความมั่นคงปลอดภัยให้ DNS

DNSSEC (DNS Security Extensions) เพิ่มการรับรองความถูกต้อง (Integrity) ให้กับ DNS Response ด้วยการใช้ Digital Signature

องค์ประกอบของ DNSSEC:

# ตรวจสอบ DNSSEC ของ Domain
dig +dnssec www.cloudflare.com
dig +dnssec example.com DNSKEY

# ตรวจสอบ DNSSEC Validation
dig +sigchase www.iana.org A    # ต้องการ dig ที่รองรับ +sigchase

# ใช้ delv (DNS Lookup and Validation) สำหรับตรวจสอบ DNSSEC
delv @8.8.8.8 www.example.com A +rtrace

# ตรวจสอบว่า Domain ใช้ DNSSEC หรือไม่
dig example.com DS +short       # มี Output = ใช้ DNSSEC

2.7.4 DHCP — หลักการและการโจมตี

DHCP (Dynamic Host Configuration Protocol) แจกจ่ายค่าการกำหนดเครือข่าย (IP Address, Subnet Mask, Gateway, DNS) ให้กับ Client โดยอัตโนมัติ ทำงานที่ Port 67 (Server) และ 68 (Client)

กระบวนการ DHCP (DORA)

sequenceDiagram
    participant C as DHCP Client\n(ไคลเอนต์ใหม่)
    participant S as DHCP Server\n(เซิร์ฟเวอร์)
    participant R as Rogue DHCP Server\n(เซิร์ฟเวอร์ปลอม)

    Note over C,S: DHCP DORA Process (ปกติ)
    C->>+S: 1. DISCOVER (Broadcast) — ขอ IP
    S-->>-C: 2. OFFER (IP: 192.168.1.100, GW: 192.168.1.1)
    C->>+S: 3. REQUEST (ขอ IP ที่ Server เสนอ)
    S-->>-C: 4. ACK (ยืนยัน IP พร้อม Lease Time)
    Note over C,S: ✅ Client ได้รับ IP 192.168.1.100

    Note over C,R: Rogue DHCP Attack (การโจมตี)
    C->>R: 1. DISCOVER (Broadcast)
    R-->>C: 2. OFFER เร็วกว่า (IP: 192.168.1.200, GW: 10.0.0.1 ปลอม)
    C->>R: 3. REQUEST
    R-->>C: 4. ACK (Client ใช้ Gateway ปลอม = MITM!)

การโจมตี DHCP:

การโจมตี หลักการ ผลกระทบ
DHCP Starvation ส่ง DISCOVER พร้อม MAC ปลอมจำนวนมาก จนหมด IP Pool Client ใหม่ไม่ได้รับ IP
Rogue DHCP Server ตั้ง DHCP Server ปลอม ตอบสนองเร็วกว่า Server จริง Man-in-the-Middle
DHCP Snooping Bypass หลีกเลี่ยง DHCP Snooping บน Switch ได้รับ IP จาก Rogue Server
# ===== ทดสอบ DHCP =====
# ดู DHCP Lease ปัจจุบัน
cat /var/lib/dhcp/dhclient.leases    # Ubuntu/Debian
cat /var/lib/dhclient/dhclient.leases

# ร้องขอ IP ใหม่จาก DHCP
sudo dhclient -r eth0    # คืน IP เดิม
sudo dhclient eth0       # ขอ IP ใหม่

# ดู DHCP Traffic ด้วย tcpdump
sudo tcpdump -i eth0 -n udp port 67 or udp port 68 -e

# ===== ตรวจจับ Rogue DHCP =====
# ดู DHCP Server ทั้งหมดใน Subnet
sudo nmap --script broadcast-dhcp-discover -e eth0

# ตัวอย่างผลลัพธ์:
# DHCP Server: 192.168.1.1 (Gateway จริง)
# DHCP Server: 192.168.1.200 (⚠️ Rogue Server!)

# ใช้ dhtest เพื่อทดสอบ DHCP Server
sudo apt install dhtest
sudo dhtest -i eth0 -m 00:11:22:33:44:55    # ทดสอบด้วย MAC ระบุ

# ===== ป้องกัน DHCP Starvation =====
# กำหนด DHCP Snooping บน Switch (Cisco Example)
# ip dhcp snooping
# ip dhcp snooping vlan 1
# interface GigabitEthernet0/1 (Uplink to DHCP Server)
#   ip dhcp snooping trust

2.7.5 DHCP Snooping — การป้องกันการโจมตี DHCP

DHCP Snooping เป็นฟีเจอร์ความมั่นคงปลอดภัยบน Switch ที่กรอง DHCP Traffic โดยแยก Port เป็น Trusted (เชื่อถือได้) และ Untrusted (ไม่เชื่อถือ)

# จำลอง DHCP Snooping ด้วย iptables บน Linux Router
# บล็อก DHCP OFFER จากทุก Interface ยกเว้น Interface ที่เชื่อถือ

# ยกเว้น DHCP Server จริง (192.168.1.1) บน eth0
sudo iptables -I FORWARD -p udp --dport 68 ! -s 192.168.1.1 -j DROP

# Log Rogue DHCP OFFER
sudo iptables -I FORWARD -p udp --dport 68 ! -s 192.168.1.1 \
    -j LOG --log-prefix "Rogue DHCP: "

สรุปโดยรวม (Chapter Summary)

บทที่ 2 ครอบคลุมความรู้พื้นฐานที่จำเป็นสำหรับการทำความเข้าใจเครือข่ายจากมุมมองด้านความมั่นคงปลอดภัย ซึ่งสรุปประเด็นสำคัญได้ดังนี้

mindmap
  root((บทที่ 2\nNetwork Protocols\nand Traffic Analysis))
    OSI and TCP/IP
      7 Layers of OSI
      Attack Surface ในแต่ละชั้น
      Encapsulation / Decapsulation
    Core Protocols
      IP — Spoofing, Fragmentation
      TCP — SYN Flood, Handshake
      UDP — Amplification Attack
      ICMP — Ping of Death, Tunneling
    Analysis Tools
      tcpdump — BPF Filter
      Wireshark / TShark
      nmap — Scanning Types
    Traffic Analysis
      Baseline Measurement
      Anomaly Detection
      NetFlow Analysis
    DPI
      Shallow vs Deep Inspection
      Privacy Concerns
      nDPI / Suricata
    Multimedia Protocols
      RTP / RTCP — Jitter
      SIP / VoIP — Toll Fraud
      SRTP — Encryption
    DNS and DHCP
      DNS Cache Poisoning
      DNS Tunneling
      DNSSEC Validation
      DHCP Starvation
      Rogue DHCP Server

ประเด็นสำคัญที่ควรจำ:

  1. OSI Model ไม่ใช่แค่ทฤษฎี แต่ช่วยระบุว่าการโจมตีเกิดที่ชั้นใด และควรป้องกันอย่างไร
  2. TCP Three-Way Handshake เป็นเป้าหมายของ SYN Flood ควรตรวจสอบจำนวน SYN_RECV ที่ผิดปกติ
  3. UDP ไม่มี State ทำให้เสี่ยงต่อ Amplification Attack ควรระวัง DNS/NTP/SSDP บน UDP
  4. tcpdump และ Wireshark เป็นเครื่องมือหลักในการวิเคราะห์ ควรฝึกการเขียน BPF Filter
  5. DPI ช่วยตรวจจับ Threat ได้ลึกกว่า แต่ต้องคำนึงถึงความเป็นส่วนตัวและประสิทธิภาพ
  6. Baseline Traffic เป็นพื้นฐานของ Anomaly Detection ควรสร้างและอัปเดตสม่ำเสมอ
  7. DNS เป็นโปรโตคอลที่ถูกใช้ในการโจมตีหลายรูปแบบ ทั้ง Poisoning, Tunneling และ Amplification
  8. DHCP Snooping เป็นมาตรการพื้นฐานที่ควรเปิดใช้บน Switch ทุกตัว

เอกสารอ้างอิง (References)

  1. RFC 791 — Internet Protocol (IP), IETF, 1981. https://www.rfc-editor.org/rfc/rfc791
  2. RFC 793 — Transmission Control Protocol (TCP), IETF, 1981. https://www.rfc-editor.org/rfc/rfc793
  3. RFC 768 — User Datagram Protocol (UDP), IETF, 1980. https://www.rfc-editor.org/rfc/rfc768
  4. RFC 792 — Internet Control Message Protocol (ICMP), IETF, 1981. https://www.rfc-editor.org/rfc/rfc792
  5. RFC 3550 — RTP: A Transport Protocol for Real-Time Applications, IETF, 2003. https://www.rfc-editor.org/rfc/rfc3550
  6. RFC 3261 — SIP: Session Initiation Protocol, IETF, 2002. https://www.rfc-editor.org/rfc/rfc3261
  7. RFC 4033 — DNS Security Introduction and Requirements (DNSSEC), IETF, 2005. https://www.rfc-editor.org/rfc/rfc4033
  8. RFC 2131 — Dynamic Host Configuration Protocol (DHCP), IETF, 1997. https://www.rfc-editor.org/rfc/rfc2131
  9. Wireshark User's Guidehttps://www.wireshark.org/docs/wsug_html_chunked/
  10. nmap Reference Guidehttps://nmap.org/book/man.html
  11. tcpdump Manualhttps://www.tcpdump.org/manpages/tcpdump.1.html
  12. Sanders, C. & Smith, J. (2017). Applied Network Security Monitoring: Collection, Detection, and Analysis. Syngress.
  13. McNab, C. (2017). Network Security Assessment, 3rd Edition. O'Reilly Media.
  14. Stallings, W. (2022). Network Security Essentials: Applications and Standards, 6th Edition. Pearson.
  15. NIST SP 800-81-2 — Secure Domain Name System (DNS) Deployment Guide. https://nvlpubs.nist.gov/nistpubs/SpecialPublications/NIST.SP.800-81-2.pdf

เอกสารนี้จัดทำสำหรับรายวิชา Network Security | มหาวิทยาลัยเทคโนโลยีราชมงคลศรีวิชัย (RMUTSV) ปรับปรุงล่าสุด: 2025