🎯 Wireshark คืออะไร?
Wireshark = Network Protocol Analyzer (Packet Sniffer) ฟรี Open Source ดูแพ็กเก็ตข้อมูลแบบ Real-time / Offline — เครื่องมือมาตรฐานอุตสาหกรรมสำหรับ Network Troubleshooting, Security Analysis, Forensics, Protocol Development
🛡️ ใช้ Wireshark ทำ Security ได้อย่างไร?
1. Traffic Analysis & Anomaly Detection
- ดู Top Talkers (Statistics → Conversations) — หา IP ที่ส่ง/รับมากผิดปกติ
- Filter:
tcp.flags.syn == 1 and tcp.flags.ack == 0— หา SYN Flood / Port Scan - Filter:
dns.flags.response == 0— หา DNS Tunneling (Query ยาวผิดปกติ) - Filter:
http.request— ดู HTTP Request ไม่เข้ารหัส (Credential, PII)
2. Malware C2 / Beaconing Detection
- Filter:
tcp.dstport == 443 and tls.handshake.type == 1— ดู TLS Client Hello (JA3 Fingerprinting) - Statistics → Flow Graph → ดู Pattern: Beaconing (Callback เป็นระยะสม่ำเสมอ)
- Export Objects → HTTP/DICOM/SMB — ดึงไฟล์/Malware ออกมา Analyze
3. Credential Theft / Clear-text Protocols
- Filter:
ftp or telnet or http or smtp or pop or imap or ldap— หา Protocol ไม่เข้ารหัส - Follow TCP Stream → ดู Username/Password ใน Plain Text
- Kerberos:
kerberos— ดู AS-REQ/TGS-REQ (Golden/Silver Ticket Detection)
4. Lateral Movement Detection
- SMB:
smb2 or smb— ดู PsExec, WMI, SMB Relay, Pass-the-Hash - RDP:
tpkt— ดู RDP Session, Brute Force - DCE/RPC:
dcerpc— ดู Remote Service Creation, Scheduled Tasks
5. Data Exfiltration
- Filter:
http.response.code == 200 and http.content_length > 1000000— Upload ใหญ่ผิดปกติ - DNS:
dns.qry.name contains "exfil" or dns.txt— DNS Exfiltration - ICMP:
icmp.type == 8 and data.len > 64— ICMP Tunneling
🚀 เริ่มต้นใช้ Wireshark (Beginner Guide)
- ติดตั้ง: wireshark.org → เลือก OS → Install + Npcap/WinPcap (Windows) / libpcap (Linux/Mac)
- สิทธิ์: Windows: Run as Admin / Linux:
sudo wiresharkหรือตั้ง Capabilitiessetcap cap_net_raw,cap_net_admin+eip /usr/bin/dumpcap - Capture: เลือก Interface (Wi-Fi/Ethernet) → 🦈 Start (ปลั๊กน้ำเงิน)
- Filter Bar: พิมพ์ Display Filter (เช่น
http,dns,ip.addr == 192.168.1.50) - Stop: 🛑 Stop (สี่เหลี่ยมแดง) → Save: File → Save As → .pcapng
🔧 Display Filters พื้นฐานที่ต้องจดจำ (Cheat Sheet)
| วัตถุประสงค์ | Filter |
|---|---|
| IP เฉพาะ | ip.addr == 192.168.1.10 |
| Port เฉพาะ | tcp.port == 443 / udp.port == 53 |
| Protocol | http dns tls ssh smb2 |
| TCP Flags | tcp.flags.syn == 1 tcp.flags.reset == 1 |
| HTTP Method | http.request.method == "POST" |
| DNS Query | dns.flags.response == 0 |
| TLS Version | tls.handshake.version >= 0x0304 (TLS 1.3+) |
| Expert Info (Errors/Warnings) | _ws.expert.severity >= warning |
⚠️ ข้อควรระวัง / Security Risks
- ❌ จับแพ็กเก็ตเครือข่ายที่ไม่ได้รับอนุญาต = ผิดกฎหมาย (Wiretap Laws, Computer Crime Act)
- ❌ Wireshark ดู Plain Text Credentials ได้ — ต้องใช้อย่างรับผิดชอบ
- ⚠️ Promiscuous Mode / Monitor Mode — อาจละเมิดนโยบายองค์กร
- ✅ ใช้ได้: Lab ของตัวเอง, Capture ของตัวเอง, Authorized Pen Test, Incident Response
🔬 ใช้ร่วมกับเครื่องมืออื่น (Pro Workflow)
- Zeek (Bro) — High-level Network Traffic Analysis (Conn.log, HTTP.log, SSL.log)
- Suricata/Snort — IDS/IPS Rules Matching บน PCAP
- Elastic Stack / Splunk — Ingest PCAP → Search/Visualize
- NetworkMiner / CapAnalysis — Extract Files, Credentials, Images จาก PCAP
- JA3/JA3S — TLS Fingerprinting ระบุ Malware/Tools
💡 เคล็ดลับโปร
- Coloring Rules: View → Coloring Rules → เพิ่มสีสำหรับ Malware C2, Exfil, Scan
- Profiles: สร้าง Profile แยก (Security, Troubleshooting, VoIP, Wireless)
- Lua Scripts: เขียน Plugin เอง (GeoIP, Custom Dissector, Auto-extract)
- Command Line:
tshark -r file.pcapng -Y "http.request" -T fields -e http.host -e http.request.uri
📚 เรียนรู้ต่อ
- Wireshark University (Official Training)
- Laura Chappell (Wireshark University Founder) — Books/Videos
- Chris Sanders — Practical Packet Analysis
- Malware Traffic Analysis (malware-traffic-analysis.net) — PCAP จริงฝึกหัด