start	end	text
0	800	Hello, everybody.
800	1740	Thank you for coming.
2140	7260	This is There and Back Again, which is all about discovering OT devices across protocol gateways.
7620	8900	My name is Rob King.
9040	11100	There's my face if you want to see it twice.
11300	12280	It's right there.
13220	16460	So let's talk about how did we get here?
17840	35480	So when we talk about OT, we talk about ICS, we talk about SCADA, we often think about these super cool looks like from the 1990s or maybe 80s with a good budget sci-fi thing with a control room and uniforms and bleepy things and all that.
35480	37500	And that is part of it and it's super great.
37640	44440	This is a control room from I think it's a refinery in Germany, but it's from Wikimedia, so very nice of them.
44860	55000	But what we're really talking about as well and what we tend to kind of abstract away from as security practitioners is the fact that we're still talking about these machines that actually do things in the real world.
55000	61360	They spin, they pump, they flap, they poke, whatever it is they do.
62240	66300	And so we need to talk about how we actually control those devices.
66600	70760	And by the way, we've got 43 slides to get through in 25 minutes, so I believe in you.
70860	72900	So we're going to go fast.
73200	75100	So industrial control technology.
75560	89140	So it started with, you know, somebody having to stand there and push a button and pull a lever and read things off, you know, read symbols off things and then type or whatever, which is a horrible job that no one should ever have to do.
89520	92380	And so we thought maybe we should automate this a bit more.
92660	96440	So we came up with this concept of simple electronic logic.
96440	99060	So we say, okay, that's a major improvement.
99060	107940	We can have things that aren't just simply repeated over and over, but you can have a little bit of, you know, if then or do this three times and then do something else and it's all great.
108140	114360	But those devices, those controllers were connected to the machines that were being controlled.
114360	121900	If you needed to change something or check on something, you had to physically walk over there and, you know, like a pilgrim and touch things, right?
121900	123380	Push buttons, do all that.
123620	127000	Still a major improvement, but not particularly efficient.
127800	134280	And then so someone had this great idea of what if we make the wires that connect those controllers longer?
134520	139840	And we put all of the controls and the dials and everything all in one spot.
139860	142620	This was the concept of distributed control systems.
143020	147820	And so you put everything in one room and so you can check on the state of your factory in a glance, right?
147960	149500	And this was great.
149500	150360	This was much more efficient.
150360	156280	You still had to occasionally go out and check on things, but it made it easier to get an overview of the whole process.
157140	167200	But it was still a problem in that each one of those, you know, dials or switches or gauges or whatever was linked more or less to one specific device, right?
167200	169680	So you still had a lot of wiring and a lot of cabling.
170500	173280	Cats and dogs living together in a mass hysteria, you know, all that.
174700	187320	If you ever watched, if you're of a certain age, if you ever watched The China Syndrome, Jane Fonda, Jack Lemmon, both of them nominated for Oscars, great movie, a little alarmist, there was a problem where one of these mechanical gauges got stuck and we almost had a nuclear meltdown.
187740	190620	The movie was released just before Three Mile Island, it was very prophetic.
190620	196800	Anyway, so we're like, hey, what if we started putting things like these newfangled computers in there?
196800	200040	Well, now I see your problem, there's a computer in there.
200040	210180	But what happened was we started coming up with the idea of using this newfangled computer intelligence technology to make buses.
210180	223500	So instead of having tons of wires running everywhere, there was enough intelligence in the end devices and the controller devices to send signals, multiplex signals over a single set of cabling, a single set of wires, right?
223660	233260	This is actually, this is an example of the Hewlett Packard instrument bus, which this was back when Hewlett Packard made laboratory equipment and not printers that made you sad.
233660	244320	And also fun note, this was adapted to be the bus for like the Commodore 64, Commodore PET, was also HPIV, just kind of adapted and slower.
244320	248540	So you were doing lab science work every time you used your Commodore 64.
248880	259540	But what was neat about this is there was enough intelligence that you could say, okay, I'm going to send a message and I want it to go to device number 8 or 7 or whatever.
259540	262540	And the other devices knew not to respond to that message, right?
262540	265100	And you only had to have one bit of wiring.
265780	277260	Now, HPIV was, it was designed more for like bench scenarios, like laboratory equipment, oscilloscopes, cool stuff, science, but not large industrial things.
277520	280100	There was a fairly short maximum cable length, that sort of thing.
280100	282720	Wasn't designed for particularly noisy environments, all that.
282840	289320	So Modicon came up with the idea of Modbus, which you've all heard of, and if you haven't, you're about to.
289820	296980	And so that was actually the first Modicon PLC, which Modicon got bought out by, was it Schneider Electric?
296980	297820	Somebody tell me.
297820	299080	Schneider Electric, I think.
299580	301200	Either that or Siemens, Schneider.
301240	307860	Anyway, and the standard protocol for Modicon, Modbus, became controlled by an industry consortium.
307860	316240	So it's kind of an open standard now, very simple, but allowed this concept of a bus architecture in an industrial environment.
316240	321260	So you could say, okay, and this is a little bit more modern, this is talking about Modbus TCP, but the principle is the same.
321260	329140	You can talk to lots of different devices by their address using a common protocol and more or less a common set of physical media.
329560	332140	Made things a lot more efficient, a lot easier.
332480	338620	But then, as time marches on, we started converging on IP and Ethernet.
338620	358440	All of these protocols either predate IP and Ethernet becoming standard or predate them entirely, you know, take your pick, or predate them even becoming useful in the kinds of environments that industrial situations involve, like noisy electrical environments and vibration and things like that.
358760	363400	So we started doing industrial Ethernet because it's a commodity, right?
363400	369460	Ethernet, IP, commodity software, commodity technology, it's cheaper, it's easier to use, it's easier to integrate.
369740	376180	This is fantastic, but it does lead to now you can have your industrial systems connected directly to the Internet, which is a bad thing.
376180	379000	You really shouldn't do that, but this was just an example.
379000	380480	I'm not going to harp on this too much.
380480	389540	Other people have talked about IP convergence and security and OT, but just for the record, I really should not see these sorts of things when I do a public scan of the public Internet, but I do.
389540	391280	So you should fix that.
392480	397240	But the advantages of this convergence are undeniable, right?
397240	401340	It makes it much easier to work with, makes it much easier to integrate into existing systems.
402160	407280	But now that they're all connected, I want to discover these devices.
407280	409380	I want to find them on the network.
409500	415520	I've spent most of my career searching for devices, trying to find them, trying to fingerprint them.
415520	416200	I love it.
416200	417860	It's super fun.
417940	419280	I'm a lot of fun at parties.
419520	425840	So this is Modbus when they took Modbus and adapted it to TCP.
426180	439380	So what they did quite literally was just put a framing header on the front so you knew how long the message was going to be and then they took the core of the Modbus protocol and shoved it on top of TCP and it works.
439380	440320	It works fine.
441180	446320	But it's not ‑‑ it was never designed to really be supporting discovery.
446400	450740	They kind of assumed that if you've got your factory, you should know what's in your factory, right?
450740	458160	Well, factories have gotten bigger, technology has gotten bigger, shadow IT, we now have shadow OT, so it's good to know what's actually going on.
458620	463740	And then this is just to give you an example, this is literally explaining how they're shoving it into the TCP data segment.
463740	466720	It's just the entire Modbus message plus some framing.
466720	468840	It's treated as a normal TCP stream.
469080	470160	There's no magic.
471480	475920	But Modbus as a protocol is very simple, which is not surprising.
475920	482960	It was created in, I think, 1978, so it's about as old as I am and I'm, you know, not very smart.
483200	486320	So it can do things like read a register.
486320	490540	Please give me the number that's in register, you know, 2 or whatever.
490920	491900	And you get that back.
491900	492860	But that's all you get.
492860	498360	There's not a lot of meta information, there's not a lot of self‑describing data, and that was on purpose, right?
498360	501180	They don't want to waste the bandwidth.
501180	503980	They don't want to waste the bits on the wire.
504520	507360	It was much more important to have that maybe be error correction or something like that.
507360	510600	So how do we identify a Modbus device?
510600	517280	Well, this is the list, I know you're all like, wait, wait, there's one more, and I was like, yes, there is, but next slide.
517280	523080	This is a list of all the possible ‑‑ all the standard function codes in Modbus.
523180	525820	And you're like, okay, well, you know, maybe one of these can work.
525820	528760	Like there's that report server ID down there, that seems useful.
528840	530540	That only works on Modbus serial.
530740	532860	Or occasionally on TCP, but it doesn't tell you much.
532860	535680	It's just, yeah, my unit ID is 3.
535680	536820	Which is, you know, great.
536820	538140	I now know that your unit ID is 3.
538140	539300	I still don't know what you are.
540320	552720	Well, Modbus 1.1 in 2004, 6, something like that, gave us the idea of the encapsulated interface transport.
552720	568080	So just like how they took Modbus and they shoved the entire thing inside TCP with some framing, they then shoved this entire sort of additional protocol that's much more complex entirely in the Modbus frame, the Modbus payload.
568080	571240	Using opcode 2B, or not 2B.
571840	578100	And one of the extended operations that they can do is read device identification.
578540	589780	And read device identification, you can say, hey, you can see here that the function code is encapsulated interface transport, and then suddenly there's this new additional secondary opcode, MEI type, read device identification.
590600	593520	And what that gets us back is much more information.
593520	597440	Vendor name, product code, all sorts of useful things.
597440	604600	And in fact, this is if your device supports MEI, it's required to at least support vendor name, product code, major or minor revision.
604920	609260	Most devices also support vendor URL, product name, model name, all that good stuff.
609360	620460	It's all exposed as objects because it was 2004 and everything had to be object oriented and there was probably, you know, somebody made a lot of money saying, oh, yes, object oriented Modbus, but it is, and it's kind of nice.
620520	628440	So you can do that, and you can get all sorts of information automatically when you do this, which is very nice for discovering Modbus.
629160	637380	But now let's talk about the second worst named, second most confusingly named protocol in this talk, which is distributed network protocol 3.
637380	640620	Does anybody, just show of hands real quick, does anybody use DMP3?
640620	642920	It's not super, okay, yeah, all right.
642960	654100	So distributed network protocol 3 is a standard industrial protocol, but it's only, I don't want to say only, it's primarily used in utility distribution.
654100	656780	So electricity, water, things like that.
656780	659680	Super useful, I like having power, I like having water.
661040	667000	DMP3 was designed later than Modbus, and so it has a much richer set of semantics.
667000	677480	This beautiful diagram explains the level of, depending on how you want to look at it, complexity or sophistication of DMP3.
677760	686240	DMP3 has its own framing, it has its own checksumming, it has its own transport layer, it has its own addressing scheme that's much more complicated than Modbus's addressing scheme.
686240	695160	Modbus was just, hey, unit 23 on the shared bus, whatever, do this thing, maximum of 255 devices.
695660	697860	This supports much, much more.
697860	707960	But just like with Modbus where they took the Modbus protocol and just kind of plopped it on top of TCP, they really did that with DMP3.
707960	719060	So DMP3, they didn't just take the user application layer or the transport layer or anything, they took the whole shebang, the whole kit and caboodle, and just plopped it on top of TCP.
719440	726680	Which is great in that you can have a shared implementation and if you're wanting to talk across different physical media, it's all the same code and that's fantastic.
726800	731160	But it also makes discovery of these devices a little problematic.
732000	742920	So DMP3 devices, if they're on an IP network or they're speaking through an IP protocol gateway, they will have an IP address, as one does, but they will also have a DMP3 address.
743160	750360	And also, also, on the gripping hand, they will only talk to their designated primary device.
750360	762760	So when you configure a DMP, I mean, usually, it weighs around everything, but usually when you configure a DMP3 device, you say your primary is, you know, at DMP3 address 7 or whatever.
762780	764860	And then it will only talk to that device.
764860	771360	So if you connect to a DMP3 device via TCP, you will get basically nothing.
771360	774880	You'll just get sort of an empty, you know, session, empty channel.
775260	789920	And if you want to ask that device, you want to query that device for any information, you have to then construct an entire DMP3 transport layer message and application layer message and then send that across the wire with the appropriate destination address for the device you're talking to,
789920	792800	but also you have to spoof the primary address.
792840	796940	So that's a problem because there's, you know, 65,000ish, there's a couple of reserved ones.
796940	799380	Addresses, it would take a long time to guess those.
799860	801620	So what can we do about that?
802020	804380	Well, I just said all that.
804380	807920	Well, what we can do is there's banner sniffing for DMP3.
807920	814180	Not a guarantee, and there's what's sad is the fallback is that you do have to enumerate the address space, but I'll cover that in a second.
814440	828860	But most DMP3 devices, not all, not all, but most, when you connect to them via TCP, will send what's called an unsolicited response, which if you didn't solicit it, it's not a response, it's just a message, but I digress.
829340	837220	But it will say, okay, you know, yeah, my clock is out of sync or here's the flags that have changed since the last time we talked or whatever, but the important thing is that's a full DMP3 message.
837220	844880	It's got the entire transport layer in there as well, including the device's own address and the device that it's talking to, which is its primary.
844960	854100	So you can say, oh, okay, well, great, now I know your address is whatever, because it's the source address, and I should pretend to be whatever the destination address was.
854100	855240	Super useful.
855320	857040	Doesn't always work.
857120	859260	They don't always send these unsolicited responses.
859260	863300	Sometimes they'll send them only if they haven't talked to the primary for five minutes.
863300	864240	Sometimes they send them every time.
864240	865520	Sometimes they never send them.
865660	870780	But if you're doing DMP3 device discovery, sometimes you luck out and you just get one and it's great.
871180	880720	But otherwise you have to go and enumerate the entire address space, which would take a really, really long time, because there's, you know, 65,000 possible combinations on the one end and the other end.
881020	889800	The good news there is that most of those devices or most networks, they tend to put addresses at the lower end of the range.
889800	892640	So really you're only talking about maybe the first 1,000 or so.
892640	894200	You'll get at least a few hits.
894480	895660	But it's not a guarantee.
896140	905220	But anyway, once you've got that connection, once you've got that address guessed or determined or sniffed or spoofed or whatever, you can then get these DMP3 attributes.
905220	907960	They're not quite standard, but they're pretty standard.
907960	913420	And you can say, hey, give me your software version, your hardware version, your host name, all that good stuff.
913500	915540	And there is, in fact, what you get.
915860	917940	By the way, this was a lot of fun to set up.
917940	921160	And when I say fun, I mean that I hated my life.
921160	922280	But I got it working.
922620	925420	So the lab was a mess, but I got it working.
926020	928620	And you can discover DMP3.
929180	931580	But now, let's move on.
931780	939060	I said DMP3 was the second most confusingly named protocol we're going to talk about.
939340	944880	The first most confusingly named, if you come from an IT background, is Ethernet IP.
945320	948900	Because the IP does not stand for Internet protocol, it stands for industrial protocol.
948900	960220	So when we talk about Ethernet IP, we are talking about Ethernet IP on top of IP on top of Ethernet and the two IPs means something different and one of the Ethernets doesn't actually mean Ethernet.
960220	961680	So it's kind of a problem.
961840	964300	But anyway, super fun.
964300	965440	It's a very pretty protocol.
965440	966200	I really like it.
966200	970500	But I really like writing protocol parsers like I would do it if they didn't pay me.
970500	972640	But they do pay me, which is great.
972640	973880	So please keep paying me.
974780	975440	Ethernet IP.
975440	981480	So Ethernet IP is an adaptation of SIP, which is the common industrial protocol.
981480	992520	Used to be an information protocol from Rockwell, but just like Modbus is now controlled by a consortium of whatever, SIP is now controlled by a consortium of whatever.
992520	996360	I still don't know what ODVNA stands for.
996360	998560	I cannot find it, but that's the name of the consortium.
998560	1000700	I'm assuming A is association, but I don't know.
1000700	1004740	Anyway, SIP is an abstract protocol.
1004980	1007640	Much like SNMP defines lots of encodings.
1007640	1011500	You can use dir and bur and sir and all those.
1012260	1016400	Which everyone out there who's ever worked with SNMP is like, no, no, please, stop talking about SNMP.
1016540	1017500	ASN1, no.
1017500	1018600	It's terrifying.
1018880	1021920	But SIP has different adaptations to different protocols.
1022040	1027060	So Ethernet IP is the SIP adaptation for IP networks, right?
1027060	1030820	But there's also standard adaptations for combo net, control net, device net.
1030820	1034520	There's one for CAN bus, you know, all this, right?
1034740	1040880	But the point is, once you get there, you're talking this abstract protocol, which is defined as objects and messages, right?
1040880	1046300	SIP defines the standard set of objects and messages and attributes on those objects.
1047700	1051560	And so, but Ethernet IP is the lower level, right?
1051560	1053280	You want to connect, or for an IP network.
1053280	1056340	So you want to connect to a device that speaks SIP.
1056340	1060680	You connect on an IP network via using Ethernet IP, and then you start talking SIP.
1060680	1064360	But before you start talking SIP, you're talking Ethernet IP.
1064360	1072160	And Ethernet IP provides a full device discovery mechanism right out of the box, super nice, it's great, called list identity.
1072360	1084680	So list identity is, you can see it here, it's command list identity, and, oh, I want SIP identity, and then you get back, you know, Rockwell automation, Alan Bradley, program a logic controller, blah, blah, blah, blah, which is great.
1084680	1090160	And you can send that via TCP, you can actually do that as a UDP broadcast, and devices will just respond and say, here I am.
1090320	1091440	And that's great.
1091480	1092480	Problem solved, right?
1092480	1093740	We're Ethernet IP done?
1093740	1094860	No, I say.
1094860	1096920	Oh, and here's what it looks like when you connect.
1097080	1098760	There's the devices you can pull.
1098920	1105400	But I don't want just that device, because remember, we're talking about protocol adaptation.
1105400	1111440	We're talking about multiple devices being adapted or having gateways to IP networks, right?
1111440	1127360	What if we're talking about one of these racks where you've got an Ethernet IP adapter, and in that rack you've got a PLC and a motor controller and a thermal monitor and a spline reticulator and all that, and they're connected via some other back plane or some other transport protocol.
1127780	1137760	Well, what I can do is I can connect via Ethernet IP to that Ethernet IP adapter, and one of the objects in SIP is a connection object.
1138080	1141320	And another object in SIP is a connection manager object.
1141320	1144260	And another object in SIP is an identity object.
1144460	1157760	So if I just connect straight to the Ethernet IP adapter, and I say, hey, I want all of the attributes off of your identity object, I'll get back more or less what I got back from the list identity, just via Ethernet IP.
1157760	1163820	But now I'm at SIP, it's a higher level of semantic meaning, whatever, but it's still more or less the same thing.
1163820	1178720	But the magic that comes in is that you can then say, hey, connection object, please, or connection manager object, please get me a connection to the device at this other address, right?
1178720	1179640	And what do you get?
1179640	1188820	Well, now you can say, okay, it'll hand you back, it'll say, okay, great, here's a connection to this other device, or I can't make a connection , you know, whatever, there's an error.
1189200	1206080	But you can now say, okay, I want you to forward this request to get all the identity attributes to this other object through that connection, and it will do so, and it will actually forward that theoretically recursively all the way down to this other object and then relay everything back up to you.
1206220	1209500	And so now you can discover everything in the rack.
1209940	1217180	It does use sort of, if you remember source routing, you actually do have to construct a path to get there.
1217600	1219760	So how am I doing on time?
1219760	1220020	Okay.
1220020	1233020	So you can say, okay, I want to get all attributes from the identity object, you can see here, get attributes all, instance one, there's only ever one instance of an identity object.
1233200	1234500	Port segment.
1235400	1243040	So I'm trying to get slot 12 of this Rockwell RS links device on its back plane, please give me that.
1243420	1246820	And what you get is voila, you get this.
1246820	1253440	So what we have here is, here's the Ethernet IP adapter, and the PLC, and there's all these other devices.
1253440	1258640	I want to discover all these other devices, because I'm not satisfied with just talking to this device, I want to know everything, right?
1258780	1259900	And so that's what you get.
1260040	1268440	You can say, hey, please walk through, please enumerate everything on the back plane recursively, give me a connection to this identity object, get all its attributes.
1269380	1273220	Cycle through, give me a connection to that identity object, get all its attributes, on and on and on.
1273400	1283680	Theoretically, even recursively, you have multiple connections, like one of these things could be another Ethernet IP adapter connecting to another rack, and you could still forward that on, and it might not be speaking Ethernet IP, it might be serial,
1283680	1284300	it might be whatever.
1284300	1301460	In fact, as you can see, down there at the bottom, you've got an RS232 connector, you've got a 24 volt DC magic thing that's probably making something cool happen in the real world, but the point is, you can use this to recursively discover everything in a SIP network.
1301760	1305740	And I think I actually managed to finish on time.
1305760	1307200	So thank you.
1307880	1310020	If there's any questions, please, I'll be right here.
