WEBVTT

00:00.000 --> 00:02.540
All right, everyone, thank you for coming to our talk.

00:02.940 --> 00:05.980
It's named Extending Zeke for ICS Defense.

00:06.720 --> 00:08.200
My name is Norman Lunt.

00:08.200 --> 00:11.080
As the slide shows you, I'm a security enthusiast.

00:11.440 --> 00:22.320
I love PCAPs, and I love the defense side of this game, where if I can find you anywhere, we'll get you out.

00:24.680 --> 00:30.800
Hey, I'm James Dickinson, and as the slide shows, I'm also a security enthusiast.

00:30.800 --> 00:37.260
And much like Norm, I enjoy PCAPs and packets that are placed inside of PCAPs.

00:40.700 --> 00:46.520
All right, so to start us off, we're going to talk about some fundamental definitions in case anybody doesn't know.

00:46.980 --> 00:52.460
I'm just going to refer to them by their acronym names and not by their full names as it suits me.

00:52.620 --> 00:55.360
So ICS stands for Industrial Control System.

00:55.860 --> 00:59.180
PLC is Programmable Logic Controller.

00:59.460 --> 01:01.900
HMI for Human Machine Interface.

01:02.040 --> 01:05.340
And NSM stands for Network Security Monitoring.

01:06.160 --> 01:08.800
All right, so who cares about ICS data, right?

01:09.500 --> 01:15.380
It seems in the NSM world, ICS is just an afterthought.

01:15.380 --> 01:24.160
Nobody cares, gives a good doggone about what's happening on Modbus or what's happening on DMP3 or what's happening with all your Siemens PLCs.

01:25.000 --> 01:37.540
So what happens, I downloaded the most recent version of Zeek, and I built it from source, and I discovered that three out of 72 out-of-the-box analyzers were for ICS.

01:38.120 --> 01:55.040
And I went online, I poked around, and the Survey of Security Tools for the Industrial Control System Environment said, the survey identified tools such as Bro, which is what Zeek used to be called, Snort and Yara, which are by design highly extensible.

01:55.180 --> 02:01.060
Enough so that with minor development, they could be used as ICS solutions for which there's no current tool set.

02:04.290 --> 02:12.090
So every year, more and more devices are exposed to attack.

02:12.770 --> 02:25.850
And the people who want ICS in their systems, a lot of times they don't care about security because they haven't been hacked or they haven't gotten to a point where they need security.

02:26.290 --> 02:31.230
And so they'll be advised and say, hey, you know what, if we expose this internet, we're probably going to get in trouble.

02:31.470 --> 02:36.210
And they're like, I don't care, it's not affecting my bottom dollar yet, just push it, just push it, just push it.

02:36.530 --> 02:48.970
And so from Security Week.com, this is a report from 2017, they used Shodan, Synthesis and Google search engines and they identified over 170,000 ICS components accessible from the web.

02:49.850 --> 02:52.670
And it was a 10% growth from 2016 to 2017.

02:52.710 --> 02:55.230
I don't know what it is currently, but I don't think it got less.

02:55.230 --> 03:12.590
I don't think they're like, you know what, we better not put more ICS stuff out there because, you know , so why this is really relevant is programmable logic controllers or ICSs in general aren't fault tolerant.

03:13.030 --> 03:18.870
Like if at any point you send your data out of order or a malformed packet or something just doesn't hit right, it just crashes.

03:18.910 --> 03:21.470
And sometimes it crashes in a state that's unrecoverable.

03:22.310 --> 03:30.610
Unrecoverable in the sense that you can't do it remotely where somebody has to physically drive out there and power cycle it or physically go out there and replace it because it's broke so hard.

03:31.810 --> 03:36.210
And so why this, so this is also what happened.

03:36.210 --> 03:44.630
I was talking to a guy , this is the whole reason we have this talk, and he was a fellow security researcher and he said , he said, you have ICS data on your network.

03:44.630 --> 03:45.790
And I told him, no, I don't.

03:45.790 --> 03:47.090
He says, you do, go find it.

03:47.090 --> 03:51.110
And so after he and I left this conference, I went back and I found this ICS data.

03:51.130 --> 03:56.710
I found these attacks coming in and I didn't have a convenient way to figure out what was happening with them.

03:57.310 --> 04:01.930
I saw the data, I could see the raw bytes, but I didn't know what they meant, I didn't know what they were doing.

04:01.950 --> 04:04.430
And I thought, this is probably a problem for everybody.

04:04.650 --> 04:12.690
Like, how do I explain to my customer, hey, you know what, you, you know, foreign IP tried to hit you 400,000 times to turn off your PLC.

04:12.990 --> 04:16.570
I mean, none of them were successful, of course, but it doesn't stop the attacks.

04:18.350 --> 04:23.650
So I would like to turn my time over for James to explain to you the Purdue model and how Zeek works.

04:25.370 --> 04:30.830
Yeah, so the Purdue model's been around for a while, 1970-ish, I think.

04:31.370 --> 04:39.270
And really what it is, it's just a way to describe how these ICS systems tie into the business network.

04:39.310 --> 04:46.970
So if you look at this, you can see down here at level zero, you have the physical devices that are actuating physical processes.

04:47.050 --> 04:53.450
So these are things like pumps, sensors, belts, things like that.

04:53.990 --> 04:59.710
And then level one here, you have the control devices that are controlling those physical processes.

05:00.090 --> 05:11.490
And then as you work your way up the network, you get up to the business analytics portions that are consuming this data to be used for making business decisions and risk decisions, right?

05:11.970 --> 05:16.270
And so what we're talking about is defense, right, of the network.

05:16.270 --> 05:30.250
And so what we want to look at is the basic stuff that you do with any network, figuring out where to do segmentation and where to create those security boundaries to isolate that data and protect it, right?

05:30.250 --> 05:35.350
And so if you look here, we have some notional firewalls that are in this diagram, right?

05:35.350 --> 05:46.250
And so those are some good places to place spans or taps or what have you, however you're going to monitor this network, um, to capture that data and see what is going on.

05:50.030 --> 05:58.710
So why did we choose Zeek as opposed to some other tool for using to monitor and defend ICS data?

05:58.810 --> 05:59.950
A couple reasons.

05:59.950 --> 06:06.630
Um, Zeek is open source, so that means it's freely available for anyone to use and it has a very active, uh, development community.

06:06.630 --> 06:08.650
It's also very well documented.

06:08.650 --> 06:14.190
There's tons of white papers, talks, and, uh, uh, whatnot to go look at.

06:14.290 --> 06:18.770
Additionally, Zeek comes with a turn complete scripting language.

06:19.010 --> 06:26.090
The Zeek scripting language is event driven and it's purpose built for network communications.

06:26.430 --> 06:35.130
Um, so it's a, it's a great tool for building additional detections on top of, uh, and other, and tying it into your other systems.

06:35.670 --> 06:40.330
Um, additionally, it has the ability to create custom parsers.

06:40.330 --> 06:42.270
So that's what we're talking about today.

06:42.350 --> 06:52.790
Um, so you can go into Zeek and modify it for your purposes and build a parser to monitor the protocols that you want to, that you care about.

06:53.310 --> 07:01.550
Additionally, Zeek is fully extensible because of the scripting language and all the other stuff and all the other tools, uh, the community has built.

07:01.550 --> 07:08.150
It's very easy to plug into your existing network and get those logs into your sim or to do some sort of active defense with.

07:11.460 --> 07:16.360
So creating parsers, um, we sort of took two approaches here, right?

07:16.360 --> 07:20.220
You need to write your own or you can find someone else's and we sort of did both.

07:20.420 --> 07:28.120
Um, so the protocol we chose to write our own on is, uh, EtherNet IP and SIP.

07:28.160 --> 07:35.620
EtherNet IP, uh, is the session layer particle for SIP, which is the common industrial protocol.

07:36.360 --> 07:49.860
Additionally, um, we went around and tried to find what other tools and things people had done and, uh, this researcher, uh, Dane Wolin wrote, uh, S7 protocol that we also used.

07:50.800 --> 07:55.900
Uh, I should say S7 is the protocol that's used for Simmons PLCs.

07:59.170 --> 08:01.990
So creating a Zeek parser.

08:01.990 --> 08:08.750
So we aren't going to dive into the deep, nitty gritty details, but we'll cover it over, uh, sort of a high level overview.

08:09.070 --> 08:13.490
Um, so first thing you need to do is go grab Zeek, right?

08:13.490 --> 08:19.870
So you can go to GitHub, find Zeek and just get clone that sucker and you'll have it there.

08:20.150 --> 08:29.370
Additionally, other things you want to do, um, Vlad, who's a member of the Zeek developer community, has this BINPACK quick start script.

08:29.370 --> 08:30.810
It's just a Python script.

08:30.810 --> 08:37.270
What that will do for you is it'll create the boilerplate, uh, files and code that you need to get started writing a protocol.

08:37.690 --> 08:41.110
And then after that, you need to write a protocol.

08:41.310 --> 08:46.090
Uh, Zeek protocols are written in a high level language called BINPACK.

08:46.150 --> 08:50.950
And so BINPACK is purpose built for, uh, describing protocols.

08:51.210 --> 09:02.450
Um, and so you're just going to describe the structures in the protocol and then you're going to tie that into the events and, uh, at a high level that's what's going on.

09:02.530 --> 09:08.610
And then after that, you're going to run it and it's probably not going to work and you're just going to keep iterating.

09:11.520 --> 09:14.140
So this is what BINPACK looks like.

09:14.220 --> 09:21.540
Um, so you can see here we have a couple different things going on.

09:21.600 --> 09:29.600
So this top level structure here is the ethernet IP header that the two protocols we just mentioned use.

09:29.740 --> 09:34.840
And we are describing the different values and where they lie in that structure.

09:34.840 --> 09:42.320
So for instance, it has a command value that will tell, uh, that describes what the command is that is coming across the wire.

09:42.320 --> 09:51.680
And then the length variable just says, hey, expect this much data in the, uh, SIP, in the SIP PDU that's to follow.

09:51.740 --> 09:53.960
And then so on and so forth.

09:54.320 --> 09:58.400
And then right below that, uh, we have a case statement.

09:58.400 --> 10:06.820
And the case statement is just saying, uh, whether the data is from the originator or the responder.

10:07.020 --> 10:12.500
And so in this case, uh, and then it's just passing it to another data structure here.

10:12.500 --> 10:16.920
Either e- ethernet IP request or ethernet IP response.

10:17.280 --> 10:22.220
And then finally, down here at the bottom, we have the ethernet IP request.

10:22.220 --> 10:30.120
And here we're calling, uh, another case statement for the command value that's up in the ethernet IP header.

10:30.140 --> 10:35.460
And so we're just looking at what value is in there to identify what the command is.

10:35.460 --> 10:39.940
And then passing that along further into the protocol, uh, structure.

10:40.240 --> 10:43.160
So in a nutshell , that's how BINPACK works.

10:43.160 --> 10:47.880
There's a little bit more with it in terms of then getting those events into the script layer.

10:47.880 --> 10:53.580
But, uh, that's, that's a, that's our quick five minute intro to BINPACK.

10:56.930 --> 10:59.810
Alright, so I'm gonna cover, cover what we did with that data.

11:00.050 --> 11:05.290
The, so off of, what's that thing?

11:06.270 --> 11:07.030
That, oh.

11:07.030 --> 11:10.270
So off of eBay, years ago, James had bought a Siemens PLC.

11:10.590 --> 11:14.490
And we're like, hey, you know, let's, let's blow this thing up, see what happens.

11:14.810 --> 11:25.410
And so, as far as the S7 protocol parser goes, I, I took a good hand to it for about 35 hours and then, and then realized somebody else had done all the work and felt dumb.

11:26.330 --> 11:28.290
And load it up and it worked great.

11:29.070 --> 11:37.870
So, first thing we did, so after that, when we decided, hey, let's break into this thing and blow it up, the, it didn't have an IP and we couldn't figure out how to give it an IP.

11:38.170 --> 11:40.650
So eventually we landed on the Siemens software portal.

11:40.650 --> 11:45.570
At one point, Siemens had sent us an email saying they couldn't verify we were American and they wouldn't let us download any of their software.

11:46.430 --> 11:51.490
We downloaded, we finally got this one called the TIA portal and we set the IP on the PLC.

11:51.490 --> 11:55.370
And it seems like this one liner, like, download the software, set the IP, right?

11:55.370 --> 11:58.170
This is like 30 hours into our project.

11:59.970 --> 12:07.670
The next thing I found is there was a, this guy, Dark LBP, he doesn't, I don't, I don't know any more data than that from his GitHub.

12:07.990 --> 12:09.890
He created this thing called ICSploit.

12:09.950 --> 12:14.330
It's a creative use of Scapey and Python to create custom attacks on PLCs.

12:14.530 --> 12:16.810
And it already has pre-built attacks for S7.

12:16.970 --> 12:18.350
So that worked fantastic.

12:18.350 --> 12:22.110
And he calls it ICSploit because it has a Metasploit style interface.

12:22.630 --> 12:26.390
But it, it's good if you just wanna, you know, if you wanna blow up your own PLCs from eBay.

12:27.410 --> 12:30.750
Then I started Wireshark.

12:30.750 --> 12:32.910
I captured data off my NIC.

12:33.150 --> 12:34.550
Then I ran the attacks.

12:35.090 --> 12:41.410
And then I took that data, fed it into Zeek that was running our S7 parser and we produced Zeek logs.

12:42.830 --> 12:46.650
So what this is, is this is ICSploit giving me data back, right?

12:46.650 --> 12:48.710
So this is a scanning style attack.

12:49.090 --> 12:52.530
And you can tell it what rack and what slot, etc.

12:52.530 --> 12:55.230
And it said it found these two vulnerable spots.

12:55.230 --> 12:56.730
Slot 0 and slot 1.

12:58.070 --> 13:04.850
The IP we set for our Siemens PLC was 192.168.38.200.

13:06.090 --> 13:09.890
The, so this is what, as an attacker you say, oh look, there's some stuff.

13:09.890 --> 13:11.330
I got, I got some data.

13:12.230 --> 13:15.210
There's, you know, so this is say, here's where I launched my attacks.

13:15.690 --> 13:21.370
This order code on there will give, you know, if you go and search, it gives you insight about what type of PLC it is.

13:22.270 --> 13:23.830
And this is what Zeek looks like.

13:23.830 --> 13:25.310
There's three type of logs represented here.

13:25.310 --> 13:31.350
The con log, which is your connection log, your S7 setup communication log, and on the bottom your S7 user data log.

13:31.430 --> 13:35.150
Now, the first field there is your, is your UID.

13:35.150 --> 13:38.910
And Zeek is really important because your UID ties all your different logs together.

13:39.330 --> 13:43.050
And so all the blue logs go with blue logs and yellow logs go with yellow logs.

13:43.050 --> 13:47.010
And if they aren't highlighted, it's because they were scanned and nothing returned.

13:47.130 --> 13:53.750
So you can see in the, in the column just before it says SRSTR, everywhere where it has zero means there was zero bytes returned.

13:53.750 --> 13:55.590
So it got, it got no, no return.

13:55.590 --> 13:59.750
So on my big scan, those are the ones that didn't return, which is why they're not highlighted.

13:59.750 --> 14:03.250
They're included just to say, hey, I scanned more than just that one area.

14:04.210 --> 14:09.030
So in the, then in the 7 setup con log, it shows you there was a call for a job.

14:09.030 --> 14:10.190
The job was acknowledged.

14:10.190 --> 14:14.570
And then the user data, it sends these SLS, SZL requests and response.

14:14.730 --> 14:26.750
And one of the things about Siemens PLCs is it doesn't matter what kind of protections you have on them, you can, you can still read, you can send read requests to the SZL and it'll respond to you every time.

14:26.830 --> 14:31.890
You may not be able to do any much more after that, but at least you know that you have a live target.

14:34.720 --> 14:37.200
The next thing I did is we tried to turn it on and off.

14:37.720 --> 14:44.060
So as you can see here, the command description, 1 to start the PLC or 2 to stop the PLC.

14:44.500 --> 14:49.660
So I set the slot to 1 because that's, that's the slot that was vulnerable.

14:50.180 --> 14:52.200
I set the command to 1 and then I ran it.

14:52.740 --> 14:57.800
And then it, then as you can see, running module, target is alive, sending packet to target, start PLC.

14:58.080 --> 15:01.000
So me as the attacker say, oh cool, the, the PLC started.

15:01.480 --> 15:06.220
And then I changed the command to stop it and this is, oh okay, the PLC stopped now.

15:06.980 --> 15:10.100
Now, turning on and off, right, doesn't seem like a major attack, right?

15:10.100 --> 15:12.320
You turn PLC, you turn it on, you turn it off, big whoop.

15:13.060 --> 15:19.760
So a couple years ago, one of the national labs had this giant generator just like, I don't know, like a billion kilowatts.

15:19.760 --> 15:20.520
I don't, it's not that high.

15:20.520 --> 15:21.380
I don't know how much it was.

15:21.380 --> 15:22.400
It was a giant, it was large.

15:22.840 --> 15:24.560
And they turned it on and off rapidly.

15:24.560 --> 15:25.180
Bum, bum, bum, bum.

15:25.180 --> 15:31.180
And it blew up because they started it and stopped it and started it and stopped it and it blew the heck up.

15:31.420 --> 15:42.860
And so, so maybe not a catastrophic explosion to kill everybody in the plant, but it's significant enough to require, who knows the amount of down time to get the heavy equipment in there to replace that generator.

15:43.500 --> 15:51.760
And, and besides like, any time your PLC just take rogue, wild turn on and off statements, like it's ridiculous.

15:51.760 --> 15:52.640
It should never happen.

15:54.860 --> 15:55.640
Here's what we have.

15:55.640 --> 15:57.040
I split it up in two parts.

15:57.300 --> 16:00.860
The top part I call turn on and the top, bottom part I call turn off.

16:01.420 --> 16:03.960
And again, it's the same, the first two logs are the same.

16:04.020 --> 16:12.700
Your con log, which is your connection log, then your setup communication, and then the bottom one that's new for this type of, of log source is your PLC function.

16:13.940 --> 16:18.440
So, main thing in your connection log, data was, was processed.

16:18.440 --> 16:20.880
It went, you got bytes to and from.

16:21.040 --> 16:25.440
Then you have the job and the job was acknowledged in the setup, in the, yeah, the setup communication.

16:25.580 --> 16:29.460
And the last part, it calls this program called P program and then it says empty.

16:29.540 --> 16:31.720
Because we didn't actually have a program in there.

16:32.200 --> 16:35.200
We, uh, we did, but we deleted it out.

16:35.820 --> 16:40.060
Our PLC wasn't connected to anything during this, during this setup.

16:40.060 --> 16:43.960
We, uh , I was just happy that we could turn it on and turn it off.

16:44.180 --> 16:45.460
And the turn off is the exact same.

16:45.460 --> 16:47.160
There's data in the connection log.

16:47.520 --> 16:49.500
We have the communication.

16:49.500 --> 16:50.060
There's a job.

16:50.060 --> 16:51.260
We acknowledge the job.

16:51.440 --> 16:52.880
And then it stopped.

16:53.040 --> 16:54.240
PLC stopped.

16:55.180 --> 17:10.940
And so, so how this is relevant to an analyst is rather than just seeing raw data on the wire, just bits, they're trying to figure out, like, if it was UDP and like DNS, if, if I give an analyst raw DNS, they could probably tell me what the IP it came from,

17:10.940 --> 17:14.360
what the IP requested it, what the IP was returned, because they know that.

17:14.360 --> 17:15.100
They live in that space.

17:15.100 --> 17:18.140
The TCP IP stack is, is daily stuff, right?

17:18.140 --> 17:23.380
But if I say, hey, here's some raw bytes from a PLC turn off command for an S7 protocol.

17:23.500 --> 17:25.500
And the analyst is like, yeah, that's cool, bro.

17:25.500 --> 17:27.720
You know, I, I hope it's not broke.

17:29.000 --> 17:29.840
Generally, right?

17:29.840 --> 17:42.740
In general, like, because we're not a PLC shop, but maybe if you have a PLC shop, you have guys dedicated just to Siemens PLCs and just to Allen Bradley PLCs and just only guys who study Modbus, right?

17:43.940 --> 17:46.640
Does anybody, is that a thing?

17:48.160 --> 17:49.300
It is?

17:50.160 --> 17:51.420
No, no, no.

17:51.660 --> 17:57.100
Where you have a Modbus guy on the network analyzing only Modbus data and he's like.

18:00.340 --> 18:02.620
So, so that's what we had.

18:02.620 --> 18:03.380
Those are attacks we ran.

18:03.380 --> 18:06.260
We scan and we turned it off.

18:07.580 --> 18:11.740
And I will now turn the time over for, to James for our conclusion.

18:13.020 --> 18:16.640
So, we're blue team guys, right, through and through.

18:16.640 --> 18:19.320
We enjoy finding bad guys.

18:19.320 --> 18:24.020
We enjoy seeing them attack our networks and then null routing their stuff.

18:24.140 --> 18:26.120
That's, that's what we do, right?

18:26.180 --> 18:31.100
So, uh, I think from our perspective, we think this stuff's really cool.

18:31.100 --> 18:33.100
We hope you guys think it's cool too.

18:33.140 --> 18:40.820
Um, we encourage you, if you think it's cool, to go look at Zeek, uh, maybe contribute, write some parsers of your own.

18:40.860 --> 18:48.540
And then additionally, uh, if you have guys have novel detections you can think of, uh, Zeek's a great tool to build detections in.

18:48.540 --> 18:50.720
And, uh, I think that's all we have.

18:50.720 --> 18:53.440
Yeah, does, are there any questions?

18:53.440 --> 18:56.320
Does anybody care to know more about my PCAP?

18:58.480 --> 18:59.640
Alright, thank you guys.

18:59.640 --> 19:00.340
Thanks.

