1 00:00:00,000 --> 00:00:06,260 So, I guess we'll get started. My name's Reid. I work for a company called Digital Bond Labs, 2 00:00:06,440 --> 00:00:10,680 and I'm going to be talking about vulnerability inheritance in programmable logic controllers. 3 00:00:11,020 --> 00:00:15,760 And if you don't know what a programmable logic controller is, go check out the ICS Village. 4 00:00:16,020 --> 00:00:24,400 It's down in Bronze 1, I think, down at the end of the hall, this way. It's the last door down there. 5 00:00:24,400 --> 00:00:28,660 So, about our company, we're a new division of Digital Bond. 6 00:00:28,780 --> 00:00:36,600 Digital Bond is a small consulting company that's been doing industrial control system and SCADA security consulting since about 2001. 7 00:00:37,900 --> 00:00:44,760 Our little part of Digital Bond is focused on working with vendors and some end users, 8 00:00:44,900 --> 00:00:50,540 trying to find new vulnerabilities in industrial control systems so that we can mitigate those vulnerabilities. 9 00:00:51,120 --> 00:00:53,780 I'm really biased because I do that for a profession. 10 00:00:53,780 --> 00:00:55,980 I'm really a big advocate of red teaming products. 11 00:00:57,300 --> 00:00:59,120 So, what am I going to talk about today? 12 00:00:59,420 --> 00:01:03,520 I'm going to be talking about vulnerabilities and what they are, and it's sad that I have to define that, 13 00:01:03,640 --> 00:01:11,540 but there's a group that does industrial control system security disclosure that has an unfortunate definition of the term. 14 00:01:11,980 --> 00:01:16,260 And then we'll be talking about some third-party libraries in the industrial space 15 00:01:16,260 --> 00:01:22,200 and look at some cool vulnerabilities that live in those libraries and what vendors are doing to not fix problems. 16 00:01:23,780 --> 00:01:25,960 So, a vulnerability is really weird. 17 00:01:26,220 --> 00:01:30,360 So, ICS-CERT, they're the ICS Computer Emergency Response Team. 18 00:01:30,480 --> 00:01:33,080 They're a group that's run by the Idaho National Labs. 19 00:01:33,600 --> 00:01:40,420 They're kind of like a government organization that discloses vulnerabilities in industrial systems, 20 00:01:40,500 --> 00:01:43,320 and they put out these advisories, and they put out these newsletters. 21 00:01:43,640 --> 00:01:51,840 A few years ago, they made this weird statement saying that they weren't going to consider design issues security vulnerabilities. 22 00:01:52,100 --> 00:01:53,320 So, if something had... 23 00:01:53,780 --> 00:01:57,380 If there was no security in its design, or if it had a poor design that wasn't securable, 24 00:01:57,540 --> 00:01:59,040 they weren't going to consider the device vulnerable. 25 00:01:59,620 --> 00:02:02,460 It was only going to be software bugs that were considered vulnerabilities. 26 00:02:02,960 --> 00:02:07,300 So, a lot of us kind of fought back against that, and they've kind of relented, but never officially. 27 00:02:07,860 --> 00:02:11,680 We get them to publish advisories for design bugs all the time now, 28 00:02:11,860 --> 00:02:15,060 but they still never officially changed their position. 29 00:02:15,720 --> 00:02:21,020 My definition, of course, of a vulnerability is any mechanism that lets you change a system 30 00:02:21,020 --> 00:02:23,760 or modify it to do something that the operator doesn't intend to do. 31 00:02:23,760 --> 00:02:31,120 So, that includes kind of traditional bugs, like bypassing authentication, parsing errors, that kind of stuff, 32 00:02:31,280 --> 00:02:35,060 but also includes these design issues, where things are insecure by design. 33 00:02:36,160 --> 00:02:38,660 So, let's look at some cool third-party libraries. 34 00:02:39,540 --> 00:02:41,160 Well, what is a third-party library? 35 00:02:41,560 --> 00:02:43,400 Anything that runs on... 36 00:02:43,400 --> 00:02:45,520 I specifically focus on embedded systems. 37 00:02:45,740 --> 00:02:48,900 Anything that runs on your system is really a third-party library, right? 38 00:02:49,000 --> 00:02:49,880 There are operating systems. 39 00:02:50,100 --> 00:02:53,740 There are these common servers that usually live on industrial computers. 40 00:02:53,760 --> 00:02:54,140 There are controllers. 41 00:02:54,480 --> 00:02:58,660 There was just a talk in here at the last session talking about, you know, 42 00:02:58,680 --> 00:03:02,580 looking at some embedded systems that have, you know, like an SSH backdoor. 43 00:03:02,760 --> 00:03:07,060 So, like, the SSH server would be a, you know, third-party library, I guess, 44 00:03:07,140 --> 00:03:10,160 but really a server sitting on that system. 45 00:03:11,380 --> 00:03:13,600 I'm looking in particular at industrial ones, 46 00:03:13,720 --> 00:03:17,440 and so two that I have focused on in the last couple of years 47 00:03:17,440 --> 00:03:22,000 have been this Codasys library and Prokonos library for industrial controllers. 48 00:03:26,180 --> 00:03:29,280 Yeah, so we'll skip over that, because that's more important to vendors. 49 00:03:30,220 --> 00:03:33,380 So, Codasys is a ladder logic runtime, right? 50 00:03:33,440 --> 00:03:36,220 So, these industrial controllers are little computers that sit there, 51 00:03:36,300 --> 00:03:39,440 and they monitor sensors, and they make decisions based on what they're seeing. 52 00:03:39,600 --> 00:03:41,100 They say, oh, when the temperature's too high, 53 00:03:41,220 --> 00:03:43,780 we need to open up the coolant valve, or what have you. 54 00:03:44,400 --> 00:03:49,080 So, these little industrial PLCs are used by all these ICS vendors. 55 00:03:49,900 --> 00:03:53,740 The Codasys library is a thing that sits on a PLC, 56 00:03:53,760 --> 00:03:56,700 and actually executes ladder logic, and it does a bunch of other stuff, too. 57 00:03:57,160 --> 00:03:59,140 They're primarily used in Europe right now, 58 00:03:59,280 --> 00:04:02,460 but we do see a few of them, at least, in the U.S. 59 00:04:02,460 --> 00:04:05,820 There's a couple of Japanese vendors that have started making these things 60 00:04:05,820 --> 00:04:08,700 with the Codasys runtime inside of them. 61 00:04:09,480 --> 00:04:11,180 So, here's a couple of vendors. 62 00:04:11,520 --> 00:04:15,660 When we initially disclosed issues in the Codasys library, 63 00:04:16,160 --> 00:04:18,460 3S Software, who are the makers of Codasys, 64 00:04:18,620 --> 00:04:21,720 used to have this list of all of their clients on it 65 00:04:21,720 --> 00:04:23,740 that had, like, 300 industrial controllers, 66 00:04:23,760 --> 00:04:24,420 control systems vendors. 67 00:04:25,020 --> 00:04:27,220 They took that down when the advisory came out, 68 00:04:27,680 --> 00:04:29,780 I guess so that, you know, people wouldn't know 69 00:04:29,780 --> 00:04:31,380 who the affected controllers were. 70 00:04:32,080 --> 00:04:34,660 But, luckily, you can go on archive.org 71 00:04:34,660 --> 00:04:36,720 and look at an old version of their website 72 00:04:36,720 --> 00:04:38,660 and, you know, grab that complete list still, 73 00:04:38,740 --> 00:04:39,980 because the Internet never forgets. 74 00:04:40,480 --> 00:04:42,320 Some of these are names that you might recognize, 75 00:04:42,620 --> 00:04:45,480 because, like, Mitsubishi is, like, kind of a household name, 76 00:04:45,540 --> 00:04:46,600 so is Bosch, right? 77 00:04:47,180 --> 00:04:49,800 Some of these are more well-known in the industrial space. 78 00:04:51,440 --> 00:04:53,100 So, Codasys, like I said, 79 00:04:53,760 --> 00:04:54,760 a lot of stuff, right? 80 00:04:54,840 --> 00:04:56,500 So, there's a ladder logic runtime, 81 00:04:56,800 --> 00:04:59,560 which is executing the logic for the PLC, right? 82 00:04:59,660 --> 00:05:01,840 So, that sits on the controller itself. 83 00:05:02,300 --> 00:05:05,220 That runs on top of a lot of embedded operating systems, 84 00:05:05,420 --> 00:05:07,340 you know, VXWorks, Windows CE, Linux. 85 00:05:07,600 --> 00:05:09,380 There's an RTOS called Nucleus. 86 00:05:09,460 --> 00:05:10,920 There's a bunch of others that we found. 87 00:05:11,380 --> 00:05:13,640 So, it executes the ladder logic, right? 88 00:05:13,820 --> 00:05:16,320 And it also runs a small listening service 89 00:05:16,320 --> 00:05:17,620 for communications, 90 00:05:17,880 --> 00:05:22,600 so that you can connect a PC to pull the PLC 91 00:05:22,600 --> 00:05:23,540 and say, hey, 92 00:05:23,540 --> 00:05:24,300 what's going on? 93 00:05:24,380 --> 00:05:25,340 How is the process working? 94 00:05:25,600 --> 00:05:26,920 Are things going okay? 95 00:05:27,520 --> 00:05:29,940 And also for uploading and downloading 96 00:05:29,940 --> 00:05:33,480 the actual logic that the PLC is going to be executing. 97 00:05:33,960 --> 00:05:36,120 So, Codasys is also 98 00:05:36,120 --> 00:05:38,420 a piece of engineering workstation software. 99 00:05:38,740 --> 00:05:40,660 So, this is like Visual Studio 100 00:05:40,660 --> 00:05:43,820 for programming an industrial process, right? 101 00:05:43,880 --> 00:05:45,780 You get to drag and drop little software components 102 00:05:45,780 --> 00:05:48,720 to say, oh, if this input gets to be too high, 103 00:05:48,820 --> 00:05:49,760 then open this valve. 104 00:05:50,000 --> 00:05:52,360 You know, if this output is like this 105 00:05:52,360 --> 00:05:53,520 and this input is like that, 106 00:05:53,540 --> 00:05:54,640 then do this other thing. 107 00:05:54,840 --> 00:05:56,220 You get to define all that stuff 108 00:05:56,220 --> 00:05:58,060 in one of these programming languages. 109 00:05:58,520 --> 00:06:01,180 And the Codasys engineering software, 110 00:06:01,380 --> 00:06:03,000 like I say, it looks a lot like Visual Studio 111 00:06:03,000 --> 00:06:03,800 if you're a programmer. 112 00:06:04,500 --> 00:06:05,600 In addition to that, 113 00:06:05,680 --> 00:06:07,680 they also have this thing called an OPC server. 114 00:06:07,980 --> 00:06:09,740 OPC is like another protocol. 115 00:06:10,040 --> 00:06:12,100 It's kind of a universal protocol 116 00:06:12,100 --> 00:06:13,420 for industrial processes. 117 00:06:13,600 --> 00:06:15,360 It stands for OLE for process control. 118 00:06:15,700 --> 00:06:19,540 If you do much programming with Microsoft stuff, 119 00:06:19,700 --> 00:06:22,800 you might have some familiarity with OLE. 120 00:06:23,620 --> 00:06:26,880 From like doing Excel sheets and Excel formulas 121 00:06:26,880 --> 00:06:27,700 and that kind of stuff. 122 00:06:27,840 --> 00:06:28,460 And it's the same thing. 123 00:06:29,120 --> 00:06:31,760 Then there's a gateway service that's optional 124 00:06:31,760 --> 00:06:34,240 that can sit between the engineering workstation 125 00:06:34,240 --> 00:06:36,840 and the PLC and can do all kinds of weird stuff. 126 00:06:37,720 --> 00:06:40,920 So, here are the main components of the Codasys network, 127 00:06:41,600 --> 00:06:42,640 I guess you'd call it, right? 128 00:06:42,760 --> 00:06:45,520 So, the PLC is that black box at the top 129 00:06:45,520 --> 00:06:46,760 and then you have all these services 130 00:06:46,760 --> 00:06:48,120 that can talk to the PLC 131 00:06:48,120 --> 00:06:50,200 and some of these services can talk to each other. 132 00:06:50,620 --> 00:06:53,340 And usually when these services are talking to each other, 133 00:06:53,340 --> 00:06:55,220 they're also using the same CodeAssist protocol 134 00:06:55,220 --> 00:06:56,940 that we looked at. 135 00:06:57,680 --> 00:06:59,420 So there are a couple of versions 136 00:06:59,420 --> 00:07:00,400 of the CodeAssist protocol, 137 00:07:00,580 --> 00:07:02,380 which makes things a little bit even more complicated. 138 00:07:02,700 --> 00:07:04,440 There's a version 2 protocol, 139 00:07:04,700 --> 00:07:08,380 which is part of CodeAssist v2.3 and v2.4. 140 00:07:08,640 --> 00:07:10,840 We did some analysis of that back in 2012. 141 00:07:11,240 --> 00:07:12,560 It didn't take very long. 142 00:07:12,820 --> 00:07:15,060 And then we also looked at the version 3 protocol, 143 00:07:15,220 --> 00:07:16,440 which changed a lot of stuff. 144 00:07:16,760 --> 00:07:19,920 We did some analysis of that in 2014, 145 00:07:20,520 --> 00:07:22,460 developed a couple of internal attack tools 146 00:07:22,460 --> 00:07:23,520 that we haven't released publicly. 147 00:07:23,720 --> 00:07:25,900 The version 2 stuff we've released publicly, 148 00:07:26,080 --> 00:07:27,760 and it's all out there, and you can grab it, 149 00:07:27,820 --> 00:07:28,880 and you can even search Shodan, 150 00:07:28,980 --> 00:07:29,840 and I'll show you how to do that. 151 00:07:30,620 --> 00:07:32,240 The protocol changed a lot, though. 152 00:07:32,880 --> 00:07:35,120 So let's look at the CodeAssist version 2 flaws. 153 00:07:35,340 --> 00:07:37,080 So first of all, there's no authentication 154 00:07:37,080 --> 00:07:38,900 on uploading new ladder logic. 155 00:07:39,080 --> 00:07:41,160 So you can actually change a factory's recipe 156 00:07:41,160 --> 00:07:42,980 for making whatever it is it makes 157 00:07:42,980 --> 00:07:44,940 without providing it as your name and password. 158 00:07:45,480 --> 00:07:46,600 So that's pretty bad. 159 00:07:47,240 --> 00:07:48,980 Then there's a little command line 160 00:07:48,980 --> 00:07:52,440 that lives as part of this service. 161 00:07:52,460 --> 00:07:55,380 That you can actually run a few commands 162 00:07:55,380 --> 00:07:57,420 via sort of like a command line interface, 163 00:07:57,700 --> 00:07:58,840 but it's actually packed binary. 164 00:07:59,860 --> 00:08:02,080 But yeah, you can interface with the PLC 165 00:08:02,080 --> 00:08:02,940 and issue it commands, 166 00:08:03,300 --> 00:08:05,640 and there's even a help command built into it, 167 00:08:05,700 --> 00:08:06,500 so you can say, like, 168 00:08:06,520 --> 00:08:08,600 hey, what can you actually do on this command line? 169 00:08:09,380 --> 00:08:12,120 Then there's the ability to start and stop 170 00:08:12,120 --> 00:08:14,900 the PLC from even operating. 171 00:08:15,060 --> 00:08:16,000 Without authentication, 172 00:08:16,580 --> 00:08:19,220 there's ability to retrieve files. 173 00:08:19,420 --> 00:08:21,680 So normally the file retrieval and upload 174 00:08:21,680 --> 00:08:22,440 is for uploading files. 175 00:08:22,460 --> 00:08:23,460 So you're uploading and retrieving 176 00:08:23,460 --> 00:08:26,040 the current ladder logic from the PLC, 177 00:08:26,080 --> 00:08:27,800 but there's a directory traversal vulnerability 178 00:08:27,800 --> 00:08:28,700 in the server, 179 00:08:28,860 --> 00:08:30,340 so you can actually grab any file 180 00:08:30,340 --> 00:08:31,740 off the controller that's running it. 181 00:08:32,340 --> 00:08:34,020 So that means you can upload and download 182 00:08:34,020 --> 00:08:34,940 any file you want. 183 00:08:35,680 --> 00:08:38,200 Usually the process on the controller 184 00:08:38,200 --> 00:08:40,060 is running as root or system 185 00:08:40,060 --> 00:08:41,680 or, you know, whatever the super user 186 00:08:41,680 --> 00:08:44,080 for the operating system happens to be. 187 00:08:44,300 --> 00:08:45,360 So you actually, 188 00:08:45,600 --> 00:08:47,520 because of the way the ladder logic works, 189 00:08:47,620 --> 00:08:49,500 you actually get free root kits because of it, 190 00:08:49,520 --> 00:08:50,320 and I'll talk about that. 191 00:08:50,940 --> 00:08:52,380 And there are quite a few 192 00:08:52,380 --> 00:08:53,820 of these systems that are Internet-connected. 193 00:08:54,280 --> 00:08:56,840 So Aaron Leverett, who's hanging around DEF CON 194 00:08:56,840 --> 00:08:58,260 and giving a talk tomorrow afternoon, 195 00:08:58,520 --> 00:08:59,380 I would go check it out. 196 00:08:59,840 --> 00:09:02,460 He and I did a joint paper a few years ago 197 00:09:02,460 --> 00:09:03,580 where we scanned the Internet. 198 00:09:03,740 --> 00:09:05,580 This was before Shodan, like, accepted 199 00:09:06,080 --> 00:09:07,340 third-party plug-ins. 200 00:09:07,400 --> 00:09:08,740 This was before ZMAP existed. 201 00:09:09,080 --> 00:09:10,740 You know, we were running NMAP, 202 00:09:10,740 --> 00:09:12,340 and we actually ran Unicorn Scanner 203 00:09:12,340 --> 00:09:14,000 and found a bunch of these things 204 00:09:14,000 --> 00:09:15,240 directly connected to the Internet 205 00:09:15,240 --> 00:09:17,180 and then tried to get them removed 206 00:09:17,180 --> 00:09:18,160 with mixed success. 207 00:09:19,480 --> 00:09:21,380 So there were a couple of ICIs 208 00:09:22,380 --> 00:09:23,820 and cert advisories about this. 209 00:09:24,040 --> 00:09:25,420 There were some CVEs issued. 210 00:09:25,600 --> 00:09:26,620 Both have a score of 10 211 00:09:26,620 --> 00:09:29,060 because they're a complete compromise of the system 212 00:09:29,060 --> 00:09:33,220 with, you know, no patches, et cetera. 213 00:09:33,820 --> 00:09:35,380 So CODIS's version 3 214 00:09:35,380 --> 00:09:38,840 has pretty much all the same problems as version 2, 215 00:09:39,000 --> 00:09:40,460 and that gets interesting 216 00:09:40,460 --> 00:09:42,600 because we'll look at the advisory 217 00:09:42,600 --> 00:09:45,380 that the 3S software company put out about it. 218 00:09:45,720 --> 00:09:47,820 The Internet scan for version 3 219 00:09:47,820 --> 00:09:50,160 turns out to be a little bit more complicated 220 00:09:50,160 --> 00:09:52,180 because they have a UDP, 221 00:09:52,180 --> 00:09:53,180 UDP version of the protocol 222 00:09:53,180 --> 00:09:54,680 that gets kind of tricky to scan, 223 00:09:55,500 --> 00:09:56,540 and I'll talk about that. 224 00:09:59,340 --> 00:10:00,880 So deployment issues. 225 00:10:01,100 --> 00:10:03,000 Like I said, usually when the vendors 226 00:10:03,000 --> 00:10:04,700 put out their PLCs, 227 00:10:04,840 --> 00:10:07,260 they run the CODIS's runtime 228 00:10:07,260 --> 00:10:08,960 with root privileges on Linux 229 00:10:08,960 --> 00:10:10,940 or system privileges on Windows CE, 230 00:10:11,240 --> 00:10:14,220 and the reason is because this latter logic 231 00:10:14,220 --> 00:10:16,220 is actually interacting directly with hardware 232 00:10:16,220 --> 00:10:17,860 that's attached to the PLC, 233 00:10:17,980 --> 00:10:19,960 so it's usually using, like, GPIO, 234 00:10:20,080 --> 00:10:22,060 and who wants to spend the time, 235 00:10:22,060 --> 00:10:24,500 figuring out how to do that stuff with least privilege. 236 00:10:24,680 --> 00:10:25,760 It's better just to, you know, 237 00:10:25,760 --> 00:10:27,420 give the process super user privileges, 238 00:10:27,520 --> 00:10:28,680 and then it can do whatever it wants, 239 00:10:28,720 --> 00:10:29,700 and you don't need to think about it. 240 00:10:30,040 --> 00:10:32,000 Usually, to me, that's a sign of rushed development. 241 00:10:32,920 --> 00:10:35,520 So the weird thing about the CODIS's runtime 242 00:10:35,520 --> 00:10:37,440 is those latter logic recipes 243 00:10:37,440 --> 00:10:40,880 that the CODIS's engineering software produces, 244 00:10:41,220 --> 00:10:43,040 they're actually binary blobs 245 00:10:43,040 --> 00:10:45,900 compiled for the processor that sits in the PLC. 246 00:10:46,100 --> 00:10:50,920 So you get to upload them without authentication, right? 247 00:10:51,020 --> 00:10:52,040 So basically, 248 00:10:52,060 --> 00:10:54,620 you get to, this service listens, 249 00:10:54,880 --> 00:10:56,660 and you can upload code to it, 250 00:10:56,740 --> 00:10:58,720 and then it will execute that code as root. 251 00:10:59,100 --> 00:10:59,940 Doesn't that stink? 252 00:11:00,360 --> 00:11:02,140 Because, I mean, basically, like I said, 253 00:11:02,220 --> 00:11:04,980 you can upload a malicious latter logic update 254 00:11:04,980 --> 00:11:07,300 that actually contains executable code, 255 00:11:07,560 --> 00:11:10,200 which is a root kit, for example. 256 00:11:11,980 --> 00:11:13,820 So to summarize the flaws, 257 00:11:14,040 --> 00:11:15,280 there's no security, right? 258 00:11:15,720 --> 00:11:18,980 I think the 3S software originally assumed that, 259 00:11:19,060 --> 00:11:21,560 you know, nobody would bother learning the protocol, 260 00:11:21,560 --> 00:11:23,460 and nobody would bother attacking these systems. 261 00:11:24,540 --> 00:11:26,080 It's kind of one of these laws, though. 262 00:11:26,220 --> 00:11:28,200 It's like, as soon as you put an Ethernet port in something, 263 00:11:28,360 --> 00:11:30,140 it's going to end up connected to the Internet, right? 264 00:11:30,380 --> 00:11:32,080 So they probably should have thought about that. 265 00:11:32,780 --> 00:11:35,320 And I don't think 3S software ever had a red team 266 00:11:35,320 --> 00:11:35,960 look at the product, 267 00:11:36,040 --> 00:11:37,960 because if they did, the red team would have screamed. 268 00:11:38,800 --> 00:11:40,260 And that'll get even more obvious 269 00:11:40,260 --> 00:11:41,700 when we look at the version 3 protocol, 270 00:11:42,280 --> 00:11:43,840 especially the code to it. 271 00:11:44,440 --> 00:11:47,240 So the original vendor, the 3S software in this case, 272 00:11:47,320 --> 00:11:51,060 they've said, well, security isn't really a priority 273 00:11:51,060 --> 00:11:51,540 of this system, 274 00:11:51,560 --> 00:11:51,800 so we're going to protect this product. 275 00:11:52,120 --> 00:11:53,560 That was their official announcement. 276 00:11:53,800 --> 00:11:55,460 They did add a username and password feature, 277 00:11:55,620 --> 00:11:57,080 but they're like, we don't assume 278 00:11:57,080 --> 00:11:59,720 that this will actually stop anyone attacking the system, 279 00:11:59,940 --> 00:12:02,240 so, you know, protect your system some other way. 280 00:12:03,020 --> 00:12:03,780 Nice response. 281 00:12:05,160 --> 00:12:07,120 So the version 2 protocol, 282 00:12:07,700 --> 00:12:09,540 you can grab some sample scripts 283 00:12:09,540 --> 00:12:11,280 from our website, digitalbond.com, 284 00:12:11,480 --> 00:12:13,300 but the protocol's pretty simple, right? 285 00:12:13,380 --> 00:12:15,160 It starts with a couple of start bytes, 286 00:12:15,840 --> 00:12:18,160 BBBB or CCCC, or the normal ones. 287 00:12:18,340 --> 00:12:21,320 It uses TCP 1200, 2455, 288 00:12:21,560 --> 00:12:24,140 and, you know, 289 00:12:24,140 --> 00:12:25,420 figuring out the rest of the protocol 290 00:12:25,420 --> 00:12:26,280 is pretty easy, right? 291 00:12:26,380 --> 00:12:28,320 You just stare at the bytes until they make sense. 292 00:12:28,520 --> 00:12:30,160 You know, you're like, oh, well, this four bytes 293 00:12:30,160 --> 00:12:31,640 is always the length, and, you know, 294 00:12:31,660 --> 00:12:33,560 this thing looks kind of like a function code 295 00:12:33,560 --> 00:12:35,820 because normally it's one, 296 00:12:35,960 --> 00:12:37,600 meaning pull the status out of the thing, 297 00:12:37,700 --> 00:12:38,560 and every once in a while, 298 00:12:38,640 --> 00:12:40,400 when I click something in the GUI, 299 00:12:41,180 --> 00:12:43,680 that little function code byte changes to something different. 300 00:12:43,840 --> 00:12:45,520 So you can kind of figure out what does what 301 00:12:45,520 --> 00:12:46,540 in the protocol that way. 302 00:12:48,760 --> 00:12:50,680 Yeah, I already talked about the code injection thing. 303 00:12:51,560 --> 00:12:52,720 So the CodeAssist version 3 protocol 304 00:12:52,720 --> 00:12:53,560 is kind of interesting. 305 00:12:53,880 --> 00:12:56,920 I bought a PLC that runs V3 306 00:12:56,920 --> 00:12:58,880 thinking, like, oh, okay, well, 307 00:12:59,020 --> 00:13:00,520 you know, I'll learn the version 3 protocol 308 00:13:00,520 --> 00:13:01,360 and see what's different, 309 00:13:01,540 --> 00:13:04,380 and I did that because when 3S Software 310 00:13:04,380 --> 00:13:05,580 released their advisory, 311 00:13:05,840 --> 00:13:07,860 they said, oh, version 2 is vulnerable, 312 00:13:08,340 --> 00:13:10,000 you know, but version 3 is not, 313 00:13:10,080 --> 00:13:11,360 don't worry about it, like, you're fine. 314 00:13:11,560 --> 00:13:14,320 Because I only released exploit code for version 2, 315 00:13:14,400 --> 00:13:16,200 and that's probably why they said version 3 is fine. 316 00:13:16,320 --> 00:13:18,200 The exploit code didn't work against version 3. 317 00:13:19,240 --> 00:13:20,980 So it can use UDP or TCP 318 00:13:21,560 --> 00:13:22,980 and UDP limits the attack surface. 319 00:13:23,480 --> 00:13:25,480 TCP might, I haven't actually looked at 320 00:13:25,480 --> 00:13:27,700 one of the PLCs that runs TCP 321 00:13:27,700 --> 00:13:29,860 just because I don't have enough money 322 00:13:29,860 --> 00:13:31,060 to be buying that kind of stuff. 323 00:13:31,460 --> 00:13:33,620 You know, these PLCs cost usually 324 00:13:33,620 --> 00:13:35,180 like $1,000 or $2,000 325 00:13:35,180 --> 00:13:37,880 for a crummy little controller with no inputs 326 00:13:37,880 --> 00:13:39,560 and you have to buy all kinds of equipment 327 00:13:39,560 --> 00:13:40,200 to support them. 328 00:13:41,080 --> 00:13:43,740 So the version 3 notes that I'm going to go over, 329 00:13:43,960 --> 00:13:46,100 I'm going to kind of talk about the protocol a bit. 330 00:13:46,560 --> 00:13:48,400 I'm reverse engineering the protocol, 331 00:13:48,600 --> 00:13:50,380 so what I say the fields are 332 00:13:50,380 --> 00:13:51,540 aren't necessarily what they are. 333 00:13:51,560 --> 00:13:52,100 They're really called, 334 00:13:52,240 --> 00:13:53,740 although it is what they really do. 335 00:13:54,900 --> 00:13:57,200 And it uses UDP 1740 336 00:13:57,200 --> 00:13:59,100 or TCP 11740 337 00:13:59,100 --> 00:14:01,140 as the port by default. 338 00:14:01,520 --> 00:14:03,580 So when CODIS is version 3, 339 00:14:03,720 --> 00:14:05,280 when the engineering software 340 00:14:05,280 --> 00:14:06,680 first connects to the PLC, 341 00:14:07,700 --> 00:14:09,780 it sends this kind of 342 00:14:10,300 --> 00:14:11,420 UDP SYN packet, 343 00:14:11,660 --> 00:14:12,960 I guess, something like that. 344 00:14:13,720 --> 00:14:15,040 It's a really weird thing, though. 345 00:14:15,120 --> 00:14:17,080 So it always starts with this C573 346 00:14:18,520 --> 00:14:19,560 4040 0011 347 00:14:19,560 --> 00:14:21,280 and then it has 348 00:14:21,560 --> 00:14:23,260 this 00E6 349 00:14:23,260 --> 00:14:25,300 which is actually the last 350 00:14:25,300 --> 00:14:26,760 octet of the IP address 351 00:14:26,760 --> 00:14:29,380 of the destination that we're sending this to. 352 00:14:29,500 --> 00:14:31,300 So this packet was being sent 353 00:14:31,300 --> 00:14:33,240 to the IP address 354 00:14:33,240 --> 00:14:35,040 192.168.63.230 355 00:14:35,320 --> 00:14:36,960 so that field 00E6 356 00:14:36,960 --> 00:14:39,040 is actually a word 357 00:14:39,400 --> 00:14:40,340 that is 230 358 00:14:40,340 --> 00:14:42,620 and that's what they do. 359 00:14:42,720 --> 00:14:45,600 They put it inside of the data payload of the UDP packet 360 00:14:45,600 --> 00:14:46,440 which is really weird. 361 00:14:46,560 --> 00:14:49,080 And they also put the last octet of the IP 362 00:14:49,080 --> 00:14:51,100 of the source address as the next field 363 00:14:51,560 --> 00:14:52,660 which is the purple one that says 1E. 364 00:14:53,520 --> 00:14:55,420 And then they have CRC 365 00:14:55,420 --> 00:14:57,640 which is this kind of dark purple thing 366 00:14:57,640 --> 00:14:58,600 down in the left hand corner, 367 00:14:58,760 --> 00:15:00,440 the 6AD579F4, 368 00:15:00,560 --> 00:15:03,520 that's actually a CRC of the entire packet. 369 00:15:04,440 --> 00:15:05,540 And then they have 370 00:15:05,540 --> 00:15:06,580 this random nonce, 371 00:15:06,620 --> 00:15:07,600 this next 4 byte thing, 372 00:15:07,720 --> 00:15:10,160 this E1179D84. 373 00:15:10,520 --> 00:15:12,260 So this took a little bit more analysis 374 00:15:12,260 --> 00:15:14,380 to figure out what all these fields actually meant. 375 00:15:15,560 --> 00:15:18,320 So when we sent that initial session ID, 376 00:15:18,480 --> 00:15:20,320 we get our first reply 377 00:15:20,320 --> 00:15:21,460 back from the PLC 378 00:15:21,560 --> 00:15:23,480 and the first reply back from the PLC 379 00:15:23,480 --> 00:15:25,400 you'll notice that the source and destination 380 00:15:25,400 --> 00:15:27,060 fields, the 1E and E6 381 00:15:27,060 --> 00:15:29,400 have changed positions because the packet is going 382 00:15:29,400 --> 00:15:30,000 the other way now. 383 00:15:30,960 --> 00:15:33,100 But we kept the same 384 00:15:33,100 --> 00:15:35,120 session ID that 385 00:15:35,120 --> 00:15:37,140 2C, the CRC obviously 386 00:15:37,140 --> 00:15:37,760 is updated. 387 00:15:39,120 --> 00:15:41,320 But yeah, so that session ID 388 00:15:41,320 --> 00:15:42,260 that we... 389 00:15:42,260 --> 00:15:44,500 When we send the first reply 390 00:15:44,500 --> 00:15:46,260 we're actually sending a session ID 391 00:15:46,260 --> 00:15:48,100 that the PLC generates. 392 00:15:48,840 --> 00:15:50,520 It's been a while since I've looked at this. 393 00:15:51,960 --> 00:15:54,680 So when the next packet 394 00:15:54,680 --> 00:15:55,800 that kind of finalizes 395 00:15:55,800 --> 00:15:57,580 the communication, the master system 396 00:15:57,580 --> 00:15:59,960 has to then send that session ID 397 00:15:59,960 --> 00:16:01,460 as part of the payload 398 00:16:01,460 --> 00:16:03,700 of that next packet before it can start issuing commands. 399 00:16:04,300 --> 00:16:05,140 And then 400 00:16:05,140 --> 00:16:06,920 it also has some sequence numbers. 401 00:16:07,200 --> 00:16:08,060 It's kind of weird. 402 00:16:08,200 --> 00:16:10,680 So what they're really doing is they're implementing TCP 403 00:16:10,680 --> 00:16:12,040 on top of UDP. 404 00:16:12,300 --> 00:16:14,760 So they're trying to create some kind of 405 00:16:15,540 --> 00:16:16,500 notion of sessions 406 00:16:16,500 --> 00:16:18,400 inside of this protocol 407 00:16:18,400 --> 00:16:20,720 even though UDP doesn't have sessions. 408 00:16:21,880 --> 00:16:23,680 But that's kind of in a nutshell 409 00:16:23,680 --> 00:16:24,220 what they're doing. 410 00:16:24,400 --> 00:16:26,460 The CRC algorithm is actually kind of interesting. 411 00:16:26,660 --> 00:16:28,760 So that CRC32 that I showed you, 412 00:16:28,880 --> 00:16:31,000 I was reverse engineering the binary 413 00:16:31,000 --> 00:16:33,480 trying to figure out what CRC algorithm they were using 414 00:16:33,480 --> 00:16:35,300 and I found a CRC algorithm 415 00:16:36,460 --> 00:16:37,660 as going through code 416 00:16:37,660 --> 00:16:39,220 but nothing actually called it. 417 00:16:39,360 --> 00:16:41,340 And I was like, well, I think they're using 418 00:16:41,340 --> 00:16:43,080 CRC32 and then I wrote some code 419 00:16:43,080 --> 00:16:44,140 and found out, yes they are. 420 00:16:44,340 --> 00:16:46,520 And then I was like, why is there no cross reference 421 00:16:46,520 --> 00:16:48,800 to the CRC32 algorithm 422 00:16:49,360 --> 00:16:51,540 that I can find where it's being called. 423 00:16:51,560 --> 00:16:53,280 Because I want to find the protocol parser. 424 00:16:53,880 --> 00:16:55,780 It turns out that there are 425 00:16:55,780 --> 00:16:57,500 a bunch of CRC algorithms implemented 426 00:16:57,500 --> 00:16:58,760 in the code 427 00:16:59,560 --> 00:17:01,900 but only the CRC32 seemed to get used. 428 00:17:02,520 --> 00:17:03,760 The answer 429 00:17:03,760 --> 00:17:05,100 to this weird mystery 430 00:17:05,100 --> 00:17:07,100 turned out to be that they used 431 00:17:07,100 --> 00:17:09,780 one of the bytes of the packet 432 00:17:09,780 --> 00:17:11,500 as a pointer 433 00:17:11,500 --> 00:17:13,340 into a function pointer table 434 00:17:13,340 --> 00:17:15,500 to decide which CRC algorithm 435 00:17:15,500 --> 00:17:17,540 to apply to the packet 436 00:17:17,540 --> 00:17:18,980 in order to verify it. 437 00:17:19,160 --> 00:17:20,440 That sounds really weird. 438 00:17:21,560 --> 00:17:21,640 But it is. 439 00:17:21,880 --> 00:17:23,900 So basically you accept this packet 440 00:17:23,900 --> 00:17:25,080 you pull out one of the bytes 441 00:17:25,080 --> 00:17:27,980 and it's the fourth byte of the packet 442 00:17:27,980 --> 00:17:29,940 you compare it to hex 41 443 00:17:29,940 --> 00:17:33,000 and then if it's less than or equal to 444 00:17:33,000 --> 00:17:33,740 hex 41 445 00:17:33,740 --> 00:17:36,920 you use it as an index into a function pointer table 446 00:17:36,920 --> 00:17:38,480 and then finally you call 447 00:17:38,480 --> 00:17:39,680 that index. 448 00:17:39,920 --> 00:17:42,180 Whatever happens to be at that index. 449 00:17:42,600 --> 00:17:44,820 So does anybody know 450 00:17:44,820 --> 00:17:46,920 who here is an x86 assembly person? 451 00:17:47,620 --> 00:17:48,140 Anybody? 452 00:17:48,380 --> 00:17:50,060 What's JLE? Signed or unsigned? 453 00:17:52,220 --> 00:17:53,220 I'll answer for you. 454 00:17:53,300 --> 00:17:53,620 It's signed. 455 00:17:54,040 --> 00:17:56,500 So that value could be negative. 456 00:17:57,180 --> 00:17:58,540 Think about that for a moment. 457 00:17:58,740 --> 00:18:01,500 So if the value of the byte 458 00:18:01,500 --> 00:18:02,700 in the packet is negative 459 00:18:02,700 --> 00:18:05,660 and then we use that as an index 460 00:18:05,660 --> 00:18:06,960 into an array, what happens? 461 00:18:07,360 --> 00:18:09,200 Well we just grab whatever happens to be 462 00:18:09,200 --> 00:18:10,660 sitting in memory before that array 463 00:18:10,660 --> 00:18:11,520 which could be anything 464 00:18:11,520 --> 00:18:14,280 and then we actually call that 465 00:18:14,280 --> 00:18:15,320 as though it's code. 466 00:18:15,600 --> 00:18:17,780 So that's pretty weird and pretty dangerous. 467 00:18:18,620 --> 00:18:20,580 So there's a lot of opportunity 468 00:18:21,560 --> 00:18:22,840 to do this in really interesting ways 469 00:18:22,840 --> 00:18:24,740 to do arbitrary code execution. 470 00:18:25,960 --> 00:18:26,460 So 471 00:18:28,000 --> 00:18:29,360 yeah, somebody else 472 00:18:29,360 --> 00:18:30,960 I'll probably start looking at this again 473 00:18:30,960 --> 00:18:32,340 because I haven't dusted it off in a while 474 00:18:32,340 --> 00:18:34,920 but if somebody else wants to look, go for it. 475 00:18:35,520 --> 00:18:37,840 It's really an interesting place to look for bugs for me. 476 00:18:38,080 --> 00:18:39,340 And there's a lot of suggestion 477 00:18:39,340 --> 00:18:41,020 that other fields in the protocol 478 00:18:41,020 --> 00:18:42,620 like some of the function codes 479 00:18:42,620 --> 00:18:44,900 take arguments and some of those arguments 480 00:18:44,900 --> 00:18:45,880 have weird parsers. 481 00:18:46,080 --> 00:18:49,340 There's some suggestion that those other functions 482 00:18:49,340 --> 00:18:51,540 of the protocol parser 483 00:18:51,560 --> 00:18:52,260 work the same way. 484 00:18:52,500 --> 00:18:54,800 So a good red team would have 485 00:18:54,800 --> 00:18:56,700 kicked and screamed and been like 486 00:18:56,700 --> 00:18:57,880 what are you doing, this is crazy. 487 00:18:58,200 --> 00:19:00,000 But it never happened I guess. 488 00:19:00,940 --> 00:19:03,300 So the security anyway of the UDP protocol 489 00:19:03,300 --> 00:19:05,980 is entirely reliant on that session ID. 490 00:19:06,260 --> 00:19:07,440 Remember the PLC generates 491 00:19:07,440 --> 00:19:09,220 a session ID and sends it to the master 492 00:19:09,220 --> 00:19:11,300 and then the master has to use that session ID 493 00:19:11,300 --> 00:19:13,680 for every request that it sends after that. 494 00:19:14,180 --> 00:19:15,320 The weird thing about 495 00:19:15,320 --> 00:19:17,560 the protocol in the UDP version 496 00:19:17,560 --> 00:19:18,840 is that those 497 00:19:19,400 --> 00:19:20,780 octets of the IP address 498 00:19:21,760 --> 00:19:23,060 they actually dictate 499 00:19:23,060 --> 00:19:25,180 where the response is going to go to. 500 00:19:25,400 --> 00:19:27,820 So if you're on a totally different subnet 501 00:19:27,820 --> 00:19:29,360 and you send a packet 502 00:19:29,360 --> 00:19:31,360 to a UDP port of one of these PLCs 503 00:19:31,360 --> 00:19:33,520 the PLC will respond to the 504 00:19:33,520 --> 00:19:35,240 IP address that happens to have the last 505 00:19:35,240 --> 00:19:36,860 octet within its local subnet. 506 00:19:37,140 --> 00:19:38,900 So it's a really weird thing with routing. 507 00:19:39,920 --> 00:19:41,240 But if you're a hacker 508 00:19:41,240 --> 00:19:42,340 and you're on the local subnet 509 00:19:42,340 --> 00:19:44,160 you win 100% of the time because you can see 510 00:19:44,160 --> 00:19:45,700 what the session ID is supposed to be. 511 00:19:46,220 --> 00:19:47,860 However if you're on a remote subnet 512 00:19:47,860 --> 00:19:49,240 it's actually pretty easy to work around. 513 00:19:51,560 --> 00:19:52,240 It has a 2 byte value 514 00:19:52,240 --> 00:19:54,900 so there are 65,535 515 00:19:55,380 --> 00:19:56,860 possible values for that session ID. 516 00:19:57,340 --> 00:19:59,500 Unfortunately they increment it by 4 every time. 517 00:20:00,080 --> 00:20:01,220 So there are actually only 518 00:20:01,220 --> 00:20:03,120 16,000 possible session IDs 519 00:20:03,120 --> 00:20:04,580 so you can brute force that pretty quick. 520 00:20:05,040 --> 00:20:07,100 You can just issue a connection request 521 00:20:07,100 --> 00:20:09,420 and then slam it 522 00:20:09,420 --> 00:20:09,740 with 523 00:20:12,040 --> 00:20:13,080 stop operations 524 00:20:13,640 --> 00:20:15,120 or stop production requests 525 00:20:15,120 --> 00:20:16,980 just guessing all the session IDs. 526 00:20:17,220 --> 00:20:18,800 It only takes 16,000 packets 527 00:20:18,800 --> 00:20:21,020 which is like that on a gigabit network. 528 00:20:22,100 --> 00:20:23,720 So Codasys version 3 529 00:20:23,720 --> 00:20:24,300 is vulnerable. 530 00:20:24,600 --> 00:20:26,740 We wrote some internal exploit tools for it. 531 00:20:27,420 --> 00:20:29,200 ICS cert in their original advisory 532 00:20:29,200 --> 00:20:30,720 Any ICS cert people in the room? 533 00:20:31,340 --> 00:20:31,980 Thank goodness. 534 00:20:32,520 --> 00:20:34,460 So in their advisory 535 00:20:34,460 --> 00:20:36,140 which is still the official advisory 536 00:20:36,140 --> 00:20:38,400 they say Codasys version 3.x 537 00:20:38,400 --> 00:20:39,800 is not affected by these vulnerabilities. 538 00:20:40,240 --> 00:20:41,100 Unfortunately it is. 539 00:20:42,060 --> 00:20:44,420 ICS cert probably got their information 540 00:20:44,420 --> 00:20:45,980 from 3S software. 541 00:20:46,300 --> 00:20:47,780 ICS cert has kind of a tendency 542 00:20:47,780 --> 00:20:49,700 of just taking whatever the vendor tells them 543 00:20:51,560 --> 00:20:53,340 and taking what the researcher says 544 00:20:53,340 --> 00:20:54,740 as gospel unfortunately. 545 00:20:57,060 --> 00:20:59,300 So 3S software also got it wrong. 546 00:20:59,520 --> 00:21:00,600 This was their official advisory. 547 00:21:01,000 --> 00:21:03,080 They said that their version 2.3 548 00:21:03,080 --> 00:21:03,980 run time was vulnerable. 549 00:21:04,360 --> 00:21:06,100 Unfortunately their version 2.4 550 00:21:06,100 --> 00:21:06,820 run time is vulnerable 551 00:21:06,820 --> 00:21:08,500 and their version 3 run time is vulnerable. 552 00:21:10,480 --> 00:21:11,920 Another unfortunate thing is 553 00:21:11,920 --> 00:21:13,720 if you are an end user of one of these PLCs 554 00:21:13,720 --> 00:21:14,840 you can't just patch it. 555 00:21:14,960 --> 00:21:17,640 You have to go to your equipment manufacturer. 556 00:21:18,000 --> 00:21:18,920 You have to go to ABB. 557 00:21:21,560 --> 00:21:22,800 Or whoever made your PLC 558 00:21:22,800 --> 00:21:24,640 and have them generate you a new firmware 559 00:21:24,640 --> 00:21:26,260 to have the fix. 560 00:21:26,600 --> 00:21:28,380 And that takes a lot of time unfortunately. 561 00:21:29,220 --> 00:21:31,640 So look at a couple of affected vendors. 562 00:21:32,080 --> 00:21:33,360 One is that Hitachi 563 00:21:33,360 --> 00:21:35,200 EHV plus line of controllers. 564 00:21:36,100 --> 00:21:37,320 So that thing runs 565 00:21:37,320 --> 00:21:38,540 Codasys version 3. 566 00:21:40,120 --> 00:21:41,940 We bought an EHV 567 00:21:41,940 --> 00:21:43,840 CPU 1025 568 00:21:43,840 --> 00:21:45,900 We couldn't buy it in the United States. 569 00:21:46,000 --> 00:21:46,880 We actually had to buy it 570 00:21:46,880 --> 00:21:48,100 from a European retailer. 571 00:21:48,700 --> 00:21:49,800 Which was pretty cool. 572 00:21:51,560 --> 00:21:52,640 It's the UDP version of the protocol. 573 00:21:52,960 --> 00:21:53,740 The command line 574 00:21:54,380 --> 00:21:56,180 like I said there is a kind of 575 00:21:56,180 --> 00:21:58,580 weird debugging command line on these things. 576 00:21:58,700 --> 00:22:01,160 The command line of that particular PLC is disabled. 577 00:22:01,900 --> 00:22:03,700 There might be a way to enable it 578 00:22:03,700 --> 00:22:04,760 via the configuration files 579 00:22:04,760 --> 00:22:06,160 but we haven't figured out how to do it yet. 580 00:22:06,880 --> 00:22:08,540 So first off what they did right 581 00:22:09,080 --> 00:22:11,700 Hitachi did actually disable a lot of services 582 00:22:11,700 --> 00:22:13,600 on this particular controller. 583 00:22:13,820 --> 00:22:15,600 It doesn't have any open TCP ports by default. 584 00:22:16,380 --> 00:22:18,260 There is only one open UDP port 585 00:22:18,260 --> 00:22:19,720 which is that Codasys protocol. 586 00:22:20,620 --> 00:22:21,480 It's a lot smaller 587 00:22:21,560 --> 00:22:23,040 attack surface than most PLCs. 588 00:22:23,240 --> 00:22:25,080 A lot of PLCs have little embedded web servers 589 00:22:25,080 --> 00:22:26,040 that are full of vulnerabilities. 590 00:22:26,440 --> 00:22:28,480 They have FTP servers 591 00:22:28,940 --> 00:22:30,920 all kinds of weird stuff with back doors. 592 00:22:32,000 --> 00:22:33,740 So doing a lot better than a lot of vendors. 593 00:22:35,280 --> 00:22:36,120 On the downside 594 00:22:36,120 --> 00:22:37,620 there is no way to actually 595 00:22:37,620 --> 00:22:39,100 update the firmware on one of these things. 596 00:22:39,700 --> 00:22:43,080 So they just don't provide any mechanism for it. 597 00:22:43,220 --> 00:22:43,980 I actually asked them 598 00:22:43,980 --> 00:22:45,700 are they ever going to produce a firmware update? 599 00:22:45,880 --> 00:22:46,420 They wouldn't answer. 600 00:22:46,680 --> 00:22:49,240 I noticed there is no firmware update mechanism 601 00:22:49,240 --> 00:22:50,700 for this in any of your software. 602 00:22:52,540 --> 00:22:54,140 But that kind of stinks. 603 00:22:54,940 --> 00:22:56,280 So to exploit 604 00:22:56,280 --> 00:22:58,000 the UDP version of the protocol 605 00:22:58,720 --> 00:22:59,460 like I said 606 00:22:59,460 --> 00:23:00,020 there is no security 607 00:23:00,020 --> 00:23:02,020 so we just have to guess that SID. 608 00:23:03,040 --> 00:23:05,620 There is no method for actually 609 00:23:05,620 --> 00:23:07,320 adding a password to this thing 610 00:23:07,320 --> 00:23:08,300 via the Codasys tool. 611 00:23:09,020 --> 00:23:11,280 The exploit scripts that we wrote 612 00:23:11,280 --> 00:23:12,820 we can start and stop the CPU 613 00:23:12,820 --> 00:23:15,380 we can retrieve and send ladder logic to the device 614 00:23:15,380 --> 00:23:17,520 we can send a new config file to the device 615 00:23:17,520 --> 00:23:19,440 using the directory traversal bug. 616 00:23:20,020 --> 00:23:21,540 We can do some other weird stuff 617 00:23:21,560 --> 00:23:23,780 we can change the PLC's IP address 618 00:23:23,780 --> 00:23:25,100 and do some other goofy things. 619 00:23:25,440 --> 00:23:26,980 And just to kind of visualize 620 00:23:26,980 --> 00:23:28,800 the attacking UDP thing 621 00:23:28,800 --> 00:23:29,920 if you are off network 622 00:23:29,920 --> 00:23:33,440 you just issue that session initiate 623 00:23:33,440 --> 00:23:35,200 the thing is going to send back 624 00:23:35,200 --> 00:23:36,540 the session ID to some 625 00:23:37,560 --> 00:23:39,100 PC on the local network 626 00:23:39,100 --> 00:23:40,420 and then you are just going to have to guess 627 00:23:40,420 --> 00:23:42,040 what the actual session ID is. 628 00:23:42,500 --> 00:23:44,380 And that is how our tool works. 629 00:23:44,700 --> 00:23:47,180 Another vendor that is vulnerable to the 630 00:23:48,020 --> 00:23:49,200 Codasys stuff is 631 00:23:49,200 --> 00:23:51,400 Sanyo Denki. They produce a line of 632 00:23:51,560 --> 00:23:53,840 controllers called the SanMotion C controller. 633 00:23:56,140 --> 00:23:59,940 And they are running the Codasys version 2.3 protocol. 634 00:24:00,320 --> 00:24:02,320 They have VxWorks on the system. 635 00:24:02,560 --> 00:24:04,700 Who remembers the VxWorks debugger service? 636 00:24:05,280 --> 00:24:07,880 It is a really old school vulnerability. 637 00:24:08,280 --> 00:24:09,800 I think it has been around since 2005. 638 00:24:10,280 --> 00:24:11,560 Basically it is a debug port 639 00:24:11,560 --> 00:24:12,880 that lets you connect and read 640 00:24:12,880 --> 00:24:14,280 all the memory out of a PC 641 00:24:14,280 --> 00:24:15,500 that is running VxWorks. 642 00:24:16,020 --> 00:24:17,380 And then there is a couple of 643 00:24:17,380 --> 00:24:18,720 backdoor accounts on the system too. 644 00:24:19,560 --> 00:24:21,540 So I didn't actually buy one of these 645 00:24:21,560 --> 00:24:23,180 Sanyo Denki controllers. 646 00:24:24,220 --> 00:24:25,300 I actually owned 647 00:24:25,300 --> 00:24:26,260 this one already. 648 00:24:26,660 --> 00:24:27,860 They look pretty similar, right? 649 00:24:28,620 --> 00:24:31,120 And then I was doing a little more searching 650 00:24:31,120 --> 00:24:32,820 because I was like, wow, that is really weird. 651 00:24:33,460 --> 00:24:34,760 And then there is, so 652 00:24:34,760 --> 00:24:36,200 this is the Sanyo Denki. 653 00:24:36,400 --> 00:24:38,400 This is the Festo CECX controller. 654 00:24:38,800 --> 00:24:41,600 This is the Caba CP232 controller. 655 00:24:42,280 --> 00:24:43,820 It turns out they are all the same thing. 656 00:24:44,160 --> 00:24:45,260 When I grabbed the firmware 657 00:24:45,260 --> 00:24:46,700 off the controller that I had, 658 00:24:46,800 --> 00:24:48,300 I just was like, wow, I never bothered 659 00:24:48,300 --> 00:24:51,100 looking for any vendor names 660 00:24:51,560 --> 00:24:52,300 in the thing. 661 00:24:52,480 --> 00:24:54,260 You know, I just was like, oh, it is a Festo controller. 662 00:24:54,580 --> 00:24:55,600 I know it is a Festo controller. 663 00:24:55,960 --> 00:24:58,060 Sure enough, there are actually tons of vendor strings 664 00:24:58,060 --> 00:24:58,820 in the firmware. 665 00:24:59,120 --> 00:25:02,660 There is Caba, Kuka, Trumpf, Hytain, Bueller, Dwer, Engel. 666 00:25:02,840 --> 00:25:04,160 There is a couple of other vendors too 667 00:25:04,160 --> 00:25:05,720 that all seem to use the same hardware. 668 00:25:06,340 --> 00:25:07,880 So they have an OEM relationship 669 00:25:07,880 --> 00:25:10,120 as far as hardware is concerned and firmware. 670 00:25:10,920 --> 00:25:12,000 So that is kind of interesting. 671 00:25:12,280 --> 00:25:14,260 We think that the OEM for this 672 00:25:14,260 --> 00:25:16,300 is actually Caba Automation. 673 00:25:16,460 --> 00:25:17,420 They are an Austrian company 674 00:25:18,500 --> 00:25:20,580 just based on a lot of analysis 675 00:25:21,560 --> 00:25:23,580 of the firmware and product release dates 676 00:25:23,580 --> 00:25:24,260 from all the vendors. 677 00:25:24,860 --> 00:25:26,480 So there is a ton of software components 678 00:25:26,480 --> 00:25:27,260 in the system though. 679 00:25:27,440 --> 00:25:29,820 There is VxWorks, the operating system. 680 00:25:30,140 --> 00:25:32,200 There is Codasys, the ladder logic runtime. 681 00:25:32,700 --> 00:25:34,360 There is the can open protocol stack. 682 00:25:34,760 --> 00:25:36,620 They have a whole bunch of other third party libraries 683 00:25:36,620 --> 00:25:37,900 that they have included in the firmware. 684 00:25:38,960 --> 00:25:41,980 So it has all the problems from Codasys version 2. 685 00:25:42,460 --> 00:25:44,220 We first contacted Festo 686 00:25:44,220 --> 00:25:46,080 through ICS cert in 2013. 687 00:25:48,720 --> 00:25:50,520 Festo didn't really do anything. 688 00:25:50,920 --> 00:25:51,440 So, 689 00:25:51,560 --> 00:25:54,260 eventually ICS cert actually gave up 690 00:25:54,260 --> 00:25:56,020 and published an advisory 691 00:25:56,020 --> 00:25:57,900 without input from them. 692 00:25:58,720 --> 00:26:00,700 Festo basically refused to fix any problems. 693 00:26:00,960 --> 00:26:02,380 And who knows if they can, right? 694 00:26:02,440 --> 00:26:04,560 Because if this thing isn't even manufactured by them 695 00:26:05,120 --> 00:26:06,720 maybe their hands are tied. 696 00:26:06,880 --> 00:26:08,740 They might not even have access to the source code. 697 00:26:09,080 --> 00:26:10,100 And, you know, 698 00:26:10,120 --> 00:26:11,260 kind of a question I have is 699 00:26:11,260 --> 00:26:13,240 did they contact Caba? 700 00:26:13,380 --> 00:26:15,240 Like upstream, their upstream provider 701 00:26:15,240 --> 00:26:17,480 and say, hey, somebody reported these bugs 702 00:26:17,480 --> 00:26:19,680 like can you make a new firmware for everyone? 703 00:26:20,600 --> 00:26:21,300 Who knows? 704 00:26:21,560 --> 00:26:23,660 And then, of course, that makes me ask the question 705 00:26:23,660 --> 00:26:25,700 do they share information about hardware defects 706 00:26:25,700 --> 00:26:26,380 with each other? 707 00:26:26,560 --> 00:26:27,140 I don't know. 708 00:26:27,520 --> 00:26:29,060 I wish I knew the answer to that question. 709 00:26:29,880 --> 00:26:33,460 So, yeah, it also had the VxWorks backdoor thing 710 00:26:33,460 --> 00:26:35,440 that was, you know, 711 00:26:35,480 --> 00:26:37,420 there was a CV for it back in 2005. 712 00:26:37,900 --> 00:26:39,900 Like I said, that's unauthenticated read-write 713 00:26:39,900 --> 00:26:40,400 to all memory. 714 00:26:40,600 --> 00:26:43,160 Which is really the same thing that Codasys lets you do. 715 00:26:43,900 --> 00:26:45,280 But a little bit easier 716 00:26:45,280 --> 00:26:46,720 because you can download tools 717 00:26:47,280 --> 00:26:49,080 to do it from Wind River. 718 00:26:50,680 --> 00:26:51,080 But 719 00:26:51,560 --> 00:26:52,520 it's important to note that 720 00:26:52,520 --> 00:26:54,500 when the PLC was released 721 00:26:54,500 --> 00:26:57,400 that VxWorks CVE had been around for five years. 722 00:26:57,600 --> 00:26:59,600 So the PLC came out in 2010. 723 00:27:00,280 --> 00:27:01,460 That VxWorks CVE 724 00:27:01,460 --> 00:27:02,500 was much older than that. 725 00:27:05,540 --> 00:27:07,720 So, yeah, of the nine total companies 726 00:27:07,720 --> 00:27:09,720 that were affected by that piece of hardware 727 00:27:10,260 --> 00:27:11,640 that one PLC 728 00:27:11,640 --> 00:27:13,820 you know, nine companies actually selling it 729 00:27:14,320 --> 00:27:16,160 none of them spotted the security problems. 730 00:27:16,360 --> 00:27:16,560 Right? 731 00:27:16,660 --> 00:27:18,920 Otherwise they would have fixed it before they put it out. 732 00:27:19,360 --> 00:27:21,140 So I don't think any of those companies do 733 00:27:21,560 --> 00:27:22,040 internal testing. 734 00:27:22,340 --> 00:27:25,000 And, you know, who knows if these companies 735 00:27:25,000 --> 00:27:26,160 share information about 736 00:27:26,880 --> 00:27:28,380 vulnerabilities with each other. 737 00:27:29,800 --> 00:27:30,400 So 738 00:27:30,400 --> 00:27:33,340 I think I'm going to run out of time 739 00:27:33,340 --> 00:27:35,500 before I can do the Prokonos 740 00:27:35,500 --> 00:27:36,500 stuff too deeply. 741 00:27:36,920 --> 00:27:39,080 So I'm going to do a not so deep dive 742 00:27:39,080 --> 00:27:40,760 and also talk about Iran. 743 00:27:41,820 --> 00:27:43,500 So Prokonos is another 744 00:27:43,500 --> 00:27:44,700 third party ladder logic 745 00:27:45,360 --> 00:27:47,300 piece of software made by 746 00:27:47,300 --> 00:27:48,280 another German company. 747 00:27:48,680 --> 00:27:51,020 So these German companies seem to love this 748 00:27:51,560 --> 00:27:53,180 and they take three words and put them together 749 00:27:53,180 --> 00:27:55,260 and capitalize and do the camel case thing 750 00:27:55,260 --> 00:27:56,160 with their names. 751 00:27:57,920 --> 00:27:59,440 So it's made by this 752 00:27:59,440 --> 00:28:01,460 company called KW Software. 753 00:28:02,400 --> 00:28:03,780 But KW Software 754 00:28:03,780 --> 00:28:05,500 was actually bought by Phoenix Contact 755 00:28:05,500 --> 00:28:07,460 and definitely go 756 00:28:07,460 --> 00:28:08,960 look at the ICS Village. 757 00:28:09,160 --> 00:28:11,640 There are tons of Phoenix Contact PLCs down there 758 00:28:11,640 --> 00:28:13,560 and I will neither confirm nor deny 759 00:28:13,560 --> 00:28:14,840 that they're vulnerable to this issue. 760 00:28:15,780 --> 00:28:16,300 So 761 00:28:18,260 --> 00:28:19,700 the CVE for this 762 00:28:19,700 --> 00:28:20,740 was in 2014. 763 00:28:21,560 --> 00:28:22,680 It also gets a score of 10 764 00:28:22,680 --> 00:28:24,680 because it allows complete compromise 765 00:28:24,680 --> 00:28:25,320 of the controller. 766 00:28:25,680 --> 00:28:28,080 There's no authentication needed for uploading 767 00:28:28,080 --> 00:28:29,300 and downloading ladder logic. 768 00:28:29,640 --> 00:28:31,960 You can start and stop process control 769 00:28:31,960 --> 00:28:33,000 without authentication. 770 00:28:33,480 --> 00:28:34,220 It kind of stinks. 771 00:28:35,860 --> 00:28:38,260 See I don't know who to attribute this quote to 772 00:28:38,260 --> 00:28:40,240 but it is from Phoenix Contact 773 00:28:40,240 --> 00:28:41,500 slash KW Software. 774 00:28:41,900 --> 00:28:43,940 They basically said it's up to the OEMs 775 00:28:43,940 --> 00:28:45,420 to implement security. 776 00:28:45,800 --> 00:28:47,220 We're not responsible for that. 777 00:28:47,360 --> 00:28:48,060 It's their job. 778 00:28:52,080 --> 00:28:53,700 So Prokonos was a little bit 779 00:28:53,700 --> 00:28:55,360 harder to find affected vendors 780 00:28:55,360 --> 00:28:57,020 for because they weren't nice 781 00:28:57,020 --> 00:28:59,360 to include a vendor list on their website. 782 00:28:59,600 --> 00:29:01,640 So I can't use the Internet Wayback Machine 783 00:29:01,640 --> 00:29:03,300 to go find a list of affected vendors. 784 00:29:04,100 --> 00:29:05,340 We've been searching online 785 00:29:05,340 --> 00:29:06,980 and buying a couple of PLCs. 786 00:29:07,460 --> 00:29:09,320 We do know that there are some Emerson 787 00:29:09,320 --> 00:29:11,500 controllers out there that are affected by this 788 00:29:11,500 --> 00:29:13,340 so they're a pretty big name in the industrial space. 789 00:29:14,440 --> 00:29:15,800 Advantech is a PLC 790 00:29:15,800 --> 00:29:17,420 that I actually bought to play 791 00:29:17,420 --> 00:29:19,540 with the Prokonos protocol so we know they're affected. 792 00:29:19,880 --> 00:29:21,540 And then there's this weird company 793 00:29:21,560 --> 00:29:23,540 called Kontronic that I'll talk about. 794 00:29:24,260 --> 00:29:25,580 So you can actually search 795 00:29:25,580 --> 00:29:26,980 for the Prokonos stuff anyway 796 00:29:26,980 --> 00:29:29,460 on Shodan. You can search for just the word 797 00:29:29,460 --> 00:29:31,460 Prokonos and you'll find a whole bunch of controllers. 798 00:29:31,600 --> 00:29:32,980 There's a couple hundred I think right now. 799 00:29:33,340 --> 00:29:34,820 It usually runs on port 800 00:29:36,140 --> 00:29:36,580 20547. 801 00:29:37,380 --> 00:29:38,620 Anyway on to Kontronic. 802 00:29:39,720 --> 00:29:41,460 I was doing this kind of funny 803 00:29:41,460 --> 00:29:43,240 thing where I was finding people's resumes 804 00:29:43,240 --> 00:29:45,300 and I ran just by searching for 805 00:29:45,300 --> 00:29:47,300 random terms. 806 00:29:47,680 --> 00:29:49,420 So I was like well I wonder 807 00:29:49,420 --> 00:29:51,540 if anybody there is running ABBR2. 808 00:29:51,560 --> 00:29:53,400 So I'm like ABBRTU 809 00:29:54,480 --> 00:29:55,440 countrycode.ir 810 00:29:55,440 --> 00:29:57,460 and sure enough you find some people's 811 00:29:57,460 --> 00:29:59,240 resumes and there were a bunch of people with resumes 812 00:29:59,240 --> 00:30:01,260 that were like I installed this 813 00:30:02,420 --> 00:30:03,280 ABBRTU560 in 814 00:30:03,280 --> 00:30:05,420 this weird substation in 815 00:30:05,420 --> 00:30:07,420 Esfahan. It's like wow that's cool. 816 00:30:07,520 --> 00:30:08,500 It's neat open source intelligence. 817 00:30:09,400 --> 00:30:11,240 One of the things I stumbled on was 818 00:30:11,240 --> 00:30:13,460 this PLC manufacturer in Iran 819 00:30:13,460 --> 00:30:15,460 and this got me really interested because I was like 820 00:30:15,460 --> 00:30:17,300 wow I don't know anything about indigenous 821 00:30:17,840 --> 00:30:18,800 PLC manufacturers. 822 00:30:19,720 --> 00:30:21,380 It's not as important now that the 823 00:30:21,560 --> 00:30:22,940 embargoes are all being lifted but 824 00:30:22,940 --> 00:30:25,300 if that had continued I mean Iran 825 00:30:25,300 --> 00:30:27,400 can't buy Siemens PLCs anymore so they 826 00:30:27,400 --> 00:30:29,500 have to start making their own. What are they going to start 827 00:30:29,500 --> 00:30:31,520 doing? And so this was an indigenous 828 00:30:31,520 --> 00:30:33,480 Iranian PLC made by 829 00:30:33,480 --> 00:30:35,280 this company called Kontronic called 830 00:30:35,280 --> 00:30:37,160 their PLC500 and 831 00:30:37,160 --> 00:30:39,400 sure enough it actually runs the Prokonos 832 00:30:39,400 --> 00:30:40,960 ladder logic runtime on it 833 00:30:40,960 --> 00:30:43,500 and uses that software for configuring it. 834 00:30:43,600 --> 00:30:45,160 So it was just kind of neat to find a vulnerable 835 00:30:45,160 --> 00:30:47,460 PLC in Iran without actually being able to 836 00:30:47,460 --> 00:30:48,020 visit the country. 837 00:30:49,500 --> 00:30:51,480 So I was mentioning 838 00:30:51,560 --> 00:30:53,300 before that Aaron Leverett and I 839 00:30:53,300 --> 00:30:54,860 did some scanning of the internet. 840 00:30:55,180 --> 00:30:57,580 In 2014 I shared 841 00:30:57,580 --> 00:30:59,600 a Codasys search script to 842 00:30:59,600 --> 00:31:01,240 John Matherly who runs 843 00:31:01,240 --> 00:31:01,760 Shodan. 844 00:31:03,120 --> 00:31:05,180 Wrote up a little script in Python to 845 00:31:05,180 --> 00:31:07,260 help identify Codasys systems 846 00:31:07,260 --> 00:31:09,360 because I was tired of doing 847 00:31:09,360 --> 00:31:10,120 the searching myself. 848 00:31:11,100 --> 00:31:13,280 You can now search for Codasys version 2 849 00:31:13,280 --> 00:31:15,380 on Shodan. If you search for the word 850 00:31:15,380 --> 00:31:17,000 3s-smart 851 00:31:17,380 --> 00:31:18,480 you'll find a lot of controllers. 852 00:31:19,780 --> 00:31:21,300 So I searched 853 00:31:21,560 --> 00:31:22,440 this morning and there were like 854 00:31:22,440 --> 00:31:25,100 2200 of these PLCs directly on the internet. 855 00:31:26,120 --> 00:31:27,560 Just for some random 856 00:31:27,560 --> 00:31:29,540 stats, I gave a version of 857 00:31:29,540 --> 00:31:31,260 this talk back in June and when I 858 00:31:31,260 --> 00:31:33,340 gave that talk there were only 1700 859 00:31:33,340 --> 00:31:34,860 of them on the internet. 860 00:31:35,520 --> 00:31:37,700 And there are actually 2200 devices 861 00:31:37,700 --> 00:31:38,980 on the internet this morning. 862 00:31:39,160 --> 00:31:41,540 So there's actually 150 were found in the last 863 00:31:41,540 --> 00:31:42,220 24 hours. 864 00:31:43,220 --> 00:31:45,400 As I updated my slides for today. 865 00:31:45,580 --> 00:31:46,360 So that's kind of cool. 866 00:31:47,000 --> 00:31:49,320 One of the things I found that was 867 00:31:49,320 --> 00:31:51,440 kind of interesting was a ferry controller 868 00:31:51,560 --> 00:31:52,960 so it was a ferry navigation 869 00:31:53,520 --> 00:31:54,680 and engine control system 870 00:31:54,680 --> 00:31:57,480 on a piece of public transportation in 871 00:31:57,480 --> 00:31:59,460 Europe. We managed 872 00:31:59,460 --> 00:32:01,260 to get that taken offline so that was fun. 873 00:32:02,320 --> 00:32:03,540 There's a lot of these controllers 874 00:32:03,540 --> 00:32:05,240 that are running HVAC systems 875 00:32:05,240 --> 00:32:07,240 I search a lot for 876 00:32:07,240 --> 00:32:09,320 stuff in my state. I recommend 877 00:32:09,320 --> 00:32:10,720 if you're into this sort of thing 878 00:32:10,720 --> 00:32:13,340 just give it a try. Search for stuff 879 00:32:13,340 --> 00:32:15,360 in your local area because you'll have 880 00:32:15,360 --> 00:32:17,440 at least some opportunity to meet people in your area 881 00:32:17,440 --> 00:32:19,480 to be like, hey, you have this vulnerable thing 882 00:32:19,480 --> 00:32:21,200 connected to the internet and you shouldn't have it there. 883 00:32:21,560 --> 00:32:23,340 Let's go chat and have a coffee or something. 884 00:32:24,260 --> 00:32:25,480 But most of these systems 885 00:32:25,480 --> 00:32:27,000 we don't really know what they do, right? 886 00:32:27,120 --> 00:32:29,140 I find a lot of HVAC ones, I find a lot of weird 887 00:32:29,140 --> 00:32:31,340 small pump ones, but a lot don't have any 888 00:32:31,340 --> 00:32:32,760 information that you can pull out safely 889 00:32:32,760 --> 00:32:34,180 to know what they're doing. 890 00:32:35,460 --> 00:32:37,020 So on scanning for systems 891 00:32:37,400 --> 00:32:39,140 so Aaron and I scanned the internet 892 00:32:39,140 --> 00:32:41,660 back in 2013. We found 600 of these 893 00:32:41,660 --> 00:32:42,360 code assist controllers. 894 00:32:42,740 --> 00:32:44,620 It cost us a lot of money to do it back then 895 00:32:44,620 --> 00:32:46,620 because we had to rent servers and we had to 896 00:32:46,620 --> 00:32:48,400 run a whole bunch of kludged together scripts 897 00:32:48,400 --> 00:32:50,840 and massage data. We figured out it cost about 898 00:32:51,560 --> 00:32:52,680 $50 to find 899 00:32:53,320 --> 00:32:55,360 one vulnerable controller on the internet 900 00:32:55,360 --> 00:32:57,540 back then. Today, thanks to 901 00:32:57,540 --> 00:32:59,000 Shodan, I can pay $20 902 00:32:59,580 --> 00:33:01,440 and just type in a single search query 903 00:33:01,440 --> 00:33:03,580 and then I can find 904 00:33:03,580 --> 00:33:05,600 2,200 of these things. So the cost 905 00:33:05,600 --> 00:33:07,520 to find them now is down to one cent. 906 00:33:07,760 --> 00:33:09,220 And the reason I mention this metric 907 00:33:09,220 --> 00:33:10,160 is just because 908 00:33:11,580 --> 00:33:13,140 governments now are kind of wondering 909 00:33:13,140 --> 00:33:15,160 what can we do to protect critical infrastructure 910 00:33:15,160 --> 00:33:17,480 or what can we do to protect 911 00:33:18,220 --> 00:33:19,540 industrial systems. And I think 912 00:33:19,540 --> 00:33:20,860 this is one of the things that we can start 913 00:33:21,820 --> 00:33:22,260 doing. 914 00:33:22,900 --> 00:33:24,240 Because this is so cheap to do. 915 00:33:24,480 --> 00:33:26,700 If you can manage a database of these systems 916 00:33:26,700 --> 00:33:29,120 as vulnerabilities come out, if the system is 917 00:33:29,120 --> 00:33:30,960 important enough, you can find the owner 918 00:33:30,960 --> 00:33:32,100 and get them to take it offline. 919 00:33:33,060 --> 00:33:34,860 Although that getting them to take it offline 920 00:33:34,860 --> 00:33:36,680 part is actually a little bit of a challenge. 921 00:33:38,100 --> 00:33:39,420 So the hardest part 922 00:33:39,420 --> 00:33:41,480 of that whole scanning for systems 923 00:33:41,480 --> 00:33:43,180 is really how do you get it offline. 924 00:33:43,640 --> 00:33:45,580 I mean these industrial systems 925 00:33:45,580 --> 00:33:47,200 are hanging on the internet and there are more 926 00:33:47,200 --> 00:33:48,800 and more of them being attached every day. 927 00:33:49,700 --> 00:33:51,380 I've been doing a whole bunch of different 928 00:33:51,560 --> 00:33:53,900 tries at getting stuff taken down 929 00:33:53,900 --> 00:33:55,760 because I find a lot of weird stuff on the internet. 930 00:33:56,320 --> 00:33:57,560 So I can say 931 00:33:58,240 --> 00:33:59,440 most of the 932 00:33:59,440 --> 00:34:02,220 computer emergency response teams 933 00:34:02,220 --> 00:34:03,780 and like official government 934 00:34:03,780 --> 00:34:05,620 incident response teams don't have any 935 00:34:05,620 --> 00:34:06,920 authority to do anything. 936 00:34:07,220 --> 00:34:09,620 Most of the PLCs and industrial 937 00:34:09,620 --> 00:34:11,740 stuff you find is connected to 938 00:34:11,740 --> 00:34:13,700 just an ISP's 939 00:34:13,700 --> 00:34:14,900 net block. Meaning 940 00:34:15,300 --> 00:34:17,740 it's a PLC connected to Verizon's network. 941 00:34:18,100 --> 00:34:19,660 Well the government can say 942 00:34:19,660 --> 00:34:21,540 hey Verizon can you contact the owner 943 00:34:21,560 --> 00:34:23,420 but Verizon's probably going to say no. 944 00:34:23,860 --> 00:34:25,000 Like why would we do that? 945 00:34:25,060 --> 00:34:26,080 That's just more work for us. 946 00:34:26,300 --> 00:34:28,460 And then there's liability issues 947 00:34:28,460 --> 00:34:30,260 that the ISP's have because they're like 948 00:34:30,260 --> 00:34:31,660 well if we do it for one person 949 00:34:31,660 --> 00:34:33,420 and we don't do it for somebody else 950 00:34:33,420 --> 00:34:35,640 like maybe that somebody else is going to end up 951 00:34:35,640 --> 00:34:37,300 suing us for doing the wrong thing. 952 00:34:37,560 --> 00:34:39,940 It's just liability that we don't want for whatever reason. 953 00:34:41,080 --> 00:34:42,680 Most ISP's that I've contacted 954 00:34:42,680 --> 00:34:43,620 they don't do anything. 955 00:34:43,900 --> 00:34:45,960 I mean they just are like thank you for your information 956 00:34:45,960 --> 00:34:48,460 we will probably never do anything with it. 957 00:34:48,820 --> 00:34:49,220 Bye. 958 00:34:51,560 --> 00:34:51,880 There's that. 959 00:34:52,760 --> 00:34:55,320 Every once in a while I find a controller that has 960 00:34:55,320 --> 00:34:57,500 some project information in it 961 00:34:57,500 --> 00:34:59,100 where it has a person's name. 962 00:34:59,360 --> 00:35:01,600 And usually from that I can figure out 963 00:35:01,600 --> 00:35:03,240 who they are because I control LinkedIn 964 00:35:03,240 --> 00:35:04,800 I can search for that person's name 965 00:35:04,800 --> 00:35:06,500 who's an industrial automation person 966 00:35:06,500 --> 00:35:08,960 and find the person. And every once in a while 967 00:35:08,960 --> 00:35:10,780 there's this nice success story where I'm like 968 00:35:10,780 --> 00:35:12,340 hey you have this thing attached to the internet 969 00:35:12,340 --> 00:35:13,960 please take it down and they do. 970 00:35:14,720 --> 00:35:15,940 It's pretty rare unfortunately. 971 00:35:17,960 --> 00:35:18,820 So anyway 972 00:35:18,820 --> 00:35:20,660 I guess conclusions of all this 973 00:35:21,560 --> 00:35:22,620 bugs in software and 974 00:35:23,340 --> 00:35:24,100 ICS is doomed. 975 00:35:24,760 --> 00:35:26,880 I really think that the ICS vendors 976 00:35:26,880 --> 00:35:28,020 need to step up their game. 977 00:35:28,220 --> 00:35:30,180 Start identifying these security problems 978 00:35:30,180 --> 00:35:31,520 before they release products. 979 00:35:32,920 --> 00:35:34,980 The vendors really need to do a good job 980 00:35:34,980 --> 00:35:37,260 of building up a list of what third party software 981 00:35:37,260 --> 00:35:38,520 they're using internally. 982 00:35:38,900 --> 00:35:40,140 And some of them are starting to do this 983 00:35:40,140 --> 00:35:41,780 and others are really falling short on it. 984 00:35:42,140 --> 00:35:44,680 But if you build up a list of third party software 985 00:35:44,680 --> 00:35:45,720 you're using in your product 986 00:35:45,720 --> 00:35:46,920 and you're bundling with your product 987 00:35:46,920 --> 00:35:49,280 then you can at least have some chance of saying 988 00:35:51,560 --> 00:35:53,720 okay I need to produce an updated firmware 989 00:35:53,720 --> 00:35:55,300 or an updated release 990 00:35:55,300 --> 00:35:56,800 and patch this stuff. 991 00:35:57,560 --> 00:35:59,060 So in the Sandio Denki example 992 00:35:59,060 --> 00:36:01,260 the controller was released in 2010 993 00:36:01,260 --> 00:36:03,580 and had well known vulnerabilities 994 00:36:03,580 --> 00:36:05,360 that would have been found just by running 995 00:36:05,360 --> 00:36:07,020 like Nessus or Nmap or whatever 996 00:36:07,020 --> 00:36:07,880 against the system. 997 00:36:08,840 --> 00:36:10,580 And then in the Hitachi example 998 00:36:11,360 --> 00:36:13,660 sure the V2 code assist 999 00:36:13,660 --> 00:36:15,600 problems weren't released at that point 1000 00:36:15,600 --> 00:36:17,420 but they're a huge company 1001 00:36:17,420 --> 00:36:19,020 and they should have a competent red team. 1002 00:36:19,100 --> 00:36:21,000 They really should have been red teaming this stuff back then. 1003 00:36:22,460 --> 00:36:23,620 The other thing is 1004 00:36:23,620 --> 00:36:25,460 that these control systems components 1005 00:36:25,460 --> 00:36:27,320 never plan to patch it seems like. 1006 00:36:27,860 --> 00:36:29,700 Some of the new products that are coming out now 1007 00:36:29,700 --> 00:36:30,440 are a little bit better 1008 00:36:30,440 --> 00:36:33,200 but they really need to come up with 1009 00:36:33,200 --> 00:36:34,880 good update mechanisms 1010 00:36:34,880 --> 00:36:37,340 ways to manage the firmware images 1011 00:36:37,340 --> 00:36:38,780 that are installed on your devices 1012 00:36:38,780 --> 00:36:40,180 so that you know what you're running 1013 00:36:40,180 --> 00:36:41,840 and can patch things easily. 1014 00:36:44,180 --> 00:36:45,220 And yeah 1015 00:36:45,220 --> 00:36:47,320 design problems are still a pretty big deal 1016 00:36:47,320 --> 00:36:48,740 for the ICS space. 1017 00:36:49,160 --> 00:36:51,340 So to pick on Schneider Electric 1018 00:36:51,560 --> 00:36:51,920 for a minute 1019 00:36:51,920 --> 00:36:54,080 we found a whole bunch of vulnerabilities 1020 00:36:54,080 --> 00:36:56,380 in Schneider Electric PLCs 1021 00:36:56,380 --> 00:36:58,480 relating to the Modbus protocol. 1022 00:36:58,860 --> 00:37:01,060 So their Modbus protocol has similar features 1023 00:37:01,060 --> 00:37:01,660 to Code Assist. 1024 00:37:02,040 --> 00:37:03,700 They have a special function code 1025 00:37:03,700 --> 00:37:04,940 called function code 90 1026 00:37:04,940 --> 00:37:07,220 that lets you do like ladder logic upload download 1027 00:37:07,220 --> 00:37:08,740 issue these start stop commands 1028 00:37:09,480 --> 00:37:11,080 it's kind of like their secret sauce 1029 00:37:11,080 --> 00:37:12,980 of their engineering software. 1030 00:37:13,720 --> 00:37:16,480 Those problems still exist in their PLCs. 1031 00:37:16,800 --> 00:37:18,660 They've been issuing a lot of security patches 1032 00:37:18,660 --> 00:37:20,480 for their PLCs fixing web server 1033 00:37:21,560 --> 00:37:22,220 like true bugs 1034 00:37:22,220 --> 00:37:23,520 but this is a design problem 1035 00:37:23,520 --> 00:37:24,980 it's a lot harder to fix 1036 00:37:24,980 --> 00:37:27,000 and it's been I don't know how many years now 1037 00:37:27,000 --> 00:37:29,140 since those problems have been disclosed 1038 00:37:29,140 --> 00:37:30,420 and there still aren't fixes for them. 1039 00:37:30,940 --> 00:37:33,540 And then in the 3S software example 1040 00:37:33,540 --> 00:37:35,780 they fixed directory traversal vulnerabilities 1041 00:37:35,780 --> 00:37:36,480 really quick 1042 00:37:36,480 --> 00:37:37,740 because that's a real bug 1043 00:37:37,740 --> 00:37:39,520 but again the design issue 1044 00:37:39,520 --> 00:37:41,240 of not having authentication 1045 00:37:41,240 --> 00:37:43,020 is going to take them a lot longer. 1046 00:37:43,560 --> 00:37:44,940 So that's all I have. 1047 00:37:45,080 --> 00:37:47,100 Any questions, comments, tomatoes? 1048 00:37:51,560 --> 00:37:52,280 Definitely do. 1049 00:37:52,460 --> 00:37:54,420 Like I said there's a lot of Phoenix Contact PLCs 1050 00:37:54,420 --> 00:37:54,900 to look at. 1051 00:37:55,060 --> 00:38:10,380 Yeah the question was 1052 00:38:10,380 --> 00:38:13,460 what's my rate of kind of vendors 1053 00:38:13,460 --> 00:38:14,800 saying that's not a vulnerability 1054 00:38:14,800 --> 00:38:16,260 where I say that it is. 1055 00:38:17,980 --> 00:38:19,640 It actually hasn't been 1056 00:38:19,640 --> 00:38:20,300 that high. 1057 00:38:22,080 --> 00:38:24,160 When getting in touch with vendors directly 1058 00:38:24,160 --> 00:38:25,220 a lot of them will be like 1059 00:38:25,220 --> 00:38:26,520 yeah that is a security problem. 1060 00:38:26,940 --> 00:38:28,480 I'd say the real challenge is 1061 00:38:28,480 --> 00:38:31,100 the kind of 3S software response 1062 00:38:31,100 --> 00:38:32,980 and even the KW software response 1063 00:38:32,980 --> 00:38:35,380 was both yes that's a security problem 1064 00:38:35,380 --> 00:38:36,940 but that's not our job. 1065 00:38:37,840 --> 00:38:39,440 Like it's not our job to fix that. 1066 00:38:40,280 --> 00:38:41,940 It's up to the OEM to fix it 1067 00:38:41,940 --> 00:38:43,320 or the end user to deal with it. 1068 00:38:44,340 --> 00:38:46,540 I'd say that's a much more common issue. 1069 00:38:46,780 --> 00:38:47,420 Any others? 1070 00:38:49,400 --> 00:38:49,840 Okay. 1071 00:38:49,920 --> 00:38:50,260 Thanks. 1072 00:38:51,560 --> 00:38:52,440 Thank you.