Skip to content

Verify S7CommPlus V2/V3-with-TLS against a real PLC + add HMAC integrity if needed #718

@gijzelaerr

Description

@gijzelaerr

What's already on master

The unified Client already implements V2/V3 with TLS, end-to-end against the emulated server (s7/_s7commplus_server.py). 46 tests in test_s7_v2.py and test_s7_tls.py cover the connection path, IntegrityId tracking, and password legitimation. connect(use_tls=True, tls_cert=..., tls_key=..., tls_ca=...) works.

PR #719 closes the documentation gap.

What's actually still open (and needs hardware)

  1. Verify against a real PLC. The emulated server is one half; a TIA Portal V17+ S7-1500 (or FW ≥ 4.5 S7-1200) is the other. Without that, we can't tell whether the existing implementation produces wire-correct frames.

  2. HMAC-SHA256 fragment integrity (if the real PLC requires it). The current code emits an incrementing IntegrityId counter, not an HMAC. Per the Rogue7 paper (Bitan/Biham et al., Black Hat USA 2019) the V3 protocol expects each fragment to carry an HMAC-SHA256 of the fragment under a session key derived from the TLS exporter secret. The emulated server doesn't enforce this. If a real PLC rejects our connection past the handshake, this is the most likely missing piece.

  3. A repro pcap. Capture TIA Portal V17+ doing a basic db_read against a target PLC, save as a .pcapng test fixture, write a small comparison test that diffs our handshake bytes against TIA's frame-by-frame. Mostly a diagnostic, but would let us verify the implementation without needing live hardware on every CI run.

Each of these can be a separate small issue when someone has the hardware. Until then, this stays open as the umbrella.

Out of scope here

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions