1 00:00:00,000 --> 00:00:19,020 Hi everyone, thanks for being here. My name is FX of Phenolite and we're going to talk about analyzing complex systems, which is essentially like when you want to hack something that's a little bit bigger than your arbitrary broken Windows server or something. 2 00:00:19,020 --> 00:00:31,320 How you're going to go about that, how you should approach that, and we're like showing that on the case of our research on BlackBerrys. 3 00:00:33,680 --> 00:00:43,940 So, when you start looking at something a bit more complex, the first thing you do, you have to do is get an idea of what the entire picture is. 4 00:00:45,080 --> 00:00:46,180 Here's the reason why. 5 00:00:46,480 --> 00:00:47,720 There's actually, yeah. 6 00:00:47,820 --> 00:00:49,000 The core reason behind it is that it's a complex system. 7 00:00:49,020 --> 00:01:08,000 The core reason being, you see something, and in our case, it was those little devices in the hands of people in way too expensive suits, used all over the place, and you see those devices and you think, wow, that got a CPU in it, and it's used by people I don't like, so I want to hack it. 8 00:01:10,200 --> 00:01:18,680 It is a very good motivation, but you should not just go ahead and beat someone up and steal his device and try to hack this device. 9 00:01:18,820 --> 00:01:19,000 Yeah. 10 00:01:19,020 --> 00:01:22,540 I'm not saying that beating up people is bad. 11 00:01:22,660 --> 00:01:31,340 I'm saying that you should not go for the obvious part of the system, because there has to be more to it. 12 00:01:32,340 --> 00:01:40,500 Obviously, if you have a device like a BlackBerry, there has to be some infrastructure existing that this thing is running on. 13 00:01:40,620 --> 00:01:41,840 It's not a stand-alone system. 14 00:01:42,580 --> 00:01:49,000 So, what you see is also probably the thing that whoever is watching this is probably going to say, oh, I don't know. 15 00:01:49,000 --> 00:01:49,100 I don't know what this thing is doing. 16 00:01:49,100 --> 00:01:54,580 And it's the same for every device that I've ever made this device concentrated on when they tried to put some security in there. 17 00:01:55,080 --> 00:02:05,200 So, basically, the defending side was probably also focusing on what everyone sees, what everyone has in hand, in this case the device. 18 00:02:07,060 --> 00:02:14,120 You have to look at the bigger picture to really see what is a promising attack vector. 19 00:02:14,360 --> 00:02:18,980 The problem is, like, if you have a complex system that contains lots of stuff, you need to have a complete system. 20 00:02:18,980 --> 00:02:25,820 stuff, like many servers, many infrastructure elements, and so on, and you're not a three-letter 21 00:02:25,820 --> 00:02:28,820 agency, then you don't have unlimited resources. 22 00:02:29,320 --> 00:02:34,080 We all have lives, like even hackers have to sleep and have to get drunk and stuff. 23 00:02:34,740 --> 00:02:38,240 So we don't have unlimited resources for research. 24 00:02:38,440 --> 00:02:43,680 So we have to focus on something, and that's better something that gets you somewhere. 25 00:02:45,240 --> 00:02:50,600 Also, you need additional resources apart from yourself and your brain, which is required 26 00:02:50,600 --> 00:02:52,600 for hacking, just for the record. 27 00:02:53,240 --> 00:02:54,420 You need hardware. 28 00:02:55,040 --> 00:02:59,700 In the case of BlackBerrys, you actually obviously need a BlackBerry. 29 00:03:00,380 --> 00:03:02,440 You need software, possibly. 30 00:03:03,300 --> 00:03:05,480 You need infrastructure and accounts. 31 00:03:06,060 --> 00:03:13,440 So again, in the case of BlackBerrys, you have to have an account on some system that 32 00:03:13,680 --> 00:03:15,620 you can forward your email to. 33 00:03:16,340 --> 00:03:18,940 Of course, you need to obtain this account. 34 00:03:20,240 --> 00:03:21,680 I'm not saying you need to buy it. 35 00:03:21,920 --> 00:03:26,000 You need to obtain an account that you can work with so you can actually see how the 36 00:03:26,000 --> 00:03:26,440 system works. 37 00:03:27,280 --> 00:03:32,300 Getting what you need might actually take time, and there are consequences to that, 38 00:03:32,760 --> 00:03:34,960 which should be considered before you go on. 39 00:03:35,140 --> 00:03:37,220 So can you afford to invest money? 40 00:03:37,420 --> 00:03:38,860 Are you a poor asshole or not? 41 00:03:39,860 --> 00:03:40,980 How much can you afford? 42 00:03:42,320 --> 00:03:42,760 Okay. 43 00:03:43,680 --> 00:03:46,040 Are you crossing legal lines if you're getting stuff? 44 00:03:46,800 --> 00:03:52,340 When we got our hands on the software to look at, like the enterprise server, it wasn't 45 00:03:52,340 --> 00:03:55,040 strictly legal because we didn't strictly buy it. 46 00:03:58,300 --> 00:04:04,760 The next very important thing is, can you afford that your potential target knows that 47 00:04:04,760 --> 00:04:05,320 it's under attack? 48 00:04:05,880 --> 00:04:11,720 For example, if you're looking for vulnerabilities in, let's say, Gmail, and you're writing 49 00:04:11,720 --> 00:04:13,660 a fuzzer for email content. 50 00:04:13,660 --> 00:04:18,840 And you're sending lots of crappy emails to Gmail, and Gmail goes down, it is fairly 51 00:04:18,840 --> 00:04:23,780 likely that they, after like the fifth or sixth system crash, start investigating. 52 00:04:24,220 --> 00:04:27,360 So your target in this case would know it's under attack. 53 00:04:28,640 --> 00:04:34,980 And all that, like especially the target knowing to be under attack and crossing the 54 00:04:34,980 --> 00:04:37,540 legal lines, there's also the question of, do you care? 55 00:04:38,200 --> 00:04:39,980 Does it make any difference to you? 56 00:04:42,120 --> 00:04:43,580 So the big picture. 57 00:04:43,580 --> 00:04:50,800 The big picture for RIM is you start with identifying all components in the system. 58 00:04:51,560 --> 00:04:54,120 So first you're getting official data. 59 00:04:54,320 --> 00:04:57,520 That's the big picture that RIM puts out in documents. 60 00:04:57,860 --> 00:05:04,480 So you have handhelds, like the native handhelds, and you have third party handhelds running 61 00:05:04,920 --> 00:05:05,460 RIM stuff. 62 00:05:05,720 --> 00:05:11,120 You have several data networks, GSM and other mobile networks. 63 00:05:11,380 --> 00:05:12,940 You have the internet. 64 00:05:13,700 --> 00:05:15,060 You have a firewall. 65 00:05:15,640 --> 00:05:19,880 Some hole in the firewall, of which you don't actually know what the hole is. 66 00:05:20,140 --> 00:05:24,840 And then you have all the server infrastructure on a potentially corporate site. 67 00:05:25,360 --> 00:05:28,860 So you have the wireless services. 68 00:05:29,660 --> 00:05:32,840 You have like the email servers on the left. 69 00:05:33,720 --> 00:05:37,700 You have application servers, web application, all that. 70 00:05:39,340 --> 00:05:41,000 When you see stuff like this. 71 00:05:41,100 --> 00:05:42,280 When you obtain documentation. 72 00:05:42,960 --> 00:05:43,480 About. 73 00:05:43,480 --> 00:05:44,540 About your potential target. 74 00:05:44,800 --> 00:05:47,620 Go ahead and build an abstract view of that. 75 00:05:47,960 --> 00:05:51,040 Like don't eat the data you're fed. 76 00:05:52,120 --> 00:05:54,040 Just try to get your own pictures. 77 00:05:54,160 --> 00:05:59,600 So that's the abstract idea of a RIM network set up here. 78 00:05:59,800 --> 00:06:02,160 So you have the evil Blackberry to the right. 79 00:06:02,360 --> 00:06:03,960 Then you have the GSM network. 80 00:06:04,160 --> 00:06:06,900 We are German, so we are living in like GSM land. 81 00:06:08,220 --> 00:06:09,960 You have provider side servers. 82 00:06:11,240 --> 00:06:13,340 They're obviously somehow specialized. 83 00:06:13,340 --> 00:06:15,360 It's something related to RIM. 84 00:06:15,900 --> 00:06:18,360 Then you have the RIM secret network over here. 85 00:06:19,900 --> 00:06:21,880 And the border systems. 86 00:06:22,140 --> 00:06:23,200 They're called SRP. 87 00:06:24,020 --> 00:06:27,260 In different countries, UK, Canada, somewhere else. 88 00:06:27,760 --> 00:06:29,620 Then you have a corporate network site. 89 00:06:29,780 --> 00:06:31,120 With an enterprise server. 90 00:06:32,780 --> 00:06:35,660 And the enterprise server management software to that. 91 00:06:35,900 --> 00:06:38,680 So that's again something in a system. 92 00:06:38,780 --> 00:06:41,140 There's always some part of management software. 93 00:06:41,140 --> 00:06:46,000 Because none of the software you can buy today is actually carefree. 94 00:06:46,140 --> 00:06:48,980 Most of it is actually quite a hassle to get to work. 95 00:06:49,200 --> 00:06:52,420 And there's always some poor guy administrating this. 96 00:06:52,660 --> 00:06:56,460 And he's always having some poor Windows GUI system. 97 00:06:56,800 --> 00:06:59,040 And that needs to be considered as well. 98 00:06:59,120 --> 00:07:00,840 Because it is a potential tag vector. 99 00:07:01,820 --> 00:07:05,980 And then you have a connection from the corporate networks somehow over to RIM. 100 00:07:09,800 --> 00:07:11,120 So when you build a RIM server. 101 00:07:11,140 --> 00:07:14,940 break this down then you get like handheld devices mobile network rim 102 00:07:14,940 --> 00:07:19,920 network internet based communication which is this little communication line 103 00:07:19,920 --> 00:07:26,860 that we've seen here and you potentially want to know what the protocols are you 104 00:07:26,860 --> 00:07:31,120 have a blackberry enterprise server the connectors to the mail servers and you 105 00:07:31,120 --> 00:07:37,780 have the management tools so you can reclassify them because unless you you 106 00:07:37,780 --> 00:07:42,460 know exactly what you're dealing with you need to classify the elements you 107 00:07:42,460 --> 00:07:45,780 need to find out what you're actually looking at so the handheld devices for 108 00:07:45,780 --> 00:07:50,500 example unembedded system it's obviously proprietary hardware it has a 109 00:07:50,500 --> 00:07:55,060 real-time operating system because that's required to run a DSM engine and 110 00:07:55,060 --> 00:08:01,960 it obviously has Java because it like the applications are slow you have a 111 00:08:01,960 --> 00:08:07,660 mobile network GSM 2.5 or 3 G GSM network 112 00:08:07,660 --> 00:08:11,780 you have a rim network of which you don't know anything but it's fairly 113 00:08:11,780 --> 00:08:17,280 likely that it's IP based you have the internet-based communication which is 114 00:08:17,280 --> 00:08:23,460 certainly gonna be IP but there is some proprietary stuff going on in there you 115 00:08:23,460 --> 00:08:26,900 have the enterprise server connectors and connectors which is like 116 00:08:26,900 --> 00:08:30,500 windows-based service software it's closed source but it is a windows 117 00:08:30,500 --> 00:08:34,700 environment so we know how to debug it how to disassemble it and the same holds 118 00:08:34,700 --> 00:08:35,700 true for the management tools 119 00:08:37,660 --> 00:08:41,240 and then you need to look at the accessibility like can you get your 120 00:08:41,240 --> 00:08:47,420 hands on this stuff handheld devices for example well it's doable there as I 121 00:08:47,420 --> 00:08:52,600 said you can like take them off people you don't like or you just buy one the 122 00:08:53,110 --> 00:08:58,680 mobile network the GSM network while it's obviously a well-defended network 123 00:08:59,340 --> 00:09:06,120 it is hard but it is possible to break into a GSM network and take it over that 124 00:09:06,120 --> 00:09:07,040 would be an attack vector 125 00:09:07,840 --> 00:09:15,260 the rim network is probably a lot more doable to get in like do you just have a 126 00:09:15,260 --> 00:09:19,100 bunch of old days sitting around breaking into the rim network but it is illegal 127 00:09:19,920 --> 00:09:25,280 internet-based communication accessibility is there so if you have a 128 00:09:25,280 --> 00:09:29,060 working installation of an enterprise server you can sniff obviously the 129 00:09:29,060 --> 00:09:33,760 traffic and start reverse engineering it the blackberry enterprise server and 130 00:09:33,760 --> 00:09:36,780 connectors accessibility is there 131 00:09:36,780 --> 00:09:40,100 there are tons of companies running this stuff this is why we are looking at it 132 00:09:40,100 --> 00:09:46,500 so you just call someone up and friendly ask can I have the city please and I'm 133 00:09:46,500 --> 00:09:52,140 like accessibility in more details is idea so disassembling it that's doable 134 00:09:52,140 --> 00:09:58,660 and the same for the management tools and then the most interesting part of 135 00:09:58,660 --> 00:10:03,840 that is what's the impact like you sit down consume whatever drugs you really 136 00:10:03,840 --> 00:10:06,140 like and imagine you are already done 137 00:10:06,780 --> 00:10:13,420 And think of what's the impact if I, like on this attack vector, are successful and implement a successful attack. 138 00:10:13,760 --> 00:10:22,620 So for the handheld devices, for example, it means you potentially have information disclosure in the form of reading some CEO's email. 139 00:10:23,580 --> 00:10:26,420 And potentially you have remote control over the device. 140 00:10:26,580 --> 00:10:29,860 So maybe you can put up point screen safers or something. 141 00:10:30,120 --> 00:10:34,020 But it is an attack that's targeted on a single user. 142 00:10:34,360 --> 00:10:35,960 Definitely because it's a single device. 143 00:10:36,780 --> 00:10:40,600 For the mobile network, well, you could do a lot of stuff in the GSM network. 144 00:10:40,860 --> 00:10:48,100 But then again, yeah, that's maybe just a little bit too big an attack vector just to own a BlackBerry. 145 00:10:49,180 --> 00:10:54,460 For the RIM network, if you take over the RIM network or the core systems, you become RIM. 146 00:10:55,060 --> 00:10:56,680 So you can do whatever you want. 147 00:10:58,080 --> 00:11:04,960 For the internet-based communication, if you successfully hack that and reverse engineer that, then you can implement the protocol. 148 00:11:05,220 --> 00:11:06,760 So you can talk to RIM. 149 00:11:06,780 --> 00:11:12,820 And you can talk to the enterprise service, which enables you to, for example, do brute force attacks. 150 00:11:13,060 --> 00:11:16,540 We still don't know if there's a password in this protocol or not. 151 00:11:16,700 --> 00:11:23,020 But if you talk to protocol, then you actually have the ability to write your own tools and to automate your attacks. 152 00:11:24,280 --> 00:11:33,800 For the BlackBerry enterprise servers, if you have a vulnerability there and you can exploit it, then you get code execution on a host OS. 153 00:11:34,460 --> 00:11:36,760 And you're owning a centralized... 154 00:11:36,780 --> 00:11:39,600 It's a locally placed server, which sounds pretty useful. 155 00:11:40,000 --> 00:11:47,260 And for the management tools, you can modify the policies that are pushed on the handhelds. 156 00:11:47,260 --> 00:11:51,140 You can send messages to everyone, whatever that's worth. 157 00:11:51,360 --> 00:11:55,180 And you could remotely install software on the handhelds. 158 00:11:55,680 --> 00:12:04,440 So when you draw this all up into one diagram, then you can see the ease of access and the impact of what you do. 159 00:12:04,840 --> 00:12:06,760 And essentially... 160 00:12:06,780 --> 00:12:13,660 You can remotely place every single item and then look at the connections, how those things are connected to each other. 161 00:12:13,920 --> 00:12:21,400 And then it's absolutely clear that you should not just concentrate on the handheld, but you should concentrate on the enterprise server. 162 00:12:22,520 --> 00:12:28,120 Now, after all this abstracting short summary, why you should go for the enterprise server. 163 00:12:28,680 --> 00:12:34,980 The enterprise server is sitting in the corporate network right next to the mail server. 164 00:12:35,140 --> 00:12:36,760 Because it needs to be connected to the mail server. 165 00:12:36,760 --> 00:12:48,240 It talks to the outside, it handles email, which is a communication vector that we all know how to use, and we all know that, like, the sender can be modified. 166 00:12:50,040 --> 00:13:02,020 And there is absolutely no way for the enterprise server to not take someone's email, because, well, it is an email system, so it's supposed to handle email. 167 00:13:03,040 --> 00:13:06,640 And if you own it, then you get, like, everything. 168 00:13:07,840 --> 00:13:11,980 So, after you have the abstract picture, get the details. 169 00:13:12,500 --> 00:13:23,600 So, it is important to figure out if, like, how feasible is a attack? 170 00:13:23,800 --> 00:13:25,680 Like, sending email is very feasible. 171 00:13:25,880 --> 00:13:29,120 Breaking into a GSM network, probably not. 172 00:13:30,560 --> 00:13:34,320 What you need, we already covered that, and how illegal it is. 173 00:13:34,960 --> 00:13:36,260 And even here... 174 00:13:37,040 --> 00:13:47,680 Sending email is, like, the more preferred way, because it might be illegal if the email actually contains an exploit, but, let's face it, you're hard to get. 175 00:13:49,280 --> 00:14:03,260 So, for the handheld devices, what we did to verify the details, we checked what's there in terms of software, so there is a simulation environment available of RIM, so you get an emulator. 176 00:14:03,860 --> 00:14:05,280 You get a developer SDK. 177 00:14:06,760 --> 00:14:07,900 The current version is for Java. 178 00:14:08,640 --> 00:14:10,120 The older version is for C. 179 00:14:11,000 --> 00:14:17,840 So, it's obviously more interesting, but it was limited to people in the U.S. and Canada. 180 00:14:18,360 --> 00:14:20,060 And that's, again, an accessibility question. 181 00:14:21,440 --> 00:14:30,280 Yes, even I know people in the U.S. and Canada, and yes, I can call them and say, come on, send this fax over to RIM and get me the software, which someone did. 182 00:14:31,060 --> 00:14:35,240 So, here again, accessibility is not always a big problem. 183 00:14:35,700 --> 00:14:36,740 Then we have desktop. 184 00:14:36,740 --> 00:14:37,500 There is desktop software available. 185 00:14:37,780 --> 00:14:38,860 There is sync software. 186 00:14:39,360 --> 00:14:41,260 And there's third-party code. 187 00:14:41,380 --> 00:14:44,320 There are products that you can put on your Blackberry. 188 00:14:44,500 --> 00:14:59,880 So, you can take this code and look into it and find out what the API calls are, how powerful the API is, because the product has to use the API to actually make something, do something. 189 00:15:00,120 --> 00:15:03,420 And the more powerful the product is, the more features this product offers. 190 00:15:03,620 --> 00:15:06,720 The more interfacing into the operating system. 191 00:15:06,740 --> 00:15:08,900 So, the operating system of the handheld has to be there. 192 00:15:09,120 --> 00:15:15,160 And by looking at the third-party product, you can actually figure out how much there is. 193 00:15:17,700 --> 00:15:28,740 For the protocols, you look at how many communication channels are used, who initiates the communication, is it UDP, is it TCP, how much encapsulation are you looking at. 194 00:15:29,860 --> 00:15:36,300 The encapsulation and how variable the protocol is, is very important for finding vulnerabilities in it. 195 00:15:36,360 --> 00:15:36,720 So, that's a big question. 196 00:15:36,720 --> 00:15:48,680 Because if it's like a multilevel encapsulation stuff, then you can assume there are going to be multilevel parsers in the software, which are maybe not written by the same person. 197 00:15:48,880 --> 00:15:54,400 So, you have potentially interfacing problems between one layer and the other. 198 00:15:54,660 --> 00:15:57,300 We've all seen that in other products happening. 199 00:15:57,500 --> 00:16:03,400 If it's a flat protocol design, like one huge structure, then the code for that is probably looking the same. 200 00:16:03,460 --> 00:16:06,700 And it's probably written by one crazy person. 201 00:16:06,720 --> 00:16:06,900 And it's probably written by one crazy Russian. 202 00:16:07,200 --> 00:16:10,060 And no variable has more than two characters and stuff. 203 00:16:11,300 --> 00:16:13,280 Which indicates different bug classes. 204 00:16:14,320 --> 00:16:16,520 The same for the variableness of the protocol. 205 00:16:16,820 --> 00:16:22,820 Like, if you have multiple length fields, and it can be, like, you have, yeah, length fields are really important. 206 00:16:22,980 --> 00:16:25,460 Or you have different encodings. 207 00:16:25,740 --> 00:16:27,940 Then there's lots of stuff that can go wrong. 208 00:16:28,480 --> 00:16:32,480 For example, on SAP, the protocols are all fixed size. 209 00:16:32,660 --> 00:16:34,840 Like, everything is pretty much like eight characters wide. 210 00:16:35,220 --> 00:16:36,700 You don't find anything. 211 00:16:36,700 --> 00:16:39,600 It overflows in something that's fixed to eight characters. 212 00:16:44,660 --> 00:16:48,780 And then, of course, you have to look at how the software is designed. 213 00:16:49,380 --> 00:16:51,160 Like, is it running in user land? 214 00:16:51,340 --> 00:16:52,280 Is it running kernel? 215 00:16:52,440 --> 00:16:54,020 Is it running system service? 216 00:16:54,720 --> 00:16:57,680 How much components, how many components are you looking at? 217 00:16:58,200 --> 00:17:00,400 And especially, what are those components doing? 218 00:17:01,420 --> 00:17:05,440 Again, if you have a piece of software with open support in user land, 219 00:17:05,440 --> 00:17:10,760 and you have another piece of software that opens support as a system service, 220 00:17:11,060 --> 00:17:14,680 then you should look at the one opening a port as a system service. 221 00:17:14,800 --> 00:17:16,720 Because if you own it, then you get higher privileges. 222 00:17:17,760 --> 00:17:20,500 And what are the building blocks of this software? 223 00:17:21,400 --> 00:17:22,840 What libraries are used? 224 00:17:23,120 --> 00:17:24,360 Who developed which component? 225 00:17:24,720 --> 00:17:27,840 Is everything, like, by this one vendor or not? 226 00:17:28,800 --> 00:17:30,880 What programming language is used? 227 00:17:31,040 --> 00:17:33,660 For example, in reverse engineering, it really sucks. 228 00:17:33,660 --> 00:17:38,060 If you take a service software apart, and then you realize it's Delphi, 229 00:17:38,240 --> 00:17:42,600 because IDA is just, like, failing on you, and nothing works anymore, 230 00:17:42,740 --> 00:17:44,160 and all your tools don't work anymore. 231 00:17:45,920 --> 00:17:48,680 So, and of course, where's the interesting stuff stored? 232 00:17:48,800 --> 00:17:51,000 Like, does it have its own crypto containers, 233 00:17:51,180 --> 00:17:54,240 or does it just throw everything into registry and blah, blah, blah? 234 00:17:56,040 --> 00:17:57,940 More things to look for is history. 235 00:17:58,860 --> 00:18:00,220 How old is this stuff? 236 00:18:00,360 --> 00:18:02,560 Like, where does the component come from? 237 00:18:02,560 --> 00:18:04,440 When was the first release? 238 00:18:05,040 --> 00:18:06,780 Was there any major rewrite? 239 00:18:07,180 --> 00:18:08,380 Check the press releases. 240 00:18:09,320 --> 00:18:10,260 They're gonna tell you. 241 00:18:11,320 --> 00:18:13,280 Someone walked up yesterday to me and said, 242 00:18:13,400 --> 00:18:15,800 another very interesting source is, 243 00:18:16,400 --> 00:18:21,220 you should go to the, if they, like, have patents for their stuff, 244 00:18:21,820 --> 00:18:24,220 especially for the communication protocols and stuff, 245 00:18:24,980 --> 00:18:29,020 then you can go to the public website and download the patents 246 00:18:29,020 --> 00:18:31,320 and actually see how this whole thing works. 247 00:18:32,920 --> 00:18:34,160 And the documentation. 248 00:18:34,540 --> 00:18:35,800 Like, what are the setup requirements? 249 00:18:36,220 --> 00:18:37,760 What is troubleshooting officially? 250 00:18:38,080 --> 00:18:39,420 How is it supposed to work? 251 00:18:39,580 --> 00:18:41,580 And what are people actually using? 252 00:18:42,040 --> 00:18:43,160 Like, check the forums. 253 00:18:43,720 --> 00:18:46,360 See if some lame-ass administrator said, 254 00:18:46,520 --> 00:18:49,380 yeah, this is the troubleshooting procedure, but it never works, 255 00:18:49,420 --> 00:18:50,680 so I just reboot the box. 256 00:18:50,900 --> 00:18:54,400 Or this and that procedure actually does work, 257 00:18:54,520 --> 00:18:58,260 because it, again, tells you who are you dealing with. 258 00:18:58,360 --> 00:19:01,160 If those people managing the systems are, 259 00:19:01,800 --> 00:19:03,800 let's put it this way, less talented, 260 00:19:04,380 --> 00:19:07,120 then it's less likely that they're gonna notice 261 00:19:07,120 --> 00:19:09,000 another administrative account on their system. 262 00:19:11,420 --> 00:19:13,540 Step three, work. 263 00:19:14,340 --> 00:19:18,020 This is just, yeah, there's nothing to say about that. 264 00:19:18,900 --> 00:19:20,200 It has to be done. 265 00:19:20,700 --> 00:19:23,360 So reverse engineering takes time. 266 00:19:24,120 --> 00:19:27,660 Taking apart networks and protocols takes time. 267 00:19:27,780 --> 00:19:30,820 So, and then you get results. 268 00:19:31,740 --> 00:19:34,000 So the first thing that we did with the handheld 269 00:19:34,000 --> 00:19:36,060 was stripping it. 270 00:19:36,140 --> 00:19:38,640 It's pretty much the same approach as, like, getting married. 271 00:19:39,220 --> 00:19:41,520 You know, you want to see what you get. 272 00:19:42,000 --> 00:19:42,480 So... 273 00:19:45,000 --> 00:19:47,120 So this is the back view. 274 00:19:48,300 --> 00:19:49,700 It actually has an... 275 00:19:49,700 --> 00:19:52,280 It actually has a... 276 00:19:52,280 --> 00:19:53,260 What's the phone? 277 00:19:54,600 --> 00:19:55,760 What's going on here? 278 00:20:07,680 --> 00:20:08,560 ... 279 00:20:08,560 --> 00:20:10,160 What's going on? 280 00:20:22,900 --> 00:20:23,780 ... 281 00:20:28,020 --> 00:20:29,780 The thing is, 282 00:20:29,920 --> 00:20:31,140 all this work that's going on, 283 00:20:45,260 --> 00:20:45,840 Bye-bye. 284 00:20:46,180 --> 00:20:46,820 Bye-bye. 285 00:20:49,620 --> 00:20:50,660 Applause for the guys. 286 00:20:50,820 --> 00:20:51,100 Come on. 287 00:20:56,240 --> 00:20:57,240 Got a lot of DEF CON. 288 00:20:58,020 --> 00:20:58,380 So. 289 00:21:01,140 --> 00:21:01,480 That was cool. 290 00:21:05,060 --> 00:21:05,960 So essentially. 291 00:21:06,180 --> 00:21:07,300 By taking the stuff. 292 00:21:07,540 --> 00:21:08,680 Taking the covers off. 293 00:21:08,760 --> 00:21:09,580 We actually figured out. 294 00:21:09,640 --> 00:21:11,160 What CPU is in there. 295 00:21:11,360 --> 00:21:12,200 Because like the. 296 00:21:12,220 --> 00:21:14,860 The CSDK that we downloaded. 297 00:21:15,180 --> 00:21:16,360 And we wanted to work with. 298 00:21:16,760 --> 00:21:18,800 Indicated that it's actually an x83. 299 00:21:22,760 --> 00:21:24,560 x86 is the CPU name. 300 00:21:25,940 --> 00:21:27,480 Turns out it's actually ARM. 301 00:21:27,620 --> 00:21:29,340 So they're running on an ARM CPU. 302 00:21:29,820 --> 00:21:31,000 In analog. 303 00:21:31,140 --> 00:21:31,760 Devices chip. 304 00:21:32,800 --> 00:21:34,560 And then there's another. 305 00:21:34,680 --> 00:21:36,640 Very interesting part on this picture. 306 00:21:37,100 --> 00:21:38,820 We suspected that. 307 00:21:39,200 --> 00:21:40,060 Where's my laser pointer? 308 00:21:41,160 --> 00:21:41,720 Okay. 309 00:21:50,000 --> 00:21:51,620 So like next to the. 310 00:21:51,780 --> 00:21:54,360 You see where the GSM card is supposed to go in. 311 00:21:54,980 --> 00:21:55,820 Next to that. 312 00:21:55,880 --> 00:21:57,400 There are a few little pins. 313 00:21:58,400 --> 00:21:59,740 Our suspicion was. 314 00:21:59,840 --> 00:22:00,840 This might actually be. 315 00:22:00,840 --> 00:22:01,140 JTEC. 316 00:22:01,520 --> 00:22:02,040 So. 317 00:22:02,680 --> 00:22:05,220 It is again a possible attack vector. 318 00:22:05,560 --> 00:22:06,480 That's the back side. 319 00:22:06,720 --> 00:22:07,800 No the front side. 320 00:22:07,920 --> 00:22:08,600 That's pretty boring. 321 00:22:09,860 --> 00:22:10,940 So as I said. 322 00:22:11,020 --> 00:22:11,900 Turns out it's ARM. 323 00:22:12,820 --> 00:22:14,280 It actually has different. 324 00:22:14,760 --> 00:22:17,300 Real time operating system kernels. 325 00:22:17,600 --> 00:22:18,120 So. 326 00:22:18,480 --> 00:22:20,220 When we took the first one apart. 327 00:22:21,920 --> 00:22:24,600 We found a KDAC AMX 4 kernel. 328 00:22:24,660 --> 00:22:28,640 KDAC is a company that sells real time operating system kernels. 329 00:22:28,900 --> 00:22:30,600 And when we later talked to. 330 00:22:30,600 --> 00:22:32,960 RIM and it was a big surprise to them. 331 00:22:33,980 --> 00:22:35,780 And I'm like wait a minute. 332 00:22:35,840 --> 00:22:39,780 It's your product but it turns out like every single device. 333 00:22:39,840 --> 00:22:42,820 Actually might have its own kernel. 334 00:22:43,080 --> 00:22:48,980 So this again shows you that the device as an attack vector is probably not very good. 335 00:22:49,060 --> 00:22:53,500 Because we have a situation like with Cisco where every single device has a different core. 336 00:22:53,700 --> 00:22:59,420 So if you find a vulnerability and you've write an exploit for it it's going to take you a lot of time and you can only. 337 00:22:59,600 --> 00:23:00,120 Own. 338 00:23:00,600 --> 00:23:06,360 One type one series of devices and when they come out with a new series of devices your exploit doesn't work anymore. 339 00:23:07,480 --> 00:23:15,500 Then it turns out that the way they built the operating system is you have a core operating system binary that's called RIMOS EXE. 340 00:23:16,100 --> 00:23:23,420 And it's actually a real PE COF format like on Windows like EXE and DLL files just compiled for ARM. 341 00:23:23,640 --> 00:23:29,880 And then everything else like the Java virtual machine are modules in the form of DLL. 342 00:23:29,880 --> 00:23:41,860 Files linked into this main EXE file so the entire operating system in terms of memory set up looks like one like one process like one application on Windows system. 343 00:23:44,240 --> 00:23:47,080 The Java virtual machine as I said is loaded as one. 344 00:23:48,360 --> 00:23:55,180 Binary module it's actually the largest one and I think in the recent BlackBerry's it's the only binary module that's loaded from the kernel. 345 00:23:56,840 --> 00:23:58,480 It is actually made by RIM. 346 00:23:58,660 --> 00:23:59,180 So. 347 00:23:59,880 --> 00:24:29,860 There are different Java virtual machine implementations like from Sun and from HP and from IBM and so on and RIM did their own implementation so it's actually worthwhile to look for virtual machine bugs in the Java virtual machine and see if you can make something happen on a device unfortunately there is with the Java classes there is not a full set so you don't have the reflection API for that. 348 00:24:29,880 --> 00:24:30,140 For example. 349 00:24:30,580 --> 00:24:44,060 And for that you get like tons of RIM classes that RIM classes are used to communicate with the device to like show something on a display or get some user input or like talk to you as M or send an email or whatnot. 350 00:24:44,480 --> 00:24:54,820 And as soon as you want to instantiate a object out of the RIM classes it actually checks the signature of your application and your application has to be signed by RIM. 351 00:24:55,240 --> 00:24:57,320 Now how that works is. 352 00:24:58,240 --> 00:25:02,960 You write a piece of code and then the development environment is going to. 353 00:25:03,820 --> 00:25:05,200 Take a hash of your. 354 00:25:06,700 --> 00:25:18,520 Job package and then this hash needs to be sent to RIM and you need to get an account with RIM that costs you a hundred bucks once one time and you pay this by credit card. 355 00:25:18,940 --> 00:25:26,440 The idea behind this is where our suspicion is that they say well if we ever have a binary. 356 00:25:26,440 --> 00:25:38,360 That's doing evil shit on our blackberries like they have a blackberry warm or something then we have to hash of the binary and since the guy paid with his credit card we know who it is and we can bust them. 357 00:25:39,220 --> 00:25:41,980 Which works in a world that doesn't have stolen credit cards. 358 00:25:43,760 --> 00:25:44,200 So. 359 00:25:45,600 --> 00:25:46,040 Yeah. 360 00:25:47,420 --> 00:25:55,240 It's not going to do that but anyway that's the procedure we didn't find a way to get around the signature checking of the binaries. 361 00:25:57,000 --> 00:25:58,740 Also the firmware is checked. 362 00:25:59,860 --> 00:26:09,320 Is signature checked so what happens is when you load the firmware the loader software on the PC site will actually verify the signature and I'm like OK this is easy. 363 00:26:10,340 --> 00:26:26,420 So here is the shortest idea manual ever if you want to crack this side of the authentication then you just go search for the string signature cross reference at once and you find the code situation and then like this is this is the jump that you need to make. 364 00:26:26,440 --> 00:26:27,040 To not take. 365 00:26:29,020 --> 00:26:39,080 Unfortunately the device itself is going to check the signature again so we after finding that out we had a device sitting there just blinking red and not doing anything else anymore. 366 00:26:41,870 --> 00:26:43,560 We found vulnerabilities. 367 00:26:44,990 --> 00:26:55,880 In the jet parsing it's actually not a bad thing but it's funny because I think it's three years ago I talked about embedded systems and I mentioned a Siemens phone that would crash. 368 00:26:55,880 --> 00:27:06,240 If you would access a jot file with a long midnight name or vendor name and it turns out the same happened for the BlackBerry browser I just found this really funny. 369 00:27:07,740 --> 00:27:17,080 Other things are as I said JTAC is a hardware debugging mechanism that's in embedded systems widely used where you can do sub CPU debugging. 370 00:27:18,940 --> 00:27:25,860 Of course finding JTAC on a BlackBerry is an interesting thing because you called circumvent the signature. 371 00:27:25,880 --> 00:27:28,120 Checking and get your own software on it. 372 00:27:29,460 --> 00:27:39,180 Looking for JVM box looking for Bluetooth vulnerabilities and like accessing memory on the device via the loader. 373 00:27:39,920 --> 00:27:55,740 The JTAC this is actually work in progress this picture was taken before we flew over so once actually developed a JTAC finder and at pH neutral we actually found the JTAC connectors so the pins I showed you earlier are actually JTAC. 374 00:27:55,880 --> 00:28:09,120 And so I had someone build me a JTAC cable for that and this is my new wired up BlackBerry unfortunately as I said that's brand new so we haven't done any work on that and the problem is when I power it on it goes like. 375 00:28:10,520 --> 00:28:14,180 So I think there is still some something at miss with the with the electronics. 376 00:28:16,700 --> 00:28:21,320 The protocols I'm going to skip a bit over them because we're running out of time I guess. 377 00:28:23,120 --> 00:28:25,340 They're not too interesting actually. 378 00:28:25,880 --> 00:28:41,300 It turns out it's a multi level encapsulation so the other side is SRP chunks like you have an SRP header and then you have several chunks in a protocol and then you have a tailor and that's it. 379 00:28:43,530 --> 00:28:55,700 They have two different types we looked at them and saw okay there's one type that's called 53 hex and one type that's 49 hex and then we saw that we're dealing with. 380 00:28:55,700 --> 00:28:56,260 Integers. 381 00:28:57,300 --> 00:29:06,820 And so we went on and later on when we looked at the decodings we actually realized it's a capital S and a capital I for string and integer. 382 00:29:09,140 --> 00:29:16,580 So that's that's a case where that shows you that when you reverse engineering stuff sometimes the obvious solution is actually the right solution. 383 00:29:18,130 --> 00:29:25,620 This is your SRP up codes this is also stuff that still needs to be played with because we didn't. 384 00:29:25,620 --> 00:29:29,520 So far there are many things that we find fairly interesting especially. 385 00:29:30,440 --> 00:29:32,620 Stuff like config or info. 386 00:29:33,740 --> 00:29:37,300 That's the communication between the enterprise server and rim so. 387 00:29:38,200 --> 00:29:46,560 Yeah I assume you cannot remotely config rim but probably there is some functionality in there that still it's worth playing with. 388 00:29:47,700 --> 00:29:54,680 This is the session set up when an enterprise server gets online and wants to talk to him it goes ahead and like. 389 00:29:54,780 --> 00:29:55,120 The. 390 00:29:55,120 --> 00:30:02,800 Client in this case the enterprise server talks to the rim server and sets a system ID and gets a server challenge back. 391 00:30:04,380 --> 00:30:09,040 And then sets a client challenge over there and it gets HMAC. 392 00:30:09,400 --> 00:30:10,540 As such a one. 393 00:30:12,180 --> 00:30:13,520 Transformed SRP key. 394 00:30:15,000 --> 00:30:21,760 And that's basically the authentication so what happens here is you have a thing that's called SRP key. 395 00:30:22,360 --> 00:30:24,740 That you have to configure in the enterprise server. 396 00:30:24,800 --> 00:30:24,880 It. 397 00:30:24,880 --> 00:30:31,040 Looks like the CD key it's actually like it's going to ask you during the installation please enter the SRP key here. 398 00:30:31,820 --> 00:30:38,220 Which looks like XXX-XXX and so on and then when the server is up and running and set up. 399 00:30:38,880 --> 00:30:39,700 Then you see. 400 00:30:40,540 --> 00:30:54,180 In the main dialogue this SRP key always displayed so everyone assumes it's like your typical CD key from like everything else like when you install the game or something that's not the case it's actually the. 401 00:30:54,180 --> 00:31:03,200 Secret between your company and room many people don't get that which has a very interesting effect because they don't consider that a secret. 402 00:31:03,980 --> 00:31:18,100 So we googled a bit and we found presentations from people showing like this is how we install the like very enterprise server version 4 on screenshots of course including their SRP key. 403 00:31:19,240 --> 00:31:23,580 Which will enable you to like become this company in. 404 00:31:24,180 --> 00:31:27,020 When you talk to him and like take over their entire email communication. 405 00:31:29,500 --> 00:31:40,040 That's very interesting because this key is used for like everything authenticating the company to rim and back everything is based off this SRP key we're going to see. 406 00:31:40,160 --> 00:31:43,400 We receive the SRP key server times in this presentation. 407 00:31:44,720 --> 00:31:53,500 But the most interesting thing is just a lack of communication or wrong communication of rim site to their customers it is. 408 00:31:53,500 --> 00:31:54,020 There's. 409 00:31:54,180 --> 00:31:55,380 Secret it is their password. 410 00:31:57,860 --> 00:32:06,340 Then in a protocol for a message you have to get way message envelope that's the routing information so you have the source. 411 00:32:07,560 --> 00:32:09,520 Sender and the destination. 412 00:32:10,260 --> 00:32:20,820 Where the message goes and those are in the form of pins when we talk about pins here it's not personal identification number but what does pin stand for. 413 00:32:22,460 --> 00:32:23,680 Okay the rim guy doesn't know. 414 00:32:24,420 --> 00:32:27,540 It's actually the device number so every every device. 415 00:32:29,440 --> 00:32:39,960 Product identification number okay every device every rim handheld house a pin it's quite a long number it's hex I think 16 characters or something. 416 00:32:40,280 --> 00:32:51,740 And this is how they do the identification of the device so like the mobile messages to pin messages have a source and a destination pin and a message ID and it looks like email. 417 00:32:53,400 --> 00:32:54,160 This is. 418 00:32:54,160 --> 00:32:58,500 This is the format I'm going to skip that it's in the slides in case someone wants to heck with them. 419 00:33:00,320 --> 00:33:13,140 Application layer information is on top of that so it's going to tell you if it's a message see mine or if it's a calendar update or if it's a policy update the it admin messages also have. 420 00:33:14,480 --> 00:33:23,240 Capabilities to reconfigure the devices to handhelds they also have the capability to remotely wipe the device so if you can spoof one of those messages. 421 00:33:23,300 --> 00:33:23,820 It's really. 422 00:33:23,820 --> 00:33:26,100 Really good but you need yes or peaky for that. 423 00:33:28,600 --> 00:33:38,240 Then we found out that specific pin messages are not encrypted pin messages are device to device messages wise per se and those are encrypted. 424 00:33:38,440 --> 00:33:44,560 But if you're sending a pin message from an enterprise server to a blackberry then it's not encrypted. 425 00:33:45,880 --> 00:33:53,620 And there's also if you're sending a pin message out of the blackberry api from the device to another device you can easily make it wrong. 426 00:33:53,820 --> 00:33:54,520 and it's not encrypted. 427 00:33:54,800 --> 00:33:56,740 So if a third party product tells you 428 00:33:57,180 --> 00:33:58,440 there is encryption going on 429 00:33:58,440 --> 00:33:59,760 because we're using pin messages, 430 00:34:00,060 --> 00:34:01,560 you should question that. 431 00:34:03,980 --> 00:34:06,060 So this is the CMIME format. 432 00:34:07,880 --> 00:34:09,640 So the whole thing looks like this. 433 00:34:10,220 --> 00:34:13,780 You have the IES or DES encryption. 434 00:34:14,160 --> 00:34:16,780 You have the key ID in clear text. 435 00:34:16,940 --> 00:34:19,000 You have the session key encrypted with the device key. 436 00:34:19,700 --> 00:34:22,840 The message is compressed and encrypted with a session key. 437 00:34:22,840 --> 00:34:25,560 Actually, the compression is quite something weird. 438 00:34:25,840 --> 00:34:27,000 We looked at it. 439 00:34:27,080 --> 00:34:30,320 I'm not 100% sure we figured out what it is, 440 00:34:30,400 --> 00:34:31,800 but it's not something standard. 441 00:34:33,340 --> 00:34:37,280 And we successfully implemented a packet dump message. 442 00:34:41,140 --> 00:34:41,740 Hi. 443 00:34:44,660 --> 00:34:49,240 Bye, honey. 444 00:34:52,980 --> 00:34:53,880 Time difference. 445 00:34:54,140 --> 00:34:55,100 She's from Germany. 446 00:34:58,180 --> 00:35:02,400 So we implemented a message decryption script. 447 00:35:04,060 --> 00:35:04,660 Huh? 448 00:35:09,280 --> 00:35:10,200 Beer, free beer. 449 00:35:12,000 --> 00:35:14,000 So if you have the SRP key, 450 00:35:14,140 --> 00:35:17,360 if you successfully stole an SRP key of someone, 451 00:35:17,560 --> 00:35:19,520 then we can give you a pro script 452 00:35:19,520 --> 00:35:21,540 so you can read someone's email. 453 00:35:23,320 --> 00:35:24,980 A word about the crypto. 454 00:35:25,540 --> 00:35:27,260 Apparently, this crypto is pretty good. 455 00:35:27,320 --> 00:35:27,820 It's certified. 456 00:35:28,180 --> 00:35:29,420 We looked at the implementation. 457 00:35:29,680 --> 00:35:33,280 The implementation looks pretty solid on the enterprise server 458 00:35:33,280 --> 00:35:34,640 as well as on the handheld. 459 00:35:35,240 --> 00:35:39,060 We are no crypto people, so the crypto details 460 00:35:39,060 --> 00:35:43,160 need to be revised and retaked by someone else. 461 00:35:44,960 --> 00:35:46,660 This is how the dumps look decoded. 462 00:35:46,840 --> 00:35:51,360 Here you also see the I and the S in the message chunks. 463 00:35:51,520 --> 00:35:52,820 And you see the passive data. 464 00:35:52,820 --> 00:35:56,440 pin messages, the pin IDs, sender and receiver, 465 00:35:57,120 --> 00:36:01,360 which of course enables you then to do traffic analysis. 466 00:36:01,800 --> 00:36:04,140 If you are reading someone's messages, 467 00:36:04,880 --> 00:36:07,880 someone's traffic, like their SMTP traffic 468 00:36:08,480 --> 00:36:10,220 and their SRP traffic, 469 00:36:10,540 --> 00:36:13,320 meaning you own their border router or something, 470 00:36:13,540 --> 00:36:14,940 and we have here, that's doable, 471 00:36:16,220 --> 00:36:17,780 then you can actually relate. 472 00:36:17,780 --> 00:36:22,680 You send in an email to ceo at evocompany.com 473 00:36:22,680 --> 00:36:26,100 and you see a pin message going out to a certain pin. 474 00:36:26,280 --> 00:36:27,720 You repeat that three times 475 00:36:27,720 --> 00:36:30,080 and it's always going out to the same pin. 476 00:36:30,200 --> 00:36:33,100 You know the product identification number 477 00:36:33,540 --> 00:36:34,880 of the CEO's device, 478 00:36:35,160 --> 00:36:37,540 which might be useful in later attacks. 479 00:36:40,320 --> 00:36:41,560 Protocol-based attacks. 480 00:36:43,080 --> 00:36:47,000 In the SRP session setup, you can, of course, 481 00:36:47,040 --> 00:36:47,760 if you have software, you can, of course, 482 00:36:47,760 --> 00:36:48,880 connect to someone else's SRP key, 483 00:36:49,040 --> 00:36:50,820 let's say from, as I mentioned, 484 00:36:50,920 --> 00:36:52,500 from Googling for their presentations, 485 00:36:53,660 --> 00:36:55,720 you can, of course, connect to them and say, 486 00:36:55,820 --> 00:36:57,040 hi, now I'm this company. 487 00:36:58,100 --> 00:37:01,180 What's gonna happen is that both sides, 488 00:37:01,340 --> 00:37:04,600 first of all, you have to make the other connection to drop, 489 00:37:04,700 --> 00:37:06,940 but that's easy, we can do that. 490 00:37:07,400 --> 00:37:11,360 For example, TCP window slipping or reset storms, 491 00:37:11,720 --> 00:37:13,160 you can drop a TCP connection. 492 00:37:13,600 --> 00:37:16,400 Then you connect and then you are this company. 493 00:37:18,400 --> 00:37:20,100 And you get their email. 494 00:37:21,520 --> 00:37:23,700 If you have a war, 495 00:37:23,800 --> 00:37:26,500 because the server is trying to reconnect as well, 496 00:37:26,720 --> 00:37:28,220 then you're causing a routing problem 497 00:37:28,720 --> 00:37:31,100 because RIM cannot decide which one of you two 498 00:37:31,100 --> 00:37:32,040 is the right one. 499 00:37:32,220 --> 00:37:34,340 So it cannot decide how to send the messages 500 00:37:34,340 --> 00:37:35,740 or where to send the messages. 501 00:37:35,980 --> 00:37:38,360 So what happens if you do that more than five times, 502 00:37:38,600 --> 00:37:41,420 this SRP key gets blacklisted. 503 00:37:41,720 --> 00:37:44,500 The interesting thing here is there is no procedure 504 00:37:45,040 --> 00:37:47,740 for un-blacklisting it automatically, or, noticeably, 505 00:37:47,740 --> 00:37:49,200 verifying the one who got blacklisted. 506 00:37:49,620 --> 00:37:53,460 So by talking to a consultant who's usually setting up 507 00:37:54,040 --> 00:37:56,100 enterprise servers, he told us, 508 00:37:56,160 --> 00:37:58,760 see, we had this problem before. 509 00:37:58,980 --> 00:38:00,960 So they had a test system and a real system 510 00:38:00,960 --> 00:38:02,600 and they turned them both on. 511 00:38:02,760 --> 00:38:05,600 And then they didn't have BlackBerry for a week 512 00:38:05,600 --> 00:38:07,120 and they tried to figure out what's wrong. 513 00:38:07,360 --> 00:38:09,320 They just couldn't get connection to RIM. 514 00:38:09,440 --> 00:38:11,320 And after a week, they called RIM and they're like, 515 00:38:11,480 --> 00:38:12,440 yeah, you're blacklisted. 516 00:38:13,120 --> 00:38:14,580 We could white list you again. 517 00:38:15,000 --> 00:38:16,880 But there is no notification procedure. 518 00:38:17,740 --> 00:38:18,960 If you play this trick to someone, 519 00:38:19,440 --> 00:38:21,160 they don't have email for a week or two. 520 00:38:24,900 --> 00:38:26,780 Protocol-based attacks, on the other hand, 521 00:38:26,800 --> 00:38:28,260 can also have, as I said, vulnerabilities. 522 00:38:29,040 --> 00:38:31,300 Unfortunately, the protocol is not very powerful. 523 00:38:33,320 --> 00:38:37,180 But even in a simple protocol, they manage to fuck it up. 524 00:38:37,380 --> 00:38:41,280 So the string fields have a length field. 525 00:38:41,460 --> 00:38:43,360 And this length field has an integer overflow. 526 00:38:43,760 --> 00:38:47,720 So if you put a length value of minus five in there, and you're 527 00:38:47,740 --> 00:38:49,380 going to connect to your enterprise server 528 00:38:49,380 --> 00:38:51,540 and send this packet, then the enterprise server 529 00:38:51,540 --> 00:38:55,460 is running in loops and taking 100% of you and stuff. 530 00:38:57,580 --> 00:38:59,820 Since we have clear text pin messages 531 00:38:59,820 --> 00:39:03,500 and we know how to send them because we talked to protocol, 532 00:39:03,800 --> 00:39:04,760 we can now spam people. 533 00:39:05,160 --> 00:39:09,060 So we can go sequentially through all the pins 534 00:39:09,060 --> 00:39:12,360 that are on the planet and just send everyone a message. 535 00:39:13,120 --> 00:39:17,340 And since it's clear text, we can also just spoof the sender. 536 00:39:17,400 --> 00:39:17,720 OK. 537 00:39:17,740 --> 00:39:21,280 So RIM is actually coming up with a new version 538 00:39:21,280 --> 00:39:25,840 of the handheld software that's allowing you to block clear text 539 00:39:25,840 --> 00:39:28,420 messages because there's, right now, no other way 540 00:39:28,420 --> 00:39:30,100 to prevent spam from happening. 541 00:39:32,640 --> 00:39:36,180 Enterprise server, this is how this enterprise server 542 00:39:36,180 --> 00:39:36,820 looks in detail. 543 00:39:37,060 --> 00:39:40,140 So you have the central machine running on Windows, 544 00:39:40,340 --> 00:39:43,580 having a dispatcher, MDS, alert service, attachment service, 545 00:39:43,800 --> 00:39:46,120 policy service, management software hanging off. 546 00:39:46,220 --> 00:39:47,200 And you have a connector. 547 00:39:47,960 --> 00:39:50,620 And then you have a SQL server down there. 548 00:39:50,880 --> 00:39:53,860 Now, the SQL server turns out to be a really juicy thing. 549 00:39:54,700 --> 00:39:57,440 But of course, if you want to attack something like this, 550 00:39:57,560 --> 00:40:00,180 you go for what's having the biggest attack surface. 551 00:40:01,120 --> 00:40:03,140 In this case, when you send in email, 552 00:40:03,420 --> 00:40:06,360 the highest attack surface is where the email is parsed. 553 00:40:06,940 --> 00:40:10,580 And the attachment service handles the most complex file 554 00:40:10,580 --> 00:40:11,000 formats. 555 00:40:11,180 --> 00:40:12,640 It handles office documents. 556 00:40:12,880 --> 00:40:13,540 It handles images. 557 00:40:13,740 --> 00:40:14,580 It handles zip files. 558 00:40:14,860 --> 00:40:16,680 So this is, of course, where the money is. 559 00:40:16,680 --> 00:40:19,000 And this is where you go attacking it. 560 00:40:20,440 --> 00:40:24,560 First, you look at what are the accounts that the machine 561 00:40:24,560 --> 00:40:26,640 actually, that the software actually needs. 562 00:40:26,960 --> 00:40:29,220 Now, here we see it needs local lock-on, 563 00:40:29,340 --> 00:40:31,200 lock-on as a service, local admin. 564 00:40:31,380 --> 00:40:34,580 It needs read-only administration of the entire Exchange system. 565 00:40:35,000 --> 00:40:38,600 And it needs read-write administrative access 566 00:40:38,600 --> 00:40:42,140 on the Exchange mail store in case of Exchange installation. 567 00:40:42,600 --> 00:40:45,500 So once you own this thing, this is what you get for free. 568 00:40:47,660 --> 00:40:52,220 The SQL Server turns out to be the really easiest way 569 00:40:52,220 --> 00:40:53,800 to break into an enterprise server, 570 00:40:54,020 --> 00:40:55,940 especially if you are an internal attacker. 571 00:40:57,360 --> 00:40:59,780 With Domino, for example, it's not 572 00:40:59,780 --> 00:41:02,020 set up for integrated authentication, 573 00:41:03,200 --> 00:41:05,880 meaning that it would use the domain accounts of Windows. 574 00:41:06,140 --> 00:41:08,900 But it's actually using username and password combination. 575 00:41:09,300 --> 00:41:12,400 It contains tables with individual messages 576 00:41:13,000 --> 00:41:14,600 and the emails, all in clear text. 577 00:41:14,880 --> 00:41:16,500 It contains a table that has 578 00:41:16,500 --> 00:41:19,300 the SRP authentication key in clear text, 579 00:41:19,520 --> 00:41:20,420 sitting in a database. 580 00:41:21,180 --> 00:41:23,700 It contains tables with all the device keys. 581 00:41:23,880 --> 00:41:25,960 That's the keys that a device is used for encryption. 582 00:41:27,040 --> 00:41:29,980 The previous one, the last one, just in case you lost it, 583 00:41:30,060 --> 00:41:32,180 and the new one that's going to be sent out to the device. 584 00:41:33,880 --> 00:41:37,640 And those keys can also be used for the traffic decryption. 585 00:41:38,120 --> 00:41:40,600 And the best thing about it, in a default installation, 586 00:41:40,780 --> 00:41:42,800 it has a username of SA and no password. 587 00:41:43,760 --> 00:41:46,440 So you can internally just connect 588 00:41:46,440 --> 00:41:49,420 to your SQL server and get everything off it 589 00:41:49,420 --> 00:41:50,440 without much hacking. 590 00:41:51,320 --> 00:41:53,940 Once you've got the SRP authentication key, 591 00:41:54,060 --> 00:41:56,480 and this is how it looks like, I told you it looks like a CD 592 00:41:56,480 --> 00:41:59,400 key, this is the transform that you 593 00:41:59,400 --> 00:42:02,780 need to do before using it in decrypting traffic. 594 00:42:05,120 --> 00:42:08,000 There's one very nice thing about the updates 595 00:42:08,000 --> 00:42:09,920 that RIM rolls out for the enterprise server. 596 00:42:10,120 --> 00:42:12,640 If you get an enterprise server in a default installation 597 00:42:13,740 --> 00:42:16,200 release version, it, of course, doesn't 598 00:42:16,200 --> 00:42:16,820 have any symbols. 599 00:42:17,880 --> 00:42:21,340 But once you install a service pack or a hotfix, 600 00:42:21,460 --> 00:42:23,440 every file that got touched by the hotfix 601 00:42:24,120 --> 00:42:26,960 is actually coming, including its PDB file. 602 00:42:27,200 --> 00:42:30,420 So you get the debug symbols for your server software. 603 00:42:30,760 --> 00:42:33,820 And that makes your IDA installation really happy. 604 00:42:34,280 --> 00:42:36,420 And of course, you can bindiff the whole thing 605 00:42:37,300 --> 00:42:39,260 and find the bugs they already fixed. 606 00:42:40,700 --> 00:42:42,300 Looking at the code and the style, 607 00:42:42,540 --> 00:42:44,820 it's actually pretty good C++ code. 608 00:42:45,680 --> 00:42:46,180 It's actually pretty good C++ code. 609 00:42:46,180 --> 00:42:48,440 They use massively STLs, so there's not 610 00:42:48,440 --> 00:42:50,100 a lot of string copy going on. 611 00:42:52,580 --> 00:42:56,780 The way they implement stuff is like they triple and double 612 00:42:56,780 --> 00:42:57,480 check everything. 613 00:42:57,860 --> 00:43:00,120 So the receiving function is actually 614 00:43:00,120 --> 00:43:02,480 like doing a select, calling a function, doing a select, 615 00:43:02,520 --> 00:43:04,900 calling a function, doing a select, and then finally 616 00:43:04,900 --> 00:43:06,060 receiving one byte. 617 00:43:07,040 --> 00:43:09,440 And they're generally using signed integers. 618 00:43:09,800 --> 00:43:11,820 So when you look for vulnerabilities there, 619 00:43:11,900 --> 00:43:12,800 look for a signedness box. 620 00:43:15,260 --> 00:43:15,820 Libraries. 621 00:43:15,820 --> 00:43:19,120 They used for the Office document parsing, 622 00:43:19,120 --> 00:43:20,540 it's iStream classes. 623 00:43:20,960 --> 00:43:26,580 Then they use Microsoft MSHTML4 for HTML document parsing. 624 00:43:26,920 --> 00:43:29,800 MSHTML SDK is installed. 625 00:43:30,020 --> 00:43:32,380 And there is a parsing product that 626 00:43:32,380 --> 00:43:35,240 used to be a company called Horizon and then got bought 627 00:43:35,240 --> 00:43:37,540 by RIM that's actually handling all the parsing 628 00:43:37,540 --> 00:43:39,920 for the other attachment classes. 629 00:43:41,040 --> 00:43:44,140 It's parsing PDF and WordPerfect natively. 630 00:43:45,820 --> 00:43:48,960 And it's parsing images and zip files. 631 00:43:49,640 --> 00:43:52,960 The version we looked at, and by now it's actually updated 632 00:43:52,960 --> 00:43:54,980 and they're running a recent ZLib, 633 00:43:55,080 --> 00:43:57,840 but the version we looked at is using ZLib. 634 00:43:57,920 --> 00:44:02,740 And zip decompression was actually code taken 635 00:44:02,740 --> 00:44:05,560 from the contrib directory of ZLib. 636 00:44:05,700 --> 00:44:08,080 So everything else is nice and tidy C++. 637 00:44:08,320 --> 00:44:10,960 And then out of the sudden you open IDA 638 00:44:10,960 --> 00:44:15,680 and you see one thing that goes like just straight C code, 639 00:44:15,720 --> 00:44:15,800 right? 640 00:44:15,820 --> 00:44:16,660 For pages and pages. 641 00:44:16,960 --> 00:44:19,420 And you're like, oh, that doesn't look right. 642 00:44:19,580 --> 00:44:21,060 And it turns out it's just copy and paste. 643 00:44:22,400 --> 00:44:23,920 And then there is GraphicsMagick. 644 00:44:24,640 --> 00:44:29,420 GraphicsMagick is used for image parsing. 645 00:44:29,600 --> 00:44:33,160 And it's a spin off from ImageMagick. 646 00:44:33,260 --> 00:44:35,880 And it's fully linked and including debug code 647 00:44:35,880 --> 00:44:37,820 and supports a lot of formats. 648 00:44:38,960 --> 00:44:42,440 And this is what you can do essentially 649 00:44:42,440 --> 00:44:45,640 is officially supported our PNG. 650 00:44:45,640 --> 00:44:47,300 And I think GIF and stuff. 651 00:44:47,900 --> 00:44:52,580 But you can actually circumvent the main horizon 652 00:44:52,580 --> 00:44:54,520 parser that's trying to fingerprint the file. 653 00:44:54,660 --> 00:44:56,420 It's just looking for the first three or four bytes. 654 00:44:56,900 --> 00:44:58,760 Once you got around that, then you 655 00:44:58,760 --> 00:45:02,360 can feed all those formats into GraphicsMagick 656 00:45:02,360 --> 00:45:04,200 because GraphicsMagick is trying to figure out 657 00:45:04,200 --> 00:45:06,180 what file format it is for its own 658 00:45:06,180 --> 00:45:07,520 following a different pattern. 659 00:45:09,120 --> 00:45:12,140 The changelog, actually I'm going to skip that. 660 00:45:12,280 --> 00:45:14,940 It just shows that the guys don't know what they're doing. 661 00:45:16,940 --> 00:45:20,620 Essentially, there have been the expected heap overflows 662 00:45:20,620 --> 00:45:23,900 like image width by image height multiplied by 32. 663 00:45:24,480 --> 00:45:30,960 If someone puts in like 4.2 billion as width and five 664 00:45:30,960 --> 00:45:33,000 as a height, the multiplication overflows. 665 00:45:33,140 --> 00:45:34,940 You allocate zero amount of memory. 666 00:45:35,140 --> 00:45:36,660 And then you copy lots of data over that. 667 00:45:36,800 --> 00:45:37,660 And it's called a heap overflow. 668 00:45:37,840 --> 00:45:38,500 And you own the machine. 669 00:45:40,340 --> 00:45:42,320 Same for the PNG parser. 670 00:45:44,960 --> 00:45:50,440 As I said, zlib is used in or was used in a non-recent version. 671 00:45:51,180 --> 00:45:52,460 That's by now fixed. 672 00:45:52,620 --> 00:45:55,740 But it was exploitable in this version we looked at. 673 00:45:56,620 --> 00:45:58,340 And then you can do stuff like this. 674 00:45:58,540 --> 00:46:01,280 So you get a asshole. 675 00:46:01,440 --> 00:46:04,060 That's the international ASCII symbol 676 00:46:04,060 --> 00:46:05,260 of an asshole on the internet. 677 00:46:07,160 --> 00:46:10,020 Sending a evil message with an evil attachment 678 00:46:10,720 --> 00:46:14,380 to the attachment service, owning the attachment service, 679 00:46:14,380 --> 00:46:15,660 which owns the entire machine. 680 00:46:16,100 --> 00:46:18,520 And then, of course, you don't want to get a shell. 681 00:46:18,680 --> 00:46:20,500 I mean, you can have just a shell. 682 00:46:20,660 --> 00:46:24,140 But what you want to do is you use the existing code 683 00:46:24,140 --> 00:46:27,340 in the server to obtain the SRP key of the database. 684 00:46:27,600 --> 00:46:30,020 And then you use the other existing code in the server 685 00:46:30,360 --> 00:46:33,160 to send your asshole an email containing the key. 686 00:46:34,860 --> 00:46:37,220 Therefore, if you're running an enterprise server, 687 00:46:37,460 --> 00:46:39,660 you better separate the attachment service. 688 00:46:40,000 --> 00:46:43,820 By now, RIM actually put out a white paper that is actually 689 00:46:43,820 --> 00:46:44,960 telling you how to do that. 690 00:46:45,740 --> 00:46:50,440 So that's highly recommended so assholes can not get your keys. 691 00:46:51,940 --> 00:46:55,840 If you have the attachment server running separated, 692 00:46:57,100 --> 00:46:59,680 you have a control channel that's 693 00:46:59,680 --> 00:47:02,560 unauthenticated XML of report 1999, 694 00:47:04,120 --> 00:47:07,740 which is just used for querying the attachment service 695 00:47:07,740 --> 00:47:08,660 and its performance values. 696 00:47:08,940 --> 00:47:13,320 But you can also set the amount of processes that actually 697 00:47:13,320 --> 00:47:14,380 parse attachments. 698 00:47:14,960 --> 00:47:16,900 And someone forget to put in limits there, 699 00:47:17,020 --> 00:47:20,120 so you can set it to zero, which, of course, 700 00:47:20,140 --> 00:47:22,860 makes it a happy, boring, not working attachment service. 701 00:47:23,080 --> 00:47:25,120 Or you can try how many processes 702 00:47:25,120 --> 00:47:28,300 this Windows machine can support at the same time. 703 00:47:28,980 --> 00:47:31,520 Mine made it up to 7,000 and then crashed. 704 00:47:33,400 --> 00:47:35,800 So when you are done with everything else, 705 00:47:35,840 --> 00:47:38,380 then, of course, there's vendor communication. 706 00:47:39,480 --> 00:47:42,880 So in this case, it turns out vendor communication 707 00:47:42,880 --> 00:47:44,180 was a very useful thing. 708 00:47:44,920 --> 00:47:48,840 Although it takes some effort to get together, 709 00:47:50,240 --> 00:47:54,280 we managed to get together like RIM and Phenolite did. 710 00:47:54,440 --> 00:47:58,100 And the result is really good because RIM is reworking the 711 00:47:58,840 --> 00:48:00,680 reworked already the attachment service. 712 00:48:00,980 --> 00:48:03,320 So they're no longer using graphics magic. 713 00:48:04,200 --> 00:48:06,860 They're actually testing all the other attachment services 714 00:48:06,860 --> 00:48:10,320 now to figure out if there are more vulnerabilities in there. 715 00:48:10,880 --> 00:48:12,580 And their customers are actually 716 00:48:13,060 --> 00:48:15,520 doing the right thing and, like, securing the database 717 00:48:15,520 --> 00:48:17,720 and moving the attachment service to a different machine. 718 00:48:20,500 --> 00:48:23,720 Yeah, and after you're done with all that, 719 00:48:23,840 --> 00:48:25,700 then that's the good thing, getting drunk 720 00:48:25,700 --> 00:48:27,040 and printing offensive t-shirts. 721 00:48:28,700 --> 00:48:31,340 I think it's time for questions, if there still are. 722 00:48:32,760 --> 00:48:33,520 Any questions? 723 00:48:35,380 --> 00:48:35,820 OK. 724 00:48:36,940 --> 00:48:38,680 Sorry for giving such a bad talk. 725 00:48:38,900 --> 00:48:41,160 I was just drinking too much over the days. 726 00:48:44,740 --> 00:48:46,140 Thank you. 727 00:48:46,260 --> 00:48:47,600 Thank you.