start	end	text
0	5980	All right, everyone, thank you for coming to our talk. It's named Extending Zeke for ICS Defense.
6720	11080	My name is Norman Lunt. As the slide shows you, I'm a security enthusiast.
11440	18400	I love PCAPs, and I love the defense side of this game,
18400	22320	where if I can find you anywhere, we'll get you out.
24680	30800	Hey, I'm James Dickinson, and as the slide shows, I'm also a security enthusiast.
30800	37260	And much like Norm, I enjoy PCAPs and packets that are placed inside of PCAPs.
40700	44580	All right, so to start us off, we're going to talk about some fundamental definitions
44580	50080	in case anybody doesn't know. I'm just going to refer to them by their acronym names and not by
50080	57740	their full names as it suits me. So ICS stands for Industrial Control System. PLC is Programmable
57740	65340	Logic Controller. HMI for Human Machine Interface. And NSM stands for Network Security Monitoring.
66160	74420	All right, so who cares about ICS data, right? It seems in the NSM world, ICS is just an
74420	79880	afterthought. Nobody cares, gives a good doggone about what's happening on Modbus or what's
79880	86660	happening on DMP3 or what's happening with all your Siemens PLCs. So what happens, I
87240	92660	downloaded the most recent version of Zeek, and I built it from source, and I discovered
92660	100480	that three out of 72 out-of-the-box analyzers were for ICS. And I went online, I poked around,
100480	107380	and the Survey of Security Tools for the Industrial Control System Environment said,
107380	112980	the survey identified tools such as Bro, which is what Zeek used to be called, Snort and Yara,
112980	117460	which are by design highly extensible. Enough so that with minor development, they could be
117460	129630	used as ICS solutions for which there's no current tool set. So every year, more and more devices
129630	139830	are exposed to attack. And the people who want ICS in their systems, a lot of times they don't
139830	144790	care about security because they haven't been hacked or they haven't gotten to a point where
144790	149630	they need security. And so they'll be advised and say, hey, you know what, if we expose this
149630	152870	internet, we're probably going to get in trouble. And they're like, I don't care, it's not
152870	159430	affecting my bottom dollar yet, just push it, just push it, just push it. And so from Security
159430	164910	Week.com, this is a report from 2017, they used Shodan, Synthesis and Google search engines
164910	170510	and they identified over 170,000 ICS components accessible from the web. And it was a 10%
170510	175350	growth from 2016 to 2017. I don't know what it is currently, but I don't think it got less. I
175350	182770	don't think they're like, you know what, we better not put more ICS stuff out there because, you
182770	190750	know, so why this is really relevant is programmable logic controllers or ICSs in general
190750	196450	aren't fault tolerant. Like if at any point you send your data out of order or a malformed packet
196450	200190	or something just doesn't hit right, it just crashes. And sometimes it crashes in a state
200190	204630	that's unrecoverable. Unrecoverable in the sense that you can't do it remotely where somebody has
204630	209130	to physically drive out there and power cycle it or physically go out there and replace it
209130	216970	because it's broke so hard. And so why this, so this is also what happened. I was talking to a
216970	220970	guy, this is the whole reason we have this talk, and he was a fellow security researcher and he
220970	226610	said, he said, you have ICS data on your network. And I told him, no, I don't. He says, you do,
226610	231330	go find it. And so after he and I left this conference, I went back and I found this ICS data.
231330	235830	I found these attacks coming in and I didn't have a convenient way to figure out what was
235830	240790	happening with them. I saw the data, I could see the raw bytes, but I didn't know what they meant,
240790	244850	I didn't know what they were doing. And I thought, this is probably a problem for everybody. Like,
244850	250270	how do I explain to my customer, hey, you know what, you, you know, foreign IP tried to hit you
250270	255530	400,000 times to turn off your PLC. I mean, none of them were successful, of course, but it doesn't
255530	261350	stop the attacks. So I would like to turn my time over for James to explain to you the Purdue model
261350	270830	and how Zeek works. Yeah, so the Purdue model's been around for a while, 1970-ish, I think.
271370	278350	And really what it is, it's just a way to describe how these ICS systems tie into the business
278350	284510	network. So if you look at this, you can see down here at level zero, you have the physical devices
284510	292570	that are actuating physical processes. So these are things like pumps, sensors, belts, things like
292570	298710	that. And then level one here, you have the control devices that are controlling those physical
298710	304850	processes. And then as you work your way up the network, you get up to the business analytics
304850	310810	portions that are consuming this data to be used for making business decisions and risk decisions,
310810	317350	right? And so what we're talking about is defense, right, of the network. And so what we want to
317350	324370	look at is the basic stuff that you do with any network, figuring out where to do segmentation
324370	330610	and where to create those security boundaries to isolate that data and protect it, right? And so
330610	337130	if you look here, we have some notional firewalls that are in this diagram, right? And so those are
337130	341730	some good places to place spans or taps or what have you, however you're going to monitor this
341730	352450	network, um, to capture that data and see what is going on. So why did we choose Zeek as opposed to
352450	360870	some other tool for using to monitor and defend ICS data? A couple reasons. Um, Zeek is open
360870	365330	source, so that means it's freely available for anyone to use and it has a very active, uh,
365330	370610	development community. It's also very well documented. There's tons of white papers, talks,
370610	377750	and, uh, uh, whatnot to go look at. Additionally, Zeek comes with a turn complete scripting
377750	384770	language. The Zeek scripting language is event driven and it's purpose built for network
384770	391410	communications. Um, so it's a, it's a great tool for building additional detections on top of,
391410	399250	uh, and other, and tying it into your other systems. Um, additionally, it has the ability to
399250	404350	create custom parsers. So that's what we're talking about today. Um, so you can go into Zeek
404350	411450	and modify it for your purposes and build a parser to monitor the protocols that you want to,
411450	417970	that you care about. Additionally, Zeek is fully extensible because of the scripting language and
417970	422430	all the other stuff and all the other tools, uh, the community has built. It's very easy to
422430	427030	plug into your existing network and get those logs into your sim or to do some sort of active
427030	436760	defense with. So creating parsers, um, we sort of took two approaches here, right? You need to
436760	443160	write your own or you can find someone else's and we sort of did both. Um, so the protocol we
443160	451000	chose to write our own on is, uh, EtherNet IP and SIP. EtherNet IP, uh, is the session layer
451000	458600	particle for SIP, which is the common industrial protocol. Additionally, um, we went around and
458600	465960	tried to find what other tools and things people had done and, uh, this researcher, uh,
465960	473920	Dane Wolin wrote, uh, S7 protocol that we also used. Uh, I should say S7 is the protocol that's
473920	484570	used for Simmons PLCs. So creating a Zeek parser. So we aren't going to dive into the deep,
484570	490390	nitty gritty details, but we'll cover it over, uh, sort of a high level overview. Um, so first
490390	497770	thing you need to do is go grab Zeek, right? So you can go to GitHub, find Zeek and just get
497770	503270	clone that sucker and you'll have it there. Additionally, other things you want to do, um,
503270	509370	Vlad, who's a member of the Zeek developer community, has this BINPACK quick start script.
509370	514530	It's just a Python script. What that will do for you is it'll create the boilerplate, uh, files
514530	520110	and code that you need to get started writing a protocol. And then after that, you need to
520110	526330	write a protocol. Uh, Zeek protocols are written in a high level language called BINPACK. And
526330	534210	so BINPACK is purpose built for, uh, describing protocols. Um, and so you're just going to
534210	540050	describe the structures in the protocol and then you're going to tie that into the events and,
540050	545930	uh, at a high level that's what's going on. And then after that, you're going to run it and
545930	552400	it's probably not going to work and you're just going to keep iterating. So this is what
552400	562180	BINPACK looks like. Um, so you can see here we have a couple different things going on. So this
562180	568940	top level structure here is the ethernet IP header that the two protocols we just mentioned
568940	575160	use. And we are describing the different values and where they lie in that structure. So for
575160	580700	instance, it has a command value that will tell, uh, that describes what the command is that
580700	587260	is coming across the wire. And then the length variable just says, hey, expect this much data
587260	595120	in the, uh, SIP, in the SIP PDU that's to follow. And then so on and so forth. And then right
595120	601700	below that, uh, we have a case statement. And the case statement is just saying, uh, whether
602560	610080	the data is from the originator or the responder. And so in this case, uh, and then it's just
610080	615700	passing it to another data structure here. Either e- ethernet IP request or ethernet IP
615700	622700	response. And then finally, down here at the bottom, we have the ethernet IP request. And
622700	628480	here we're calling, uh, another case statement for the command value that's up in the
628480	634640	ethernet IP header. And so we're just looking at what value is in there to identify what the
634640	641140	command is. And then passing that along further into the protocol, uh, structure. So in a
641140	646420	nutshell, that's how BINPACK works. There's a little bit more with it in terms of then getting
646420	652220	those events into the script layer. But, uh, that's, that's a, that's our quick five minute
652220	662210	intro to BINPACK. Alright, so I'm gonna cover, cover what we did with that data. The, so
662210	670270	off of, what's that thing? That, oh. So off of eBay, years ago, James had bought a Siemens PLC.
670590	676250	And we're like, hey, you know, let's, let's blow this thing up, see what happens. And so, as
676250	683110	far as the S7 protocol parser goes, I, I took a good hand to it for about 35 hours and then, and
683110	687570	then realized somebody else had done all the work and felt dumb. And load it up and it worked
687570	692870	great. So, first thing we did, so after that, when we decided, hey, let's break into this thing
692870	698350	and blow it up, the, it didn't have an IP and we couldn't figure out how to give it an IP. So
698350	702030	eventually we landed on the Siemens software portal. At one point, Siemens had sent us an
702030	704810	email saying they couldn't verify we were American and they wouldn't let us download any of
704810	710430	their software. We downloaded, we finally got this one called the TIA portal and we set the IP
710430	715370	on the PLC. And it seems like this one liner, like, download the software, set the IP, right?
715370	723970	This is like 30 hours into our project. The next thing I found is there was a, this guy, Dark
723970	728550	LBP, he doesn't, I don't, I don't know any more data than that from his GitHub. He created this
728550	733630	thing called ICSploit. It's a creative use of Scapey and Python to create custom attacks on
733630	738850	PLCs. And it already has pre-built attacks for S7. So that worked fantastic. And he calls it
738850	744310	ICSploit because it has a Metasploit style interface. But it, it's good if you just wanna,
744310	751010	you know, if you wanna blow up your own PLCs from eBay. Then I started Wireshark. I
751010	757510	captured data off my NIC. Then I ran the attacks. And then I took that data, fed it into Zeek
757510	765110	that was running our S7 parser and we produced Zeek logs. So what this is, is this is ICSploit
765110	771650	giving me data back, right? So this is a scanning style attack. And you can tell it what rack and
771650	779270	what slot, etc. And it said it found these two vulnerable spots. Slot 0 and slot 1. The IP we
779270	788870	set for our Siemens PLC was 192.168.38.200. The, so this is what, as an attacker you say, oh
788870	793870	look, there's some stuff. I got, I got some data. There's, you know, so this is say, here's
793870	798750	where I launched my attacks. This order code on there will give, you know, if you go and
798750	803830	search, it gives you insight about what type of PLC it is. And this is what Zeek looks like.
803830	807030	There's three type of logs represented here. The con log, which is your connection log, your
807030	813670	S7 setup communication log, and on the bottom your S7 user data log. Now, the first field there
813670	817970	is your, is your UID. And Zeek is really important because your UID ties all your different
817970	823050	logs together. And so all the blue logs go with blue logs and yellow logs go with yellow logs.
823050	827530	And if they aren't highlighted, it's because they were scanned and nothing returned. So you
827530	832470	can see in the, in the column just before it says SRSTR, everywhere where it has zero means
832470	837130	there was zero bytes returned. So it got, it got no, no return. So on my big scan, those are
837130	840430	the ones that didn't return, which is why they're not highlighted. They're included just to
840430	846770	say, hey, I scanned more than just that one area. So in the, then in the 7 setup con log, it
846770	851710	shows you there was a call for a job. The job was acknowledged. And then the user data, it
851710	857210	sends these SLS, SZL requests and response. And one of the things about Siemens PLCs is
857670	862130	it doesn't matter what kind of protections you have on them, you can, you can still read, you
862130	868130	can send read requests to the SZL and it'll respond to you every time. You may not be able to
868130	875380	do any much more after that, but at least you know that you have a live target. The next thing
875380	881400	I did is we tried to turn it on and off. So as you can see here, the command description, 1 to
881400	888840	start the PLC or 2 to stop the PLC. So I set the slot to 1 because that's, that's the slot that
888840	894120	was vulnerable. I set the command to 1 and then I ran it. And then it, then as you can see,
894120	899420	running module, target is alive, sending packet to target, start PLC. So me as the attacker say,
899420	904860	oh cool, the, the PLC started. And then I changed the command to stop it and this is, oh okay,
904860	910100	the PLC stopped now. Now, turning on and off, right, doesn't seem like a major attack, right?
910100	915320	You turn PLC, you turn it on, you turn it off, big whoop. So a couple years ago, one of the
915320	919900	national labs had this giant generator just like, I don't know, like a billion kilowatts. I don't,
919900	923600	it's not that high. I don't know how much it was. It was a giant, it was large. And they turned it
923600	928720	on and off rapidly. Bum, bum, bum, bum. And it blew up because they started it and stopped it
928720	933360	and started it and stopped it and it blew the heck up. And so, so maybe not a catastrophic
933780	939020	explosion to kill everybody in the plant, but it's significant enough to require, who knows
939020	943580	the amount of down time to get the heavy equipment in there to replace that generator. And,
945480	951020	and besides like, any time your PLC just take rogue, wild turn on and off statements, like it's
951020	957860	ridiculous. It should never happen. Here's what we have. I split it up in two parts. The top
957860	962700	part I call turn on and the top, bottom part I call turn off. And again, it's the same, the
962700	966740	first two logs are the same. Your con log, which is your connection log, then your setup
966740	971880	communication, and then the bottom one that's new for this type of, of log source is your PLC
971880	979320	function. So, main thing in your connection log, data was, was processed. It went, you got
979320	984140	bytes to and from. Then you have the job and the job was acknowledged in the setup, in the,
984140	988560	yeah, the setup communication. And the last part, it calls this program called P program and
988560	993460	then it says empty. Because we didn't actually have a program in there. We, uh, we did, but
993460	1000560	we deleted it out. Our PLC wasn't connected to anything during this, during this setup. We,
1000560	1005060	uh, I was just happy that we could turn it on and turn it off. And the turn off is the exact
1005060	1010120	same. There's data in the connection log. We have the communication. There's a job. We
1010120	1018080	acknowledge the job. And then it stopped. PLC stopped. And so, so how this is relevant to an
1018080	1022000	analyst is rather than just seeing raw data on the wire, just bits, they're trying to figure
1022000	1028320	out, like, if it was UDP and like DNS, if, if I give an analyst raw DNS, they could probably
1028320	1033740	tell me what the IP it came from, what the IP requested it, what the IP was returned, because
1033740	1038520	they know that. They live in that space. The TCP IP stack is, is daily stuff, right? But if I
1038520	1043880	say, hey, here's some raw bytes from a PLC turn off command for an S7 protocol. And the
1043880	1049840	analyst is like, yeah, that's cool, bro. You know, I, I hope it's not broke. Generally, right?
1049840	1055720	In general, like, because we're not a PLC shop, but maybe if you have a PLC shop, you have guys
1055720	1061480	dedicated just to Siemens PLCs and just to Allen Bradley PLCs and just only guys who study
1061480	1074000	Modbus, right? Does anybody, is that a thing? It is? No, no, no. Where you have a Modbus guy on
1074000	1082760	the network analyzing only Modbus data and he's like. So, so that's what we had. Those are
1082760	1090560	attacks we ran. We scan and we turned it off. And I will now turn the time over for, to James
1090560	1098620	for our conclusion. So, we're blue team guys, right, through and through. We enjoy finding
1098620	1104560	bad guys. We enjoy seeing them attack our networks and then null routing their stuff. That's,
1104560	1110720	that's what we do, right? So, uh, I think from our perspective, we think this stuff's really
1110720	1116540	cool. We hope you guys think it's cool too. Um, we encourage you, if you think it's cool, to go
1116540	1122940	look at Zeek, uh, maybe contribute, write some parsers of your own. And then additionally, uh,
1122940	1127580	if you have guys have novel detections you can think of, uh, Zeek's a great tool to build
1127580	1133520	detections in. And, uh, I think that's all we have. Yeah, does, are there any questions? Does
1133520	1140340	anybody care to know more about my PCAP? Alright, thank you guys. Thanks.
