☼
⌃
☰

Programmable Logic Controller

Table of Contents

Related: Industrial Control Systems SCADA Modbus

Programmable Logic Controller

Description

PLCs are the "brains" of the factory floor. Unlike a standard desktop computer, a PLC is built to survive harsh industrial environments characterized by extreme temperatures, electrical noise, vibration, and humidity. They are a core component of ICS.

How a PLC Operates: The Scan Cycle

A PLC functions in a continuous loop known as the Scan Cycle, which typically happens in milliseconds:

  1. Input Scan: The PLC checks the status of all input devices (e.g., is the "Start" button pressed? Is the temperature sensor at 20°C?).
  2. Program Scan: The PLC runs the user-created logic (often written in Ladder Logic) to decide what should happen based on the inputs.
  3. Output Scan: The PLC updates the output devices (e.g., turn on the motor, close the valve).
  4. Housekeeping: The PLC performs internal diagnostics and communication tasks (like talking to a SCADA system).

Programming Languages

While there are several languages used (defined by the IEC 61131-3 standard), the most common is Ladder Logic (LD). It was designed to mimic the physical relay logic diagrams that electricians used before PLCs existed, making it intuitive for maintenance personnel.

Security Perspective

In the context of Cyber Security, PLCs are critical targets. Because they directly control physical hardware, compromising a PLC can lead to physical destruction. Historically, PLCs lacked authentication; if you could "talk" to the PLC via its protocol (like Modbus), you could rewrite its logic or stop its process entirely.


Examples

1. Basic Industrial Logic

Scenario: A conveyor belt should only move if the "Start" button is pressed AND the "Emergency Stop" is NOT active. * Input 1: Start Button (Normally Open) * Input 2: E-Stop (Normally Closed) * Output: Conveyor Motor * Logic: IF (Start = 1) AND (E-Stop = 1) THEN Motor = 1

2. Interaction via Network (Python)

Attackers or testers use libraries like pymodbus or cppo to interact with PLCs. If a PLC is improperly exposed to the network, an unauthorized user could force an output.

PYTHON
from pymodbus.client import ModbusTcpClient

# Connect to the PLC
client = ModbusTcpClient('192.168.1.10')

# Force Coil (Output) #5 to be ON, potentially starting a motor
client.write_coil(5, True)

client.close()