scada timothy bennett cenitech.fgcu.edu/faculty/zalewski/cnt4104/projects/scada_report6.pdf ·...

43
Security in SCADA Applications Timothy Bennett Mentor: Janusz Zalewski CEN 4935 Senior Software Engineering Project Florida Gulf Coast University 10501 FGCU Blvd. S. Fort Myers, FL 339656565 Spring 2010 Draft #6 Submission Date: April 28, 2010

Upload: others

Post on 04-Aug-2020

16 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: SCADA Timothy Bennett CENitech.fgcu.edu/faculty/zalewski/CNT4104/Projects/SCADA_Report6.pdf · Coding System: Hexadecimal, ASCII characters 0–9, A–F One hexadecimal character

 

 

 

 

 

Security in SCADA Applications 

 

 

Timothy Bennett 

 

 

Mentor: 

Janusz Zalewski 

 

 

CEN 4935 

Senior Software Engineering Project 

 

 

Florida Gulf Coast University 

10501 FGCU Blvd. S. 

Fort Myers, FL 33965‐6565 

 

 

Spring 2010 

Draft #6 

Submission Date: April 28, 2010 

 

 

 

 

Page 2: SCADA Timothy Bennett CENitech.fgcu.edu/faculty/zalewski/CNT4104/Projects/SCADA_Report6.pdf · Coding System: Hexadecimal, ASCII characters 0–9, A–F One hexadecimal character

Page 2 

 

1. Introduction 

According to the National Communications System Technical Information Bulletin 04‐1: “SCADA 

Systems,” SCADA was initially developed and deployed during the 1960’s.[1] SCADA stands for 

Supervisory Control And Data Acquisition. SCADA systems are typically found in industrial plants where 

remote monitoring and control of systems is necessary because of hazardous and/or inaccessible 

equipment locations. Such facilities might include water treatment plants, wastewater treatment plants, 

chemical engineering facilities, oil refineries, nuclear facilities, and other such plants that are critical to 

the nation’s infrastructure.  

SCADA systems are usually networked, with at least one controller, and one or more remote terminal 

units (RTUs) distributed throughout the plant at necessary control points. [1] An RTU can be compared 

to an analog/digital converter. It can receive signals from sensors at the control point, convert and send 

these signals to the controller, and also receive signals back from the controller and convert the 

commands so they can be understood by the actual control mechanisms. 

 

 

Figure X 

 

Page 3: SCADA Timothy Bennett CENitech.fgcu.edu/faculty/zalewski/CNT4104/Projects/SCADA_Report6.pdf · Coding System: Hexadecimal, ASCII characters 0–9, A–F One hexadecimal character

Page 3 

 

This project focuses on a simple network of one RTU, one control unit, and a workstation connected to 

the control unit, as illustrated in figure x (workstation not pictured). This workstation is meant to allow 

the operator to actually control the system on the control unit via a web‐based interface. This interface 

is called a human‐machine interface, or HMI. The RTU also has a web‐based interface, but this is mainly 

used only for the initial configuration of the RTU. 

_+

_+

 

Figure X 

 

The goal of this project is to make the RTU able to viewed and/or controlled remotely, while still 

maintaining as much security as possible. This would be important for plants that had operators, 

troubleshooters, etc., off‐site and/or outside the plant’s systems. If an employee at the plant reported 

the failure of a part or system, especially a mission‐critical part or system, and for some reason or 

Page 4: SCADA Timothy Bennett CENitech.fgcu.edu/faculty/zalewski/CNT4104/Projects/SCADA_Report6.pdf · Coding System: Hexadecimal, ASCII characters 0–9, A–F One hexadecimal character

Page 4 

 

another either couldn’t access the system, or maybe the controls were compromised, another person 

(outside of the plant) could be called to try to rectify the situation. That’s not to say that this external 

access would be a fail‐safe; there still need to be other contingency plans. This is merely a convenience. 

Page 5: SCADA Timothy Bennett CENitech.fgcu.edu/faculty/zalewski/CNT4104/Projects/SCADA_Report6.pdf · Coding System: Hexadecimal, ASCII characters 0–9, A–F One hexadecimal character

Page 5 

 

2. Principles of Communication 

SCADA is a generic term integrating a number of technologies. One of these technologies is an industrial 

communications protocol called Modbus, which is described briefly in this subsection. 

2.1 Modbus 

Modbus was first published by Modicon in 1979. [2] The company has gone through several takeovers, 

and is now Schneider Electric.  

Modbus controllers can communicate using two serial transmission modes: either ASCII or RTU. 

Regardless of which mode is picked, the mode must be the same for all devices on that Modbus 

network. 

Longitudinal Redundancy Check (LRC) is the error‐checking used for ASCII mode; Cyclical Redundancy 

Check (CRC) is the error‐checking used for RTU mode. 

Modbus contains 24 function codes (as that was the amount of function codes that Modicon’s hardware 

supported at the time) 

The following Modbus information is taken from [2], section 1, pages 2‐16. 

Page 6: SCADA Timothy Bennett CENitech.fgcu.edu/faculty/zalewski/CNT4104/Projects/SCADA_Report6.pdf · Coding System: Hexadecimal, ASCII characters 0–9, A–F One hexadecimal character

Page 6 

 

2.1.1 Introduction to Modbus 

Modicon programmable controllers can communicate with each other and with other devices over a 

variety of networks. Supported networks include the Modicon Modbus and Modbus Plus industrial 

networks, and standard networks such as MAP and Ethernet. Networks are accessed by built–in ports in 

the controllers or by network adapters, option modules, and gateways that are available from Modicon. 

For original equipment manufacturers, Modicon ModConnect ‘partner’ programs are available for 

closely integrating networks like Modbus Plus into proprietary product designs. 

The common language used by all Modicon controllers is the Modbus protocol. This protocol defines a 

message structure that controllers will recognize and use, regardless of the type of networks over which 

they communicate. It describes the process a controller uses to request access to another device, how it 

will respond to requests from the other devices, and how errors will be detected and reported. It 

establishes a common format for the layout and contents of message fields. 

The Modbus protocol provides the internal standard that the Modicon controllers use for parsing 

messages. During communications on a Modbus network, the protocol determines how each controller 

will know its device address, recognize a message addressed to it, determine the kind of action to be 

taken, and extract any data or other information contained in the message. If a reply is required, the 

controller will construct the reply message and send it using Modbus protocol. 

On other networks, messages containing Modbus protocol are imbedded into the frame or packet 

structure that is used on the network. For example, Modicon network controllers for Modbus Plus or 

MAP, with associated application software libraries and drivers, provide conversion between the 

imbedded Modbus message protocol and the specific framing protocols those networks use to 

communicate between their node devices. 

This conversion also extends to resolving node addresses, routing paths, and error–checking methods 

specific to each kind of network. For example, Modbus device addresses contained in the Modbus 

protocol will be converted into node addresses prior to transmission of the messages. Error–checking 

fields will also be applied to message packets, consistent with each network’s protocol. At the final point 

of delivery, however – for example, a controller – the contents of the imbedded message, written using 

Modbus protocol, define the action to be taken. 

Figure X shows how devices might be interconnected in a hierarchy of networks that employ widely 

differing communication techniques. In message transactions, the Modbus protocol imbedded into each 

network’s packet structure provides the common language by which the devices can exchange data. 

Page 7: SCADA Timothy Bennett CENitech.fgcu.edu/faculty/zalewski/CNT4104/Projects/SCADA_Report6.pdf · Coding System: Hexadecimal, ASCII characters 0–9, A–F One hexadecimal character

Page 7 

 

 

 

 

[FIGURE x] ‐ Overview of Modbus Protocol Application 

 

2.1.1.1 Transactions on Modbus Networks 

Standard Modbus ports on Modicon controllers use an RS–232C compatible serial interface that defines 

connector pinouts, cabling, signal levels, transmission baud rates, and parity checking. Controllers can 

be networked directly or via modems. 

Page 8: SCADA Timothy Bennett CENitech.fgcu.edu/faculty/zalewski/CNT4104/Projects/SCADA_Report6.pdf · Coding System: Hexadecimal, ASCII characters 0–9, A–F One hexadecimal character

Page 8 

 

Controllers communicate using a master–slave technique, in which only one device (the master) can 

initiate transactions (called ‘queries’). The other devices (the slaves) respond by supplying the requested 

data to the master, or by taking the action requested in the query. Typical master devices include host 

processors and programming panels. Typical slaves include programmable controllers. 

The master can address individual slaves, or can initiate a broadcast message to all slaves. Slaves return 

a message (called a ‘response’) to queries that are addressed to them individually. Responses are not 

returned to broadcast queries from the master. 

The Modbus protocol establishes the format for the master’s query by placing into it the device (or 

broadcast) address, a function code defining the requested action, any data to be sent, and an error–

checking field. The slave’s response message is also constructed using Modbus protocol. It contains 

fields confirming the action taken, any data to be returned, and an error–checking field. If an error 

occurred in receipt of the message, or if the slave is unable to perform the requested action, the slave 

will construct an error message and send it as its response. 

 

2.1.1.2 Transactions on Other Kinds of Networks 

In addition to their standard Modbus capabilities, some Modicon controller models can communicate 

over Modbus Plus using built–in ports or network adapters, and over MAP, using network adapters. 

On these networks, the controllers communicate using a peer–to–peer technique, in which any 

controller can initiate transactions with the other controllers. Thus a controller may operate either as a 

slave or as a master in separate transactions. Multiple internal paths are frequently provided to allow 

concurrent processing of master and slave transactions. 

At the message level, the Modbus protocol still applies the master–slave principle even though the 

network communication method is peer–to–peer. If a controller originates a message, it does so as a 

master device, and expects a response from a slave device. Similarly, when a controller receives a 

message it constructs a slave response and returns it to the originating controller. 

 

Page 9: SCADA Timothy Bennett CENitech.fgcu.edu/faculty/zalewski/CNT4104/Projects/SCADA_Report6.pdf · Coding System: Hexadecimal, ASCII characters 0–9, A–F One hexadecimal character

Page 9 

 

2.1.1.3 The Query‐Response Cycle 

 

[FIGURE X] ‐ Master‐Slave Query‐Response Cycle 

 

The Query: The function code in the query tells the addressed slave device what kind of action to 

perform. The data bytes contain any additional information that the slave will need to perform the 

function. For example, function code 03 will query the slave to read holding registers and respond with 

their contents. The data field must contain the information telling the slave which register to start at 

and how many registers to read. The error check field provides a method for the slave to validate the 

integrity of the message contents. 

 

The Response: If the slave makes a normal response, the function code in the response is an echo of the 

function code in the query. The data bytes contain the data collected by the slave, such as register 

values or status. If an error occurs, the function code is modified to indicate that the response is an error 

response, and the data bytes contain a code that describes the error. The error check field allows the 

master to confirm that the message contents are valid. 

 

Page 10: SCADA Timothy Bennett CENitech.fgcu.edu/faculty/zalewski/CNT4104/Projects/SCADA_Report6.pdf · Coding System: Hexadecimal, ASCII characters 0–9, A–F One hexadecimal character

Page 10 

 

2.1.2 The Two Serial Transmission Modes 

Controllers can be setup to communicate on standard Modbus networks using either of two 

transmission modes: ASCII or RTU. Users select the desired mode, along with the serial port 

communication parameters (baud rate, parity mode, etc), during configuration of each controller. The 

mode and serial parameters must be the same for all devices on a Modbus network . 

The selection of ASCII or RTU mode pertains only to standard Modbus networks. It defines the bit 

contents of message fields transmitted serially on those networks. It determines how information will 

be packed into the message fields and decoded. 

On other networks like MAP and Modbus Plus, Modbus messages are placed into frames that are not 

related to serial transmission. For example, a request to read holding registers can be handled between 

two controllers on Modbus Plus without regard to the current setup of either controller’s serial Modbus 

port. 

 

2.1.2.1 ASCII Mode 

When controllers are setup to communicate on a Modbus network using ASCII (American Standard Code 

for Information Interchange) mode, each 8–bit byte in a message is sent as two ASCII characters. The 

main advantage of this mode is that it allows time intervals of up to one second to occur between 

characters without causing an error. 

The format for each byte in ASCII mode is: 

 

Coding System:    Hexadecimal, ASCII characters 0–9, A–F 

      One hexadecimal character contained in each 

      ASCII character of the message 

 

Bits per Byte:    1 start bit 

      7 data bits, least significant bit sent first 

      1 bit for even/odd parity; no bit for no parity 

      1 stop bit if parity is used; 2 bits if no parity 

 

Error Check Field:  Longitudinal Redundancy Check (LRC) 

 

Page 11: SCADA Timothy Bennett CENitech.fgcu.edu/faculty/zalewski/CNT4104/Projects/SCADA_Report6.pdf · Coding System: Hexadecimal, ASCII characters 0–9, A–F One hexadecimal character

Page 11 

 

2.1.2.2 RTU Mode 

When controllers are setup to communicate on a Modbus network using RTU (Remote Terminal Unit) 

mode, each 8–bit byte in a message contains two 4–bit hexadecimal characters. The main advantage of 

this mode is that its greater character density allows better data throughput than ASCII for the same 

baud rate. Each message must be transmitted in a continuous stream. 

The format for each byte in RTU mode is: 

 

Coding System:    8–bit binary, hexadecimal 0–9, A–F 

      Two hexadecimal characters contained in each 

      8–bit field of the message 

 

Bits per Byte:    1 start bit 

      8 data bits, least significant bit sent first 

      1 bit for even/odd parity; no bit for no parity 

      1 stop bit if parity is used; 2 bits if no parity 

 

Error Check Field:  Cyclical Redundancy Check (CRC) 

 

2.1.3 Modbus Message Framing 

In either of the two serial transmission modes (ASCII or RTU), a Modbus message is placed by the 

transmitting device into a frame that has a known beginning and ending point. This allows receiving 

devices to begin at the start of the message, read the address portion and determine which device is 

addressed (or all devices, if the message is broadcast), and to know when the message is completed. 

Partial messages can be detected and errors can be set as a result. 

On networks like MAP or Modbus Plus, the network protocol handles the framing of messages with 

beginning and end delimiters that are specific to the network. Those protocols also handle delivery to 

the destination device, making the Modbus address field imbedded in the message unnecessary for the 

actual transmission. (The Modbus address is converted to a network node address and routing path by 

the originating controller or its network adapter.) 

 

Page 12: SCADA Timothy Bennett CENitech.fgcu.edu/faculty/zalewski/CNT4104/Projects/SCADA_Report6.pdf · Coding System: Hexadecimal, ASCII characters 0–9, A–F One hexadecimal character

Page 12 

 

2.1.3.1 ASCII Framing 

In ASCII mode, messages start with a ‘colon’ ( : ) character (ASCII 3A hex), and end with a ‘carriage return 

– line feed’ (CRLF) pair (ASCII 0D and 0A hex). 

The allowable characters transmitted for all other fields are hexadecimal 0–9, A–F. Networked devices 

monitor the network bus continuously for the ‘colon’ character. When one is received, each device 

decodes the next field (the address field) to find out if it is the addressed device. 

Intervals of up to one second can elapse between characters within the message. If a greater interval 

occurs, the receiving device assumes an error has occurred. A typical message frame is shown below. 

 

 

[FIGURE X] ‐ ASCII Message Frame 

 

Exception: With the 584 and 984A/B/X controllers, an ASCII message can normally terminate after the 

LRC field without the CRLF characters being sent. An interval of at least one second must then occur. If 

this happens, the controller will assume that the message terminated normally. 

 

2.1.3.2 RTU Framing 

In RTU mode, messages start with a silent interval of at least 3.5 character times. This is most easily 

implemented as a multiple of character times at the baud rate that is being used on the network (shown 

as T1–T2–T3–T4 in the figure below). The first field then transmitted is the device address. 

The allowable characters transmitted for all fields are hexadecimal 0–9, A–F. Networked devices 

monitor the network bus continuously, including during the ‘silent’ intervals. When the first field (the 

address field) is received, each device decodes it to find out if it is the addressed device. 

Following the last transmitted character, a similar interval of at least 3.5 character times marks the end 

of the message. A new message can begin after this interval. 

The entire message frame must be transmitted as a continuous stream. If a silent interval of more than 

1.5 character times occurs before completion of the frame, the receiving device flushes the incomplete 

message and assumes that the next byte will be the address field of a new message. 

Page 13: SCADA Timothy Bennett CENitech.fgcu.edu/faculty/zalewski/CNT4104/Projects/SCADA_Report6.pdf · Coding System: Hexadecimal, ASCII characters 0–9, A–F One hexadecimal character

Page 13 

 

Similarly, if a new message begins earlier than 3.5 character times following a previous message, the 

receiving device will consider it a continuation of the previous message. This will set an error, as the 

value in the final CRC field will not be valid for the combined messages. A typical message frame is 

shown below. 

 

 

[FIGURE X] ‐ RTU message frame 

 

2.1.3.3 How the Address Field is Handled 

The address field of a message frame contains two characters (ASCII) or eight bits (RTU). Valid slave 

device addresses are in the range of 0 – 247 decimal. The individual slave devices are assigned addresses 

in the range of 1 – 247. A master addresses a slave by placing the slave address in the address field of 

the message. When the slave sends its response, it places its own address in this address field of the 

response to let the master know which slave is responding. 

Address 0 is used for the broadcast address, which all slave devices recognize. When Modbus protocol is 

used on higher level networks, broadcasts may not be allowed or may be replaced by other methods. 

For example, Modbus Plus uses a shared global database that can be updated with each token rotation. 

 

2.1.3.4 How the Function Field is Handled 

The function code field of a message frame contains two characters (ASCII) or eight bits (RTU). Valid 

codes are in the range of 1 – 255 decimal. Of these, some codes are applicable to all Modicon 

controllers, while some codes apply only to certain models, and others are reserved for future use. 

Current codes are described in Chapter 2 [of source 2]. 

When a message is sent from a master to a slave device the function code field tells the slave what kind 

of action to perform. Examples are to read the ON/OFF states of a group of discrete coils or inputs; to 

read the data contents of a group of registers; to read the diagnostic status of the slave; to write to 

designated coils or registers; or to allow loading, recording, or verifying the program within the slave. 

When the slave responds to the master, it uses the function code field to indicate either a normal 

(error–free) response or that some kind of error occurred (called an exception response). For a normal 

Page 14: SCADA Timothy Bennett CENitech.fgcu.edu/faculty/zalewski/CNT4104/Projects/SCADA_Report6.pdf · Coding System: Hexadecimal, ASCII characters 0–9, A–F One hexadecimal character

Page 14 

 

response, the slave simply echoes the original function code. For an exception response, the slave 

returns a code that is equivalent to the original function code with its most–significant bit set to a logic 

1. 

For example, a message from master to slave to read a group of holding registers would have the 

following function code: 

 

0000 0011 (Hexadecimal 03) 

 

If the slave device takes the requested action without error, it returns the same code in its response. If 

an exception occurs, it returns: 

 

1000 0011 (Hexadecimal 83) 

 

In addition to its modification of the function code for an exception response, the slave places a unique 

code into the data field of the response message. This tells the master what kind of error occurred, or 

the reason for the exception. 

The master device’s application program has the responsibility of handling exception responses. Typical 

processes are to post subsequent retries of the message, to try diagnostic messages to the slave, and to 

notify operators. 

 

2.1.3.5 Contents of the Data Field 

The data field is constructed using sets of two hexadecimal digits, in the range of 00 to FF hexadecimal. 

These can be made from a pair of ASCII characters, or from one RTU character, according to the 

network’s serial transmission mode. 

The data field of messages sent from a master to slave devices contains additional information which 

the slave must use to take the action defined by the function code. This can include items like discrete 

and register addresses, the quantity of items to be handled, and the count of actual data bytes in the 

field. 

For example, if the master requests a slave to read a group of holding registers (function code 03), the 

data field specifies the starting register and how many registers are to be read. If the master writes to a 

group of registers in the slave (function code 10 hexadecimal), the data field specifies the starting 

Page 15: SCADA Timothy Bennett CENitech.fgcu.edu/faculty/zalewski/CNT4104/Projects/SCADA_Report6.pdf · Coding System: Hexadecimal, ASCII characters 0–9, A–F One hexadecimal character

Page 15 

 

register, how many registers to write, the count of data bytes to follow in the data field, and the data to 

be written into the registers. 

If no error occurs, the data field of a response from a slave to a master contains the data requested. If 

an error occurs, the field contains an exception code that the master application can use to determine 

the next action to be taken. 

The data field can be nonexistent (of zero length) in certain kinds of messages. For example, in a request 

from a master device for a slave to respond with its communications event log (function code 0B 

hexadecimal), the slave does not require any additional information. The function code alone specifies 

the action. 

 

2.1.3.6 Contents of the Error Checking Field 

Two kinds of error–checking methods are used for standard Modbus networks. The error checking field 

contents depend upon the method that is being used. 

 

2.1.3.6.1 ASCII 

When ASCII mode is used for character framing, the error checking field contains two ASCII characters. 

The error check characters are the result of a Longitudinal Redundancy Check (LRC) calculation that is 

performed on the message contents, exclusive of the beginning ‘colon’ and terminating CRLF characters. 

The LRC characters are appended to the message as the last field preceding the CRLF characters. 

 

2.1.3.6.2 RTU 

When RTU mode is used for character framing, the error checking field contains a 16–bit value 

implemented as two 8–bit bytes. The error check value is the result of a Cyclical Redundancy Check 

calculation performed on the message contents. 

The CRC field is appended to the message as the last field in the message. When this is done, the low–

order byte of the field is appended first, followed by the high–order byte. The CRC high–order byte is the 

last byte to be sent in the message. 

Additional information about error checking is contained later in this chapter. Detailed steps for 

generating LRC and CRC fields can be found in Appendix C [of source 2]. 

 

Page 16: SCADA Timothy Bennett CENitech.fgcu.edu/faculty/zalewski/CNT4104/Projects/SCADA_Report6.pdf · Coding System: Hexadecimal, ASCII characters 0–9, A–F One hexadecimal character

Page 16 

 

2.1.3.7 How Characters are Transmitted Serially 

When messages are transmitted on standard Modbus serial networks, each character or byte is sent in 

this order (left to right): 

 

Least Significant Bit (LSB) . . . Most Significant Bit (MSB) 

 

With ASCII character framing, the bit sequence is: 

 

 

[FIGURE X] Bit order(ASCII) 

 

With RTU character framing, the bit sequence is: 

 

 

[FIGURE X] Bit order (RTU) 

 

 

Page 17: SCADA Timothy Bennett CENitech.fgcu.edu/faculty/zalewski/CNT4104/Projects/SCADA_Report6.pdf · Coding System: Hexadecimal, ASCII characters 0–9, A–F One hexadecimal character

Page 17 

 

2.1.4 Error Checking Methods 

Standard Modbus serial networks use two kinds of error checking. Parity checking (even or odd) can be 

optionally applied to each character. Frame checking (LRC or CRC) is applied to the entire message. Both 

the character check and message frame check are generated in the master device and applied to the 

message contents before transmission. The slave device checks each character and the entire message 

frame during receipt. 

The master is configured by the user to wait for a predetermined timeout interval before aborting the 

transaction. This interval is set to be long enough for any slave to respond normally. If the slave detects 

a transmission error, the message will not be acted upon. The slave will not construct a response to the 

master. Thus the timeout will expire and allow the master’s program to handle the error. Note that a 

message addressed to a nonexistent slave device will also cause a timeout. 

Other networks such as MAP or Modbus Plus use frame checking at a level above the Modbus contents 

of the message. On those networks, the Modbus message LRC or CRC check field does not apply. In the 

case of a transmission error, the communication protocols specific to those networks notify the 

originating device that an error has occurred, and allow it to retry or abort according to how it has been 

setup. If the message is delivered, but the slave device cannot respond, a timeout error can occur which 

can be detected by the master’s program. 

 

2.1.4.1 Parity Checking 

Users can configure controllers for Even or Odd Parity checking, or for No Parity checking. This will 

determine how the parity bit will be set in each character. 

If either Even or Odd Parity is specified, the quantity of 1 bits will be counted in the data portion of each 

character (seven data bits for ASCII mode, or eight for RTU). The parity bit will then be set to a 0 or 1 to 

result in an Even or Odd total of 1 bits. 

For example, these eight data bits are contained in an RTU character frame: 

 

1100 0101 

 

The total quantity of 1 bits in the frame is four. If Even Parity is used, the frame’s parity bit will be a 0, 

making the total quantity of 1 bits still an even number (four). If Odd Parity is used, the parity bit will be 

a 1, making an odd quantity (five). 

Page 18: SCADA Timothy Bennett CENitech.fgcu.edu/faculty/zalewski/CNT4104/Projects/SCADA_Report6.pdf · Coding System: Hexadecimal, ASCII characters 0–9, A–F One hexadecimal character

Page 18 

 

When the message is transmitted, the parity bit is calculated and applied to the frame of each character. 

The receiving device counts the quantity of 1 bits and sets an error if they are not the same as 

configured for that device (all devices on the Modbus network must be configured to use the same 

parity check method). 

Note that parity checking can only detect an error if an odd number of bits are picked up or dropped in a 

character frame during transmission. For example, if Odd Parity checking is employed, and two 1 bits are 

dropped from a character containing three 1 bits, the result is still an odd count of 1 bits. 

If No Parity checking is specified, no parity bit is transmitted and no parity check can be made. An 

additional stop bit is transmitted to fill out the character frame. 

 

2.1.4.2 LRC Checking 

In ASCII mode, messages include an error–checking field that is based on a Longitudinal Redundancy 

Check (LRC) method. The LRC field checks the contents of the message, exclusive of the beginning 

‘colon’ and ending CRLF pair. It is applied regardless of any parity check method used for the individual 

characters of the message. 

The LRC field is one byte, containing an 8–bit binary value. The LRC value is calculated by the 

transmitting device, which appends the LRC to the message. The receiving device calculates an LRC 

during receipt of the message, and compares the calculated value to the actual value it received in the 

LRC field. If the two values are not equal, an error results. 

The LRC is calculated by adding together successive 8–bit bytes of the message, discarding any carries, 

and then two’s complementing the result. It is performed on the ASCII message field contents excluding 

the ‘colon’ character that begins the message, and excluding the CRLF pair at the end of the message. 

In ladder logic, the CKSM function calculates a LRC from the message contents. For applications using 

host computers, a detailed example of LRC generation is contained in Appendix C [of source 2]. 

 

2.1.4.3 CRC Checking 

In RTU mode, messages include an error–checking field that is based on a Cyclical Redundancy Check 

(CRC) method. The CRC field checks the contents of the entire message. It is applied regardless of any 

parity check method used for the individual characters of the message. 

The CRC field is two bytes, containing a 16–bit binary value. The CRC value is calculated by the 

transmitting device, which appends the CRC to the message. The receiving device recalculates a CRC 

Page 19: SCADA Timothy Bennett CENitech.fgcu.edu/faculty/zalewski/CNT4104/Projects/SCADA_Report6.pdf · Coding System: Hexadecimal, ASCII characters 0–9, A–F One hexadecimal character

Page 19 

 

during receipt of the message, and compares the calculated value to the actual value it received in the 

CRC field. If the two values are not equal, an error results. 

The CRC is started by first preloading a 16–bit register to all 1’s. Then a process begins of applying 

successive 8–bit bytes of the message to the current contents of the register. Only the eight bits of data 

in each character are used for generating the CRC. Start and stop bits, and the parity bit, do not apply to 

the CRC. 

During generation of the CRC, each 8–bit character is exclusive ORed with the register contents. Then 

the result is shifted in the direction of the least significant bit (LSB), with a zero filled into the most 

significant bit (MSB) position. The LSB is extracted and examined. If the LSB was a 1, the register is then 

exclusive ORed with a preset, fixed value. If the LSB was a 0, no exclusive OR takes place. 

This process is repeated until eight shifts have been performed. After the last (eighth) shift, the next 8–

bit byte is exclusive ORed with the register’s current value, and the process repeats for eight more shifts 

as described above. The final contents of the register, after all the bytes of the message have been 

applied, is the CRC value. 

When the CRC is appended to the message, the low‐order byte is appended first, followed by the high‐

order byte. 

In ladder logic, the CKSM function calculates a CRC from the message contents. For applications using 

host computers, a detailed example of CRC generation is contained in Appendix C [of source 2]. 

Page 20: SCADA Timothy Bennett CENitech.fgcu.edu/faculty/zalewski/CNT4104/Projects/SCADA_Report6.pdf · Coding System: Hexadecimal, ASCII characters 0–9, A–F One hexadecimal character

Page 20 

 

2.2 Security 

Because of the critical nature of the systems in which SCADA is used, security is one of the top priorities. 

The Modbus protocol is used to transfer data between the SCADA server and the TCU. Since existing 

infrastructures are usually pre‐wired with network cables, this communication between the SCADA 

server and the TCU can be encapsulated in Transmission Control Protocol / Internet Protocol (TCP/IP) 

packets. This is known as Modbus over TCP/IP. This presents an interesting set of circumstances. Now, 

the security issue can be simplified a little bit, as now all that’s required is a (somewhat) working 

knowledge of networking, ports, addresses, and protocols, to name a few.  

When a computer sends out a packet, there is a header on that packet with the destination IP address, 

the destination port, and sometimes even the MAC address of the host, if it is known. Each computer 

has the possibility of having any one of 65,535 (216 – 1) ports opened at any one time. That is a LOT of 

potential for a hacker. And all he needs is one unsecured port. The problem, then, will focus on figuring 

out which ports to secure, without crippling the operation of the device, and at the same time, not 

leaving many (if any) opportunities for a potential hacker to break into the network. 

The following information is taken from [3]. 

 

Page 21: SCADA Timothy Bennett CENitech.fgcu.edu/faculty/zalewski/CNT4104/Projects/SCADA_Report6.pdf · Coding System: Hexadecimal, ASCII characters 0–9, A–F One hexadecimal character

Page 21 

 

3. Problem Description 

The first problem was how to get all of the devices communicating. The control unit and RTU had 

already been initialized and programmed by Data Flow Systems (hereafter “DFS”), the company that 

supplied the equipment, in Melbourne, FL. 

The IP addresses are as follows: 

69.88.163.28 – Workstation 

69.88.163.29 – RTU 

69.88.163.30 – Controller 

The 69.x.x.x IP address falls into the Class A IP address range (1.x.x.x‐126.x.x.x), however, the school’s 

Computing Services department had kept a Class C subnet mask (typical for small‐to‐medium networks.) 

When setting up the subnet address for the workstation, it was determined by trial and error which 

subnet mask to use. Once this had been determined, and all of the necessary network and port 

assignments had been taken care of by Computing Services, the three devices were able to 

communicate with each other on the network. 

The TCU has failed twice so far. The first time was Friday, 6 November, 2009. The TCU was rebooting 

itself approximately every seven seconds. It was determined the TCU needed to be RMA’d back to DFS 

in Melbourne, FL. The unit was sent back to DFS, “repaired”, and sent back to FGCU. Receipt and setup 

of the TCU happened on Wednesday, 2 December 2009. Two days later, Friday, 4 December 2009, the 

TCU was observed to be doing the exact same thing as it was before it was sent off. DFS was contacted 

again. I was informed that the person we had been in contact with the first time had not actually seen 

our TCU, and an in‐depth diagnostic had not been performed. The TCU was RMA’d again to DFS. Since 

receiving the TCU back from DFS the second time, the ‘Analog Input 1’ had stopped working completely 

/ only worked intermittently. 

DFS informed me that in order to determine more information about this problem, a special diagnostic 

cable and software was to be purchased from them. 

Page 22: SCADA Timothy Bennett CENitech.fgcu.edu/faculty/zalewski/CNT4104/Projects/SCADA_Report6.pdf · Coding System: Hexadecimal, ASCII characters 0–9, A–F One hexadecimal character

Page 22 

 

 

Figure X 

 

Figure X 

Page 23: SCADA Timothy Bennett CENitech.fgcu.edu/faculty/zalewski/CNT4104/Projects/SCADA_Report6.pdf · Coding System: Hexadecimal, ASCII characters 0–9, A–F One hexadecimal character

Page 23 

 

 

Figure X 

 

The WinRTU software was shipped on a CD with the cable. The cable consists of a female DE‐9 (often 

incorrectly termed a DB‐9) D‐subminature (DSUB) connector on one end, and a 6P6C (6‐pin, 6‐contact) 

modular plug (often incorrectly termed an RJ‐11 plug) on the other end. 

The WinRTU software needs to have some initial settings set before it can successfully connect to the 

TCU, shown in figures x, x and x. 

Page 24: SCADA Timothy Bennett CENitech.fgcu.edu/faculty/zalewski/CNT4104/Projects/SCADA_Report6.pdf · Coding System: Hexadecimal, ASCII characters 0–9, A–F One hexadecimal character

Page 24 

 

 

Figure x 

Page 25: SCADA Timothy Bennett CENitech.fgcu.edu/faculty/zalewski/CNT4104/Projects/SCADA_Report6.pdf · Coding System: Hexadecimal, ASCII characters 0–9, A–F One hexadecimal character

Page 25 

 

 

Figure x 

 

Figure x 

To set the communication settings, open WinRTU Test. Go to Configure > Comm on the menu bar. This 

will open the Communications Settings dialog box seen in figure x. Input the settings shown, and then 

click OK. 

Once the communication settings have been entered, you will need to auto‐populate the modules 

screen. Make sure you are on the Modules screen by going to Form > Modules on the menu bar. The 

screen you are currently on will be grayed out. If ‘Modules’ is not already grayed out, click on it to go to 

the Modules form. 

From here, click on Configure > Auto on the menu bar. This should auto‐populate the different modules 

that are currently in use. A summary of the modules and points can be found in the TCU Installation and 

Operations Manual (Appendix x). 

Page 26: SCADA Timothy Bennett CENitech.fgcu.edu/faculty/zalewski/CNT4104/Projects/SCADA_Report6.pdf · Coding System: Hexadecimal, ASCII characters 0–9, A–F One hexadecimal character

Page 26 

 

At this point, it was determined the Analog 1 Transducer (AKA ‘Xducer’ or ‘potentiometer’ or ‘pot’, etc.) 

was functioning normally. 

This led to the discovery of four (4) different input types for Analog Input 1 in the TCU menu settings 

(described on page 131 of the TCU installation and Operation Manual). 

For correct operation of the Analog Input 1, ‘Xducer Type’ must be set for ‘0‐5Vlt’. 

‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐ 

After the HSS and TCU are set up and appear to be fully functioning, we can go ahead and begin to test 

the TCP/IP ports, to see which ones need to be opened. You will need a few things before we get 

started: 

(1) standard networking router (and appropriate power supply). Typically comes with an embedded 4‐

port switch 

(2) standard straight‐through networking cables to connect the HSS and the workstation to the router 

(1) extra computer / laptop. This is optional, but STRONGLY RECOMMENDED, as it will definitely save 

time as you configure your router. 

You will also need WireShark (and along with it, WinPCap, which is usually included in the download of 

the WireShark installation file). WireShark is free, and is available from wireshark.org. 

 

WireShark is a protocol analyzer and packet capture program. We will use it to determine the network 

traffic being sent between the workstation and the HSS. Then, we will test our assumed ports to see 

what works… 

First, we need to configure the router and computers that we will be using. Even though the author is 

using an SMC Barricade router, the steps performed should be similar for just about any router, 

although the specific settings you are looking for may be in a different section of the router 

configuration pages. 

Find out the default user name and password of your device. 

We are going to perform a 30‐30‐30 reset. This will ensure that all of the router’s NVRAM has been 

cleared, and loaded back to factory defaults. 

The 30‐30‐30 reset is performed as follows: 

Start with the router plugged in (power only, no network cables). 

Hold the reset button (on the back of the router) down for at least 30 seconds (you may need a 

paperclip or other similar device to accomplish this. 

Page 27: SCADA Timothy Bennett CENitech.fgcu.edu/faculty/zalewski/CNT4104/Projects/SCADA_Report6.pdf · Coding System: Hexadecimal, ASCII characters 0–9, A–F One hexadecimal character

Page 27 

 

While holding the reset button down, unplug the power from the router, still keeping the reset button 

down. Hold for at least 30 seconds. 

While still holding the reset button down, plug the power cord back into the router. Hold the reset 

button down for another 30 seconds. 

At this point, you should have held the reset button down for AT LEAST A CONTINUOUS 90 SECONDS. 

After the router is back on, and the reset button has been held for at least 30 seconds after being 

powered back on, you can release the reset button. 

If you decided to use an extra computer / laptop, use that computer. Otherwise, you’re going to be 

switching back and forth an awful lot. 

Hook the computer up to one of the four LAN ports on the router. This should be the only network cable 

plugged into the router. 

We are now going to configure the router, using the following IP addresses: 

WORKSTATION IP:        69.88.163.28 

WORKSTATION SUBNET MASK:      255.255.255.0 

WORKSTATION GATEWAY:      69.88.163.1 

ROUTER WAN IP:        65.42.48.105 

ROUTER WAN SUBNET MASK:      255.255.255.0 

ROUTER WAN GATEWAY:      65.42.48.102 

ROUTER LAN IP:         69.88.163.1 

ADDITIONAL COMPUTER IP:      65.42.48.102 

ADDITIONAL COMPUTER SUBNET MASK:  255.255.255.0 

ADDITIONAL COMPUTER GATEWAY:    65.42.48.105 

To find out the current IP address of your computer, go to the Start Menu. Click ‘Run…’ Type in CMD in 

the box to launch the Windows Command Line Interface (CLI), also known as the Command Prompt. 

Click the OK button or hit the Enter or Return key on your keyboard. 

A command line interface terminal will appear. Type in ‘ipconfig’. Hit enter. The screen will look similar 

to the following, depending on how many networking adapters are installed in your system. Note we are 

only interested in the wired LAN connection, typically named ‘Local Area Connection’ under Windows 

XP. 

Page 28: SCADA Timothy Bennett CENitech.fgcu.edu/faculty/zalewski/CNT4104/Projects/SCADA_Report6.pdf · Coding System: Hexadecimal, ASCII characters 0–9, A–F One hexadecimal character

Page 28 

 

 

Figure x 

 

If computer ‘A’ sends a packet to computer ‘B’, and computer ‘B’ is on a different network (defined by 

the subnet mask), the packet is first forwarded to the gateway address. The gateway address is the 

address of a device on the network that provides a ‘gateway’ to another network, such as a router. 

The gateway address of the ‘Ethernet Adapter Local Area Connection’ is what we are looking for at the 

moment. Note this address (i.e. – write it down somewhere, if you need to). 

We will now connect to your router’s web interface. Open an internet browser. Type the gateway 

address into the address bar. Hit enter. You should be prompted for a user name and password. This 

should be the router manufacturer’s default user name and password. 

The first thing we are going to change is the router’s WAN IP address. 

Refer to your router’s documentation on how to set up a static WAN IP address. (Note: This part should 

be straightforward.) Refer to the previous section for the IP address to be used.  

Page 29: SCADA Timothy Bennett CENitech.fgcu.edu/faculty/zalewski/CNT4104/Projects/SCADA_Report6.pdf · Coding System: Hexadecimal, ASCII characters 0–9, A–F One hexadecimal character

Page 29 

 

 

Figure X – SMC Barricade WAN Settings 

Page 30: SCADA Timothy Bennett CENitech.fgcu.edu/faculty/zalewski/CNT4104/Projects/SCADA_Report6.pdf · Coding System: Hexadecimal, ASCII characters 0–9, A–F One hexadecimal character

Page 30 

 

 

Figure X – SMC Barricade Static WAN IP Setup Screen 

Page 31: SCADA Timothy Bennett CENitech.fgcu.edu/faculty/zalewski/CNT4104/Projects/SCADA_Report6.pdf · Coding System: Hexadecimal, ASCII characters 0–9, A–F One hexadecimal character

Page 31 

 

 

Figure X – SMC Barricade Static WAN IP Settings 

Page 32: SCADA Timothy Bennett CENitech.fgcu.edu/faculty/zalewski/CNT4104/Projects/SCADA_Report6.pdf · Coding System: Hexadecimal, ASCII characters 0–9, A–F One hexadecimal character

Page 32 

 

Next, we will change the router’s LAN IP address. 

Refer to your router’s documentation on how to change the router’s LAN address. (Note: This part 

should also be straightforward.) Refer to the previous section for the IP address to be used. 

 

 

Figure X – SMC Barricade Default LAN Settings 

Page 33: SCADA Timothy Bennett CENitech.fgcu.edu/faculty/zalewski/CNT4104/Projects/SCADA_Report6.pdf · Coding System: Hexadecimal, ASCII characters 0–9, A–F One hexadecimal character

Page 33 

 

 

Figure X – SMC Barricade New LAN IP Address Settings 

 

In addition to modifying the router’s LAN IP address, you should also turn off DHCP (Dynamic Host 

Configuration Protocol). This means that the router will no longer automatically issue an IP address to 

any computer connecting to it. Since this will be the case, we need to set up a static IP address for the 

network adapter you will be using. Refer to the previous section for the IP address to be used. 

 

Page 34: SCADA Timothy Bennett CENitech.fgcu.edu/faculty/zalewski/CNT4104/Projects/SCADA_Report6.pdf · Coding System: Hexadecimal, ASCII characters 0–9, A–F One hexadecimal character

Page 34 

 

To set up a static LAN IP address in Windows XP: 

Open up the Control Panel. (Typically, Click on Start > Settings > Control Panel) 

 

If you are viewing the Control Panel in Category View, you will see figure x. 

 

Figure x – Windows XP Control Panel (Category View) 

 

Page 35: SCADA Timothy Bennett CENitech.fgcu.edu/faculty/zalewski/CNT4104/Projects/SCADA_Report6.pdf · Coding System: Hexadecimal, ASCII characters 0–9, A–F One hexadecimal character

Page 35 

 

If you are viewing the Control Panel in Classic View, you will see something similar to figure x. 

 

Figure x – Windows XP Control Panel (Classic View) 

 

Page 36: SCADA Timothy Bennett CENitech.fgcu.edu/faculty/zalewski/CNT4104/Projects/SCADA_Report6.pdf · Coding System: Hexadecimal, ASCII characters 0–9, A–F One hexadecimal character

Page 36 

 

For Category View, click on ‘Network and Internet Connections’, then click on ‘Network Connections’ 

under ‘…or pick a Control Panel icon’. 

 

Figure x – Windows XP Control Panel – Classic View – Network and internet Connections 

For Classic View, click on ‘Network Connections’ (as seen in figure x). 

Page 37: SCADA Timothy Bennett CENitech.fgcu.edu/faculty/zalewski/CNT4104/Projects/SCADA_Report6.pdf · Coding System: Hexadecimal, ASCII characters 0–9, A–F One hexadecimal character

Page 37 

 

 

Figure x – Windows XP Control Panel – Network Connections 

 

Page 38: SCADA Timothy Bennett CENitech.fgcu.edu/faculty/zalewski/CNT4104/Projects/SCADA_Report6.pdf · Coding System: Hexadecimal, ASCII characters 0–9, A–F One hexadecimal character

Page 38 

 

Once you are viewing Network Connections, right‐click on the network adapter you will be using 

(typically, this will be ‘Local Area Connection’), and select ‘Properties’. 

 

Figure X – Right click on a network adapter and select ‘Properties’ 

 

Page 39: SCADA Timothy Bennett CENitech.fgcu.edu/faculty/zalewski/CNT4104/Projects/SCADA_Report6.pdf · Coding System: Hexadecimal, ASCII characters 0–9, A–F One hexadecimal character

Page 39 

 

In the window that pops up, you will need to find ‘Internet Protocol (TCP/IP)’ under ‘This connection 

uses the following items’. Highlight ‘Internet Protocol (TCP/IP)’, then click on the ‘Properties’ button 

immediately below that section. 

 

Figure x – ‘Local Area Connection Properties’ 

Page 40: SCADA Timothy Bennett CENitech.fgcu.edu/faculty/zalewski/CNT4104/Projects/SCADA_Report6.pdf · Coding System: Hexadecimal, ASCII characters 0–9, A–F One hexadecimal character

Page 40 

 

 

Figure X – ‘Internet Protocol (TCP/IP) Properties’ 

Click on ‘Use the following IP address:’, and then fill in the information asked for with the information 

previously provided. 

Once all of the information is filled in, click on the ‘OK’ button on the ‘Internet Protocol (TCP/IP) 

Properties’ dialog box. Click ‘OK’ once more at the ‘Local Area Connection Properties’. You now have a 

static IP address. 

Still to do (with plenty of screenshots, of course): 

Set up WireShark on the additional computer 

Start WireShark, and set up and start a packet capturing session 

Log into the HSS from the additional computer. 

Perform routine functions on every screen in the HSS interface, so that as much unique traffic is 

generated as possible. 

Note the port numbers of the traffic being passed 

Open the ports one at a time through the router, so that a port can be tested as being required or not. 

Page 41: SCADA Timothy Bennett CENitech.fgcu.edu/faculty/zalewski/CNT4104/Projects/SCADA_Report6.pdf · Coding System: Hexadecimal, ASCII characters 0–9, A–F One hexadecimal character

Page 41 

 

4. Solution 

The MySQL port was found to be the most essential port. Without this port opened, a user could not 

even connect to the SCADA server. The MySQL port number is 3306. It is being left to a future student to 

further this project by following this report and finding any additional ports required for full operation of 

the SCADA server. 

 

 

 

 

Page 42: SCADA Timothy Bennett CENitech.fgcu.edu/faculty/zalewski/CNT4104/Projects/SCADA_Report6.pdf · Coding System: Hexadecimal, ASCII characters 0–9, A–F One hexadecimal character

Page 42 

 

5. Conclusion 

The SCADA server is a very versatile and powerful system. This power needs to be kept in the good guys’ 

hands at all times. This requires vigilant security practices and techniques. This document has hopefully 

highlighted some of those concerns and techniques. Armed with this new knowledge, you too can 

protect your SCADA system from dangerous hackers. 

 

Page 43: SCADA Timothy Bennett CENitech.fgcu.edu/faculty/zalewski/CNT4104/Projects/SCADA_Report6.pdf · Coding System: Hexadecimal, ASCII characters 0–9, A–F One hexadecimal character

Page 43 

 

6. References 

[1]  National Communications System. “Technical Bulletin 04‐1: Supervisory Control and Data 

Acquisition (SCADA) Systems”. Published by Communication Technologies, Inc. 14151 Newbrook 

Drive, Suite 400 Chantilly, VA 20151. Published October 2004. 

<http://www.ncs.gov/library/tech_bulletins/2004/tib_04‐1.pdf> 

[2]  Modicon. “Modicon Modbus Protocol Reference Guide.” Published by Modicon. One High Street, 

North Andover, MA 01845. Published June 1996. <www.modbustools.com/PI_MBUS_300.pdf> 

[3]  Krutz, Ronald L. “Securing SCADA Systems”. Published by Wiley Publishing, Inc. 10475 Crosspoint 

Boulevard, Indianapolis, IN. Published 2006.