ARTICLE DETAIL

资讯详情

深耕网站建设与运营推广的一线实战洞察。

国庆重保红蓝演练(五):跨网段横向移动检测与防火墙阻断实测

国庆重保红蓝演练(五):跨网段横向移动检测与防火墙阻断实测 国庆重保红蓝演练五跨网段横向移动检测与防火墙阻断实测在国庆重保前的红蓝实战攻防演练中红队在通过外网边缘资产如边界 VPN 或对外 Web 服务拿到初始立足点Foothold后真正的威胁在于其向内网核心生产域、数据库网段和容器编排集群的横向穿透Lateral Movement。蓝队如果仅守住边界而缺乏东西向East-West流量的检测与阻断能力内网防御就会沦为“纸糊的蛋壳”。红队典型横向穿透路径与网络行为特征演练中红队从 DMZ 区突破到核心数据中心通常依赖以下几类典型横向移动手法多级加密代理穿透利用 FRP、Chisel 或自定义的 WebSocket 隧道打通 DMZ 到办公网OA及内网测试网段的 Socks5 链路规避静态端口检测。凭据窃取与协议滥用利用机器内存中抓取的 NTLM Hash / Kerberos 票据通过 WMI、WinRM 或 SMB/RPC如 PsExec向内网跳板机实施 Pass-the-Hash (PtH) 或 Pass-the-Ticket (PtT)。SSH 密钥漫游与配置利用在 Linux 服务器上搜索.ssh/known_hosts、历史命令及无密码 SSH 密钥快速批量登录同集群其他节点。典型横向通信行为特征 - 短时间内源 IP 向同一子网或跨网段多个目标主机的 445 (SMB)、135 (RPC)、5985 (WinRM)、22 (SSH) 发起并发探测。 - 非办公时间如凌晨 2:00~5:00突发跨网段的大流量传输数据打包回传。 - 进程执行树中出现 cmd.exe / powershell.exe 由 wmiprvse.exe 或 services.exe 直接衍生。基于 NDR 与 Linux eBPF 的横向行为实时检测为了实现毫秒级的跨网段横向探测感知我们在核心汇聚交换机旁路镜像和主机端 eBPF 探针上部署了双层检测模型# lateral_movement_detector.py from collections import defaultdict import time class LateralMovementMonitor: def __init__(self, threshold5, time_window10): self.threshold threshold # 判定阈值时间窗口内扫描不同主机数 self.time_window time_window self.connection_tracker defaultdict(list) def process_flow_event(self, src_ip, dst_ip, dst_port, timestampNone): if timestamp is None: timestamp time.time() # 重点关注横向敏感端口 SENSITIVE_PORTS {22, 135, 445, 3389, 5985, 2375, 6443} if dst_port not in SENSITIVE_PORTS: return None # 清理过期窗口数据 self.connection_tracker[src_ip] [ (t, ip, p) for (t, ip, p) in self.connection_tracker[src_ip] if timestamp - t self.time_window ] # 记录本次跨网段访问 self.connection_tracker[src_ip].append((timestamp, dst_ip, dst_port)) # 统计访问的不同目标主机数 distinct_targets {ip for (_, ip, _) in self.connection_tracker[src_ip]} if len(distinct_targets) self.threshold: alert { alert_type: LATERAL_MOVEMENT_SCAN, source_ip: src_ip, target_count: len(distinct_targets), targeted_hosts: list(distinct_targets), ports: list({p for (_, _, p) in self.connection_tracker[src_ip]}), timestamp: timestamp } return alert return None在主机侧通过 eBPF 捕获security_socket_connect系统调用实时判定进程是否在发起非白名单的东西向跨网段请求。分布式防火墙策略自动化下发与联动阻断一旦 SOAR安全编排自动化与响应平台确认横向高危告警必须秒级联动内网核心交换机 ACL 和主机端iptables/nftables进行主机隔离Host Isolation# auto_containment_soar.py import subprocess import requests import json def block_lateral_source(attacker_ip, target_segment): 通过调用分布式防火墙 API 和在相关节点执行动态阻断规则 print(f[*] Triggering Auto-Containment for {attacker_ip} targeting {target_segment}) # 1. 动态下发 iptables 策略阻断所有跨网段转发 cmd [ iptables, -I, FORWARD, -s, attacker_ip, -j, DROP ] try: subprocess.run(cmd, checkTrue) print(f[] Successfully isolated {attacker_ip} at network gateway) except Exception as e: print(f[-] Failed to apply gateway iptables rule: {e}) # 2. 调用核心 SDN 控制器 API阻断源 IP 的 OpenFlow 流表 sdn_url https://sdn-controller.internal/api/v1/acls/quarantine payload { quarantine_ip: attacker_ip, action: DROP_ALL_EAST_WEST, duration_seconds: 3600 } headers {Authorization: Bearer SEC_TOKEN_REDACTED, Content-Type: application/json} try: resp requests.post(sdn_url, jsonpayload, headersheaders, timeout3) if resp.status_code 200: print([] SDN Micro-segmentation policy enforced successfully) except requests.exceptions.RequestException as e: print(f[-] SDN API call failed: {e}) if __name__ __main__: block_lateral_source(10.10.45.18, 172.16.0.0/16)实测验证与网络微隔离闭环在演练现场实测中红队在控制 DMZ 某测试机后尝试使用fscan对生产数据库段172.16.20.0/24发起 445 端口弱口令爆破。T0s红队启动扫描进程发出第 5 个 TCP SYN 包。T0.8sNDR 流量探针检出跨网段横向扫描告警SOAR 决策引擎触发高危收敛。T1.5s网关核心交换机与主机探针同步完成流表下发将源 IP 调度至黑洞路由Blackhole Routing同时告警推送到 SOC 大屏与值班专家群。T3.0s演练平台确认红队控制信道被成功切断横向移动路径完全收敛。通过实战检验验证了“流量全景感知 eBPF 主机取证 SDN 微隔离秒级阻断”的纵深防御体系在重保场景下的实战有效性。
返回列表