All right, I'd like to get started. My name is John Rose. I work for Trustwave in Spider Labs, which is their division that does pen testing, code review, network pen testing, forensics, and things like that. So basically what this talk is about is it's a tool that I wrote for an assessment I was doing for Flex servers. So the tool is called Dblaze, mainly because when I first wrote it, it was working on Blaze DS servers. And so I'll tell you guys a little bit about that and basically how it works. So I wrote a quick little demo app to show you guys how this stuff works. So it's just your standard Swift file. This application is supposed to represent a banking application. And you can log in and get your banking information and make funds. It transfers and log out. That's pretty much all it does at this point. It's not a whole lot. So what happens is with this application, you have the SWF file, which is running on the client side, and it's making remoting calls to the server side, which is all Java, or it can be Python or a couple different back ends. When this application communicates to the server, it goes through an HTTP post, and in that body of that post is AMF is the format, which is action message script. So it's a serialized version of that. I was doing an assessment of an application similar to this one, and I realized that it was very difficult to actually invoke those remoting methods with any of the tools that were out there. There basically wasn't anything that did it. So what I did is I leveraged a library called PYAMF, which basically is a Python library for doing AMFs. AMF communication. And I wrote just a generic client that would work on any Flex server. So it was really interesting as I started looking more and more into this and seeing what you could access on these servers, and it seemed like nobody really implemented a lot of access controls on the remoting methods. Either the developers felt like you couldn't find it, or it was just difficult to call or something like that. So I'll give you a quick example of this tool I wrote. It's called Dblaze. It's got a couple different methods for querying a Flex server. Basically, this may be somewhat difficult to see. It's kind of bright up here, but I'll walk through the different options. So one of the first options is to brute force different methods and services. The way that you communicate with a Flex server, is there's first the Flex gateway. So that's in the URL. There will be this gateway URI that you actually communicate with. And then you talk to a specific service. That service is going to map to a class file, and then you have the actual method that you're going to call. So the three things you need are the gateway, the service, and then the method to actually invoke any of the functionality on a Flex server. So, what I did is I came up with a couple different ways when you were analyzing a Flex server for security to figure out these things. So the first way is to just brute force them. You can figure out the gateway a couple different ways. Once you have the gateway, then you can brute force the service name, and then the method name. Different types of Flex servers respond differently to the request that you make. So, you can actually, a lot of them are not case sensitive, so you can brute force method names and service names, you know, and it doesn't matter, uppercase, lowercase, you'll still get the same response. And so, BlazeDS, from what I've seen, is case sensitive, but none of the other Flex servers are. And then once you've figured out the service and the method, then you can figure out the parameters that those methods take. Now, each method, will give you an error message based on the parameters that you supply, saying, you know, you only supplied, you know, you supplied zero parameters, this method takes two parameters. So it's easy to automate this and figure out exactly, you know, what it takes. The server tells you. And then it'll also say, you know, you supplied an int, this service takes a string. So there's a lot of information that comes back when you're invoking these services. So to give you a quick example of how this works, I've got, I've got a couple, a couple of demos. Hopefully you guys can see it and it's not too hard. Can, can you guys see that? Is that okay? I, I built a website that shows basically all these examples. I feel like it's a pretty good walkthrough. So if you are ever doing an assessment of a Flex application, you should be able to, to, you know, go through the walkthroughs and get enough information to, to use the tool. So, hopefully that'll work for you. All right. So my first example here, basically I'm calling dblaze, which is the tool. I'm supplying the URL to the gateway. It's up here. And then also I'm supplying the dash one parameter. That means brute force the service. And then also I'm supplying a test method. And I'm just grepping through the results. Otherwise it'll just spit out, you know, what's there, what's not there. And so it just brute forces the different services based on whatever, you know, list you have of service names. And so if you can see here, these two that came out, they're a little bit longer. It says this method test was not found on the service balance. So now I know that that service named balance is valid, but it doesn't have, you know, a method called test. So then next, once you've figured out that service, you can go back and then, basically, based on that service, you can brute force the method. And it's pretty much the same thing. And then if you can see this thing right here, we actually made a valid request to the balance service, and the method was get balance, which we brute forced as well. And so we know that's valid, but it gives me an empty array collection. So that means the result doesn't have any information. So it means it's a valid, if it's a valid request, you just didn't get any information back for it. So one of the things I wanted to do is, once you've figured out you have a valid service, you have a valid method, you want to go through and you want to try different parameters to try to, you know, fuzz that and see what responses you can get. So in this example, I'm just going through and fuzzing these different, different parameters that I'm, that for that same method. And if you see some of these responses, it's going to say, let's see, cannot convert type Java lang string to value, you know, whatever the fuzz value is. It's all these different values to instance of int. So it's providing a lot of information. I've seen this on all the different implementations of flex servers, whether it's Python or AMF PHP or blaze DS or the lifecycle data services. So all of them provide a lot of information back. So here's an example of a valid, a valid call. Basically, the parameter that I'm supplying here is, is the account number for get balance and you know, returns back my account balance, you know, information from that banking app. One of the things that I noticed a lot was applications, you know, they try to put some of the security controls in the client side. It's, you know, the same old problem, but they don't enforce it on the server side. So I've seen flex apps where you can just reset users passwords like this. I mean, you just, you're just arbitrarily grabbing you know, accounts and things like that. So another thing you can do is I created, you know, just a little bash script, you know, and you can just loop through these different account balances, potential accounts. So, you know, you go through like just brute force them. And so this is going to return all this information. All right. And it depends what, you know, your services and things like that. So another thing that I did, besides manually calling these, one of the ways that I figured out how to determine whether there were valid services and methods and stuff like that is I used this SWF dump tool. And so what SWF dump is going to do is, it's going to take your SWF file and basically convert it back into a more human readable like bytecode. So what you can do is you can grab a SWF file, convert it back to that bytecode, and then grep, grep through that for the remoting methods and other things that'll give you more information on the, the remoting stuff. So in this example, and this is, I've seen this on every version of SWF that was built with FlexBuilder. So, you know, it, it really depends on how you, you build it, but the ones that I've seen, I've all been like this. And basically what this does is I'm grepping through, I'm converting it back into, you know, the bytecode. I'm grepping through for a specific service tag, and which is embedded in a variable in the SWF which tells you where the gateway is and what the services are. So on here, you know, you can look through this. It's actually an XML file. It comes back as. And it gives you the information. Right? So, instead of having to actually like parse through all that stuff, you know, I've created a little, I've kind of filled out the tool so it actually automatically does that for you. Which is kind of nice. So here's another example where I search for the remoting methods. So actually after you, you know, query and figure out all the gateways from the SWF, you can find the methods too. Right? So here they are. There's our balance, trans, and login. Right? Now this isn't always the case, depending on how the SWF is written. So you may have to search for different things, but it, it definitely helps out in finding these things. So, another thing I, I guess I should say is that if you are using this tool to, to brute force method, or to, you know, grep through and find the methods in an SWF, that might not be all the methods available on that flex server. So you still probably want to brute force some things too. Because maybe there's different SWFs for like an admin or a normal user. And all those server, all those methods and, and, you know, remoting stuff is exposed, but you don't actually see it in the, in the, in the SWF. So, the next way that you can do it is there's a, this fully automated mode that I created that basically is gonna download the SWF, grep through, pull out all the, the things for it, all the remoting methods, the gateways, the end points. It's gonna go through all the services and the methods. It's gonna figure out the proper number of parameters. Then it's going to do some basic fuzzing of those parameters and generate a report for you. I mean, this isn't gonna auto-own anything for you, but it definitely gets you a lot closer. Because those methods, once you can access them, you know, potentially privilege escalation if it's, you know, admin related functionality. A lot of times there's information that leaks out. They, you know, SQL injection, all your standard, you know, web app stuff. So this is the report that it generates. And the first page here has just the SWF analysis. So this is running SWF dump. Basically the things that I pull out. So this is your gateways, your services and your methods. Once you have that, it's basically all you really need to, to manually call all those things and start doing it yourself if you want. Then I also have the methods that came back with a valid or, or seemingly valid response. And so you can see here it's got the URL, and that's your gateway. And then, you know, the service, which is login for this example, and the method is check creds. This was all pulled out of that SWF. It takes two parameters. The ones we supplied during the fuzzing was just zero, zero. And then the result was invalid username and password. Right. So there's the login. And I think that's the only one that comes up here. And then you look at the errors, and you'll see that we found this transfer method. The transfer service with the make trans method. And it takes four parameters and, but none of these actually worked correctly. And so you see here we get the wrong data type, which we saw earlier when I ran it manually. And then if you keep looking down through all these logs, it gives you a lot of information. So, like for this example it's got, it gives you the whole SQL query and other stuff about, you know, what, it's, it's just a stack trace basically. And then also, I also show any of the empty results. So that's basically where you query a method, and then you're gonna create the, with what appears to be the right parameters, but you don't get any response back. So for this example, I have the balance and then the get balance method, but with one parameter of just zero, and I get an empty array collection back. So I didn't get anything. So if you remember earlier, I threw in the proper numbers for the account number, and I got the results back. So another way that you can figure out, you know, what the methods that are being called, if you don't want to decompile the Swift file or whatever, is you can just use, like, Wireshark to grab the data. I don't think Wireshark has an AMF decoder yet, but you can still kind of pull it out and just see it, you know, in the actual body of that post. So it's not that hard. Also, charlsproxy will pull out some of that information, although it doesn't pull out all of that information. It's kind of interesting when I was going through the different decompilers to figure out some of the information about what the services and methods are. When you look at, I was using HPSWFscan, which came out fairly recently. That doesn't actually decompile all of the code for you. When you export that code, it's missing a lot of stuff, like the services and stuff like that. So, and I was using SoThink, but that's commercial, so it's, you know, not an ideal solution in my mind. And then SWFdump is open source, and it gets you enough there to actually manually review the output and figure out, you know, what's going on. So, you know, that's pretty much it for this tool. Like I said, there's three ways to figure out what the methods and services and gateways are. Looking through the SWF, grepping through that, reverse engineering that, just brute forcing them, and then sniffing the data. And then network traffic. So, you know, I've talked to a couple people over the last week or two who have had projects where they've had to do an assessment of flex servers, and they said, you know, it's been really useful because there's no real tool for it. So, you know, in the future, I hope to make it a little bit easier. I'm not a huge Python fan, so, you know, I don't know how much more coding I'm gonna do on it. I was thinking about porting it to Java. But it definitely, you know, does what it does for a quick and dirty hack tool. And doing Python, you know, I think, you know, pen testing as a profession right now, I've definitely broken into a lot of servers with this. So it's, you know, it does the trick for me. I guess as far as talking about how to fix this stuff, you know, it's kind of like anything else with the web app security stuff, is you gotta put access controls on those methods. Make sure that there's authorization. It depends on, you know, what your language you're writing in and the backend and things like that. But it's not that hard. And a lot of times, I think, when people use FlexBuilder or other things to build the GUI, they don't think about the backend or they don't really see that part. They think it's automatically taken care of. Or you have separate groups writing the backend and some people writing the frontend. Or in the frontend, they forget about the security controls or they think they can implement it there and they don't need it on the server side. So I don't know, I've had a lot of success with it. And yeah, it's worked out pretty good for me. So, and hopefully, you know, if you guys do any testing, things like that, you can try it out. Do you guys have any, any questions? I don't know if I have tried it on Lifecycle Data Services 3. I have tried it on the Lifecycle Data Services, but I don't know what version it was because I didn't actually have access to the server. Do you know if there's any changes between the last version and, and 3 that would affect this tool? I don't, I don't think so, honestly, because I think it's more of an application code specific thing than really the server. Although some of the error messages that come back are definitely generated by the server. So maybe if those got cleaned up. But I, I would be surprised, to tell you the truth. On air, it, you know, if, if an air app is doing flex remoting to a server, it would. Because it's not really focused on the client side, it's focused on the server side. So if you had an air application that did flex remoting with AMF, then yes, it would work. I haven't tried SWF on air, SWF dump on an air file yet, but I feel like it, it would probably work. But I'm not, I'm not positive. Any other questions? Any other questions from the audience? I have a question about, you know, pulling the methods from the, from the SWF itself. But there could be methods that aren't used by that. Are there any other ways to do that? Right, right. OK, so the question is, if you pull out the methods from the SWF, what if there's additional methods that are not in the SWF? Right? How do you find those? The way I've gone about finding those is just brute forcing them. I don't know. You know, maybe you could find another SWF file that had that information. And then basically, you know, do that. But basically brute force, you just guess them. That's what I do. I've been pretty successful. I mean, people, you know, I, I have a, a small word list that, that I have with the tool. Basically with a bunch of common getters and setters and, and common functions. And you know, it's pretty successful. I mean, I think honestly you could put the biggest word list you want on it and just let it run. I don't think anyone would notice it on their server. . Yeah. Yeah. Yeah. Yeah. Yes. I have a list that you can take to either brute force services or the methods. Yep. Yes. Question back here. . If you, okay, if you per, the question is if you prefix your methods with certain characters, would it make it more difficult or, or, I'm possible to brute force? I guess it just matters if it, if those characters are in your brute force list, right? I mean, it's obfuscation. It's a matter of how big your dictionary is. Right? So. All right. Well, thank you. I'm out of time here, but I'll be, I'll be around if anyone has any questions. Thank you very much.