Good morning slash afternoon, depending on what time it actually is, everyone. As he so illustriously introduced me, I'm Mark Bristow. I am a SCADA security engineer for a consulting firm who, for various reasons of politics, decided they did not want to be associated with this talk, so I'm here as an independent researcher. My day job is I perform security assessments for lots of commercial and government clients, some of whom are probably actually in this room right now because I saw you at Black Hat. This is really just kind of a personal project that I started putting together at my old company, actually, and decided to submit it for a talk, and now I'm here. And by the end of this talk, I'm actually going to release it as a free and open-source tool. Well, that's a lie. I haven't uploaded the code yet because I'm afraid to use the Wi-Fi. So just a quick agenda about what we're going to talk about today. I'm going to start out with just kind of an introduction to SCADA systems because I'm sure not everyone in this room is a SCADA security engineer. I'm not a security expert. Then I'm going to do a real quick primer about ModScan, why I built the tool, and what kind of problems I'm trying to solve with the tool. Then I'm going to talk about the ModBus protocol, which is really actually pretty important because if you don't understand the actual protocol that I'm talking about here, you're going to get really confused as to what my tool does. I'm going to go through a little bit of the history. I'm going to go over packet construction, some of the more interesting functionality, and then the communication flow and how errors are handled, which becomes really important. You'll see that in a little bit. Then I'm going to talk about ModBus TCP, which honestly is just a wrapper for ModBus into TCP, although they changed the packet structure and the protocol a little bit. So I'm going to go over that architecture, packet construction, and then we're going to look at some packet captures. Conveniently, Wireshark actually decodes the ModBus protocol, so that's kind of nice. Then we're going to get into the demo. I actually have a virtual SCADA network. I had delusions of grandeur of bringing hardware with me at one point, but, yeah, that didn't happen. So we've got a virtual machine that's a SCADA network that we're actually going to do a live demo, and if the demo gods smile upon me, hopefully everything will work. And then we're just going to go over some project information, Q&A if we have any time, and like he said, I think I'm going to be in room 104 after this if you have questions. So I can't give a talk without a disclaimer. You know why it's there. Don't be stupid, okay? This tool was not written with the intent of being particularly malicious, but you can still do nasty things. SCADA systems? Think like 1980s. 80s technology, okay? I mean, literally, that's what's going on in most of these places. They're really fragile and temperamental, and if you run this on some system, you could easily crash it. So if you do, you didn't hear it from me. Okay, so like I said, go over a little primer. What is SCADA? How many people in this room know what SCADA is? How many people in this room would bet a beer on their definition of what a SCADA system was? Yeah, that's what I thought. You all know that. You all know that. It's Supervisory Control and Data Acquisition, but you have no clue what that actually means based on the number of hands. I saw, like, three. What's that? Deal. Anyway, SCADA systems are basically the long definitions up on the slide, but basically it's a system that takes real-time data inputs from various sensors, local or remote, uses that stuff to make real-time decisions about controlling a process, and then goes and controls that process, again, from local or remote locations, and then goes and controls that process, again, from local or remote locations, A lot of times you also hear the term ICS or Industrial Control Systems used. They're virtually synonymous. There is actually some technical differences between the two terms, but for the most part they mean the same thing. So, now we know what SCADA is, where do we find SCADA? SCADA is touching your lives right now. The power – the lights are on in here, which means a power system is running somewhere out in probably Hoover Dam, right? Guess what? Hoover Dam is run by a SCADA controller. control network. Power is one of the biggest ones, but you have stuff like water treatment. This water bottle was manufactured and they put water in it because why? A SCADA system did that control. Who hates gas? The price of gas. I know I hate the price of gas. Wow, no hands? Come on, guys. Wake up. It's noon. It's $4 a gallon. What's up with that? That's all pipe through pipelines. All those pipelines are controlled with SCADA control systems. In big cities, I'm from Washington, D.C., and I hate traffic because it sucks up more of my life than I care to admit. Traffic control systems in big cities are typically done by SCADA. Yes, believe it or not, in some of those crazy hacker movies like Hackers, there are some systems that you could actually control the traffic lights if you were so inclined. This is not a comprehensive list of everywhere there's SCADA, but as you can see, this stuff touches your life a whole lot. This here is kind of what SCADA looks like, sort of, in a conceptual manner from my experience with dealing with clients. Typically, you have a big corporate network, some type of control network, some field sites down here at the bottom, and a whole bunch of stuff running in between. You've got all kinds of specialty devices. You've got regular servers, these big things called PLCs, which are the brains of the operation, along with the SCADA application controller. Notice how there's different color lines on this. On this slide, each color here represents a different protocol. SCADA networks today are just kind of a big hodgepodge of different things. You've got TCP IP running all over the place. You've got Modbus serial. You've got Modbus TCP. You've got DNP3, all kinds of stuff just running around, which creates a big problem for the asset owners because now they have to deal with all these different protocols. What's changing about this picture is it's all going blue. Everything is starting to get touched into standard switch TCP networks. Well, what that means for all of you and us is that, well, we already know how to break into regular Ethernet networks pretty good. All those proprietary protocols that are the things that are supposed to provide the security by obscurity in SCADA, yeah, they don't matter anymore because we can get in and then, over the TCP, break through the routers, break through the firewalls, and we're done. The other thing, too, is some of these firewalls, especially that one right there, not usually there. It's great. You own a web server, and all of a sudden, you're on the control end, and you go, really? Okay. ModScan. We're not here to talk about SCADA architecture. I just need to give you a primer. What is ModScan? ModScan is basically a tool that I wrote to detect open Modbus TCP ports and then identify these things called slave IDs because you can't address any device without knowing its slave ID. Then you need to associate that with an IP address. Well, that's what ModScan does, at least what it does today. My original intent was to make this a reconnaissance tool, something that administrators could use to map out their network. Think really, really, really early versions of Nmap, except it only runs on one port. Basically, I was going for something kind of a general reconnaissance tool is what I was looking for. I keep talking about this Modbus thing. Has anyone here, like, actually read the Modbus protocol spec? Wow, I'm impressed. Like, more hands than I thought I'd see. Okay, well, then, you guys are going to be really bored for this part of the presentation. I'm sorry. So Modbus is old, okay? Modbus was developed in 1979 by a company called Modicon that doesn't even exist anymore. Okay, so we're talking this is literally 1979, early 1980s technology we're dealing with. It's pretty basic. It is free. It's open source. You can go to the Modbus website, which is in my references, and download the protocol spec if you want to. That's kind of how I got started with this whole thing. Depending on who you ask, it's the most common protocol out there. And I'd say that's probably a lie, but, like, a pretty good lie. Almost every major control system network that I've seen has at least some element of Modbus running on it because it's very, very prevalent because it's so old and well-established. And it runs. Modbus TCP is registered on port 502, so if you ever come across port 502, that's typically what you're looking at if it's registered. And it comes in two flavors. There's the RTU flavor, which is a binary flavor that I have actually never actually seen deployed. Most places are running what's called Modbus ASCII. They're basically the same thing except for the compression format, and they use different CRC versus LRC checks. It's not really that big a deal. They're pretty much the same thing. So what's a Modbus? What's a Modbus packet look like? Modbus packet is broken up into two major sections. There's the ADU, which is the entire packet, and the PDU, which is the protocol data unit, which is this kind of green stuff going on over here. All right? The only thing that is absolutely written as stone in the spec is that the PDU has to exist to have this thing with the function code and the data. That's the only thing that you actually have to have for Modbus. Now, Modbus Serial has this other concept. It has a slave ID and has error checking on it. As you can see, it runs up to 256 bytes, which was actually because this was originally designed in the 70s as a serial protocol, and 256 was the maximum size of an RS-485 packet could be. So that's why it's the size that it is. So important notes. These function codes, we're going to get into these function codes and these slave IDs pretty good here. Function codes are valid 1 through 127. The function codes 128 through 255 are reserved for error codes, and we'll get back to error codes. Like I said, they become important. And it's big Indian encoding, which is important because if you look at any of the packet captures and you're not thinking about that, you'll get confused as to why things don't look like they should. Now, who sees any type of security relevant stuff in this packet? Yeah, giggles is about the right thing, right? There's nothing. There's no authentication in here. There's no even place for it. You know, the inherent protocol has absolutely no... If you're on the wire, you win. You can send commands. Modbus uses a master-slave relationship. Masters don't have to be authenticated. They don't have to authenticate to slaves. You just put out your thing, and it happens. So you make it down to the actual wire on Modbus. Pretty much the only thing that's left is you don't know how to address the slaves, and that's what ModScan solves for you. So basically, if you can get to the wire and run... If you can run my tool, you own that SCADA network. Fun stuff. So, I said I'd get into the function codes a little bit. Here's the function code reference. I'm not going to go through all these. If you want to read them, read the spec. I don't want to waste my time on that. Some important things are read coils, and these read functions are basically to read data, right? Which becomes very useful in a scanner, because we don't want to scan with a write, because some devices are read-only. But you can write data. You can write data to devices, which can be fun if the device is, say, a breaker, and you want to trip it. So you just write, switch a bit somewhere, and all of a sudden, the power goes out in Nevada. Awesome. Another interesting thing here is diagnostics. We'll get into those in just a second. Also, where is it? Function code 11, report slave ID. This is actually the default function code for ModScan. Now, you might think, well, why did you write this tool to discover slave IDs if you just ask it for the slave ID and it gives it to you? Well, it doesn't, because what that does... Oops, I went in a slug. There we go. Report slave ID gives you a human-readable text string. So it says, hey, I'm substation number 57, switch 2. It doesn't give you back the actual addressing slave ID that you need. So I don't know why it's called that, but that's what they call it. If you actually address it with the wrong slave ID and ask it for this code, it gives you an error. So I didn't really understand that part. So diagnostic codes. I said diagnostic codes are pretty interesting. Code 0 is kind of boring. It just is an echo. But code 1 and code 4, those are pretty interesting, because code 1, if you were to just continually broadcast diagnostic code 1 at a ModBus network, what would happen? Communications get reset, and then what? You're DOSing the entire network. Built right into the protocol for you. Thank you very much, Modicon. The other thing you can do is use code 4, which is force listen-only mode. Well, why does that matter? Well, most of these, as I said, these control networks, they take data in and then make decisions and then use them to do stuff. Well, if you cut off the data feed, the SCADA control system goes, oh, my God, everything just crashed, and who knows what happens. So that's also a kind of interesting little, little tidbit that they added. And then, of course, you've got, they built in your obfuscation for you with clear counters and diagnostic registers and clear the overrun counters, so if you were banging against the bytes for a little while and you want to clear all the logs, that's built right into the protocol, no problems. So, now we know what packets look like. Let's talk about COM for a little bit, okay? COM for this protocol is, again, really simple. Basically, like I said, you've got a master and a slave. Masters are the only one that can start communications. Slaves cannot under any circumstances. Although some vendors, and the truth about Modbus is that some vendors implement things differently, so some have added that functionality, but in the spec, only masters can start the talk. So, basically, a master sends a request out to a slave, slave does something, slave responds. Pretty simple. So, what happens when, I said, errors are important for my tool, okay? So, what happens when errors occur? It looks just like the last one. The master sends out a request that's improperly formatted or something. The error is detected at the slave level. The slave reports an error back in a special format, which is a little bit different. So, you have the slave ID, you have this EFN, then you have the error code where the data should be, and then you have the error check. That EFN is just the function code plus 80 hex, which is why I said earlier that 128 through 255 were reserved because it's the error half of all the actual function codes that are being used. This basically becomes the foundation of how my scanner works. So, the error codes are defined in the spec. I'm not going to go over them. They don't really matter. The only one that matters that you'll see in the slides is error code three, which means illegal data value. So, okay, kind of recap real quick. Valid slave. Slaves one through 247. Okay, why they didn't run that all the way up to 255, I really have absolutely no idea. It fits in one byte, but whatever. The slave ID has to be unique on every bus because, remember, this is serial protocol, right? So, if you have two mod bus serial networks next to each other, they don't care what the other one's doing. But on the same bus, you can't have two devices with the same slave ID. Otherwise, oh, no, two devices are going to respond at the same time and you have a race condition and you don't know what's going to happen. So, masters, if you look back in that slide, the masters don't announce themselves in any way. They just send something on the wire. See, there's no, like, master ID in this packet. There's just slave ID. So, masters don't have to authenticate in any fashion. And you can only run one request at a time. It's really highly timing-based. The good news is that mod bus straight is not really run a whole lot. I've seen it in some systems, but it's not everywhere. But you could actually, if someone's running just straight mod bus, you can do really nasty things to them pretty easy. It's pretty bad. So, that's mod bus. My tool runs on my bus TCP, which I said is basically just a wrapper for mod bus. Okay? What they did is they had to modify the protocol a little bit because, like, things like checksum, why do we care? The TCP IP layer will take care of all the checksum for us. So, why are we going to add that? We introduced gateways. These become really important because a gateway basically takes a mod bus TCP connection, gives it one IP address, and then it'll allow you to attach a whole ring of slaves to that. So, you can put up to 247 slaves attached to one gateway, now hiding behind one IP address, which is how a lot of these systems are kind of put together. As I said before, port 502 is still the port for this, but basically everything else is completely unchanged in the protocol. The end of the day. The underlying packet is the same. So, a mod bus TCP architecture looks kind of like that last slide, but just a little bit different. You've got the corporate LAN, then you've got the firewall, hopefully, and then you have your control center, which has all your fun toys in it, and that's where you take all of your VPs and all that kind of stuff. And then, if you notice, we've got blue running over here. The blue is all the mod bus TCP connections, and that can run throughout the entire network over your regular Ethernet. And then, occasionally, you have your gateways that typically talk to, like, kind of more legacy devices, like things that are high capital, like generators and those kinds of things, transformers. They might only speak regular mod bus. You just kind of drop a gateway in there so that you can talk to them over the regular network. You're seeing from the device vendor standpoint that a lot of vendors are adding mod bus TCP directly into their products. So, most of this stuff is going away. But it's definitely still out there, because, like I said, they're high capital investment items. They don't turn over very fast. So, this is a mod bus TCP packet. It's broken up, again, really into two major sections. There's the PDU, which is the thing from last time. Remember, I said that's the only thing that you have to have for mod bus? Well, that's unchanged, okay? And then, you have this thing, which is the MBAP, with the mod bus application protocol handler, which has all of your routing information. You have a transaction ID and a protocol ID, which, for some reason, is always zero. Always. You never change them for any reason. I don't understand why they're there, but... Okay. So, you just put in zeros for the first couple bits. Yeah? Oh, good. Good. Okay. That guy knows. Thank you, that guy. Appreciate it. Yeah, you get a beer, too. Oh, sorry. Yeah, my bad. What he said was that, originally, they were going to have multiple protocols that were going to be attached to this, so that's why the protocol ID was there, but that they only ever developed one protocol, and so that's why it's always zero. Did I surmise appropriately? Close enough? Okay, good. So, anyway, more importantly, again, still big Indian encoding. PDU is the same. But you have this kind of additional header here with a length. And notice that the slave ID is, again, in the extra addressing. So, that's what it looks like conceptually. Let's look at an actual request response going on from something on a packet capture I did a while ago. So, if you look at the request, this is obviously straight out of Wireshark. Wireshark will decode this into, like, more readable format, but I prefer to read it in the hex because I'm a geek. So, you've got your transaction ID, protocol ID, your length, which you actually have to calculate. It's not that hard. Your slave ID, and then your function. In this particular case, I ran diagnostic code zero, which is echo, and then 0535, which is leet and hex, in case anyone doesn't know. The request gets sent out by the master, and then a response looks like this. Again, you have 0000. You get your length. Your slave ID gets returned. Then notice, since this was a valid response, the function code gets returned as the one that was sent in. That's important. And then, since this was diagnostic, you get diagnostic code and data. So, the important part of this is that it looks exactly like the request, right? Because that function code is the only thing that will let you know if there was any type of error or that it came from the slave. So, what happens when we do something bad, right? That's what we're going to do. That's what we're all interested in, anyway. All this stuff stays the same. Your function, now this is the request. So, the function code, we put in a valid function code, but with a diagnostic code of FF, which is not in the spec. Okay? So, we're going to send it something that it doesn't expect. What happens is, is you get your transaction ID, protocol ID, length, slave ID, et cetera. But if you look at the function code, and that's actually kind of hard to read on that screen. Sorry. That's 88 there, right? So, we got that. We got that function code back, and it had 80 hex added to it. And that's really the key to how this all works. Because if you send a request with an invalid slave ID, it errors or ignores you, right? So, if your flow is this, if you either error or get it error or ignored when there's an improper ID, but when the proper ID is sent, you get that function code back. Now, we've got a binary switch where we can say, okay, well, if we meet these conditions, it's not the right one. If we meet this condition, it's the right one. And now we have a fundamental basis for how to write do mapping. So, back to my tool, enough with the boring lesson. Basically, mod scan will, the only required parameter for it is an IP range. It'll scan the IP range on whatever port you ask it to, although it defaults to 502. You can run ModBus on another port if you want to. It's your choice. When it finds an open port, it's pretty simple. It just does a slave ID brute force. It's not very elegant, but it gets the job done, and it's surprisingly faster than you might think it would be. By default, it stops at the first slave ID that it finds. That's just because I chose to do it that way to be more efficient. But again, for gateways, that doesn't really fly, and we'll take a look at that in a little bit. And it outputs in just a IP colon port tab slave ID format, because that's what I felt like. I intend on adding actual CSVs or something like that to it, but I am just way too lazy right now to get that done. So, you get a whole bunch of switches and options on the tool. Again, it's written in Python, but Python has a nice little options handler. Beautiful. You can set the port, the timeout. A, this is important, the aggressive mode. I said before that default mode is it stops at the first slave ID. Well, in aggressive mode, it enumerates the entire address space every time. So, if it finds the slave ID, it just assumes that it's at a gateway because there's no other way of detecting it, and just runs through the entire list. So, if you're dealing with a place with gateways, you have to pretty much use the aggressive mode. You can change the function. Why is that important? Because, like I said before, Modbus is kind of like every vendor does their own little special implementations and that kind of stuff with Modbus. So, function code 17, which is what I default to, report slave ID 1, might not actually be implemented on particular devices. It's possible. So, maybe you want to use read to streets or read coils or a diagnostic code to do your scanning. The principle of the tool will still work. If it's the wrong slave ID, it'll come back with an error. So, you can really use any function code. You could even use a write function code if you wanted to, and it would come back and report all the slave IDs. Although, you probably just made a real big mess in someone's skating network, but what you do with my tool is your own business. Okay? If you're using the F, you've got to use D because now, in order to send a properly formatted packet, you have to have the right data to back up the function code that you sent. So, basically, if you're going to switch the function, you better read the Modbus spec because you're not going to get it right. It's not that hard, but the tool doesn't have a nice way of handling all that. I was not running out to make a Modbus client tool. This is a scanner, and it's pretty basic. And, of course, we've got verbose and debug modes, which are mainly for me. So, demo time. Put all this down. So, as I said before, I have a little skating network that I put together in Ubuntu Virtual Machine that we can run for the demo because hardware was just impractical. This actually uses a tool I have kind of running in the background called Modsac by a company called WingPath out in the UK. So, give them some props. Their tool is actually pretty nice, and I'm using it for their demo, and they were nice enough to help me out when this stopped working like yesterday. Oops. And let me just make sure that my packet capture is running. Okay. We're good to go. So, let's take a look. Okay. Let's run the tool. Let's find my mouse. Okay. So, to run the tool, there you go. Wow, that was awesome. Right? If you run it with no options, it gives you all the options, just like every other tool in the world is supposed to do. Well, it works just like you expect it to. That's the same option list as we saw before, so I'm not going to go over it. Modscanning, its most basic interpretation, is you want to run it against a single host. So, let's... Give that a try, and hopefully everything will work. Yay, it worked. Okay. So, when you're running against a single one host... I don't know if I can scroll that. There, if you can't see it, now you'll probably be able to. Can everyone read that? Is that big enough font? Okay. So, basically, if you're running against one host, it's not particularly interesting. It just starts... It starts the scan, and then when it finds the valid slave ID, it tells you the IP address and the slave ID associated with it. Like I said, it's just a pretty basic mapping tool. That's really all I was going for. Running against one host is pretty uninteresting. So, we can run it against multiple hosts... using slash notation. Now, this is going to take about 30 seconds to run. I'm doing a slash 26, because it takes... On average, in my testing, it takes about two minutes and nine seconds to do a whole class D almost exactly every time, which is actually kind of cool. But that's a lot slower than I want to do for this talk. But it can do any IP address range you want to give it. It'll just suck it up. So, as you can see, we're getting some results here. The first one we already saw, .21 has a slave ID of 8. But there's other devices sitting on this network. We've got one at .22 with a slave ID of 30, .25, 7, etc., etc. You can read the slide. Maybe you can't. There you go. And then it tells you when the scan's done, which originally wasn't in there, but someone told me that, hey, I don't know when it's finished. I was like, oh, okay. That's a good point. So, pretty basic when you're running it with no options. It just will sit there and scan the whole network and map everything out for you. Now, I said before that it has two basic modes operations, the aggressive mode and standard mode. Well, as you can see here, on port IP25, we only have one slave ID come back, right? Well, if we run this entire network again, but do it in aggressive mode, oops, oh, okay, I just did one IP there. Never mind. I changed my demo, sorry. If we run against the number 25, we actually see that there's four devices sitting behind that. So, that's obviously a gateway, right? And that's really the difference between the two modes, is that this one went through and then tried to enumerate every single slave ID, whereas the other one stopped at the first one. So, if you want to see it actually working, which I don't know about you, but I hate tools that just sit there and like starting and gives you absolutely no status. Well, sometimes you're going to have to do that. There's not a lot you can do with a command line tool. But if you want to see it working, you just put it in verbose mode. And it'll sit there, and tell you, well, it failed to connect to all these IPs on port 502, et cetera, et cetera, et cetera. And it'll sit there and run out. And you'll see in a couple seconds here that it'll come up on one that's valid. And it gives you the same output as before. Just verbose mode gives you this extra information. So, I mentioned, too, that my tool can support multiple function codes. And that that can be important because not every vendor supports the same stuff, right? Well, here's an example of that. So, we're going to do this. We're going to do function code. We're going to do function code four. So, PY. You just do an F4, okay? But like I said before, we have to push in our own data because now the data that's in there by default won't work anymore. So, the data has to be entered in Unicode escaped hex. So, we do this. No, I don't. Thank you. This is why I should just use the copy and paste, but I kind of wanted to explain this. That's better. Thank you. Thank you. So, 0, 0, 0, 0. Did I do my X yet? Okay. 0, 0, 0, 1. Okay. Well, what does that mean? Okay. Well, so, for reading registers, basically what you do is you say, the first, the first two bytes there are what address do we want to start at? In this case, address 0. And then the next number is how many addresses do you want to read? 1, okay? Nothing too special about that. And then we're going to just scan one of the devices. 16, 2, 3, 1. 21. Okay. I'm going to copy and paste it. As you can see, though, you have to know a little bit something about the protocol and actually to use the function code spec. Otherwise, it won't work right. And look, it looks just like the very first thing we did, except for if we come over here to, did I lose my Skeeter? Oh, there it is. Come over here and look at the function codes that we're running. We can actually pull up the query, maybe. Maybe. I can't read that from over here, but that should say that it's running on function code 4, but I can't actually see it from over here. So I lose for being the presenter and not being able to see the screen. But it should have come up and actually showed in the packet capture that, yeah, we were really using a different function code. So just basically, yes, it works. So, okay, function code 4 is not really all that interesting. But what happens if we use that diagnostic code, function code 8? And do this instead. Now, instead of just trying to read registers, it just went through and did echo data back. Well, something that's particularly interesting about function code 8 is that you can do stuff like the reset communications and stuff, and I basically just could have DOSed that as opposed to doing what I was doing. Which I'm not going to do because it'll break my demo and then I won't be able to do the next thing. But as you can see, you can kind of use it as a client as well, which is just a nice little feature. That I added. If you are trying to use it as a client, though, your debug mode becomes valuable because when you run it with debug mode enabled, you actually get all the, it just prints out all the actual raw packets that got back. So you can actually go through and read and see what's going on and do all that kind of stuff. Which, if you're doing testing, is actually really, really useful. But not something that absolutely everyone's going to want to use the tool with. So. So. No, because remember, the tool's objective is to figure that out for you. And I did not feel like writing a full-fledged client. Would it be easy to modify the code to make that happen? Yeah. But, you know, that's not what I was going for with the thing. Any other questions about, like, the tool? Because I'm pretty much done with the demo part. Okay. Okay. So if I can find my presentation again. So, the thing that probably some of you were sitting here waiting for, where does the code live? It's going to live at modscan.googlecode.com as soon as I, like I said, get around to uploading it and on a Wi-Fi. Probably want to get back to Caesars because I'm not using the Internet here. This is my good laptop. No. Yeah. So, like I said, I kind of developed the tool to kind of be in a network. Work in enumeration, scanning tool. Yes, there's lots of other things you could do with it. That's your business, like I said. It also would actually be useful for doing IDS testing. There actually are Modbus IDS, like, snort signatures out there. And I haven't actually done this, but it would be kind of interesting to run my tool against those and kind of see what happens. Another thing that you can use it for is asset management. Too many of my clients tell me that they don't really know all the gear they have and where it's all addressed and all that kind of stuff. Which, frankly, scares me a little bit based on who those clients are. So, whatever. You could also use it as a really cheap way of issuing a whole lot of bulk commands in a very, very noisy way. So, what are the problems with ModScan? Like I said, this is a really, like, alpha product. This is the first thing I ever wrote in Python in my entire life. So, from a code perspective, it sucks. It's also the first scanner I ever wrote. So, from a scanning perspective, it sucks. It sucks probably pretty bad, too. It's not very effective. The port scanning parts of it are really noisy and not really efficient. Root forcing, I can't think of a better way to do it. Maybe one of you has a better theory on this, but it's the only way I can think of enumerating slave IDs. Another thing, too, is it doesn't interpret those error codes. There are some conditions where, for example, if you're trying to read coil zero, right, and there is no coil zero, it's a safe assumption that coil zero exists. But if there is no coil zero, you'll get an error code in that error message that'll tell you that, yes, you actually addressed me properly, but I don't have that particular device. So, if we was actually interpreting the error codes, I could get a lot more, I could lower my false negative rate, which is something I'd like to do in the future in my enhancements, which is, like I said, interpret the error codes. I'd like to implement it in something like SCAPI. Is anyone in the room familiar with SCAPI? Anyone? Anyone? Can you give me some good documentation for SCAPI? Come see me. Oh, it's you. Okay. Yes. Talk to me later. Because I was not able to find any good documentation nor figure it out in less than 10 minutes, and therefore that's about my attention span. So, yeah, go ahead. I can't hear a word you're saying. Funny you should mention that. The con gods decided that, Fyodor would sit next to me at lunch on Wednesday and told me all about the fact that he now lets you write plug-ins for NMAP. So, that's actually one of the things I might do in the future is implement an NMAP plug-in for, basically, that's a copy of ModScan. I don't want to just do it as a plug-in because the next thing I want to do is actually add different protocol support. So, instead of just doing ModBus, do, like, DNP3 or some of the other SCADA protocols and kind of make it a little bit more of a robust scanner. Again, like, the base code for this tool, I wrote it in, like, four hours. So, it's pretty basic. Another thing I'd really like to do is do fingerprinting. Is anyone here from, like, a SCADA vendor or have a lot of assets or, like, a lab they want to let me borrow for a little while? Because the problem with writing a fingerprinting database is you have to actually, like, have the thing, which is expensive. I mean, if anyone knows anything about SCADA, like, this gear is, like, in the millions of dollars, some of it, so, yeah. Yeah. Yeah, I'm thinking my day job would probably really not get along with me if I did that, but, yeah, I thought about that, too. But, also, I'm, you know, it's an open source project. If anyone wants to help me write it and make it better, give me some suggestions. You know, please do contact me, especially if you have gear that I can test, because I would love to be able to do that and make it a much more robust tool. So, just quick, actually, wow, I ran short for a change. Go figure. I just wanted to put up my references and some thanks to Kathleen Whalen, Jim Kelly, and Doug Wilson, who helped me put this presentation or tool together in various ways. And my contact information's here. My blog is onelittlewindow.org. I actually share it with Doug Wilson, so you can hit us up there. Send me an email. Yeah, whatever. So, any more questions? Because I actually have extra time. So, the question was, is there any hope for a more secure protocol? And that's funny, because outside of the SCADA talk at DEF CON, or sorry, at Black Hat, we were having a conversation about how, like, we as an industry need to get together and start a new protocol. And start writing a better protocol and start mandating it. So, the answer is no, but we'd like to see it go that way. So, anyone else? I can't even really see hands. So, if anyone else has questions, just come see me, because I can't really see you at this point. You're too early. You can't finish yet. I know. I'm sorry. I talk faster.