Hi, guys. So we're going to go ahead and start. This is the attacking JBoss talk. If you want the WebSphere talk, that's in a different room. So just first, who am I? I work at a software security, or I'm sorry, software as a service company as a security engineer, so hence my interest in the JBoss topic. If you are into Twitter, you could follow me on it. Also, I'm really awesome at PowerPoint. So I just want to quickly just set a couple of expectations here. The first thing I wanted to mention is that most of what I'm talking about here is not really new stuff. It's stuff that's kind of out in the wild. I tried to just say, you know, pull it together all into one place. The second thing is that most of, again, with a couple of exceptions, the stuff that we are talking about is not like bugs that are going to get patched. These are, you know, fundamental issues in configuration or architecture. Oh, and one other thing. They had said that this was going to be a tool release. What ended up happening in the last six months or so was like the world of JBoss security kind of exploded. So there's a bunch of stuff that got released into Metasploit, and I ended up releasing my own scanner into the Metasploit trunk. So if you want the tools, you find them in Metasploit. One more awesome PowerPoint transition. Yeah. Okay. So what is JBoss? How many of you are already people who use JBoss, and that's why you're interested? Wow. Okay. A bunch. How many of you use WebSphere? Are in the wrong room? That guy over there. Okay. So you guys already know what JBoss is, but just really quickly. Java EE application server. People like it because it's open source. It's by JBoss, which is now a division of Red Hat. And basically what any of these application servers do is abstract the infrastructure so that the developers can focus on, you know, just writing business logic. JBoss is really big and complex. There's a lot of stuff in it. You could look at it for a long time and not see everything. I think that's where some of the issues we're going to talk about come from is there aren't a lot of straightforward ways to do a lot of things. Just wanted to post this little snippet. This is from the JBoss security blog. This was in response to a talk that Chris from Spider Labs did at Black Hat Europe. It was a similar talk. And basically what the JBoss security architect said was, like, well, this is how it ships and the developers will know better and they'll secure it before it goes to production. This is like late 90s style security response. So I don't know about you guys, but this does not thrill me. I will say, though, however, that I got, you know, a nice concerned e-mail from Red Hat security response. So they kind of do a good job, I think. So there's some kind of disconnect happening there between the JBoss side and the Red Hat side. And go read the whole blog post, by the way. You should check that out. So just to talk really quickly, most of what we're talking about here is going to be focused specifically on JMX, which is Java management extensions. And, you know, again, it's kind of complex. I feel like Java people are like to make up these big, like, Rube Goldberg-type contraptions. Are any of you guys those Java people? So what you've got at the bottom here is the instrumentation layer, the probe layer. And basically that's where mBeans or management beans sit that allow you to manage the internals of your app server. And then there's an mBeans server that allows you to interface with those. And the way that you can interface with them is via connectors and adapters. The difference between the two is not really important. But the point is that there are a lot of different ways that you can connect in and ultimately interface with these mBeans, which, as an attacker, is what you want. You want to get in and remotely manage the server. So, okay. So welcome to JBoss. This is the default page you get with your JBoss installation. There's some interesting things that it links you to here, and we're going to talk about them. So the main way that we talk about really doing JMX on JBoss is a web application called the JMX console. Did you guys notice, by the way, that I'm looking at the slides over here when I have them on a screen in front of me? So if you see here what you're looking at, you get a web interface to JMX. And things to do with the JMX console, all kinds of interesting things. Deploying code is always nice. Shutting down the server is always fun. And this is just what it looks like. So the JMX console is installed by default with zero security. You put up your JBoss server. There's the JMX console. There's the JMX server. There's the JMX console. No passwords, no encryption, no nothing. So JBoss does give you some recommendations for securing the JMX console. Cool. Some of them are wrong. Some of the things that they some of the things they just simply don't address. So the first thing that you tend to want to do, right, is password protect your JMX console. Great. There's instructions out there to do that. There's a default log in module, which is what they recommend that you do when you're installing the JMX console. Well, the module doesn't provide you with some of the things that you generally expect to see, like enforced password length complexity, account lockouts after too many tries. So if you find a JMX console that happens to be password protected, brute force away. And by the way, admin, admin is the default. And you will find lots of JMX consoles out in the wild that went to the trouble of doing the password protection but left admin, admin. So, okay. I would like my app sec folks to take a quick look at this and see if you see anything interesting. So this is the log in config that was the default until May of this year. What's interesting about this is that these this, by the way, came from the minded security blog. I did not make this up. So thanks to those guys for finding this and talking to me about this. So I'm going to post it. So what's interesting about this is that this configuration makes the authentication apply only to get and post requests. Well, for those of you guys who are familiar with what HTTP verb tampering is, that means that I can just use a different verb that's not get or post and I can bypass your authentication, which is great. The fix for this, by the way, the fix for this is just to remove these two lines. Just take them out. And obviously, again, for my app sec folks, CSERF everywhere, yes, cross-site scripting everywhere, persistent and reflected, definitely. One really interesting use case for the cross-site request forgery here is that you'll find in some cases where people look at their JBoss server and they say, wow, this is really complicated to protect. What I'm going to do instead is I'm just going to use, you know, I'm just going to use, you know, I'm just going to use, you know, I'm just going to use, you know, I'm just going to use, you know, I'm just going to use, you know, Apache or my firewall or whatever and just not allow access from outside my network to the JMX console. So, yeah, cool. So if you go to somebody's JMX console and you see, like, a 403 forbidden, that's a good time to start trying to use CSERF admins. And, again, you know, no protection, really, against these things. This is one I just thought was interesting. Login config, you know, this is a config file that says how your different applications, including your web console and your JMX console, get authenticated to. What's cool about this is that you can actually load a new login config.xml from an arbitrary URL, including one that you control. So, you know, just remove authentication if you want to or change it, add new accounts, whatever you want to do, it's fine. And this URL at the bottom is just kind of what it looks like. So, again, I'm just going to show you what it looks like. I mean, I think it's kind of an interesting use case. I just think it's kind of cool that you can, in some cases, load from remote as part of the functionality. But, honestly, if you're at this point where you can run this particular functionality, run something cooler, like, oh, one other quick thing first. So that was the JMX console. There's also a bunch of different services that allow you to, again, interact with the MB and stuff in a variety of ways. There's a service, it's an RMI adapter service, so that's just a network-based, it's not a web-based service. But it will give you the same functionality as the JMX console because, again, if you remember the diagram at the beginning, the MBs at the bottom are all there and you're just interfacing with them in different ways. So, again, different authentication mechanism, different configuration. At the point at which you go and secure every way to get into JMX, you've probably spent at least a whole day. It's, you know, I want the, you know, I want the, you know, I want the, you know, the toggle switch that turns security on, but it's not there. JBoss comes with a tool called twiddle. It's a command line tool that allows you to easily interface with the service. So, again, you will find out in the wild places that have gone through the trouble of password protecting their JMX console, but they don't have a firewall and they've just left this service wide open. And more, again, with different configuration, different options. So, again, there's a lot of different authentication mechanisms. This stuff, by the way, I highly recommend, there are links at the end, there are references, but I highly recommend that you go check out the work that red team pen testing has done on JBoss. They have some tools to interact with these particularly. They have a lot of good information. So, exploits. Let's get to the fun stuff. And unfortunately, like I said, this stuff, fortunately for all of us, but unfortunately for me, particularly, is a lot of this stuff all ended up in Metasploit before I could get to talking to you guys. So, this one is actually in Metasploit as of February. And it just uses the built-in code deployment mechanisms to allow you to, as an attacker, deploy arbitrary code. And, again, this is, like I said, it's not a bug. It's part of the functionality. So, JBoss 4 and lower, there's a lot of cool things you can do. You can load your arbitrary code from, again, the site that you control. There's a scripting language called bean shell. So, if the web server cannot make an outbound connection to your host, what you can do is write one of these bean shell scripts and just have it spit out your payload to the local file system and deploy it that way. So, JBoss 5 is a little bit interesting. And I spent most of my time looking at 501. So, this may be, quote, unquote, fixed at this point. But the HTTP server is a little bit different. It's a little bit more complex. It's a little bit more complex. It's a little bit more complex. So, if you're looking at the B deployer and the bean shell deployer, the code is all there. But it doesn't seem to be quite fully implemented. So, in theory, this is something you could go, like, open a bug in on their JIRA and maybe it will get fixed eventually. But if you can get a file on the local file system, and, again, anywhere on the file system, you can deploy that. So, think about things like, you know, anonymous FTP or, you know, broken image upload mechanisms, things like that. If you can get a file there, that's game over, no matter what version of JBoss you're using. And, again, check this out in Metasploit. Another similar exploit, deployment file repository, allows you to upload arbitrary files, so arbitrary content, arbitrary file names. I'm sure there is some purpose for this to exist. I don't know what it is. So, this was actually reported in 2006 and, quote, unquote, fixed because it was actually reported as a directory traversal, right? So, this functionality has a default directory that you, you know, deploy your code to, and you could actually, you know, traverse your way back up the tree and put files, you know, wherever you wanted. Well, so it turns out they fixed that by removing the directory traversal, but they did not remove the functionality that allows you to change the base directory. So, if you set this to just dot, like you see in the example here, you are taking the directory, you're removing the function, you're removing the at the server root. Now, not the actual operating system server root, but the JBoss server root, which means that what you're probably gonna do at that point is go put your JSP command shell into one of the existing web applications that lives on the system. But you can also do other cool things like overwrite config files, anything like that. By the way, this is part of the, what we're not really talking about much, the JBoss web console, not the JMX console. So if you have JMX console deployed and not web console, this won't work. And it's fun, and I like to think of Google crawling people's unprotected JMX consoles and finding server shutdown. So some other stuff that's not deploying code, but you'll find a lot of, a lot of the time is people will lock down their web console, their JMX console, their RMI, whatever, and they'll leave this status servlet available. So, which is fine, because it's just status, right? It doesn't, you can't do anything with it. Well, that depends, right? Because what are your developers doing? Well, one thing that they're doing is they are putting secret tokens into URLs. So I just pulled a couple of examples here. You've got, I don't know if you guys can read these. The first one is a software download. So you get a link to your purchased software. It's got this secret number, so you go get your purchased software. So I recommend you guys all go get yourself some free whatever crappy app this is. Found this next one actually in the Google cache. It's a blacked out large retailer that you would have heard of. And plain text user ID and password in the URL. This third one is really broken. If you are an admin and you are in the JBoss web console and you are viewing the status page, it's going to helpfully put your session ID right here as a parameter. So all you really need to do as an attacker if you get the status servlet is wait for an admin to go driving around in there and grab this thing. Other interesting things, you may not need to actually own the server at all because somebody else might have already helpfully installed a command shell for you. You can also just append a parameter full equals true to the status servlet and you can get a list of the deployed applications, which can sometimes be interesting. Just a couple of examples I found out there. Again, this one with the blacked out stuff, a large retailer you would have heard of. This other one, wow, just a lot of stuff deployed. And I like the idea here that somebody may be relying on somebody not being able to guess the name of their admin functionality. So I just list them. So okay, so we know some different stuff about JBoss. Now we're just gonna go find it. And luckily there's a lot of help for you out there. The customer list is a good place to start. JBoss sets this X powered by header that'll come in one of these formats. That thing is an absolute pain in the ass to remove. I don't know why. There should be a line in the XML file that I just remove and it no longer sends this header. Look for, definitely look for that. This stuff, by the way, is all in the scanner in Metasploit. So just fire that up and hit whatever hosts and you'll see all this information if it exists. Error pages give, by default, very helpful error messages telling you about the version of JBoss, stuff like that. Again, kind of a pain in the ass to fix. You guys familiar with a tool called Shodan? You guys have used this one? Couple people. Very cool. And so one search that will bring up some JBoss servers is X powered by JBoss. The authentication realm, if it is password protected, will always be JBoss JMX console. Nobody will ever, like in reality, change this. I'm almost positive of that. And obviously our favorite, you can Google Dork. So we see we've got like 550,000 results. These are probably not all unique systems, but there's plenty of them out there is the point. And this actually, I should point out, means that not only did we find it, but that there's no authentication on it. By default, if I'm seeing HTML adapter, that means it's not authenticated at all, at least at the time that Google crawled it. So you guys can go have some servers. They're out there. I highly recommend that you check out these references. You know, this was a short talk, kind of an intro to what's out there. Some of this stuff goes a lot more in depth. Like I mentioned earlier, Red Team. Chris, however you say his name, from Spider Labs did a great talk. And then again, that's a blog post with the authentication bypass that I mentioned. And I'm just under 20 minutes, so that's good. So I guess we are going to do a Q&A if anyone's interested in the thing across the hall. Thank you guys very much.