1 00:00:00,000 --> 00:00:05,760 Okay. So, I'm talking about picking electronic locks using 2 00:00:05,760 --> 00:00:06,980 TCP sequence prediction. 3 00:00:08,740 --> 00:00:09,440 Welcome Rick. 4 00:00:11,800 --> 00:00:12,380 Thank you. 5 00:00:16,080 --> 00:00:21,140 Okay. So, I've probably met a few of you by this point, but 6 00:00:21,140 --> 00:00:23,740 I've been drinking a lot this weekend, so I don't remember. 7 00:00:25,260 --> 00:00:27,500 So, this is who I am. 8 00:00:27,680 --> 00:00:30,900 I've got a couple of security certs. 9 00:00:30,980 --> 00:00:33,960 I'm a network technician at Texas State University in 10 00:00:33,960 --> 00:00:35,480 beautiful San Marcos, Texas. 11 00:00:36,560 --> 00:00:40,140 And I've been working on their electronic building access 12 00:00:40,140 --> 00:00:44,480 systems, and in my spare time I've been breaking the 13 00:00:44,480 --> 00:00:45,680 electronic access systems. 14 00:00:47,780 --> 00:00:53,560 So, basically what I'm talking about is whenever people start 15 00:00:53,740 --> 00:00:56,680 talking about the security of these systems, it's usually 16 00:00:56,680 --> 00:01:02,500 involving the readers, like the RFID cards or, you know, 17 00:01:02,600 --> 00:01:05,740 vulnerabilities in biometrics and things like that. 18 00:01:05,820 --> 00:01:09,220 But nobody really concentrates on the network side of things. 19 00:01:09,440 --> 00:01:14,880 And a lot of these door controllers are moving to IP-based 20 00:01:14,880 --> 00:01:20,380 systems for obvious reasons in large organizations. 21 00:01:20,900 --> 00:01:21,680 But... 22 00:01:22,640 --> 00:01:23,420 There... 23 00:01:23,740 --> 00:01:30,020 They're networked devices that have little or no network security. 24 00:01:30,900 --> 00:01:35,080 They've got persistent TCP sessions with no encryption and 25 00:01:35,080 --> 00:01:36,560 predictable sequence numbering. 26 00:01:38,840 --> 00:01:43,440 So, what I wondered is, is it possible to send a spoofed 27 00:01:43,440 --> 00:01:47,040 command across the network and open the door without needing a 28 00:01:47,040 --> 00:01:49,460 card or a retinal scan or anything? 29 00:01:49,920 --> 00:01:53,100 And since you're seeing this presentation here, you can guess 30 00:01:53,100 --> 00:01:53,920 what the answer is. 31 00:01:55,880 --> 00:01:58,960 So, a brief overview of electronic building access. 32 00:01:59,880 --> 00:02:03,100 You've got your authentication device, which is your reader, 33 00:02:03,840 --> 00:02:05,280 and then you've got your locking device. 34 00:02:05,680 --> 00:02:10,200 And both of those are connected to a door controller, which is 35 00:02:10,200 --> 00:02:11,200 then connected to the network. 36 00:02:13,720 --> 00:02:19,460 And client programs can send remote commands to these, 37 00:02:20,900 --> 00:02:23,020 specifically locking and unlocking commands. 38 00:02:23,020 --> 00:02:26,380 And they also, you know, monitor the state of the door and, 39 00:02:26,960 --> 00:02:29,900 you know, alarm points and all that stuff. 40 00:02:32,060 --> 00:02:36,720 So, this is the part where I start using goofy diagrams to illustrate 41 00:02:36,720 --> 00:02:37,340 my points. 42 00:02:39,200 --> 00:02:42,520 So, you've got your client that's connected to a database that's 43 00:02:42,520 --> 00:02:45,140 connected to a door controller that's connected to some doors. 44 00:02:45,940 --> 00:02:49,000 So, the client says, I want to open a door. 45 00:02:50,620 --> 00:02:51,100 Wee! 46 00:02:56,020 --> 00:02:58,660 So, the open command goes through the database. 47 00:02:58,960 --> 00:03:01,480 The database sends it to the appropriate door controller. 48 00:03:01,740 --> 00:03:03,820 And the door controller opens the door. 49 00:03:04,700 --> 00:03:07,600 Now, what happens in this scenario? 50 00:03:07,700 --> 00:03:10,840 And you can tell he's the bad guy because he's red. 51 00:03:11,200 --> 00:03:12,360 Like a communist. 52 00:03:15,280 --> 00:03:15,840 Okay. 53 00:03:15,920 --> 00:03:17,400 So, same thing again. 54 00:03:18,100 --> 00:03:20,480 The client says, open the door. 55 00:03:21,680 --> 00:03:24,940 And now the attacker has a copy of that command. 56 00:03:26,400 --> 00:03:29,020 And, you know, then he forwards it on to the door controller. 57 00:03:29,180 --> 00:03:30,620 And the door controller opens the door. 58 00:03:30,740 --> 00:03:31,460 Just like normal. 59 00:03:31,880 --> 00:03:32,400 Everybody's happy. 60 00:03:35,300 --> 00:03:35,860 Hang on. 61 00:03:36,760 --> 00:03:37,160 Okay. 62 00:03:37,660 --> 00:03:40,940 So, now the attacker has a copy of the command. 63 00:03:41,460 --> 00:03:42,920 And some time goes by. 64 00:03:43,060 --> 00:03:44,580 And he says, okay, I want to open the door. 65 00:03:46,860 --> 00:03:48,340 And pop goes the weasel. 66 00:03:48,340 --> 00:03:54,100 The door controller interprets it just like any other command. 67 00:03:54,440 --> 00:03:57,820 And you'll notice that nothing happened on the database at all. 68 00:03:57,880 --> 00:03:59,120 So, there's no log of the command. 69 00:03:59,820 --> 00:04:03,980 No alarms are tripped because the door controller saw it as a valid open. 70 00:04:04,840 --> 00:04:05,560 Everybody's happy. 71 00:04:07,280 --> 00:04:14,160 So, the reason it works is because these devices have really, really predictable sequence numbering. 72 00:04:14,480 --> 00:04:17,720 That allows you to inject a packet into their session. 73 00:04:18,540 --> 00:04:23,220 Sequence number prediction was usually used in hijacking TCP sessions. 74 00:04:23,840 --> 00:04:25,640 But we don't really need to do that. 75 00:04:25,720 --> 00:04:28,800 We're just sticking our own packet in an existing session. 76 00:04:29,860 --> 00:04:32,500 It's been fixed in most modern operating systems. 77 00:04:32,660 --> 00:04:35,980 But embedded systems are still notoriously bad. 78 00:04:38,510 --> 00:04:39,640 Another goofy diagram. 79 00:04:41,400 --> 00:04:47,200 So, here's an example conversation between a sender and a receiver with sequence numbering. 80 00:04:48,440 --> 00:04:52,520 Can anybody see a pattern in the sequence numbering? 81 00:04:54,920 --> 00:04:57,100 I'd like to say this is a really simple example. 82 00:04:57,420 --> 00:04:58,160 But it's not. 83 00:05:01,880 --> 00:05:05,800 So, the attacker guesses the next sequence number in order. 84 00:05:06,140 --> 00:05:07,060 Sends a packet. 85 00:05:07,180 --> 00:05:09,040 The receiver says, yeah, that's the next one. 86 00:05:10,740 --> 00:05:14,960 The sender then tries to send its packet with that sequence number. 87 00:05:15,200 --> 00:05:17,340 And the sender's like, well, I already got that packet. 88 00:05:17,720 --> 00:05:18,780 Send the next one. 89 00:05:20,860 --> 00:05:23,280 So, now we get to talk about some code. 90 00:05:29,260 --> 00:05:29,820 Okay. 91 00:05:30,480 --> 00:05:35,100 So, I used the SCAPI library for the packet manipulation. 92 00:05:36,660 --> 00:05:38,800 This is really, really simple code. 93 00:05:41,620 --> 00:05:42,740 But, yeah. 94 00:05:44,420 --> 00:05:47,160 Basically, you just take two variables. 95 00:05:48,660 --> 00:05:52,060 One of which is the target IP of the door controller. 96 00:05:52,460 --> 00:05:54,500 And the other is the payload that you want to inject. 97 00:05:54,920 --> 00:05:59,920 And I suppose I should probably mention that I tested this on a... 98 00:06:00,480 --> 00:06:04,740 It's an HID door controller that's running Seaboard Squadron firmware. 99 00:06:06,760 --> 00:06:09,040 And I've actually talked to Seaboard about this. 100 00:06:09,100 --> 00:06:11,020 And they say they've got an update coming. 101 00:06:11,180 --> 00:06:11,800 So, we'll see. 102 00:06:14,520 --> 00:06:15,560 But, yeah. 103 00:06:15,560 --> 00:06:17,820 So, first things first. 104 00:06:18,100 --> 00:06:24,500 It takes the hex stream that you send to it and formats it properly so that it'll interpret it. 105 00:06:26,140 --> 00:06:35,380 And then you start sniffing some traffic so that you can get your IP addresses that you need and your window sizes and all that stuff. 106 00:06:35,680 --> 00:06:42,920 The important command, and I can't really highlight on here, but I'm going to point. 107 00:06:44,460 --> 00:06:49,580 Down near the bottom, you'll see a function, SR1. 108 00:06:50,240 --> 00:06:51,220 That's sending, receiving. 109 00:06:52,840 --> 00:06:56,340 And basically, at the end of that line, it says sequence plus 40. 110 00:06:57,500 --> 00:06:58,100 That's it. 111 00:06:59,260 --> 00:07:00,540 That's the secret. 112 00:07:00,700 --> 00:07:02,360 You add 40 to the sequence number. 113 00:07:02,580 --> 00:07:04,740 And then you attach your payload to the end. 114 00:07:05,320 --> 00:07:06,200 And, yeah. 115 00:07:06,460 --> 00:07:07,540 It opens the door. 116 00:07:10,140 --> 00:07:11,040 I don't get it. 117 00:07:18,960 --> 00:07:32,720 So, my conclusion is it's not necessary to break the authentication medium in order to bypass these systems. 118 00:07:34,600 --> 00:07:36,460 You know, these are network devices. 119 00:07:36,800 --> 00:07:39,880 And they need to protect themselves against network vulnerabilities. 120 00:07:41,900 --> 00:07:44,600 And it's not hard to fix. 121 00:07:45,640 --> 00:07:56,400 Like, you know, first off, what you can do to protect yourself is obviously put your door controllers on a separate LAN that your users can't get to. 122 00:07:58,160 --> 00:08:00,940 And monitor that LAN for man in the middle attacks. 123 00:08:01,880 --> 00:08:08,880 But really what it comes down to is the vendors making their sequence numbers harder to guess. 124 00:08:08,880 --> 00:08:12,260 And for the love of God, encrypt the traffic. 125 00:08:15,300 --> 00:08:18,800 Like, Seaboard at least says that they are encrypting. 126 00:08:18,800 --> 00:08:23,960 But I'm thinking, like, they might be confusing encrypting and encoding. 127 00:08:28,640 --> 00:08:33,420 Because, you know, the open commands, they always start off with the exact same hex values. 128 00:08:33,740 --> 00:08:35,960 And I don't care what the rest of the command says. 129 00:08:36,240 --> 00:08:38,420 I just know that that's the command that I need. 130 00:08:38,420 --> 00:08:43,780 So I just, you know, grab that hex stream and inject it whatever it says. 131 00:08:44,040 --> 00:08:47,360 And it does what it does. 132 00:08:48,640 --> 00:08:54,780 So, yeah, encrypt the traffic at the session level so that I can't see the sequence numbers. 133 00:08:55,000 --> 00:08:56,800 And that will fix it. 134 00:08:58,100 --> 00:08:58,780 All right. 135 00:08:59,200 --> 00:09:02,080 I don't know if that was 20 minutes. 136 00:09:05,580 --> 00:09:06,620 Thank you. 137 00:09:11,680 --> 00:09:12,040 Thank you. 138 00:09:12,380 --> 00:09:12,740 . 139 00:09:23,660 --> 00:09:26,740 If it's an incorrect sequence number, it just ignores it. 140 00:09:28,020 --> 00:09:28,380 Yeah. 141 00:09:28,500 --> 00:09:30,380 You can keep trying as much as you want. 142 00:09:30,480 --> 00:09:36,640 If it's a correct sequence number, then it ends up burning the session and, you know, 143 00:09:36,700 --> 00:09:38,400 redoing the handshake and all that stuff. 144 00:09:38,400 --> 00:09:43,020 But if it's an incorrect sequence number, you can just guess as much as you want. 145 00:09:45,860 --> 00:09:46,420 Sorry? 146 00:09:50,180 --> 00:09:54,320 It doesn't on the Seaboard system, or at least it does, 147 00:09:54,580 --> 00:09:59,540 but every once in a while, the sessions get torn down anyway, 148 00:10:00,260 --> 00:10:03,500 so it's not seen as an important event. 149 00:10:08,400 --> 00:10:10,500 hey, I've already, I've opened this door 150 00:10:10,500 --> 00:10:12,400 and sent it back to the log file? 151 00:10:13,260 --> 00:10:14,980 It probably could. 152 00:10:16,300 --> 00:10:19,920 I mean, again, the normal events 153 00:10:19,920 --> 00:10:22,300 aren't really paid attention to. 154 00:10:22,500 --> 00:10:24,360 Like, anything that's normal activity 155 00:10:24,360 --> 00:10:26,840 isn't really flagged, so. 156 00:10:27,220 --> 00:10:28,640 How often do you find 157 00:10:28,640 --> 00:10:32,300 that an LMS is locked 158 00:10:32,300 --> 00:10:35,320 on the same thing as a regular network? 159 00:10:37,040 --> 00:10:38,480 Hopefully not often. 160 00:10:39,720 --> 00:10:42,880 I mean, we set it up like that originally 161 00:10:43,480 --> 00:10:45,540 until I started messing around with this stuff 162 00:10:45,540 --> 00:10:48,980 and now we've taken them off of the networks. 163 00:10:49,240 --> 00:10:51,060 But, I mean, you know, it's really easy 164 00:10:51,060 --> 00:10:52,800 to put these door controllers in a comm room 165 00:10:52,800 --> 00:10:54,340 and just plug them into the network. 166 00:10:54,520 --> 00:10:57,220 So it probably happens quite a lot. 167 00:11:00,100 --> 00:11:02,860 Along with that, do you prefer, perhaps, 168 00:11:02,880 --> 00:11:03,880 because these are used to say, 169 00:11:03,880 --> 00:11:04,960 buy things on campus, 170 00:11:05,320 --> 00:11:06,320 would you spoof to say 171 00:11:06,320 --> 00:11:07,280 your car has more money? 172 00:11:08,680 --> 00:11:09,180 Maybe. 173 00:11:10,160 --> 00:11:11,780 I haven't really messed around 174 00:11:11,780 --> 00:11:13,520 with the point of sale side of things. 175 00:11:15,840 --> 00:11:17,800 So I'm not really sure. 176 00:11:18,060 --> 00:11:19,660 I mean, this is really, really 177 00:11:19,660 --> 00:11:20,800 just scratching the surface 178 00:11:20,800 --> 00:11:22,940 of the vulnerabilities in these systems. 179 00:11:23,400 --> 00:11:23,900 So. 180 00:11:27,440 --> 00:11:28,160 All right. 181 00:11:28,440 --> 00:11:29,100 Thank you.