Dưới đây là một Lab thực hành phân tích log thực tế trong SOC kết hợp Prompt Engineering với AI (GPT/LLM). Mục tiêu của lab là giúp học viên hoặc chuyên viên SOC mới có thể:
🧪 SOC Lab: Phân tích log SSH brute-force + AI hỗ trợ phản ứng
🎯 Mục tiêu lab:
🧱 Môi trường & công cụ cần có:
🔧 Bước 1: Tạo log thực tế bằng tấn công SSH brute-force
Trên máy Kali Linux:
hydra -l root -P /usr/share/wordlists/rockyou.txt ssh://<ip-victim>
Kết nối sẽ sinh ra log trong /var/log/auth.log (Ubuntu) hoặc /var/log/secure (CentOS):
Jun 14 15:32:41 ubuntu sshd[1409]: Failed password for root from 192.168.1.100 port 50350 ssh2 Jun 14 15:32:42 ubuntu sshd[1409]: Failed password for root from 192.168.1.100 port 50350 ssh2 Jun 14 15:32:44 ubuntu sshd[1409]: Failed password for root from 192.168.1.100 port 50350 ssh2 ...
📦 Bước 2: Copy log và đưa vào prompt phân tích
Dán 5–10 dòng log vào Prompt sau:
✅ Prompt mẫu dùng trong lab
You are a SOC analyst. Analyze the following SSH log entries and determine whether they indicate a brute-force attack. Identify key indicators, estimate attack intensity, and recommend next steps.
Log: Jun 14 15:32:41 ubuntu sshd[1409]: Failed password for root from 192.168.1.100 port 50350 ssh2 Jun 14 15:32:42 ubuntu sshd[1409]: Failed password for root from 192.168.1.100 port 50350 ssh2 Jun 14 15:32:44 ubuntu sshd[1409]: Failed password for root from 192.168.1.100 port 50350 ssh2 Jun 14 15:32:46 ubuntu sshd[1409]: Failed password for root from 192.168.1.100 port 50350 ssh2 Jun 14 15:32:47 ubuntu sshd[1409]: Failed password for root from 192.168.1.100 port 50350 ssh2
🧠 Kết quả mong đợi từ AI:
🚨 Bước 3: Sinh Playbook phản ứng từ AI
Tiếp tục yêu cầu AI:
Based on your analysis, generate a step-by-step incident response plan for the SOC team to follow. Include containment, eradication, and recovery.
Output AI có thể tạo:
- Phân tích các log thật
- Nhận diện hành vi tấn công
- Viết Prompt phù hợp để nhờ AI phân tích và hỗ trợ phản ứng sự cố
🧪 SOC Lab: Phân tích log SSH brute-force + AI hỗ trợ phản ứng
🎯 Mục tiêu lab:
- Nhận diện tấn công brute-force SSH
- Dùng prompt để AI phân tích log và sinh đề xuất
- Ghi lại playbook phản ứng
🧱 Môi trường & công cụ cần có:
- Một máy ảo Linux (Ubuntu Server hoặc CentOS)
- SSH service được bật
- Một máy Kali Linux hoặc máy công cụ giả lập tấn công
- File log: /var/log/auth.log hoặc /var/log/secure
- Tài khoản ChatGPT / OpenAI hoặc LLM nội bộ dùng được (có khả năng context dài)
🔧 Bước 1: Tạo log thực tế bằng tấn công SSH brute-force
Trên máy Kali Linux:
hydra -l root -P /usr/share/wordlists/rockyou.txt ssh://<ip-victim>
Kết nối sẽ sinh ra log trong /var/log/auth.log (Ubuntu) hoặc /var/log/secure (CentOS):
Jun 14 15:32:41 ubuntu sshd[1409]: Failed password for root from 192.168.1.100 port 50350 ssh2 Jun 14 15:32:42 ubuntu sshd[1409]: Failed password for root from 192.168.1.100 port 50350 ssh2 Jun 14 15:32:44 ubuntu sshd[1409]: Failed password for root from 192.168.1.100 port 50350 ssh2 ...
📦 Bước 2: Copy log và đưa vào prompt phân tích
Dán 5–10 dòng log vào Prompt sau:
✅ Prompt mẫu dùng trong lab
You are a SOC analyst. Analyze the following SSH log entries and determine whether they indicate a brute-force attack. Identify key indicators, estimate attack intensity, and recommend next steps.
Log: Jun 14 15:32:41 ubuntu sshd[1409]: Failed password for root from 192.168.1.100 port 50350 ssh2 Jun 14 15:32:42 ubuntu sshd[1409]: Failed password for root from 192.168.1.100 port 50350 ssh2 Jun 14 15:32:44 ubuntu sshd[1409]: Failed password for root from 192.168.1.100 port 50350 ssh2 Jun 14 15:32:46 ubuntu sshd[1409]: Failed password for root from 192.168.1.100 port 50350 ssh2 Jun 14 15:32:47 ubuntu sshd[1409]: Failed password for root from 192.168.1.100 port 50350 ssh2
🧠 Kết quả mong đợi từ AI:
- Nhận diện tấn công brute-force (dựa vào tần suất, tài khoản root, cùng IP)
- Đề xuất:
- Chặn IP bằng iptables hoặc fail2ban
- Xác định nếu tấn công thành công
- Theo dõi các hành vi sau đăng nhập
🚨 Bước 3: Sinh Playbook phản ứng từ AI
Tiếp tục yêu cầu AI:
Based on your analysis, generate a step-by-step incident response plan for the SOC team to follow. Include containment, eradication, and recovery.
Output AI có thể tạo:
- Containment: Block IP 192.168.1.100
- Eradication: Audit all login attempts, disable root SSH login
- Recovery: Enforce SSH key auth, enable Fail2Ban, rotate passwords