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. 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. 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. Here's the reason why. There's actually, yeah. The core reason behind it is that it's a complex system. 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. 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. Yeah. I'm not saying that beating up people is bad. I'm saying that you should not go for the obvious part of the system, because there has to be more to it. Obviously, if you have a device like a BlackBerry, there has to be some infrastructure existing that this thing is running on. It's not a stand-alone system. So, what you see is also probably the thing that whoever is watching this is probably going to say, oh, I don't know. I don't know what this thing is doing. 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. So, basically, the defending side was probably also focusing on what everyone sees, what everyone has in hand, in this case the device. You have to look at the bigger picture to really see what is a promising attack vector. The problem is, like, if you have a complex system that contains lots of stuff, you need to have a complete system. stuff, like many servers, many infrastructure elements, and so on, and you're not a three-letter agency, then you don't have unlimited resources. We all have lives, like even hackers have to sleep and have to get drunk and stuff. So we don't have unlimited resources for research. So we have to focus on something, and that's better something that gets you somewhere. Also, you need additional resources apart from yourself and your brain, which is required for hacking, just for the record. You need hardware. In the case of BlackBerrys, you actually obviously need a BlackBerry. You need software, possibly. You need infrastructure and accounts. So again, in the case of BlackBerrys, you have to have an account on some system that you can forward your email to. Of course, you need to obtain this account. I'm not saying you need to buy it. You need to obtain an account that you can work with so you can actually see how the system works. Getting what you need might actually take time, and there are consequences to that, which should be considered before you go on. So can you afford to invest money? Are you a poor asshole or not? How much can you afford? Okay. Are you crossing legal lines if you're getting stuff? When we got our hands on the software to look at, like the enterprise server, it wasn't strictly legal because we didn't strictly buy it. The next very important thing is, can you afford that your potential target knows that it's under attack? For example, if you're looking for vulnerabilities in, let's say, Gmail, and you're writing a fuzzer for email content. And you're sending lots of crappy emails to Gmail, and Gmail goes down, it is fairly likely that they, after like the fifth or sixth system crash, start investigating. So your target in this case would know it's under attack. And all that, like especially the target knowing to be under attack and crossing the legal lines, there's also the question of, do you care? Does it make any difference to you? So the big picture. The big picture for RIM is you start with identifying all components in the system. So first you're getting official data. That's the big picture that RIM puts out in documents. So you have handhelds, like the native handhelds, and you have third party handhelds running RIM stuff. You have several data networks, GSM and other mobile networks. You have the internet. You have a firewall. Some hole in the firewall, of which you don't actually know what the hole is. And then you have all the server infrastructure on a potentially corporate site. So you have the wireless services. You have like the email servers on the left. You have application servers, web application, all that. When you see stuff like this. When you obtain documentation. About. About your potential target. Go ahead and build an abstract view of that. Like don't eat the data you're fed. Just try to get your own pictures. So that's the abstract idea of a RIM network set up here. So you have the evil Blackberry to the right. Then you have the GSM network. We are German, so we are living in like GSM land. You have provider side servers. They're obviously somehow specialized. It's something related to RIM. Then you have the RIM secret network over here. And the border systems. They're called SRP. In different countries, UK, Canada, somewhere else. Then you have a corporate network site. With an enterprise server. And the enterprise server management software to that. So that's again something in a system. There's always some part of management software. Because none of the software you can buy today is actually carefree. Most of it is actually quite a hassle to get to work. And there's always some poor guy administrating this. And he's always having some poor Windows GUI system. And that needs to be considered as well. Because it is a potential tag vector. And then you have a connection from the corporate networks somehow over to RIM. So when you build a RIM server. break this down then you get like handheld devices mobile network rim network internet based communication which is this little communication line that we've seen here and you potentially want to know what the protocols are you have a blackberry enterprise server the connectors to the mail servers and you have the management tools so you can reclassify them because unless you you know exactly what you're dealing with you need to classify the elements you need to find out what you're actually looking at so the handheld devices for example unembedded system it's obviously proprietary hardware it has a real-time operating system because that's required to run a DSM engine and it obviously has Java because it like the applications are slow you have a mobile network GSM 2.5 or 3 G GSM network you have a rim network of which you don't know anything but it's fairly likely that it's IP based you have the internet-based communication which is certainly gonna be IP but there is some proprietary stuff going on in there you have the enterprise server connectors and connectors which is like windows-based service software it's closed source but it is a windows environment so we know how to debug it how to disassemble it and the same holds true for the management tools and then you need to look at the accessibility like can you get your hands on this stuff handheld devices for example well it's doable there as I said you can like take them off people you don't like or you just buy one the mobile network the GSM network while it's obviously a well-defended network it is hard but it is possible to break into a GSM network and take it over that would be an attack vector the rim network is probably a lot more doable to get in like do you just have a bunch of old days sitting around breaking into the rim network but it is illegal internet-based communication accessibility is there so if you have a working installation of an enterprise server you can sniff obviously the traffic and start reverse engineering it the blackberry enterprise server and connectors accessibility is there there are tons of companies running this stuff this is why we are looking at it so you just call someone up and friendly ask can I have the city please and I'm like accessibility in more details is idea so disassembling it that's doable and the same for the management tools and then the most interesting part of that is what's the impact like you sit down consume whatever drugs you really like and imagine you are already done And think of what's the impact if I, like on this attack vector, are successful and implement a successful attack. So for the handheld devices, for example, it means you potentially have information disclosure in the form of reading some CEO's email. And potentially you have remote control over the device. So maybe you can put up point screen safers or something. But it is an attack that's targeted on a single user. Definitely because it's a single device. For the mobile network, well, you could do a lot of stuff in the GSM network. But then again, yeah, that's maybe just a little bit too big an attack vector just to own a BlackBerry. For the RIM network, if you take over the RIM network or the core systems, you become RIM. So you can do whatever you want. For the internet-based communication, if you successfully hack that and reverse engineer that, then you can implement the protocol. So you can talk to RIM. And you can talk to the enterprise service, which enables you to, for example, do brute force attacks. We still don't know if there's a password in this protocol or not. But if you talk to protocol, then you actually have the ability to write your own tools and to automate your attacks. 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. And you're owning a centralized... It's a locally placed server, which sounds pretty useful. And for the management tools, you can modify the policies that are pushed on the handhelds. You can send messages to everyone, whatever that's worth. And you could remotely install software on the handhelds. 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. And essentially... You can remotely place every single item and then look at the connections, how those things are connected to each other. And then it's absolutely clear that you should not just concentrate on the handheld, but you should concentrate on the enterprise server. Now, after all this abstracting short summary, why you should go for the enterprise server. The enterprise server is sitting in the corporate network right next to the mail server. Because it needs to be connected to the mail server. 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. 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. And if you own it, then you get, like, everything. So, after you have the abstract picture, get the details. So, it is important to figure out if, like, how feasible is a attack? Like, sending email is very feasible. Breaking into a GSM network, probably not. What you need, we already covered that, and how illegal it is. And even here... 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. 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. You get a developer SDK. The current version is for Java. The older version is for C. So, it's obviously more interesting, but it was limited to people in the U.S. and Canada. And that's, again, an accessibility question. 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. So, here again, accessibility is not always a big problem. Then we have desktop. There is desktop software available. There is sync software. And there's third-party code. There are products that you can put on your Blackberry. 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. And the more powerful the product is, the more features this product offers. The more interfacing into the operating system. So, the operating system of the handheld has to be there. And by looking at the third-party product, you can actually figure out how much there is. 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. The encapsulation and how variable the protocol is, is very important for finding vulnerabilities in it. So, that's a big question. 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. So, you have potentially interfacing problems between one layer and the other. We've all seen that in other products happening. If it's a flat protocol design, like one huge structure, then the code for that is probably looking the same. And it's probably written by one crazy person. And it's probably written by one crazy Russian. And no variable has more than two characters and stuff. Which indicates different bug classes. The same for the variableness of the protocol. Like, if you have multiple length fields, and it can be, like, you have, yeah, length fields are really important. Or you have different encodings. Then there's lots of stuff that can go wrong. For example, on SAP, the protocols are all fixed size. Like, everything is pretty much like eight characters wide. You don't find anything. It overflows in something that's fixed to eight characters. And then, of course, you have to look at how the software is designed. Like, is it running in user land? Is it running kernel? Is it running system service? How much components, how many components are you looking at? And especially, what are those components doing? Again, if you have a piece of software with open support in user land, and you have another piece of software that opens support as a system service, then you should look at the one opening a port as a system service. Because if you own it, then you get higher privileges. And what are the building blocks of this software? What libraries are used? Who developed which component? Is everything, like, by this one vendor or not? What programming language is used? For example, in reverse engineering, it really sucks. If you take a service software apart, and then you realize it's Delphi, because IDA is just, like, failing on you, and nothing works anymore, and all your tools don't work anymore. So, and of course, where's the interesting stuff stored? Like, does it have its own crypto containers, or does it just throw everything into registry and blah, blah, blah? More things to look for is history. How old is this stuff? Like, where does the component come from? When was the first release? Was there any major rewrite? Check the press releases. They're gonna tell you. Someone walked up yesterday to me and said, another very interesting source is, you should go to the, if they, like, have patents for their stuff, especially for the communication protocols and stuff, then you can go to the public website and download the patents and actually see how this whole thing works. And the documentation. Like, what are the setup requirements? What is troubleshooting officially? How is it supposed to work? And what are people actually using? Like, check the forums. See if some lame-ass administrator said, yeah, this is the troubleshooting procedure, but it never works, so I just reboot the box. Or this and that procedure actually does work, because it, again, tells you who are you dealing with. If those people managing the systems are, let's put it this way, less talented, then it's less likely that they're gonna notice another administrative account on their system. Step three, work. This is just, yeah, there's nothing to say about that. It has to be done. So reverse engineering takes time. Taking apart networks and protocols takes time. So, and then you get results. So the first thing that we did with the handheld was stripping it. It's pretty much the same approach as, like, getting married. You know, you want to see what you get. So... So this is the back view. It actually has an... It actually has a... What's the phone? What's going on here? ... What's going on? ... The thing is, all this work that's going on, Bye-bye. Bye-bye. Applause for the guys. Come on. Got a lot of DEF CON. So. That was cool. So essentially. By taking the stuff. Taking the covers off. We actually figured out. What CPU is in there. Because like the. The CSDK that we downloaded. And we wanted to work with. Indicated that it's actually an x83. x86 is the CPU name. Turns out it's actually ARM. So they're running on an ARM CPU. In analog. Devices chip. And then there's another. Very interesting part on this picture. We suspected that. Where's my laser pointer? Okay. So like next to the. You see where the GSM card is supposed to go in. Next to that. There are a few little pins. Our suspicion was. This might actually be. JTEC. So. It is again a possible attack vector. That's the back side. No the front side. That's pretty boring. So as I said. Turns out it's ARM. It actually has different. Real time operating system kernels. So. When we took the first one apart. We found a KDAC AMX 4 kernel. KDAC is a company that sells real time operating system kernels. And when we later talked to. RIM and it was a big surprise to them. And I'm like wait a minute. It's your product but it turns out like every single device. Actually might have its own kernel. So this again shows you that the device as an attack vector is probably not very good. Because we have a situation like with Cisco where every single device has a different core. 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. Own. One type one series of devices and when they come out with a new series of devices your exploit doesn't work anymore. 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. And it's actually a real PE COF format like on Windows like EXE and DLL files just compiled for ARM. And then everything else like the Java virtual machine are modules in the form of DLL. 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. The Java virtual machine as I said is loaded as one. 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. It is actually made by RIM. So. 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. For example. 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. 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. Now how that works is. You write a piece of code and then the development environment is going to. Take a hash of your. 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. The idea behind this is where our suspicion is that they say well if we ever have a binary. 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. Which works in a world that doesn't have stolen credit cards. So. Yeah. 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. Also the firmware is checked. 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. 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. To not take. 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. We found vulnerabilities. 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. 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. 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. Of course finding JTAC on a BlackBerry is an interesting thing because you called circumvent the signature. Checking and get your own software on it. Looking for JVM box looking for Bluetooth vulnerabilities and like accessing memory on the device via the loader. 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. 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. So I think there is still some something at miss with the with the electronics. The protocols I'm going to skip a bit over them because we're running out of time I guess. They're not too interesting actually. 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. 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. Integers. 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. 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. This is your SRP up codes this is also stuff that still needs to be played with because we didn't. So far there are many things that we find fairly interesting especially. Stuff like config or info. That's the communication between the enterprise server and rim so. Yeah I assume you cannot remotely config rim but probably there is some functionality in there that still it's worth playing with. This is the session set up when an enterprise server gets online and wants to talk to him it goes ahead and like. The. Client in this case the enterprise server talks to the rim server and sets a system ID and gets a server challenge back. And then sets a client challenge over there and it gets HMAC. As such a one. Transformed SRP key. And that's basically the authentication so what happens here is you have a thing that's called SRP key. That you have to configure in the enterprise server. It. Looks like the CD key it's actually like it's going to ask you during the installation please enter the SRP key here. Which looks like XXX-XXX and so on and then when the server is up and running and set up. Then you see. 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. 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. 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. Which will enable you to like become this company in. When you talk to him and like take over their entire email communication. 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. We receive the SRP key server times in this presentation. But the most interesting thing is just a lack of communication or wrong communication of rim site to their customers it is. There's. Secret it is their password. Then in a protocol for a message you have to get way message envelope that's the routing information so you have the source. Sender and the destination. 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. Okay the rim guy doesn't know. It's actually the device number so every every device. 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. 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. This is. This is the format I'm going to skip that it's in the slides in case someone wants to heck with them. 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. 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. It's really. Really good but you need yes or peaky for that. 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. But if you're sending a pin message from an enterprise server to a blackberry then it's not encrypted. 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. and it's not encrypted. So if a third party product tells you there is encryption going on because we're using pin messages, you should question that. So this is the CMIME format. So the whole thing looks like this. You have the IES or DES encryption. You have the key ID in clear text. You have the session key encrypted with the device key. The message is compressed and encrypted with a session key. Actually, the compression is quite something weird. We looked at it. I'm not 100% sure we figured out what it is, but it's not something standard. And we successfully implemented a packet dump message. Hi. Bye, honey. Time difference. She's from Germany. So we implemented a message decryption script. Huh? Beer, free beer. So if you have the SRP key, if you successfully stole an SRP key of someone, then we can give you a pro script so you can read someone's email. A word about the crypto. Apparently, this crypto is pretty good. It's certified. We looked at the implementation. The implementation looks pretty solid on the enterprise server as well as on the handheld. We are no crypto people, so the crypto details need to be revised and retaked by someone else. This is how the dumps look decoded. Here you also see the I and the S in the message chunks. And you see the passive data. pin messages, the pin IDs, sender and receiver, which of course enables you then to do traffic analysis. If you are reading someone's messages, someone's traffic, like their SMTP traffic and their SRP traffic, meaning you own their border router or something, and we have here, that's doable, then you can actually relate. You send in an email to ceo at evocompany.com and you see a pin message going out to a certain pin. You repeat that three times and it's always going out to the same pin. You know the product identification number of the CEO's device, which might be useful in later attacks. Protocol-based attacks. In the SRP session setup, you can, of course, if you have software, you can, of course, connect to someone else's SRP key, let's say from, as I mentioned, from Googling for their presentations, you can, of course, connect to them and say, hi, now I'm this company. What's gonna happen is that both sides, first of all, you have to make the other connection to drop, but that's easy, we can do that. For example, TCP window slipping or reset storms, you can drop a TCP connection. Then you connect and then you are this company. And you get their email. If you have a war, because the server is trying to reconnect as well, then you're causing a routing problem because RIM cannot decide which one of you two is the right one. So it cannot decide how to send the messages or where to send the messages. So what happens if you do that more than five times, this SRP key gets blacklisted. The interesting thing here is there is no procedure for un-blacklisting it automatically, or, noticeably, verifying the one who got blacklisted. So by talking to a consultant who's usually setting up enterprise servers, he told us, see, we had this problem before. So they had a test system and a real system and they turned them both on. And then they didn't have BlackBerry for a week and they tried to figure out what's wrong. They just couldn't get connection to RIM. And after a week, they called RIM and they're like, yeah, you're blacklisted. We could white list you again. But there is no notification procedure. If you play this trick to someone, they don't have email for a week or two. Protocol-based attacks, on the other hand, can also have, as I said, vulnerabilities. Unfortunately, the protocol is not very powerful. But even in a simple protocol, they manage to fuck it up. So the string fields have a length field. And this length field has an integer overflow. So if you put a length value of minus five in there, and you're going to connect to your enterprise server and send this packet, then the enterprise server is running in loops and taking 100% of you and stuff. Since we have clear text pin messages and we know how to send them because we talked to protocol, we can now spam people. So we can go sequentially through all the pins that are on the planet and just send everyone a message. And since it's clear text, we can also just spoof the sender. OK. So RIM is actually coming up with a new version of the handheld software that's allowing you to block clear text messages because there's, right now, no other way to prevent spam from happening. Enterprise server, this is how this enterprise server looks in detail. So you have the central machine running on Windows, having a dispatcher, MDS, alert service, attachment service, policy service, management software hanging off. And you have a connector. And then you have a SQL server down there. Now, the SQL server turns out to be a really juicy thing. But of course, if you want to attack something like this, you go for what's having the biggest attack surface. In this case, when you send in email, the highest attack surface is where the email is parsed. And the attachment service handles the most complex file formats. It handles office documents. It handles images. It handles zip files. So this is, of course, where the money is. And this is where you go attacking it. First, you look at what are the accounts that the machine actually, that the software actually needs. Now, here we see it needs local lock-on, lock-on as a service, local admin. It needs read-only administration of the entire Exchange system. And it needs read-write administrative access on the Exchange mail store in case of Exchange installation. So once you own this thing, this is what you get for free. The SQL Server turns out to be the really easiest way to break into an enterprise server, especially if you are an internal attacker. With Domino, for example, it's not set up for integrated authentication, meaning that it would use the domain accounts of Windows. But it's actually using username and password combination. It contains tables with individual messages and the emails, all in clear text. It contains a table that has the SRP authentication key in clear text, sitting in a database. It contains tables with all the device keys. That's the keys that a device is used for encryption. The previous one, the last one, just in case you lost it, and the new one that's going to be sent out to the device. And those keys can also be used for the traffic decryption. And the best thing about it, in a default installation, it has a username of SA and no password. So you can internally just connect to your SQL server and get everything off it without much hacking. Once you've got the SRP authentication key, and this is how it looks like, I told you it looks like a CD key, this is the transform that you need to do before using it in decrypting traffic. There's one very nice thing about the updates that RIM rolls out for the enterprise server. If you get an enterprise server in a default installation release version, it, of course, doesn't have any symbols. But once you install a service pack or a hotfix, every file that got touched by the hotfix is actually coming, including its PDB file. So you get the debug symbols for your server software. And that makes your IDA installation really happy. And of course, you can bindiff the whole thing and find the bugs they already fixed. Looking at the code and the style, it's actually pretty good C++ code. It's actually pretty good C++ code. They use massively STLs, so there's not a lot of string copy going on. The way they implement stuff is like they triple and double check everything. So the receiving function is actually like doing a select, calling a function, doing a select, calling a function, doing a select, and then finally receiving one byte. And they're generally using signed integers. So when you look for vulnerabilities there, look for a signedness box. Libraries. They used for the Office document parsing, it's iStream classes. Then they use Microsoft MSHTML4 for HTML document parsing. MSHTML SDK is installed. And there is a parsing product that used to be a company called Horizon and then got bought by RIM that's actually handling all the parsing for the other attachment classes. It's parsing PDF and WordPerfect natively. And it's parsing images and zip files. The version we looked at, and by now it's actually updated and they're running a recent ZLib, but the version we looked at is using ZLib. And zip decompression was actually code taken from the contrib directory of ZLib. So everything else is nice and tidy C++. And then out of the sudden you open IDA and you see one thing that goes like just straight C code, right? For pages and pages. And you're like, oh, that doesn't look right. And it turns out it's just copy and paste. And then there is GraphicsMagick. GraphicsMagick is used for image parsing. And it's a spin off from ImageMagick. And it's fully linked and including debug code and supports a lot of formats. And this is what you can do essentially is officially supported our PNG. And I think GIF and stuff. But you can actually circumvent the main horizon parser that's trying to fingerprint the file. It's just looking for the first three or four bytes. Once you got around that, then you can feed all those formats into GraphicsMagick because GraphicsMagick is trying to figure out what file format it is for its own following a different pattern. The changelog, actually I'm going to skip that. It just shows that the guys don't know what they're doing. Essentially, there have been the expected heap overflows like image width by image height multiplied by 32. If someone puts in like 4.2 billion as width and five as a height, the multiplication overflows. You allocate zero amount of memory. And then you copy lots of data over that. And it's called a heap overflow. And you own the machine. Same for the PNG parser. As I said, zlib is used in or was used in a non-recent version. That's by now fixed. But it was exploitable in this version we looked at. And then you can do stuff like this. So you get a asshole. That's the international ASCII symbol of an asshole on the internet. Sending a evil message with an evil attachment to the attachment service, owning the attachment service, which owns the entire machine. And then, of course, you don't want to get a shell. I mean, you can have just a shell. But what you want to do is you use the existing code in the server to obtain the SRP key of the database. And then you use the other existing code in the server to send your asshole an email containing the key. Therefore, if you're running an enterprise server, you better separate the attachment service. By now, RIM actually put out a white paper that is actually telling you how to do that. So that's highly recommended so assholes can not get your keys. If you have the attachment server running separated, you have a control channel that's unauthenticated XML of report 1999, which is just used for querying the attachment service and its performance values. But you can also set the amount of processes that actually parse attachments. And someone forget to put in limits there, so you can set it to zero, which, of course, makes it a happy, boring, not working attachment service. Or you can try how many processes this Windows machine can support at the same time. Mine made it up to 7,000 and then crashed. So when you are done with everything else, then, of course, there's vendor communication. So in this case, it turns out vendor communication was a very useful thing. Although it takes some effort to get together, we managed to get together like RIM and Phenolite did. And the result is really good because RIM is reworking the reworked already the attachment service. So they're no longer using graphics magic. They're actually testing all the other attachment services now to figure out if there are more vulnerabilities in there. And their customers are actually doing the right thing and, like, securing the database and moving the attachment service to a different machine. Yeah, and after you're done with all that, then that's the good thing, getting drunk and printing offensive t-shirts. I think it's time for questions, if there still are. Any questions? OK. Sorry for giving such a bad talk. I was just drinking too much over the days. Thank you. Thank you.