Okay, hi there everyone, thanks for coming along. This talk's called MQ Jumping. For those of you who are not aware of what it's about, I'm going to be talking about IBM's WebSphere MQ software. Now, for those people who were at DEF CON last year, they'll know that I talked about some crazy IBM networking attacks, looking at some old-fashioned protocols. I was intending to actually continue looking at them, but as any pen-testers out there will know, a client comes along with a request to look at some software, and you kind of get sidetracked from what you originally thought you were going to be doing. And it just so happened that the client actually asked me to look at WebSphere MQ. So, it wasn't like I actually picked some of their IBM products and said, right, I'm going to have a go at that. It's more a reflection of the fact that the businesses we work for out there are running IBM technology, and they asked me to look at it. So, for those of you who don't know who I am, my name is Martin Rooks. I work for MWR Info Security over in the UK. And I don't have a background in IBM computing at all. I've approached this subject purely as a pen-tester and a security consultant. I got asked by a client to look at some software, and then just started taking it apart the same way that I'm sure many of you guys out there would do. So, I'm going to talk about IBM. And just so I can try and understand what kind of audience we've got here, can I get a show of hands as to who here has MQ on their network, admins it, runs it? Okay, cool. How many of you have had a pen-test of your MQ environment? Okay. Did any of you guys get a clean bill of health, or do you think that your systems are all okay? Okay. So, okay, cool. What I'm going to do today is I'm going to talk through some of the background to MQ for you, for those guys that don't know about the technology. Talk through some of the features that it has with regard to security, and then talk about a few little issues I've discovered that may well put your installation at risk. So, I'm going to try and cater to a few different audiences today. Try and keep some of the stuff on the table. High level for security management out there. Also try and talk to a sufficiently techie level for anyone out there who's a pen-tester or security consultant. And also anybody that's developing applications for MQ. Hopefully you'll get something out of this as well. Now, anybody that knows MQ will know it's an absolutely massive piece of software. It can be configured in a whole lot of different ways in a whole lot of different environments. And I've not got time to go through every single aspect of security here. What I am going to focus on... ...is MQ from a network perspective in a TCP IP environment. And most of the research I've done has actually been against Windows and UNIX systems. In the last couple of weeks I was actually fortunate enough to look at this running on an i-Series system. And most of the code that I've written works actually straight out of the box on that as well. So why did I actually decide to look at MQ? Well... ...the reason why I did that is because the clients that are running it... ...and the way they're using it is actually mission critical. People are using this to pass their trade data, their share dealings, their retail transactions, healthcare information... ...using it to pass that around the business between various applications. When I started looking at this there were also no tools out there for me to really kind of get stuck into... ...to enable me to test an installation and say to the client... ...yes you're secure, no you're not. And what I've found generally is that when there aren't such tools out there... ...people often have installations that are not properly secured... ...because people don't know how to test them or to evaluate them. And generally with any application if you actually own the middleware... ...you normally own that business process. So a quick history lesson as I've managed to find out what the history of this thing is. MQ started back in 1993 as a kind of collaboration between SSI Systems and IBM. And over time IBM has kind of gradually adopted the code and taken it on themselves. Produced a set of versions for their core operating systems... ...as they were AIX, OS2 and AS400. And then used them as a kind of template to then portal their code to other platforms. The kind of latest version of the software that I've seen our clients running is version 6. And people tend to have been running that for either the last year, year and a half. Although some people are still at start there running anything from 5.1 up to 5.3. I've never found anyone running anything before that but that's not to say they aren't out there. So if you're a business why have you actually put MQ into your environment? Well normally you need some component there that's going to manage all your messaging. That can pass information accurately and reliably from one part of your infrastructure and your environment to another. People choose MQ because it's pretty stable enterprise technology. I hear clients that are passing millions of messages through their systems every minute. They need something that's going to be reliable... ...and not start dropping messages. They need something that's going to be scalable. They need something that's going to be able to run on a whole lot of different technologies. And MQ will run on Windows, Unix, it will run on mainframes. And that gives an enterprise an awful lot of functionality in how it actually uses its MQ installations. When you couple with that the whole lot of APIs that IBM have produced to help you build applications... ...that gives you an awful lot of power in interfacing with these systems. The various other bits of enterprise functionality in there make this a very attractive piece of software... ...for an awful lot of companies out there. I've already mentioned the type of data that goes across these systems. It's the stuff that's really core to people's businesses. So a really bad diagram for you to have a look at. If you're not sure of what MQ looks like and how it's actually set up... ...this is a reasonable attempt to describe that. What we can see is we essentially have two sets of queues on different machines... ...which is essentially a way of packaging up the data and keeping them in a nice tidy format. We then have the ability to transfer that data across a network. And we have these entities called queue managers... ...which are then responsible for managing this information and making sure it gets to where it needs to go to. There's a bit of terminology involved in this. We're involved in the MQ world and we'll talk about some of this today. I've already mentioned a queue manager. We also have different concepts like channels, queues. We have things like triggers and monitors. As I said, we'll run into these over the course of the presentation. So what's a queue manager? Essentially it's an application that's responsible for managing all the queues within which the data sits. As far as I'm aware, and please correct me if I'm wrong... ...you can only have one queue manager that listens on one TCP port. Each queue manager itself is an independent entity that has access to its own queues. But you can set up an environment where these queue managers can talk to each other... ...and therefore exchange data across a network. In the environments I've been working in, we often find multiple queue managers on a single system. So someone will be running a production MQ server on the same box as a development MQ installation... ...and because they manage separate queues, they think that's a suitable way of running things. As we'll find out a bit later on, there's reasons why that might not be such a good idea. Channels. I mentioned them briefly. The best way to think of a channel is some kind of conduit or pipe that enables you to get to the queues themselves. You can then apply various controls to that channel that restrict how access is actually gained to those queues themselves. So different people can access the queues themselves. You can apply queues down different channels. And you can apply different security features to each one of those channels. There are various different types of channel. But again, this is something we've really not got time to get into today. And then we have a queue. A queue is essentially what it sounds like. It's a container where your data goes. MQ is really designed to operate on a queue basis where everything works with queues. There are first in, first out structure generally. The message you put onto the queue first is the one you're going to recover off there first. There are some exceptions to that. You can use priorities in order to pull off urgent messages first. Again, these are some of the bits of functionality that make it so attractive to the enterprise market. Now the real elegance with MQ is that everything is really a get or a put. You're either getting data from a queue or you're putting data onto that queue. There's obviously some more complexity to the way the software works. But the real essence of what I'm going to show you today revolves around those two operations. So let's talk about the MQ protocol. As far as I'm aware, there's no actual official public disclosure of the protocol. But if you look in E3 or Wireshark, you will actually find some dissectors in there that enable you to get a pretty good understanding of what the protocol is doing. And when you look at the protocol, you'll see there's a series of different sections in each packet that depend on what purpose that packet is actually for. So a packet that is getting data will have sections like the get message options and the message descriptors that are not necessarily in other types of packet. All packets will have a transmission segment header. And if you see the letters TSH at the top of your packet, you're pretty certain that you're actually dealing with MQ. So you might not be able to see that diagram particularly well, but that's essentially what a packet looks like in Ethereal. At the top of the packet here, we can see the letters TSH, which is where this transmission segment header actually begins. This type of packet is actually a reply from a get request. So we've requested to get data from a queue, and this is the reply that's come back to us. So we can see some of the various differences. We've got different sections that are included in the packet. And down the bottom here, we have something that's known as PCF, programmable command formats, which is essentially a type of administrative packet, and we'll come on and talk about that in a little bit. So what is PCF? As I've said, it's essentially admin packets. It's a way you can actually manage the queue manager itself. And the way we use these is we actually, we put a particular data structure into either a get or a put message, and we put them on specific queues on the queue manager, and then we can read data back from other queues. Now the PCF data structure is well documented. There are some IBM guidelines out there about exactly what this data looks like, what format it's in, and that's what I've been able to use to put together some of the tools I've been writing. So one of the things we're going to talk about a bit later on, is how we actually execute a PCF command and how we can use that for our own purposes. And if we're going to issue a PCF command, essentially what we need to do are the following steps. First of all, we need to establish a connection to the queue manager. And if we're running on a TCP IP network, that's essentially a TCP connection that needs to be opened. And then a number of different handshakes need to occur to actually connect to the queue manager. We then need to open what's known as the admin queue on the software. And that is essentially a queue where we're going to put our data. Now as I said, everything on MQ works on queues. So if we're issuing a command, we put data onto a queue, and it gives us the reply back on another queue. And what we actually need is another queue for us to put the reply to that first query onto. So we open what's known as a dynamic, or a model queue. That essentially generates... a new dynamic queue for us that we can then use to put the data back onto. So the sequence events is we put our PCF data onto the admin queue. We then read our response back off the dynamic queue. So what security features does MQ have? Well essentially there are three types of security feature. And I'm going to talk through each one of these in turn. We have an MCA user, which is essentially a user ID on a particular channel. We have a security exit, which is an external program that can be called to enforce authentication. And we have SSL and TLS support, including the use of client certificates and some basic user filtering from that as well. So we start with MCA user, and this is not a particularly simple concept to get your head around. And I haven't got time to go into all the complexities of how it works. Essentially though, it's a tag in the packet that says which user has this data come from. And a lot of the API calls you'll find there actually read the user name of the logged on user on their machine and put that value into the packet. There's an awful lot of confusion out there about exactly what that means in terms of a security feature. I'm sure anybody here is aware that if you're reading the local user off a machine, then that's not really a security control. We can also apply an MCA user to a particular channel. And in the simplest form, that is essentially the user that that channel and those communications are going to run under if no other user is specified. As I say, there's a lot more complexity to that. We'll talk about some of the real showstoppers when we're actually talking about MCA users. So the limitations of this. And the first thing that anybody who has come across Web3MQ security will know is that by default, there will be a blank MCA user on all your channels when you take this thing out of the box. And a blank MCA user means everybody has access to that channel. So by default, if you've installed Web3MQ and you've not set the MCA user, your system is wide open. I've already mentioned that the MCA user is essentially a client-side parameter that is being passed from the client. If we can construct our own packets, we can construct a packet with any MCA user we wish in there. If you look at the newsgroups and people talking about MQ security, you'll see that there's a lot of people that really don't understand what this control actually means. And one lesson that you should take away from today's presentation, as we'll see, is you should never rely on an MCA user as your sole security measure. And we'll see a really good reason for that a bit later on. So we move on to a security exit. And a security exit is essentially, an external program that MQ can call, and that can do authentication for you. Now there are a number of commercial security exits out there. The other clients of ours actually write their own. And usually what you do is you get that security exit to check a username and password that has been submitted from the user. And if the username and password is correct, you send back the right return code to MQ, and that says, yeah, this guy's authenticated. There's lots more you can actually do with that security exit. You can enforce IP address restrictions. You can, in theory, do anything you want to. But essentially the lesson of a security exit is that it's enforcing access control for you. Now what are the limitations on it? Again, with any protocol, if you're sending that username and password over a clear text channel, that's just the same as using Telnet, FTP, any of those other protocols. If you write your own security exit or buy one that's written insecurely, that code is essentially now the front door to MQ. It's the front door to your system. If that code is insecure, you could get your system owned, and therefore it's very important to actually look at what code you're using for that security exit. Another limitation, and this might not be an obvious one, is that MQ actually has to make sure that that exit is called for you. You literally kind of tick a box on MQ and say, yeah, use this exit. But you have to then have trust that MQ is actually going to call your exit for you. So what about transport security? Well, MQ has good support for SSL and TLS. Unusually, MQ will actually accept an SSL handshake on the same port as it will accept a standard MQ clear text handshake. Unlike a web server where you can negotiate a cipher suite to use, a particular channel will be set with one cipher, one SSL version. There's no negotiation. There's no negotiation actually permitted on that. If you're thinking about building your own tools, OpenSSL has had good support for the majority of the ciphers that MQ supports for quite a while now. Something in the UK we don't really have much call for is FIPS compliance, and I believe that MQ can actually be set up to be FIPS compliant if that's what you actually require. You can do that in the software or through additional hardware accelerators. So what are the limitations of SSL? Well, if you think that by putting a particular cipher on a particular channel that's going to stop someone talking to you, again, that's a false assumption. We can just cycle through all the ciphers and see which one we get a proper handshake from. By default, if you put SSL on a channel, you're not going to get any authentication control. Hopefully everyone here is completely aware of that one. Limitation again. If you think that just because we're using SSL it's going to be difficult for guys to write tools, using Python, which I've used to write most of my tools, it's just a couple of lines extra to do that SSL handshake. Also, you have to be aware that if you're using SSL, there's obviously a certain amount of trust with regard to who you're actually talking to. That's based on the certificate authorities that are actually in the key repository on either end of the communication. You need to be very careful. You need to be very careful about how you set that up. I also mentioned we can do client authentication using MQ. We can actually set it so that MQ only accepts communications from someone who is using a certificate issued by our trusted CA. We can also filter users based on the values in that certificate. And if we lock down our repositories on either end so that only trusted CA's are in there, then we can actually make sure that only the right people are connecting. The problem is by default there's a whole load of trusted CA's in those key repositories when you create them. If you don't actively remove them, that means that someone with a key from a trusted CA, for example from VeriSign or Thought, they will also be able to gain access to your queue manager. Again, it's really easy to add support for a certificate in using Python. It's a couple of lines of code. Another limitation with the actual filtering within MQ's client authentication controls is that it only works from the start of the pattern match. So if I have a pattern match that I'm matching CN equals admin, then CN equaling admin1, admin2, administrator are all going to be allowed. We don't have to actually specify a trailing kind of wildcard on the end of that filter. That is there by default and implied. So if we're not careful about who we're issuing certificates to and what the names are in those certificates, we could find ourselves in trouble again. So now let's move on to talk about actually testing MQ. If we want to connect to MQ, we need to know a number of things and the success of our connection is essentially going to rely on a number of things. It's going to rely on us knowing the right port to connect to. There's no reason why we can't change that. So we have to find it. We then have to know a channel to communicate with. Thankfully, from our perspective, if we're an attacker, there are some default channels that we can find. In other circumstances, people will publish the names of their channel on a wiki or on the internet. If they're using clear text communication, we can sniff these values. The success of our connection will also depend on what's known as the MCA user. Most of the guidebooks out there tell us that we set an invalid user as the MCA user and that essentially locks people out of that channel. We'll come on to see why that might not be such a good control. It also depends on whether we've got a security exit defined. But again, as we'll come on to see, that might not necessarily save us. And again, if SSL is being used, we need to know which ciphers to use and whether particular certificates are trusted or not. Thank you. So the first one of those challenges is to actually find MQ. Easiest way of finding it is to just attempt an MQ initial data handshake on each port on the system that we think might be MQ. If we get it right, we're probably going to get the queue manager name coming back in our packet. Well, not necessarily. In most client instances I see, we actually get some kind of data back that we can use to actually identify that MQ is on that port. And we'll see a demo of running that against an installation a bit later on. So the pattern of connection is essentially we can actually do an initial data handshake where we agree to various parameters that are going to be used by MQ. We then actually send a username and password packet. If no username and password is set up, we still send that packet, but we actually send it without any values in there. If no security exit is defined, then we can just go ahead and try to connect. We get a connection response back if we're successful. And then we can try opening queues and accessing data and doing all the things we might want to. So one thing that I've noticed that I've never actually seen anyone use but looks like it's quite an interesting feature is that you can actually set up channel auto-definition, whereby connecting to a channel that doesn't exist, MQ will quite happily set up a new channel for you based on a particular template that you've defined. I'm sure you can imagine that connecting with lots of different invalid channel names could cause a few issues if we're able to actually talk to the MQ port itself. If someone has actually set that up and used an administrative template as the channel definition we might find ourselves gaining access straight away. Previewing code actually connected, what do we actually want to do? Well, there are a number of things we can do. We can issue these PCF commands. We could administer the queue manager itself. We can open and actually look at the queues themselves, look at the information on them. We can pull data off those queues, maybe. Put more data on them. Also, we can execute operating system commands if the conditions are right. So what PCF commands might be useful to us? Well, there are some that enable us to enumerate the version of MQ. Some allow us to dump out a list of all the channels on the system, a list of all the queues and how they're configured. There's also a queue there that contains the information regarding the MCA users of particular channels. So if an attacker actually isn't interested in your queue data and wants to start executing commands, what do they need to do? Well, from version 6 onwards, MQ supports something called services. This is essentially a way of defining an external program that can be run through the execution of PCF. So if we're able to gain access with enough ability to execute PCF commands, we can define ourselves a new service, which is essentially an application to run and start that running. Another method, and this method works before version 6, is on MQ you can setup triggers. This is essentially an application that will sit there and listen for data on a particular queue, when it receives it, it then executes a particular command for you. Administrators like to use this and say at particular, say at the end of day for a retail organization, a message gets sent to a queue to say all the tills have closed and and that actually then gets fired onto a queue, and a trigger fires to tell the administrator that all the queues have closed for the day. I mean, there are lots of things you can do with a trigger. That's just one kind of really made-up example. Now, if we want to execute commands using that trigger, there are a few different things we need to do. First of all, we need to define a new process. Now, the process is essentially the command that we're going to execute. We then need to change the queue definition to actually turn the trigger on and tell it to use that particular process when it fires. We then need to put a message onto the right queue so that our trigger fires, and the trigger monitor application actually reads that information and runs that command. Now, the one caveat to this is a trigger monitor needs to be running. So in this particular installation, we need to have that actual application running. Before version 6, I'm not aware of any way of actually starting that remotely. But that last method actually requires us to execute PCF commands. Now, if we don't have permission to execute PCF, then there is a slightly easier way for us to do it. Now, what happens when a trigger fires is essentially MQ puts a particular type of message onto what's known as an initiation queue, and that's what's read by the trigger. Now, rather than go through the hassle of defining a new process or to a queue definition, if we know the format of that message, we can just put that message in there. We can put that message directly onto that queue. Now, if we put a message onto an initiation queue and the trigger monitor isn't using, and our expiry time isn't set to a low value, that message will actually sit there. So the next time an administrator fires up a trigger on that queue, that will actually run. Now, you can imagine that as being almost a kind of very unstealthy backdoor, so that a particular person has gained access to an MQ installation, drops a particularly malicious message onto that queue, and then when an administrator decides... they're going to start running a trigger monitor, that fires. And if they're not particularly familiar with the use of a trigger, the actual message they get on their screen, they might not understand the actual importance of that and the fact that an attacker has just executed a command. So if you're familiar with MQ and all the features I've been talking about, then it's probably not much that you're too worried about so far. You've probably got all these things in place. You've probably got your whole system set up and secured. But when I actually started testing this software, I actually discovered two new vulnerabilities that actually exposed some pretty serious holes. Now, I went through the process of reporting these to IBM back in January and another one in May this year. I actually talked to the MQ Development guys in the UK and reported these issues through the Center for the Protection of National Infrastructure in the UK. And for various reasons, I'm not going to tell you exactly how to exploit these vulnerabilities today, but I'm going to tell you what they are, what they mean for your environment, and how you can protect against them. Once everyone's had a chance to digest that and actually protect their systems at the right time, then I'll actually release some more information about these. So what's the first one of these issues? I was actually testing an installation where their security measure was a security exit. They'd correctly protected texted channels. It was actually with a security exit that would take a username and password, check that against a database, and then if that was actually correct, it would log you in. I was able to actually bypass that completely, so that I managed to get MQ not to call that exit, meaning that MQ did not know to kick me off the software and I was able to gain access to that installation. The systems I tested were versions 5.1 to 5.3. I'm on a Solaris platform. Others may be vulnerable. I know that the version of MQ I have, which is version 6 on Windows, is not vulnerable to that issue, as far as I've been able to tell. I'm aware of rumors that say that this issue has been fixed somewhere down the line, but I'm not aware of any documentation, though I can't actually tell you at what point that got fixed or what patch you need to actually apply to essentially mitigate that. The next one is actually an invalid MCA user bypass. Now, a lot of the books out there on security and MQ will say, as soon as you get this thing out of the box, put an invalid user into the MCA user channel agent. That means anybody connecting to the box is going to get a reason code back saying you're not authorized to connect. I actually found a way of bypassing this, meaning that if you essentially have protected your administrative channels or any other channels by setting an invalid user, it is still possible to gain access to that. And every version I've tested so far has actually been vulnerable to this issue. So if our objective is to actually test the security of an installation, there are a number of tools we actually need. We need somewhere to find the MQ services on our network. We need a way of finding the channels on these systems so we can communicate with them. We need the ability to test what SSL settings are in place so we know how to communicate with those channels. It would also be good to recover information from the MQ manager that tells us things like operating system version, what processes are defined, and whether there are any triggers running. It would also be good to be able to test whether we can read data from a MQ, whether we can write data to a MQ. It would also be good to test whether we can actually execute operating system commands through both of the methods I've just talked about. So what I've actually done is written some tools that actually help us to perform these tasks. I've actually written them in a set of Python classes that enable you to then build packets up and fire these in whichever order you want. It's not a finished tool by any means. And what I'm actually releasing is some sample tools that enable you to do some of the enumeration of your systems for MQ. And actually enable you to dump out some information. I'm also in the process of putting together a white paper on MQ security. I've only been looking at this subject for about six months, so I don't know everything about this software yet. And what I'm trying to do is distill down what I've actually found from a security perspective into one document that enables people to look at their installations in a realistic manner. And I'm going to put lots of information in there. Today I've had to skip over an awful lot of stuff. I'm going to put some more information in there. That's going to be available through our company's website, hopefully in the next month or so. So now we're going to get to the fun bit and have a look at actually exploiting some of these vulnerabilities to look at how we can actually gain access to a system running MQ. And I've got a very basic setup here. I've got my laptop, and that's going to... It's essentially a VMware partition that's going to talk to an MQ server. Our objective's on the demo. We're going to scan a box, look for MQ services. We're going to try and work out what SSL support is on the channels on there. We're going to recover some information using some PCF commands. And I've also got Netcat on that system, and all I'm going to do is execute a command to start that running so we can actually see that we have an ability to actually execute a command. Obviously your kind of method of exploitation out there in the wild is going to be dependent on the architecture and the environment you find yourself in. So I'm going to flick over to the demo now. If you can't see anything, please give a shout. I've tried to use a reasonable font size. And what I'm going to do quickly is just show you a quick look at the actual MQ software itself set up in a configuration that we've actually seen out there that our customers are using. And for those people that haven't come across MQ before, this software is called MQ Explorer. It's essentially a GUI tool that enables you to manage your queue manager. And you can see here I have a number of channels actually set up. And the one I'm actually going to demonstrate attacking is, is this channel here called Defcon 15 admin. If we look at that, we can see we've got SSL set up on that channel. We've also got it set up to externally only accept certificates with this particular string in the distinguished name. And we're only going to accept connections from people with trusted certificates. We've also been paranoid on this channel because there's no valid MCA user on there. So technically no one should be able to gain access to that channel. Now I'm just going to show you quickly also why my certificate that I'm going to try and talk to the queue manager with actually works. And this is essentially the view you get from the key repository manager on MQ. And by default we have a whole load of certificate authorities that are in there by default. So if I've got a certificate that's signed by one of these CAs, because I haven't removed them from there, actively removed them, I'm going to be able to gain access. And the last thing just to show you quickly is that we've also got a trigger monitor running that we're going to use to demonstrate executing a command. So that's just our trigger monitor sat there waiting, listening on the default initiation queue, waiting for a message to come along. I'm logged onto this box as an administrator, so that trigger monitor is running as an administrator and we'll see why that's a really foolish idea. So the first thing I'm going to do now is just run a quick M-Map scan against that system to see what services are listening. Let me try and get that in the right place. And if we look down here at the bottom, we can see that our default port 1414 is actually listening on this system. What we're actually going to do is run a quick tool against that system just to make sure that it is listening. That is actually MQ. I'm just going to try and resize this window a bit to let you be able to see the bottom of the screen a bit easier. Okay, so the next thing I'm going to run... This is essentially going to take my M-Map output in greppable format. It's just going to try doing a handshake against each one of those ports on that box. And that will take a little bit of time to go through. So essentially that's firing an initial data handshake at the box. All those ports, as we expect, are on MQ. And these ones eventually will get to port 1414. And we'll see that we've got a nice handshake back from there and that's actually given us the... the actual name of the queue manager for us. Next thing we're going to do now is actually... I've got a text file on the machine here with a number of default channels and also the channels that we saw in the actual MQ software. I'm going to run an SSL check against those. It's going to essentially check... It's going to run through a whole list of different ciphers to see which cipher suites are actually supported on those channels. So we can see our DEF CON 15 channel is SSL version 3 with a null char. We've then got some of the system channels and they've all been set up without any SSL protection on them. Now notice one thing that's actually missing from there is our DEF CON 15 admin channel. And that's because of a little bug in this tool at the moment. We need to rerun this in verbose mode. And we actually find that on a channel that has... SSL set up but actually requires a client certificate we get a slightly different error message back. You can see there for AES 256 we've got a reply that says invalid client certificate rather than bad remote cipher. So we now know which ciphers we can actually use to talk to those channels. Next thing we're going to do now is actually just using one of these insecure default admin channels we're just actually going to dump out some information just to show you what kind of things we can get out of this. So if we work down we can see the various different packets that I'm actually sending and the responses we're getting back from them. So I complete a handshake, I connect, I open my admin queue, I open my model queue to get my data back. I then actually submit an inquire queue manager PCF command and that returns us a whole lot of information about that queue manager. Most of which we're probably not going to be interested in but there are some... some values in here of interest to us. We see there we're at Web3MQ version 6 and a bit further down we can see that our operating system type is Windows. So we've already got a fairly good idea about what kind of system we're attacking and how we actually need to go about that. So now what we'll actually try doing is executing commands to start that Netcat that's listening on there. Just to show you that I'm not cheating. Hopefully that's not listening there at the moment. What we're going to do is we're going to create a service that actually is going to start Netcat then we're going to start that service running. As you can see we've specified which channel we're connecting to, what cipher we're going to be using, and we're also using a network. We're using our certificate that's been signed by our trusted CA. As you can see that's gone through all okay. And there we go, we've started Netcat running. In this case though, as you can see, we're only running as the restricted privileged MQ user so we've still got some work to do if we actually want to get admin on this box. But at least we've got a foothold onto that system now. Next thing we're going to look at now is actually executing a command using that trigger monitor that we saw previously. Now what this is going to do is it's going to execute the command you can see down the bottom of the screen there maybe, which is start Netcat listing on 6969 again. Let's just try telnetting to make sure that our service has died. And see an interesting thing here, we've got a response back from our queue manager saying we're not authorized. But let's see whether we are or not. Yep. This time, because we started our trigger monitor as administrator, we're now running as admin. So it all looks pretty bad at this point. Is there anything we can do to actually protect ourselves? Well the answer is yes. At a technical level there's a whole heap of things we can do. We need to make sure we protect all the default and admin channels, don't leave them wide open. We need to have a defense in depth approach that means we're not just relying on one security measure. If we actually combine some of these techniques of using SSL client certificates, we use security exits that have been properly audited, we can actually put together a much better security model for our installation. Now we've been able to execute PCF commands because something called the command server is running, which enables us to manage the command server remotely. We can turn that off. We can do all our admin on the console itself. So again, turning that on is going to, it's not going to stop an attacker gaining access to the message data, but it might stop them executing commands and actually altering your queue manager itself. Another recommendation, don't use channel auto-definition. I'm not sure in what circumstances people would use that. I've never actually seen that turned on. Make sure you're using SSL to protect your data over the network. Make sure you go through that key repository and remove all non-trusted CAs. Be very specific with your user filtering strings that you're using with your certificates. And make sure that the people that are issuing the certificates know what the limits are. So for example, if you need to grant the user admin access, make sure they're not then issuing a whole load of other admin-related certificates. If you're particularly paranoid, make sure you always clear the initiation queue before you start a trigger monitor running. And if you're using trigger monitors, make sure you run them with a lower standard. And make sure you have the lowest possible privileges. So at a high level, there's also a number of things we need to do. We need to make sure we look at the middleware. Make sure that the guys we're getting to test our systems don't just know about the web server and the database or the actual client application. Make sure that they can test this system properly. Make sure you use all the security features. Don't use one feature and say, okay, that's it, that's me protected. Use access control and encryption. And when there's security fixes out there, make sure you apply them. As I said, make sure the testing you have done is thorough. Make sure someone doesn't turn up with a scanner. Just scan your box and say, yep, that's okay. And look at the whole environment. A lot of clients of mine have different queue managers running on different systems. They'll have transmission queues and remote queues set up to allow different people access to queues on production systems because they have incompatible software or other bits and pieces like that. Make sure that when you're testing it, you're looking at the whole environment. There isn't some other route to get to your queue manager you've not looked at. Now I've talked about running a development and a production queue manager on the same system. The problem with that is if we're running them under the same user on the local system, if we manage to gain access to the operating system through our insecure data, through the development environment, we're then running with the privileges with which our production queue manager is running. So we might find that someone has circumvented all the controls on our production queue manager simply by using that development queue manager. There's also a whole other load of things I haven't talked about today. Cluster security and a whole load of other things. You need to make sure you look at those as well. That's something I haven't looked at in great detail thus far. It's probably something I'm going to move on to look at next. As I've just mentioned, are we safe now? Well, we can be reasonably safe if we put the right controls in place. There's still more to look at. It's a very complex state machine and protocol. Therefore, there's probably a whole load of bugs out there that we can find by fuzzing. We've done some limited fuzzing and we've found a couple of crashes. We've not had time to go and look at exactly what caused them. And if we do find that there's any issues with those we'll certainly be reporting those I haven't had a chance to look particularly at MQ on iSeries and ZEOS. They're two particularly interesting targets. We also get IBM recommending that we use Tivoli for all our remote administration. Maybe that's something we can have a look at. And how do other messaging solutions compare to WebSphere MQ? Are these issues in isolation or do we find the same kind of issues across different bits of software? That's something we really need to find out. So in a three line summary Do everything that it actually tells you to do with regard to security features. Don't just use a couple. As with anything new vulnerabilities can expose your environment can expose your software. And if you're using multiple layers of defense you're obviously going to be more protected. There's a few references in the back of this talk that you can have a quick look at. There's some excellent reading out there. And that's just about me done. I think we're going to go over to the QA room now. So if anyone's got any further questions follow me over there and we'll go through them there.