Introduction To Network Forensics EX1 Toolset V1.1
Introduction To Network Forensics EX1 Toolset V1.1
Forensics
ICS/SCADA Environment
Toolset, Document for students
1.1
AUGUST 2019
About ENISA
The European Union Agency for Cybersecurity (ENISA) is a centre of network and information security
expertise for the EU, its member states, the private sector and Europe's citizens. ENISA works with these
groups to develop advice and recommendations on good practice in information security. It assists EU
member states in implementing relevant EU legislation and works to improve the resilience of Europe's
critical information infrastructure and networks. ENISA seeks to enhance existing expertise in EU member
states by supporting the development of cross-border communities committed to improving network and
information security throughout the EU. More information about ENISA and its work can be found at
www.enisa.europa.eu.
Contact
For queries in relation to this paper, please use:
[email protected]
PGP Key ID: 31E777EC 66B6052A
PGP Key Fingerprint: AAE2 1577 19C4 B3BE EDF7 0669 31E7 77EC 66B6 052A
02
ICS/SCADA Environment
1.1 | August 2019
Legal notice
Notice must be taken that this publication represents the views and interpretations of ENISA, unless
stated otherwise. This publication should not be construed to be a legal action of ENISA or the ENISA
bodies unless adopted pursuant to the Regulation (EU) No 526/2013. This publication does not
necessarily represent state-of the-art and ENISA may update it from time to time.
Third-party sources are quoted as appropriate. ENISA is not responsible for the content of the external
sources including external websites referenced in this publication.
This publication is intended for information purposes only. It must be accessible free of charge. Neither
ENISA nor any person acting on its behalf is responsible for the use that might be made of the
information contained in this publication.
Copyright Notice
© European Union Agency for Cybersecurity (ENISA), 2018
Reproduction is authorised provided the source is acknowledged.
03
ICS/SCADA Environment
1.1 | August 2019
Table of Contents
04
ICS/SCADA Environment
1.1 | August 2019
05
ICS/SCADA Environment
1.1 | August 2019
Summary
This scenario will deal with an attack on an ICS/SCADA environment in the energy sector. The successful
completion of this scenario will you how to set up and configure a network security monitoring
environment, including the baselining of regular (non-malicious) traffic and finally, the successful analysis
of a multi-stage attack on the network. During the exercise, you will have to deal with a previously unseen
network architecture and to familiarise with an unknown protocol used to control the industrial
environment.
In the first two tasks, you will have to set up an IDS for the SCADA network using well-established (open
source) software solutions. Main goal of this part will be to learn where and how place and
configure sensor(s) to gain suitable forensic data given a specific network setup.
The latter tasks (3-5) will focus on forensic analysis of three attack stages. For each stage, network traffic
captures will be given to you to analyse with the IDS environment you have set-up in the previous tasks of
the scenario.
What is ICS/SCADA?
Industrial plants (power plants, factories, oil refineries, etc.) are large, distributed complexes, where
operators must continuously monitor and control many different sections of the plant, to ensure its’
proper operation.
Before computers were introduced, industrial plants had to rely on (human) personnel to manually control
and monitor equipment and processes through push buttons and dials. As plants grew in size, a solution
was needed to control and monitor equipment over long distances. With the introduction of computers, it
become possible to remotely control and monitor industrial components and processes through Industrial
Control Systems (ICS).
The first ICS were simple point-to-point networks connecting a monitoring panel or command device to a
remote sensor or actuator. These have since evolved into complex, large-scale networks interconnecting
computers, sensors, actuators, Remote Terminal Units (RTUs), and Programmable Logic Controllers (PLCs).
Supervisory Control and Data Acquisition (SCADA) is a control system architecture that allows high-level
management systems to interface with peripheral devices such as PLCs from different vendors to perform
a supervisory operation. The general model can be seen below, in Figure 1 where:
06
ICS/SCADA Environment
1.1 | August 2019
Level 0
Contains the field devices such as flow and temperature sensors, and final control elements, such as
control valves.
Level 1
Contains the industrialised input/output (I/O) modules, and their associated distributed electronic
processors.
Level 2
Contains the supervisory computers, which collate information from processor nodes on the system,
and provide the operator control screens.
Level 3
Is the production control level, which does not directly control the process, but is concerned with
monitoring production and targets.
Level 4
Is the production scheduling level.
The move from proprietary technologies to more standardized and open solutions together with the
increased number of connections between SCADA systems, office networks and the Internet has made
them more vulnerable to types of network attacks that are relatively common in computer security. This
imposes new challenges to traditional IT-security monitoring, including:
07
ICS/SCADA Environment
1.1 | August 2019
SCADA environments have a different guiding principle. Foremost importance for SCADA systems is the
safety, reliability and availability (SRA) of the (industrial) process, because outages would risk
damaging equipment or risking catastrophic failures. For traditional IT-systems, confidentiality,
integrity and availability (CIA) of data is the guiding principle.
SCADA systems and networks were originally not planned with IT-security in mind. Particularly, they
lack encryption and authentication.
Furthermore, with availability being the primary concern, systems may not be updated regularly, thus
exposing vulnerabilities for months or longer, as testing on live systems is not possible due to the SRA
principle and dedicated test environments are deemed to complex or expensive.
A multitude of SCADA protocols exist and in general traditional IT-security personnel is unfamiliar with
them.
There are many threat vectors to a modern SCADA system. One is the threat of unauthorised access to the
control software, whether it is human access or changes induced intentionally or accidentally by virus
infections and other software threats residing on the control host machine.
Another is the threat of packet access to the network segments hosting SCADA devices. In many cases, the
control protocol lacks any form of cryptographic security, allowing an attacker to control a SCADA device
by sending commands over a network. In many cases, attackers were also able to compromise the
monitoring systems so that operators were unaware of the ongoing attack (ENISA, 2011).
The toolset
Most of the actual work will be done in a virtual machine that is supplied to you. The virtual machine
image is in the Open Virtualisation Appliance1 (OVA) format that has been compressed with the xz2
program. After decompression, the image can be imported to run in any contemporary virtualisation
environments that supports OVA images, like VMware, VirtualBox, Hyper-V, Qemu, etc. The image can be
downloaded from the following location:
https://www.enisa.europa.eu/ftp/ENISA_INF _5.1.ova
PARAMETER VALUE
Username exercise
Password enisa
The machine consists of a Security Onion3 Linux distribution with custom installation of Wireshark4 that has
the dissectors for the S7comm-plus5 protocol added to it.
The packet captures mentioned in the following sections are in the folder traffic.
1
https./www.dmtf.org/standards/ovf
2 https://tukaani.org/xz
3 https://securityonion.net/
4 https://www.wireshark.org/
5 https://sourceforge.net/projects/s7commwireshark/
08
ICS/SCADA Environment
1.1 | August 2019
2. Introduction
Background information
The teacher will give a presentation that covers the topics from chapters 1-4 and will familiarise the
students with the basic knowledge needed for the upcoming exercises. It is recommended to do this in a
workshop-style approach where students and teacher can discuss ideas, which will make this part less dry
and more adaptable to the students’ prior level of knowledge. This part could be skipped, if the students
already have a high enough knowledge about IDS and network forensics.
09
ICS/SCADA Environment
1.1 | August 2019
3. Exercise Tasks
10
ICS/SCADA Environment
1.1 | August 2019
Within this scenario, those systems will be interconnected through a single hardware switch, as shown in
Figure .
The network traffic data has been generated through the courtesy of National Centre for Nuclear Research
(NCBJ, Poland).
11
ICS/SCADA Environment
1.1 | August 2019
Students: Select one or more capturing points for monitoring the above network. Justify your decision.
Solution: Since traffic to/from all the above systems will need to be monitored, the canonical point for
traffic capture is to configure a span-port on the switch where traffic from the four systems (workstations
and PLCs) will be mirrored (Figure ). This may impose a traffic problem, as the span-port would need 4-8
times the bandwidth of an individual network connection (4 systems times 2 for in- and outgoing traffic).
For this exercise, it is assumed that the mirroring port has enough bandwidth.
12
ICS/SCADA Environment
1.1 | August 2019
Alternative Solution: If the switch does not support port mirroring (or perhaps all ports are already in use),
an alternative solution will have to be devised. One could be to use cable taps for both workstations and
PLCs as shown in Figure 5. This would require more cables going from the taps to the capturing system: 8
in total, 2 for each system covering in- and outgoing traffic, and correspondingly, 8 network ports on the
capturing system, on the other hand, this would avoid bandwidth problems and does not require anything
from the switch. The costs for taps, cables and network ports would probably exceed that of a switch with
port mirroring support, however.
Students: Select a monitoring policy and target(s) for the above network. Justify your decision.
Solution: Blacklist monitoring is difficult, as there are not enough attack signatures for SCADA networks
available, especially for the type of PLCs used in this exercise.
For both anomaly monitoring and policy monitoring, a point can be made.
The network is small and closed, so it can be expected to have a clear set of traffic patterns that will
not change too often. This speaks for anomaly monitoring. In addition, the fact that that the traffic
patterns will be known only after baselining (the next sub-task) is another point for anomaly
monitoring as one can start right away and refine the policy over time.
Details of the policy will have to be postponed until the baselining is done.
With full control over the systems on the network, a case can also be made for policy monitoring. Only
a few key points can already be made:
Only the workstations shall communicate with the PLCs
Communication shall be limited to port 102/tcp and the S7plus protocols
13
ICS/SCADA Environment
1.1 | August 2019
The question of with whom (except the PLCs) the workstations should communicate can be left
open. If they should communicate, communication should be limited to port 5900/tcp (VNC) and
only from the Engineering workstation to the SCDA workstation.
Both can be combined into a hybrid approach. This should be kept in mind and can be brought back as
a point in the summary discussion.
As will be seen later all systems on the network need to be monitored. When talking for individual targets,
the following arguments can be made:
The PLCs should be monitored as they can be attacked from any other system on the network,
bypassing any protective measures on the workstations.
The PLCs should be monitored, as they have no defensive measures on their own. This can be said for
the workstations too, but some sort of firewall or IDS/IPS can be retrofitted on them, which is more
difficult for the PLCs.
The SCADA workstation should be monitored, as an attack on this workstation could be used to
compromise the SCADA application. It is also the system with the largest attack surface, having two
protocols (VNC and S7plus) running.
In addition, the SCADA workstation could be used to attack the PLCs and as communications between
these systems would be considered “normal”, the attack would be very hard to detect.
The engineering workstation will be the one with the largest influence, as it controls the programs that
run on the PLCs.
Since there is no connection to other networks, there is no use of name servers (DNS), NAT or VPN-
gateways or automatic address management. Therefore, additional information is not needed or present
here. One may argue the lack of NTP, so the investigators should be cautions when comparing timestamps
from the different hosts. As this exercise will work only with network packet captures, this will not be a
problem.
Students: Assume you had the time to sample some traffic from you network. The file normal.pcapng
will contain traffic without user activity at the SCADA workstation and the file button_push.pcapng will
be that of a button push at the SCADA workstation. Answer the following questions:
1. What systems are on the network? What are the addresses (MAC, IPv4) of the systems? Are there
other addresses for these systems?
2. Over what protocols do the systems communicate with each other?
14
ICS/SCADA Environment
1.1 | August 2019
Solution:
A good way to start is to use the endpoint statistic that can be obtained with
Or from Wireshark (Statistics → Endpoints → Ethernet tab). Ignoring the broadcast and multicast
addresses a total of seven systems remains. The first column shows the MAC-addresses with the Ethernet
vendor part resolved. This can be turned off with the “-n” option for tshark or in the Wireshark GUI under
View → Name Resolution → Resolve Physical Addresses.
For completeness, the MAC and IP-addresses for the second PLC and the Engineering workstation are
given below. These systems will come up later in the exercise.
The relationship between MAC- and IP-addresses can be obtained from ARP responses exchanged on the
network. These responses can be identified by having an opcode of 2. In the Wireshark GUI, this can be
done by applying a filter for ARP responses, thus arp.opcode == 2. From the CLI with tshark -O arp
-Y 'arp.opcode == 2' -n -r normal.pcapng. Note that only responses for 10.3.5.3, the SCADA
workstation, not 10.3.5.12, the PLC, can be seen.
Seemingly, at the time of the capture the entry for 10.3.5.12 was already in the ARP cache so the system
was not asking. However, its IP- and MAC-address can still be seen in the response (see Figure 6):
15
ICS/SCADA Environment
1.1 | August 2019
There are no IPv6 or other protocol addresses on the network as can be seen from the empty tab from the
endpoints display.
1. To get an overview of the protocols used, Wireshark offers the protocol hierarchy display, which can
be used with Statistics → Protocol Hierarchy or with tshark –r normal.pcapng -z io,phs with the
GUI giving more detailed information (Figure 77).
As the Layer 2 protocols play no larger role in this exercise, the focus will be on IP. There are four different
protocols used: Two UDP-based (SSDP and LLMNR), one TCP-based (S7 Communication Plus, shortened to
S7plus in this document) and IGMP. SSDP and LLMNR are artefacts from Microsoft Windows, which can be
ignored here, as can IGMP.
As can be seen from the hierarchy, S7plus is encapsulated via two more protocols, TPKT and COTP. Being
originally from the OSI suite of protocols, S7plus is being transported over TCP through encapsulation of its
own transport protocol, COTP (short for Connection Oriented Transport Protocol) which plays the same
16
ICS/SCADA Environment
1.1 | August 2019
role as TCP in the OSI world. The encapsulation is done through a small intermediate protocol layer, TPKT6
(see Figure 8, the third and second rightmost columns7).
While redundant, it once made porting OSI applications to the TCP/IP world easier. The drawback is that
TPKT uses one TCP port (102) for all transported OSI protocols. One cannot see what OSI protocol is
transported without looking at the higher protocol layers. The TPKT header is just four bytes long, the first
byte being the version (3), one reserved byte (0) and the other two bytes being the length of the
encapsulated OSI packet including the TPKT header (see Figure ).
6
TPKT is specified in RFC 1006: https://tools.ietf.org/html/rfc1006
7
Taken from: https://plc4x.incubator.apache.org/img/protocols-s7-osi.png
17
ICS/SCADA Environment
1.1 | August 2019
COTP defines five classes of transport protocols. In this exercise, only class 0 is used, which is also referred
to as “TP0” (with class 1 being TP1, etc.) and each higher class defining more functions. TP0 has only a
minimal set of functions (its use was planned for connection-oriented layer 3 protocols like X.25, where
most functions were already supplied by the lower level protocol) and with TP4 being roughly equivalent
to TCP8 in functionality. Since TCP is already used and supplying most of the needed functionality, only TP0
needs to be used. COTP connections are initiated by the initiator sending a TPDU with a type of 0x0e
(Connect Request), the other party responding with a Connect Confirm (type 0x0d) packet. Data is
exchanged with TPDUs of type 0x0f (Data) and an ordered connection release is done by sending a TPDU of
type 0x08 (Disconnect), there is no disconnect response in COTP.
The S7comm and S7comm-plus protocols are layered on top of COTP. However, unlike TCP and IP, one
cannot see directly from the COTP header what protocol is transported in it. Instead, one has to look at the
S7comm or S7comm-plus header, where the first byte tells which type of protocol is used. Figure and
Figure show a sample of each protocol version. They will be needed later in the exercise.
8
For a comparison of COTP class functionality, see
https://en.wikipedia.org/wiki/OSI_model#Layer_4:_Transport_Layer
18
ICS/SCADA Environment
1.1 | August 2019
19
ICS/SCADA Environment
1.1 | August 2019
Let us go a little deeper and try to answer the question: “what sort of S7plus packets are being sent here?”
The type of S7plus packets can be inferred from the opcode (in Wireshark filter terminology: s7comm-
plus.data.opcode). The table below gives an overview of the opcodes used in this exercise:
s7comm-plus.data.opcode
Hex Mnemonic
0x31 Request
0x32 Response
0x33 Notification
First, there are notifications; these are going from the PLC (10.3.5.12 to the workstation (10.3.5.12).
Notification are used to inform the SCADA application about the value of a set of variables. A sample
packet is shown below. These packets form the bulk of the S7plus traffic in the captures. The SCADA
application "subscribes" to a set of variables it wants to be notified of and each “subscription” is identified
by its "Subscription Object Id" (or s7comm-plus.notification.subscrobjectid). A sample
notification frame is shown below
Frame 494: 122 bytes on wire (976 bits), 122 bytes captured (976 bits) on interface 0
Ethernet II, Src: 28:63:36:ad:91:96, Dst: f4:8e:38:9f:7c:74
Internet Protocol Version 4, Src: 10.3.5.12, Dst: 10.3.5.3
Transmission Control Protocol, Src Port: 102, Dst Port: 52464, Seq: 42600, Ack: 21167,
Len: 68
TPKT, Version: 3, Length: 68
ISO 8073/X.224 COTP Connection-Oriented Transport Protocol
S7 Communication Plus
Header: Protocol version=V3
Protocol Id: 0x72
Protocol version: V3 (0x03)
Data length: 53
Integrity part
Digest Length: 32
Packet Digest: dbf6f38588aded43bfdc37245f084b8561ef494046aa7cb1...
Data: Notification
Opcode: Notification (0x33)
Notification Data Set
Subscription Object Id: 0x70000c87
Unknown 2: 0x0400
Unknown 3: 0x0000
Unknown 4: 0x0000
Notification Credit tickcount: 201
Notification sequence number (VLQ): 1354
Unknown5: 0x01
ValueList
Terminating Item/List
Unknown additional 3 bytes, because 1st Object ID > 0x70000000: 0x000000
Data unknown: 00
Trailer: Protocol version=V3
Protocol Id: 0x72
Protocol version: V3 (0x03)
Data length: 0
20
ICS/SCADA Environment
1.1 | August 2019
While one can play around with Wireshark display filters like this:
To find all opcode values in a capture file (uniq -c output: first column being the number of occurrences,
second column being the content of the line):
The Subscription Id will change with each S7plus session, so it will not be the same in other captures,
although the variables subscribed to may be the same. Unfortunately, it cannot be inferred from the
capture, what variables exactly are meant.
Let us move on to the other opcodes; Requests (0x31) and Responses (0x32). "What" exactly is requested
is identified by the function subfield:
Therefore, there are three functions: SetVariable (0x04f2) and GetMultiVariables (0x054c) that are used in
the normal operation, and SetMultiVariables (0x0542) that is used when a button is pushed in the SCADA
application.
Responses are answers to Requests (obviously) and almost identical in structure, Responses have the same
function type as the request they are answering, in the capture files, only two different functions can be
seen:
21
ICS/SCADA Environment
1.1 | August 2019
Note that the number of Responses is equal to that of the corresponding Requests. It seems that
"SetVariables" request do not trigger a response. The following table gives an overview about functions
used in this exercise:
Hex Function
0x04bb Explore
0x04ca CreateObject
0x04d4 DeleteObject
0x04f2 SetVariable
0x0524 GetLink
0x0542 SetMultiVariables
0x054c GetMultiVariables
0x0556 BeginSequence
0x0560 EndSequence
0x056b Invoke
Solution:
1. No real attack is in the network capture, only unsuccessful communication attempts that may be
noticed:
22
ICS/SCADA Environment
1.1 | August 2019
The unsuccessful attempts to download pictures from the internet (TCP traffic to 23.95.230.107, port
80, i.e. HTTP).
The unsuccessful attempts to contact the command and control server over an unknown protocol
(UDP traffic to 234.5.6.7 port 8910).
Both communications can be seen by noting the IP-addresses, which are not part of the net 10.3.5.0/24 or
the protocols, which are deviating from the traffic patterns in normal.pcapng or
button_push.pcapng. The trick is how to strip away the bulk of the “known good” traffic, i.e. LLDP,
PROFINET and S7. With a structured analysis, one would start with an overview of protocols used, like in
the previous task. Starting with a simple overview of the communication endpoints:
Both IP-addresses not from the network 10.3.5.0/24 clearly stand out. But who is talking to them? This can
be answered again with the conversations statistic, but this time the output will be limited to the
suspicious IP-addresses, which can be done with a filter added to the conv selector (the filter for 234.5.6.7
will yield an empty list for TCP)
23
ICS/SCADA Environment
1.1 | August 2019
As can be seen from the port (80), the protocol used is HTTP. Moreover, with just one frame being sent,
this must be the initial SYN packet of the TCP connection. As the network has no connection to the outside,
no answer will be received (Figure ).
The same can be done for UDP communications (empty when filtering for 23.95.230.107):
24
ICS/SCADA Environment
1.1 | August 2019
What about the S7plus traffic? Let us have a look at the opcodes
2. With a monitoring policy that looks for anything that deviates from the laid down rules, the
unsuccessful communication attempts are suspicious per definition.
3. At the very least, any communication attempt to IP-addresses other than the workstations and PLCs
should raise suspicion, as well as use of any other communication protocol than TCP and port 102.
25
ICS/SCADA Environment
1.1 | August 2019
Solution: The answer to this question depends on the policy the students developed in section 3.1.4.
When the sample policies key points are used (repeated below),
The HTTP and UDP connections are clearly detected by destination IP-addresses, which are neither that of
the PLCs nor of one of the workstations. They can also easily be detected by protocol, HTTP using port
80/tcp and UDP port 8190, that are not whitelisted in the policy.
For this part, the policy would detect all of the adversaries’ activities.
When using the sample policy given in the solutions section of 3.1.4, the port scan and the VNC password
brute force would be noticed, because they involve a connection from the engineering to the SCADA
workstation (10.3.5.5 to 10.3.5.12, port 5900/tcp) that is not whitelisted in the policy. In addition, the
S7scan is discovered as plain S7comm uses a different protocol version (0x32) than S7plus (0x72).
The VNC username and passwords are brute-forced; the malware successfully logs in to the SCADA
workstation (through VNC) (network activity) and stops an industrial process through the SCADA panel
(emergency shutdown).
1. In attack1.pcapng, the engineering workstation is scanning/probing the network. This is typical scan
like the one outlined in section 3.2.2.
2. In attack2.pcapng, the engineering workstation is specifically scanning for S7 enabled systems (i.e.
PLCs)
9
Command and Control
26
ICS/SCADA Environment
1.1 | August 2019
3. attack3.pcapng contains the VNC attack on the SCADA workstation which consists of a brute-force
attempt on the password.
27
ICS/SCADA Environment
1.1 | August 2019
Lots of ports that were not in use before. But wait, if this is a port scan, what about other IP-addresses in
the network? Why are only 4 IP-addresses in the network? This can be answered by a look at the ARP
requests in wireshark (see Figure below).
From the list of unanswered ARP queries, it can be seen that the adversary really tries to probe the whole
network.
In attack2.pcapng, the PLC scan can be seen in when selecting the S7comm protocol (not s7comm-plus)
28
ICS/SCADA Environment
1.1 | August 2019
The scan conveys information similar to that what can be obtained with the nmap "s7-info.nse" script
shown below:
29
ICS/SCADA Environment
1.1 | August 2019
Six sessions can be seen in the packet capture, each starting from successively increasing source ports:
1396, 1397, 1398, ...
VNC authentication (of the type used here, VNC) is a challenge response process10
However, as can be seen from the packet capture, in the first five sessions, the server responds with three
authentication result packets, the first two of them containing a code of 1 (failure) which is what one
would expect. The third however, has a code of 0, but also the string "Authentication failed" attached.
10 https://tools.ietf.org/html/rfc6143
30
ICS/SCADA Environment
1.1 | August 2019
The sixth session is different, there is only one authentication result packet and this time, it has a value of 0
and no additional string attached (see Figure ). Also, the client is closing the connection, which can be seen
from the TCP packet coming next.
It can be safely assumed that the adversary did successfully guess the password in the last session.
The port scan and the PLC scan did no damage, except that the adversary gained information about the
network and the systems on it. The VNC brute-force attack did give the adversary a login to the SCADA
workstation. However, as no other activity can be seen in the capture, it is unclear whether this is already
used to compromise or misuse the SCADA workstation.
Solution:
31
ICS/SCADA Environment
1.1 | August 2019
When using just the first two points, the port scan and the VNC password brute force would be noticed,
because they involve a connection from the engineering to the SCADA workstation (10.3.5.5 to 10.3.5.12,
port 5900/tcp) that is not whitelisted in the policy. Also, the S7 scan is discovered as plain S7comm uses a
different protocol version (0x32) than S7plus (0x72).
However, the VNC brute-force attack would not be noticed, if this protocol is included in the whitelist.
One more fine point: The policy specifies S7plus protocols (note the plural). If this is taken as both S7comm
and S7comm-plus, the S7 scan would not be noticed. Taken more narrowly as S7comm-plus (i.e. only
protocol type 0x72) than the scan will be noticed.
For the revision, the VNC brute-force will have to be discovered and the S7 scan. As has been said, the
latter is easily recognised by the protocol type, so the policy should clearly state that only type 0x72 (i.e.
s7comm-plus) connections are meant.
The brute-force attempts will need a closer look into the protocol. When looking closer into the packet
capture, the following wireshark filter rules can be worked out with respect to login packets (the length
field in the wireshark windows is that of the frame, the IP packet length can be seen when looking into the
IP header):
a) A vnc.auth_result code of 0 and a packet length of 44 (i.e. without the trailing Authentication
failure) denotes a successful login: vnc.auth_result == 0 and ip.len == 44
b) A vnc.auth_result code of 1 or vnc_auth_result of 0 and packet length > 44 denotes a login failure:
vnc.auth_result == 1 or (vnc.auth_result == 0 and ip.len > 44)
Later, the pump is again disabled, but this time it could not be changed back to the original by an operator
(using the SCADA workstation).
32
ICS/SCADA Environment
1.1 | August 2019
Solution: The overview of the conversations shows four TCP connections, one VNC and three S7plus.
The VNC session behaves differently like the one from the last task. More authentication result packets are
seen in the session (see below), all with code 0 (success) and a little larger (60 bytes).
33
ICS/SCADA Environment
1.1 | August 2019
The authentication type selected can explain the difference. In the previous task, the authentication type
was 2, for VNC, now the authentication type is 16, for TightVNC (see Figure 17 above).
Frame 116: 60 bytes on wire (480 bits), 60 bytes captured (480 bits) on interface 0
Ethernet II, Src: 00:1b:1b:f7:7c:4f, Dst: f4:8e:38:9f:7c:74
Internet Protocol Version 4, Src: 10.3.5.5, Dst: 10.3.5.3
Transmission Control Protocol, Src Port: 1404, Dst Port: 5900, Seq: 13, Ack: 16, Len: 1
Virtual Network Computing
Security type selected: Tight (16)
When looking further into the VNC connection, the movement and button presses of the mouse can be
seen as "client pointer event" packets. At two points, mouse button 1 is pressed:
In Frame 609 - 630 (while the mouse moves from x=965/y=125 to x=985/y=99). The frames are
transmitted within half a second, speculating, this maybe some drag operation.
Button 1 is pressed again in Frame 1126 at position x=518/y=261, as can be seen below (Figure 18)
34
ICS/SCADA Environment
1.1 | August 2019
Looking at the functions used, a similarity to the button_push capture file can be seen:
Let’s see if we can break this down by TCP session (TCP stream in wireshark terminology), the streams are
numbered starting with 0.
Stream 1 is the VNC connection and stream is again S7plus, but empty with regards to operations.
So, stream 2 is the interesting one, since only this one contains the SetMultiVariables (0x0542) operation.
35
ICS/SCADA Environment
1.1 | August 2019
Two request -- response pairs can be seen in the capture file (we look at the request side only here).
36
ICS/SCADA Environment
1.1 | August 2019
Frame 1129: 165 bytes on wire (1320 bits), 165 bytes captured (1320 bits) on interface 0
Ethernet II, Src: f4:8e:38:9f:7c:74, Dst: 28:63:36:ad:91:96
Internet Protocol Version 4, Src: 10.3.5.3, Dst: 10.3.5.12
Transmission Control Protocol, Src Port: 54239, Dst Port: 102, Seq: 119, Ack: 66, Len:
111
TPKT, Version: 3, Length: 111
ISO 8073/X.224 COTP Connection-Oriented Transport Protocol
[2 COTP Segments (104 bytes): #954(0), #1129(104)]
S7 Communication Plus
Header: Protocol version=V3
Protocol Id: 0x72
Protocol version: V3 (0x03)
Data length: 96
Integrity part
Digest Length: 32
Packet Digest: ced5b77ab7ea0919e7c4a5094206bf0f3547e088f06c674f...
Data: Request SetMultiVariables
Opcode: Request (0x31)
Reserved: 0x0000
Function: SetMultiVariables (0x0542)
Reserved: 0x0000
Sequence number: 8
Session Id: 0x000003ba
Transport flags: 0x34, Bit2-AlwaysSet?, Bit4-AlwaysSet?, Bit5-AlwaysSet?
.... ...0 = Bit0: False
.... ..0. = Bit1-SometimesSet?: False
.... .1.. = Bit2-AlwaysSet?: True
.... 0... = Bit3: False
...1 .... = Bit4-AlwaysSet?: True
..1. .... = Bit5-AlwaysSet?: True
.0.. .... = Bit6-NoResponseExpected?: False
0... .... = Bit7: False
Request Set
Unknown: 0x00000000
Item Count: 1
Number of fields in complete Item-Dataset: 5
AddressList
Item Address [1]: (82), SYM-CRC=fc4ae127, (3736), LID=10
Symbol CRC: 0xfc4ae127
Access base-area: Unknown (82)
Number of following IDs: 2
Access sub-area: Unknown (3736)
LID Value: 10
ValueList
Item Value [1]: (Bool) = True
Item Number: 1
Datatype flags: 0x00
...0 .... = Array: False
..0. .... = Addressarray: False
.0.. .... = Sparsearray: False
0... .... = Unknown-Flag1: False
Datatype: Bool (0x01)
Value: True
Data unknown: 000000
...
37
ICS/SCADA Environment
1.1 | August 2019
Now it’s time to combine both parts, we can see that the second SetMultiVariables request comes
immediately after the mouse button press event in the VNC session (Figure 19).
Although it is not in the packet capture, one can infer that the adversary used the SCADA application to
disable the pump through the GUI.
The unusual authentication type (TightVNC) gives away the initial VNC connection that started the
attack. Adversaries could improve by using the same authentication type as regular connection, so it
would no longer look suspicious.
The button push, as coming from the SCADA application itself, would not be noticed as there is nothing
that differentiates it from normal traffic.
The combination of a VNC connection and an unusual event (like pump shutdown) would likely raise
suspicion, as the SCADA operator would normally not use a remote connection but sit in front of the
workstation. Also, this would only be known after the attack had already taken place and a forensic
investigation would begin.
38
ICS/SCADA Environment
1.1 | August 2019
Solution: This time, there is direct involvement of the compromised engineering workstation, several
connections to port 102 on one of the PLCs (10.3.5.3.12) can be seen:
When looking at the number of frames and the number of times an IP-address shows up in a TCP stream,
we can collate stream numbers in Wireshark to conversations.
39
ICS/SCADA Environment
1.1 | August 2019
And it seems like the malware is trying to contact its C&C server (note the communication to port 8910).
As it comes late in the packet capture, it looks like it is trying to report its success, but this is just a guess.
Going back to the TCP streams, going by the number of frames, we now examine the streams from the
SCADA workstation (10.3.5.3 to 10.3.5.12)
So, judging by the IP-addresses, opcodes and functions, this seems to be the normal background S7plus
activity, except for the DeleteObject (0x04d4) operations. They seem to happen towards the end of that
stream (at frame 5680) at frame 5524, 5534, and 5674 (see Figure 20 below).
40
ICS/SCADA Environment
1.1 | August 2019
The other two streams seem to try to delete objects too (inferring from the function codes).
Stream 1 opcodes:
18 0x00000031
18 0x00000032
Stream 1 functions
2 0x000004d4
34 0x00000542
Stream 2 opcodes:
1 0x00000031
1 0x00000032
Stream 1 functions:
2 0x000004d4
There are four TCP connections from the engineering workstation to the PLCs, with a breakdown of its
opcodes and functions used:
Stream 3 opcodes:
69 0x00000031
69 0x00000032
125 0x00000033
functions
18 0x000004bb
10 0x000004ca
10 0x000004d4
8 0x000004f2
4 0x00000524
6 0x00000542
24 0x0000054c
41
ICS/SCADA Environment
1.1 | August 2019
2 0x0000056b
56 0x00000586
Stream 4 opcodes
19 0x00000031
19 0x00000032
functions
8 0x000004ca
8 0x000004d4
8 0x000004f2
4 0x00000524
2 0x00000542
8 0x00000586
Stream 5 opcodes
13 0x00000031
13 0x00000032
functions
12 0x000004bb
2 0x000004ca
2 0x000004d4
2 0x000004f2
2 0x00000542
6 0x00000586
Stream 6
opcodes
24 0x00000031
24 0x00000032
functions
12 0x000004bb
14 0x000004ca
2 0x000004d4
4 0x000004f2
2 0x00000542
2 0x00000556
2 0x00000560
10 0x00000586
As can be seen, there are previously unseen functions the composition is also unseen before. While
functions like SetVariable or DeleteObject are more or less self-explanatory, functions like Invoke (0x056b)
or GetVarSubStreamed (0x0586) are not. Without in-depth knowledge of the PLC operation and its internal
memory layout one cannot hope to make any sense out of it.
Even when looking into the request packets, no more information will be gained that will help in resolving
the incident. There is still the IP-address and the unusual functions used in S7plus connections which is
enough to flag this as suspicious activity, however without prior knowledge that something malicious had
happened it would be impossible to infer what has happened (malicious or not) from the packet content.
Tool Homepage
tshark https://www.wireshark.org/
wireshark https://www.wireshark.org/
42
ICS/SCADA Environment
1.1 | August 2019
Further reading
ENISA Report: Protecting Industrial Control Systems. Recommendations for Europe and Member States,
https://www.enisa.europa.eu/publications/protecting-industrial-control-systems.-recommendations-
for-europe-and-member-states
ENISA Report: Analysis of ICS-SCADA Cyber Security Maturity Levels in Critical Sectors,
https://www.enisa.europa.eu/publications/maturity-levels
ENISA Report: Certification of Cyber Security skills of ICS/SCADA professionals,
https://www.enisa.europa.eu/publications/certification-of-cyber-security-skills-of-ics-scada-
professionals
ENISA Report: Good Practices for an EU ICS Testing Coordination Capability,
https://www.enisa.europa.eu/publications/good-practices-for-an-eu-ics-testing-coordination-
capability
ENISA Report: Window of exposure… a real problem for SCADA systems?,
https://www.enisa.europa.eu/publications/window-of-exposure-a-real-problem-for-scada-systems
ENISA Report: Can we learn from SCADA security incidents?,
https://www.enisa.europa.eu/publications/can-we-learn-from-scada-security-incidents
43
ICS/SCADA Environment
1.1 | August 2019
Glossary
ARP Address Resolution Protocol
ASCII American Standard Code for Information Interchange
C&C Command and Control (Server)
CLI Command Line Interfaces
COTP Connection Oriented Transport Protocol
GUI Graphical User Interface
ICS Industrial Control Systems
IGMP Internet Group Management Protocol
ISO 27001 International Organization for Standardization
LLDP Link Local Discovery Protocol
LLMNR Link Local Multicast Name Resolution
PCAP Packet CAPture
PLC Programmable Logic Controller
SCADA Supervisory Control and Data Acquisition
SMB Server Message Block
SSDP Simple Service Discovery Protocol
TCP Transmission Control Protocol
TPKT Packet format used to transport OSI TPDUs over TCP
TPDU (OSI) Transport Protocol Data Uni
UDP User Datagram Protocol
VNC Virtual Network Computing
References
Bejtlich, R. (2013), The Practice of Network Security Monitoring – Understanding Incident Detection and
Response, No Starch Press, 2013, ISBN-13:1-59327-509-9
ENISA (2011), Protecting Industrial Control Systems Recommendations for Europe and Member States,
https://www.enisa.europa.eu/topics/critical-information-infrastructures-and-services/scada (last
accessed on October 7th, 2018)
44
ENISA
European Union Agency for Cybersecurity
Science and Technology Park of Crete (ITE)
Vassilika Vouton, 700 13, Heraklion, Greece
Athens Office
1 Vass. Sofias & Meg. Alexandrou