Okay. So owning the enterprise with the Blackberry. I am Zeon. Some of you here know me as Zeon. I'm also known as Jesse Deguano. I'm a founder and director of professional services and research with Praetorian Global, a consulting company in Northern California. And also a core member and current team captain of Digital Revelation. We're a security research group who actually formed here about five, six years ago, kind of centering around the DEF CON capture the flag originally. And we've done some things since then, but we usually seem to participate in the capture the flag events. So who here uses Blackberry? Who has a Blackberry? Wow. I have a feeling more than that. Lots and lots of people use Blackberries. It's, according to Gartner, they're the market share lead for handhelds. And I thought it was pretty interesting when Research in Motion was going through the whole copyright issue, and there was a potential for an injunction that government and emergency workers were going to be, it seemed like, exempt from that. Because it was critical infrastructure. So I thought it was worth investigating a little bit more as far as the security of it. I'm going to take some time and go over kind of the background of how the Blackberry solution works. In case for anybody who's not familiar with how it does the thing it does, here's a diagram of a typical Blackberry, corporate Blackberry installation. Pretty much. You've got your, you've got your mobile devices here, I apologize, I apologize for I thought that we could get the slides for part of it on both screens. We're going to have a couple demos. So if you can't see very well, I would miss out on the crowd, I apologize. But anyway. So you've got your, your portable, your handheld devices, who, which connect to some wireless carrier, Nextel, or Singular, or whatever your carrier of Yasu choice is. And then you've got this little cloud as if any of you saw FX's talk, he kind of goes into that as well, where you've got a bunch of arrows on the diagrams, but nobody really knows what the RAM network really does. And then that tunnels over the internet to basically your corporate network. So the BEZ and also different elements that are associated with the BEZ lie on your corporate network. BEZ is Blackberry Enterprise Server. There's also the MDS, which is a component of that, the mobile data service and attachment service and different things like that that can either be on one machine or separated into multiple machines. Then I have just, typically the BEZ talks with the exchange box or Lotus or whatever. 05.00 05.00 05.00 depending on your installation. And then basically just whatever other application services and things like that that you provide access to from your Blackberry. This also, typically users have a workstation on the corporate network that as long as it's on the domain and that user has a Blackberry assigned to them, then there's this relationship between when they sync. the BlackBerrys and it does magical stuff that we'll go over later. So to break it down a little bit as far as how that all, how it works, how you can actually access internal applications and internet sites and things like that and your mail and your calendaring and all of that from your BlackBerry. First, the MDS actually creates an outbound TCP connection from inside your network out to RIM. You actually, you have to of course create, allow this by creating firewall rules and then negotiation takes place between RIM's side and your MDS or your BEZ MDS and that creates kind of a persistent tunnel between the BEZ and your, and RIM. That in turn, the BlackBerry, I'll go back for a second, the BlackBerry is of course connected to the wireless carrier and so with, somewhere in that little, that RIM cloud, the mystery network, it gets connected and gets end-to-end encryption between the handheld device and your BEZ and MDS and all of that jazz. So you end up with basically something kind of like this. It's a persistent tunnel through the internet from, from your BEZ out to the internet through RIM's network, through the, the carrier network and to your handhelds. And so basically your handheld then ends up virtually on your internal network, which looks great because you can then access all your internal apps and browse websites that only you could if you're in the office, things like that. Anybody see any problems with that though? Typically handhelds, the security of handhelds, the, the, is usually focused around the data on the handhelds, email, things like that, not what risk it can pose to your internal network. Here we have an always on, always connected, code running device that sits on your internal network. So here's a, just a, you know, simple review of. Of that. I think I skipped a slide basically. So the big problem and, and the reason why we figured that this research was a, a good thing to do and giving a talk, this talk was a good thing to do was to increase the awareness with, with Blackberry users and administrators as to what the dangers, the, the potential dangers could be. And what an attacker could possibly do. With the, the typical Blackberry installation. So it's obviously important to remember that they are computers that sit on your, your network. And in, in your typical IT infrastructure though, they're not thought of that way. They're not thought of and, and controlled in the way that, you know, a VPN or a dial-up solution or something like that would be. So you obviously end up with, with big problems. So we can exploit this problem obviously. That's why we're all here. So there's this app, this little application we threw together called BB Proxy. And what BB Proxy does is first it creates an outbound socket connection from your Blackberry device out to an arbitrary control, attacker controlled host on the intranet. Kind of like that. If you can. Typically, at least from your, from your Blackberry, you can at least browse websites. So if the, if you chose to use port 80 or something like that, then obviously, most likely your, your connection is going to be allowed through. Then from the attacker controlled host, we have a, a listening socket that, that it, it's connected to. And we create, we tell the Blackberry to, to create a subsequent connection. Okay. To a, a second host. And, and the benefit of this is that we can make a subsequent connection now to an internal host. Kind of like that. So now from our attacker controlled host, we can directly talk to a, a machine on the internal network and, and not have to worry about, you know, silly firewalls on, on the perimeter. Okay. Okay. So, I think, yeah, I have a, we'll do a little demo. To just show how that works, what I'm going to do is just start up a, a netcat listener. Hold on one second. Okay. Okay. And this will, this will be kind of like our little internal service. Use your imagination for what do you want it to be. It could be Telnet or SSH or an intranet site or whatever. And on this host, crap, hold on one second. We'll start another listener. This will be our attacker host over here. So we have our attack host here on the Internet on this side and our friendly little intranet site here, here. So what we'll do is, again, just Netcat listener. . . . . . . . . . . . . Now from the Blackberry, we'll fire up BBProxy. Oh, forgot to rename that. And usually . Do you mind questions during the talk or you want them afterwards? No, you can go ahead. So, maybe I missed it, but this is predicated on being able to actually get code to run on the handheld, which requires it to be signed and hashed by RIM, which means they know about it, right? Sure. Well, we'll get to that, actually. You will? Okay. Yes. Cool. Just wanted to make sure that I didn't miss something. Thank you. Oh, no. It's all right, I think. Let's see. . We usually do, don't we? Okay, so, what we get is a helpful little message here that asks to enter the destination host and port in kind of standard fare, so, we're... Okay. Actually, let me kill this first. Sorry. I need to prove that we can't, I can't just connect to that, you know, because we could be cheating. So. . Okay. All right. All right. Okay. All right. Let's see. It's one, two, three, four. So. It'll sit there and... Nothing. Okay. Can we ping it? All right. That's my special ping, actually. . All right. I'll type for real. . . . . . . . Hopefully everybody believes it now. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . just like it was in Interactive Service because it's being proxied through the conduit of the BlackBerry, so. Oh, it's over there. Okay, cool. Okay, back to the presentation. Okay. So now we saw, we can interact now with a Talnet service or anything on the internal network without the silly firewall rules getting in our way. But this is DEF CON, right? I mean, we came here to break stuff, not just to do things that are nice. So we've all heard of Metasploit, I think, probably. . Yeah, the point click route from Spoonum and H.G. Moore and all those folks. Well, now it has BlackBerry flavor. It just basically added a simple function to Metasploit, which will create a listener and wait for an incoming BlackBerry connection. Once it gets that connection, it hands it off to, it stores the connection and will hand it off to whatever exploit calls it. So we're gonna, I'll go over exactly the details of that too. Kind of how easy it is to port exploits over to use it and things like that. So basically. So I'll show a little demo of that. Pretty much the same thing, except now we're actually going to exploit a box, so. Can you clear your screen? Huh? Oh, okay. Clear. Clear? Okay, yeah. Thank you. Better? No problem, sorry. Start up Metasploit. And here. We have over here, our, our little host here happens to be a an unpatched XP box. I know it's not very realistic that there would be on the internal network, a, a vulnerable machine. So, just gonna have to use your imaginations. Okay. Listener function. So it sits and it waits for, uh. Uh, an incoming Blackberry connection. So actually, yeah, key. Um, it's 192.168.100, no, 102.100, and port 1455. Oh, that's right. Okay. So that goes out and connects. And it got the connect. So now we can go ahead and just, uh, set our, our normal options like we would whenever we're exploiting a box. So hold on. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Okay, so now we just exploit. And we've got root. All right, so cool. We can now root boxes on the internal network. Okay, so to port an exploit, to use the file handle that we, the connection, it's actually pretty easy. I'm just gonna walk you through the amount of code that it takes to port your basic kind of vanilla TCP exploit over to it. We use, I used MSASN1, kind of old school exploit, but it's pretty reliable, even though it's one shot. So basically first, we, we set the target to the, let's see, I can't hardly see, okay. So So we listen for the proxy connection. There's a global variable set if the Blackberry listener, the listener function has been invoked. And if we've gotten a connection from that, that's been handed off. It's set to that global variable proxy con. Then from there, instead of doing the, we remove the standard kind of socket build stuff that happens right before an exploit is sent. So the standard kind of socket build stuff that happens right before an exploit is sent. Stuff that actually goes and, and makes a connection to a vulnerable service. And replace it instead with if the, the socket that we got from a Blackberry exists, it sends it through that. Otherwise, it sends it, you know, the normal way. So as you can see, it's pretty straightforward and pretty easy to just port most exploits to this, to use this conduit. We sleep a little bit, just so that it, it gives the, the connect, the second connection a little bit of time to actually make the connection. And then we send our exploit. The limitations with, currently, that we have with the Metasploit patches is that it's only, it's limited to TCP based exploits. Kind of vanilla TCP based. We've run into some problems with, with certain RPC protocols and, and other, you know, we've had those kind of exploits. And it, it would be really easy to port it over to UDP and also to, to make, to let it work with some of those as well, but just haven't gotten around to it yet. So look for an update to these patches. We're going to, I'm going to provide these patches also to Metasploit so that you can play around with it. But check back too. So one cool thing too. It. About this is that we actually have the ability to completely, basically evade all perimeter defenses. Not only just can we talk to machines behind the firewall, but because of the functionality in the BES and MDS, we can, we can really evade IDS sensors on the perimeter as well. We don't actually need to make, to use the MDS to make the, the first connection. Most newer devices. Have a TCP IP stack on them themselves and can make a, a connection from the device side via the carrier's network. So what, it's very easy to, to specify this in code. It's, it's a simple device side equals true or device side equals false in the, the URL for the connection string. So what we can do is we can make a, a, the first connection from the device, directly from the device. And then the second connection via the MDS. Yes. And you're essentially straddling the border because nothing ever actually travels across the, the perimeter other than through the nice and happy encrypted network that goes from your BES to your handheld. A little diagram of how that works. So the Black, the Blackberry itself is, is just going through the carrier network and making. Making the connection to the attacker control box without any, any interaction with the BES itself or, or the MDS. This is doing it just on the device side. Then the second connection is then the one that we, our exploit is going over. Is actually going through the whole, the, what we described earlier, the, through REMS, RIMS network. Through the MDS and into your internal network connection. So it's a lot, basic, it's a little bit of a complex diagram. But here you see the, the first connection out to the attacker control box. And then the second connection going all the way through the RIMS network and the internet and the firewall and through the MDS. And then ascend, and, and connecting to an internal host. So just let, it basically, just like having a machine, a workstation. Just two ethernet connections. One inside your, your internal network and one outside on, directly on the internet. And straddling your perimeter defenses. Kind of like the reason we usually don't allow dual home systems and, and configurations in VPNs. But again, people don't think of this as a, a remote access solution. Okay. So the problem with, with this as far as a viable attack vector. Is that. It, it really requires control, physical control of a device to put your code on the device. And, and run it in order to go out to an attacker control host and etcetera. So the solution to that is a Trojan that you can actually download over the air. And have the users run without seeing anything of course. Just like we all know what a Trojan is. So hot game 2018. 2006 is, has the same functionality of BB proxy. The user only sees the game interface. The tic-tac-toe is our hot game. We have the ability to over the air download. And of course, this is just a proof of concept. So it's fairly limited in function. Just kind of plugged in the, the code from BlackBerry and BB proxy. But obviously you could use a lot more specialized code. Control channels and things like that. Like IRC and also functions to identify kind of the per, the, the internal network structure and that sort of thing. Right now we just have a hard coded host inside. So I'm gonna demo that. Again with our imaginary vulnerable system on the internal network. Okay. Everybody can see? All right. Okay. Okay. Okay. Okay. So hot game 2006. It's actually flippin' sweet. You should check it out. Okay. So we got the connect. And Temtel's gonna play tic-tac-toe for us. Hold on. Well. . Hold on. Maybe Temtel won't be playing this for us. All right. We're back. . Our configs are still the same. So. . .