PLC/RTU Attacks
Programmable Logic Controllers (PLCs) and Remote Terminal Units (RTUs) are the workhorses of industrial automation. Compromising these devices can lead to direct physical impact.
Read on live plant, write only on a simulation
Common PLC Vulnerabilities
Authentication Issues
- No authentication in the classic protocol
- Protection level left at none
- Hardcoded credentials
- Password bypass vulnerabilities
Logic Vulnerabilities
- Unauthenticated program upload
- Logic download without verification
- Runtime value manipulation
- Stop/start control
The two columns are different findings with different fixes. A protocol with no authentication in it can only be constrained from outside the device, by segmentation, a filtering conduit or a protocol variant that carries its own security, whereas a protection level left at none is a configuration change on a device that already supports better. Reporting the first as though it were the second produces a remediation that cannot be applied, and the reverse produces one that is never needed.
Siemens S7 Attacks
S7 Enumeration
# The S7 protocol listens on 102/tcp (ISO-on-TCP)
nmap -p 102 --script s7-info 192.168.1.100import snap7
client = snap7.client.Client()
client.connect("192.168.1.100", 0, 1) # IP, rack, slot
info = client.get_cpu_info()
print(info.ModuleTypeName, info.SerialNumber, info.ModuleName)
# Run, Stop, or an error state. Reading it does not change it.
print(client.get_cpu_state())
client.disconnect()The module type, serial number and the name the project gave the CPU are what let you match a device to an advisory: advisories are written against a catalogue number and a firmware range, and the module name alone will not distinguish two variants of the same family. Record all three rather than the model number you inferred from the enclosure.
S7 Authentication Bypass
Whether an S7 password can be attacked at all is decided by the dialect, not by the tool. Classic S7comm carries its job and acknowledgement frames unencrypted and uses the legacy protection levels, so a CPU configured for password protection receives a password in the session setup and everything after it is readable on the wire. S7comm-plus, the dialect the S7-1200 and S7-1500 families negotiate, opens with a certificate-based handshake and encrypts the payload, so the same capture holds a handshake and then records with no function codes in them.
The check is a capture of the first frames of a session, taken after the TCP handshake. Classic frames dissect field by field, and the s7comm display filter selects them; a plus session shows the certificate exchange and then nothing readable. That single observation tells you which of the two conversations you are having, and therefore whether a password is even in the packets. Do not infer the dialect from the CPU family in the site documentation. The same family answers both, depending on which service the client asks for.
On the classic dialect the useful finding is the protection level, because it decides what an unauthenticated session is allowed to do: no protection, read protection, or read and write protection. Read it from the CPU's configuration export or the vendor tool, and record it with the capture that proves the session was accepted. A password prompt in a tool is not evidence of a protection level. The level is the property; the prompt is one client's interpretation of it.
S7 Control Commands
import snap7
client = snap7.client.Client()
client.connect("192.168.1.100", 0, 1)
# Reads only: none of these change controller state.
db_data = client.db_read(1, 0, 100) # DB1, offset 0, 100 bytes
inputs = client.read_area(snap7.types.Areas.PE, 0, 0, 10)
outputs = client.read_area(snap7.types.Areas.PA, 0, 0, 10)
markers = client.read_area(snap7.types.Areas.MK, 0, 0, 10)
# Mode changes are deliberately not shown. An S7-1200 or S7-1500 with protection
# configured rejects a stop or cold start issued without the access level that
# permits a mode change, and a CPU that accepts one stops the process. Use a
# simulator if you need to observe the request and the refusal.
client.disconnect()That refusal is itself the finding to report. A mode-change request that is rejected proves the protection level is enforced; a request that succeeds proves it is not, which is the case worth writing up even when no one asked you to stop anything.
Allen-Bradley / Rockwell Attacks
EtherNet/IP Exploitation
from pycomm3 import LogixDriver
with LogixDriver("192.168.1.100") as plc:
# Print the whole identification dictionary: the keys differ between
# controller families, so iterate rather than indexing a guessed key.
info = plc.get_plc_info()
for key, value in info.items():
print(f"{key}: {value}")
for tag in plc.get_tag_list():
print(f"{tag['tag_name']}: {tag['data_type']}")
# A read returns the value the running program holds at that moment.
# Tag writes and program downloads are not included: both change what the
# plant does at the next scan.
result = plc.read("SomeTag")
print(result.value)The tag list is the more useful artefact. It exposes the process vocabulary: which tags are commands, which are setpoints, which are status. A tag whose name says start or enable is worth writing up before anyone sends a packet to it. Explicit messaging on 44818 is the same service the engineering tool uses, so reachability from an unexpected zone is a finding whether or not the controller accepts a write.
Whether a write is accepted depends on the controller mode and on its security configuration. CIP Security binds a connection to a certificate, and a controller configured for it rejects an unauthenticated explicit message rather than answering it. A controller with neither CIP Security nor a key switch in a protecting position is the unprotected case; where the key switch is the only protection, the footer's false-positive list applies and the finding is the conduit, not the controller.
Modbus PLC Attacks
Classic Modbus/TCP carries no authentication: any host that can reach port 502 can issue every function code the device implements, and the exception response tells you whether the device accepted it. That statement does not cover every Modbus deployment. Modbus Security, the TLS variant of the protocol, binds a session to a certificate and enforces role-based access, so a device that answers only after a TLS handshake is not the unauthenticated case. The test is the first bytes of the connection: a Modbus connection begins with an application header of transaction identifier, protocol identifier, length and unit identifier, followed by a function code, while a TLS connection begins with a handshake record. Capture it before you write the finding.
from pymodbus.client import ModbusTcpClient
client = ModbusTcpClient("192.168.1.100", port=502)
client.connect()
# Client calls are keyword-only, and the unit identifier is passed under a
# different argument name in the request PDU. Check your installed release's
# own API page rather than copying an argument list from a post.
registers = client.read_holding_registers(address=0, count=10, device_id=1)
print(registers.registers)
coils = client.read_coils(address=0, count=10, device_id=1)
print(coils.bits)
client.close()
# Writes are not included. What an address means is device-specific: a coil may
# drive an output, or a relay, or nothing at all, and the program scan often
# overwrites the value on the next cycle. The device's documentation, or a
# simulator, tells you which.The coil map is where assessments go wrong. A coil is a single bit addressed by number, and the address-to-terminal mapping is defined by the device and its program, not by the protocol. Writing a coil on a running controller is racy by construction: the scan can rewrite the value before the output ever changes, so a successful write proves the register was writable, not that anything moved. Read the map from the device's documentation or from a simulator before you claim an impact.
Logic Manipulation
The most impactful attacks involve modifying the PLC logic itself. This can cause subtle malfunctions that are difficult to detect.
A logic change is a different class of event from a value write. A written value persists until the next scan or the next operator action, whereas changed logic persists through power cycles and program restarts and runs whenever its branch is reached. That difference is why logic integrity is a change-management problem and a value anomaly is a monitoring problem.
Attack Scenarios
The four patterns below are descriptions of behaviour observed in incidents and in malware. None is a procedure, and the techniques they name are catalogued behaviour rather than a sequence to follow. What makes each worth reading is the artefact it leaves behind, because that artefact is what a defender has to be able to find.
Stuxnet-style Attack
Logic was altered so that the equipment was driven outside its design envelope while the values reported to the operator stayed inside the normal range. The operator display was healthy for the whole period in which damage accumulated.
Safety System Bypass
Documented attacks have targeted the logic that enforces a safety function rather than the process, so that the interlock no longer acted at its setpoint while the operator display still showed it armed. MITRE records the two halves of this as a change of operating mode and as loss of safety. No procedure is given here and none should be inferred: a safety function is tested on an offline replica or inside a shutdown window, never on a live interlock. The argument, and why approval does not change it, is on Safety Considerations.
Production Sabotage
Parameters were drifted by amounts small enough to stay inside alarm deadbands, and the result was product that failed quality checks weeks after the run that made it. The loss was traced from batch records, not from the control system, which is the part that makes it expensive.
Ransomware
Operator access was removed and project archives were encrypted, so recovery depended on a backup that the same access had often reached first. The controller is rarely the target of the encryption; the engineering workstation holding the only copy of the program is.
Logic Upload/Download
Direction is the first thing to get right, because the vendor vocabulary reverses the file-transfer habit. An upload reads the program out of the controller into the engineering station: the CPU sends and nothing on it changes. A download writes the engineering station's program into the controller, replacing what executes at the next mode change. A report that says "downloaded the logic for analysis" has described a change to the plant.
import snap7
client = snap7.client.Client()
client.connect("192.168.1.100", 0, 1)
# full_upload returns a tuple: the block bytes and the block length, so it does
# not go straight into a file object. OB1 is the main cyclic organization block.
block_data, block_size = client.full_upload(snap7.types.Block.OB, 1)
with open("OB1.bin", "wb") as handle:
handle.write(block_data)
print(f"uploaded {block_size} bytes")
client.disconnect()An upload needs a session with an access level that permits it, so the protection level you recorded earlier predicts whether you will get the block or a refusal, and the refusal is the same finding. Every major family has its own equivalent: a Rockwell controller returns its program to the engineering tool, and the offline project archive the tool exports is what comparisons are run against; a Modicon returns its project through the engineering software. The artefact matters more than the path, because the artefact is what gets compared against an approved baseline.
Firmware Attacks
Firmware and logic fail differently, and conflating them produces findings that cannot be verified. Logic lives in the program blocks the engineering tool uploads and compares. Firmware is the code the module executes underneath that, and a modified firmware image can present a program that is not the one running. The two are found by different means: logic by comparing block checksums against an approved baseline, firmware by reading the module's catalogue and firmware version and matching them to the vendor advisory.
Rockwell's handling of the code-masquerading case is the clearest worked example of the distinction: the engineering tool writes human-readable program code to one location and the compiled code that executes to another, so a change to the executed copy leaves the source comparison showing nothing. The comparison that finds it is against the code read back from the controller, not against the project the tool happens to have open.
# A firmware image comes from a vendor download, a captured update, or the flash
# chip itself over a debug interface.
binwalk image.bin
binwalk --extract image.bin
# Then strings and disassembly over what came out, looking for:
# - a network service in the image that no datasheet mentions
# - credentials or keys compiled into it
# - a debug service that ships enabled
# For the advisory match, use the catalogue number and the firmware range from
# the vendor's record, not the product name from the datasheet.Whether a platform verifies a signature on an image before accepting it is a documented property of that platform, and the way to establish it is the update mechanism's response to an image the vendor did not sign rather than the presence of a hash on a download page. A hash on a download page proves the transfer was intact, which is a different claim from the module refusing to run unsigned code.
Notable ICS Malware & Threat Landscape
Real-world campaigns supply both the offensive scenarios and the detection content an OT assessor is expected to know.
Targeted Siemens S7-300 controllers driving uranium centrifuges. Modified PLC logic to damage equipment while replaying normal values to the HMI, the archetypal "false view to the operator" attack.
Industroyer / CRASHOVERRIDE (2016) & Industroyer2 (2022)
T1692.001 | Command Message T0814 | Denial of ServiceGrid malware used against Ukraine. Modular payloads spoke IEC-101, IEC-104, IEC 61850 (MMS) and OPC DA to open breakers directly. Industroyer2 (2022) was a hardcoded IEC-104 variant retargeted at a specific substation.
The first malware to target a Safety Instrumented System. It went after Schneider Triconex SIS controllers through the proprietary TriStation protocol. A failed reprogram tripped the plant to a safe state, revealing the attack. See the Safety Considerations section for why SIS is off-limits.
A modular, cross-vendor ICS attack framework (CISA AA22-103A). Components target Schneider and Omron PLCs plus any CODESYS and OPC UA device, making it vendor-agnostic rather than tied to one product. Discovered before deployment.
OT:ICEFALL (2022)
Common PLC CVEs
Every row below was checked against the CVE record for the affected products, the mechanism and the consequence. A CVE number is not a finding until it matches the catalogue number and firmware range on the device in front of you: many of these records list several variants and a set of fixed releases, and quoting the number alone is how a true statement becomes a false one.
| CVE | Vendor | Vulnerability | Impact |
|---|---|---|---|
| CVE-2012-6435 | Rockwell EtherNet/IP (incl. MicroLogix 1100/1400) | CIP message that stops logic execution | CPU enters a fault state; availability lost |
| CVE-2015-1015 | Omron CX-Programmer / CJ2 | Reversible password storage in object files | Password recoverable from a Compact Flash object file |
| CVE-2020-15782 | Siemens S7-1200 / S7-1500 | Memory protection bypass on 102/tcp | Write to protected memory, or read sensitive data |
| CVE-2021-22779 | Schneider Modicon M580 / M340 | Auth bypass by spoofing Modbus traffic | Unauthenticated read and write to the controller |
| CVE-2022-1161 | Rockwell ControlLogix / CompactLogix / GuardLogix | Source and compiled code stored separately | Executed logic differs from the program shown |
| CVE-2022-45788 | Schneider Modicon M340 / M580 | Malicious project file accepted on load | Code execution or denial of service on project load |
| CVE-2023-3595 | Rockwell 1756-EN2* / EN3* | Out-of-bounds write via crafted CIP | Remote code execution with persistence on the module |
PLC Testing Checklist
Enumeration
- Identify PLC vendor, model and catalogue number
- Read the firmware version from the vendor tool, not from a banner
- Match the pair to the vendor advisory for that range
- Enumerate the protocols the device actually answers on
Authentication
- Record the protection level, not whether a tool prompted
- Check whether authentication is enforced or merely offered
- Test for authentication bypass against the documented mechanism
- Record which dialect the session negotiated
Access Control
- Test read access to memory and registers
- Establish write restrictions from the configuration, not by writing
- Check which accounts may upload or download logic
- Confirm the mode-change path is restricted by the protection level
Documentation
Practice Lab
A soft PLC on your own machine, with the process disconnected and no hardware attached: OpenPLC Runtime (free, GPL) running a short program that drives one output coil, with its Modbus slave interface enabled so your own client can write the same coil. Write the coil and re-read it across a scan — the program's next pass puts its own value back. Then write a register the program never touches and re-read that one, which stays. Run the same two writes against a slave simulator with no program, such as pymodbus' own server, and they both persist. Done when you can say, from what you watched, which of your writes survived the scan and which did not, and why the difference is the scan owning the device rather than the protocol.
Evidence to Capture
A controller finding must be provable without writing to a running process. Reachability plus the protection setting is the proof.
Programming path: The capture showing which host can open a programming session, on which port, from which zone: S7 on 102, EtherNet/IP explicit messaging on 44818, or a Modbus write function. Reachability is the finding; a write is not required to demonstrate it.
Protection settings: The controller protection level, key switch position, and write-protection state read from the configuration export or the vendor tool. These decide whether the reachable path is actionable.
Logic baseline: The comparison output between the running program and the approved project version: checksum, block list, or a diff from the vendor tool. Without a baseline, logic integrity cannot be assessed.
Module and firmware: Catalogue and firmware version read through the vendor tool, mapped to the specific advisory. A web banner is not a firmware version.
Change record: The authorisation covering the last logic download or firmware change, with its date and approver. A baseline with no change history cannot distinguish an update from tampering.
Likely False Positives
A reachable controller is not a writable one. The gap depends on the protection layer behind the network path.
- Programming port reachable, key switch in RUN: A physical key in RUN with remote write disabled is a compensating control with a documented boundary. Report the conduit weakness, not an unprotected controller.
- Advisory that does not match the module: Many PLC advisories are variant-specific or require a feature that is not enabled. Confirm the catalogue number and firmware against the advisory text.
- Writes from the engineering workstation: A download inside an approved change window is the intended path. Compare the time against the change record before flagging it.
- No controller password: Some platforms do not support authentication at all. The reviewable control then is the conduit restriction on port 102, not a missing password field.
- Read functions observed: A SCADA poll using read-only function codes is normal plant traffic. Only write or program functions change the state of the process.
Review Checklist
Reachability
- ☐ Map which hosts can reach each controller programming port, by zone.
- ☐ Confirm the engineering workstation is the only source, and that it is not dual-homed to the corporate network.
- ☐ Check the conduit restricts the programming service rather than the whole host address.
- ☐ Confirm no wireless or vendor path bypasses the conduit.
Controller posture
- ☐ Read the protection level and key switch state for each controller.
- ☐ Confirm remote write is disabled where the process does not require it.
- ☐ Check firmware follows a supported release and that a change window exists for the next update.
- ☐ Confirm the controller clock is synchronised, since event logs depend on it.
Integrity and change
- ☐ Confirm an approved logic baseline exists for each controller and is stored off the engineering workstation.
- ☐ Check the compare has been run since the last change window.
- ☐ Confirm logic downloads are logged and the log is retained.
- ☐ Check the change record names the person who downloaded and the approver.
Remediation
Restrict the path first, then verify the programme
Structural
- • Restrict the programming service at the conduit to the engineering workstation address, so a host in the same zone cannot open a session.
- • Take the engineering workstation off any dual-homed path to the corporate network; it should reach the control zone through the DMZ only.
- • Stand up an offline baseline of every controller programme and compare against it on a fixed cadence.
Compensating
- • Where the controller cannot authenticate, put deep-packet inspection in front of it and alert on write and program function codes outside a change window.
- • Where a key switch is the only protection, record it in the zone risk assessment and confirm plant procedure keeps it in RUN.