They're going to be doing a talk on attacking Oracle from the Metasploit project. All right, thanks. Let's get started. Thanks for either staying up late or waking up early. So this is me, Chris Gates, part of the Metasploit project, pen tester by day, blogger, security twit, all the other stuff. If you want to know more, ask me or bust out your Maltego license. My name is Mario Ceballos. I'm kind of known as MC within the framework. I'm sorry, now? Okay, again, my name is Mario Ceballos, known as MC from within the framework. I do a lot of vulnerability research, exploit development. Some of that stuff ends up in the framework. A lot of it doesn't. My primary focus is on auxiliary modules and code execution vulnerabilities. And for a day job, I... All right, do pen testing. So a quick disclaimer. This is not our employers. Everyone has to do that one. And then the other disclaimer is, with the exception of some SQL injection that Mario found, most of this stuff is not new. It's been around for quite a while. It's been really hard to put all these random SQL files and Perl scripts and everything together to kind of put a whole attack together. So what we did, one of the things I was kind of going for when we did this was to put a process in place for pen testing in Oracle, and Mario's going to talk a bit about some of the other things he did and why he built this stuff. But that was the big thing, is we didn't invent or discover it. We just tried to streamline the process and make it easier for all of us that are doing pen testing. So why are we focused? So lots of pen tests, I've seen lots of potential Oracle clients. From my experience, and everyone's experience is going to differ, people are either falling into the, I have a DBA and his own personal hell is making sure he's doing this Oracle stuff, or they don't. And I'd say, oh, you got Oracle stuff. If you've got Oracle on your network, who's in charge of the MetaLink account? And they'd be like, what's a MetaLink account? So with the Oracle business model of allowing free downloads, but no updates without paying, we started seeing lots of default installs out on the network. And privilege escalation is easy and data theft is easy, but you know, it's Metasploit, so we want shells. So why we did this, there's not a lot of, actually, I don't know of any support in any of the for pay frameworks that will go after any, like, support in any of the for pay frameworks that will go after any, like, support in any of the for pay frameworks that will go after any, like, SQL injection vulnerabilities in Oracle. Saint will do some of the memory corruption stuff that's in the default packages. But maybe Core does now, I haven't seen it. And some of the other open source tools that do that are in Guma. I'm not sure it's still being worked on. Orisploit, that's not public. And then some commercial tools that focus more on doing VAs against Oracle and less on exploitation. All right, so I, okay, now, right, cool. So some of the current Metasploit support. We have is more on, again, the memory corruption vulnerabilities. This stuff's kind of supported by myself and a few other developers. We got coverage for things like Oracle secure backup, WebLogic, WebLogic overflow, a couple of TNS listener version, or TNS listener process overflows in different pieces. We also have some auxiliary modules that we kind of stuck in there at first using a file format mix and to take advantage of some of the SQL injection flaws that we're going to be talking about. Those are kind of obsolete now, I kind of removed those Tuesday and kind of rewrote those to use a new mixin' we're going to get into. And a really cool NTLM stealer, which doesn't really inject anything, but kind of tells the Oracle instance to pretty much mount an SMB share on our side. And then we pretty much relay that hash and log back in to the, you know, the Oracle instance as the credentials we received from DBMS. So, I'm sorry. All right. So, cool. So, new Metasploit support. I think sometime last year I kind of wrote a TNS mixin' to support one of the, a couple of TNS overflows that I was writing. Doing all that work up front pretty much helped me out to do a lot of other things that weren't really exploit related. And again, so that mixin', which pretty much is just, creates a dynamic. TNS packet, it's used for our SID enumeration tool, our brute force enumeration tool, our, what else we got there? A lot, what happened is that we ended up getting a full blown TNS command.PL port into the framework. But the big thing about this talk here is an injection of our Oracle mixin', which pretty much is what allows us to do all the magic we're probably going to show you here in a second. A couple of dependencies. We're wrapped around the Oracle instant client for the direct database access. We're using a really lightweight API for the database execution of our SQL statements and we're using an OCA Ruby driver. It's kind of broke with the newer versions of Ruby 1.9. Right. So. It doesn't work on Windows yet either. So. Right. Sorry. Yeah. So anybody who can get that stuff, I mean, I usually develop under Linux or OS 10. I don't touch Windows. I might attack it. And Eric, I mean, Chris has a link here to the install P2, right? So. So with the mixin' we kind of, with the mixin' I kind of create a couple of methods that are really simple to use. Straight forward. Connect, disconnect. Those two methods are used for our brute force module that looks for default known accounts given a correct SID. The per exec method does just that. It takes a statement. It makes sure that it's correct. Sends it off to the remote service. And if things are correct, you know, it spits out a pretty nice format of what you just sent off. This is just a quick example of the output of our. So what we've done is essentially made a really simple SQL client from within the framework to talk to the database. So, yeah, you can do some administrative tasks that we've gotten from Carlos Perez. And I think Rory, if you're in the room. But it's kind of used for more of the evil stuff that we're doing. All right. So from a tag methodology point of view, we need four things to connect to an Oracle database. We need to know what IP it's on, obviously. What port it's listening on, if it's on its default 1521. The service identifier, which is kind of the unique name for the Oracle database. And a username and password. So that makes sense, right? So from it. First thing, locate Oracle systems. So we got NMAP information disclosure. So maybe as you're doing some other pen testing or some web app work, you'll see that there's some Oracle errors coming back. Or you'll just kind of stumble across it. Or Google. So if you're doing an organization, you may see if they have any kind of public presence via Google. Starting with, like, I know with 4.9 and NMAP, it will now return the TNS listener version. Which is actually really handy. Up until, you know, that, it was really hard. You would just get an open Oracle port. Which wouldn't really tell you too much what version it was, what status that thing was in. So the new NMAP is actually really handy for that. And you can also look for other common Oracle ports. So 1158 is your enterprise manager console. Your 5560, your SQL plus web portal. Plenty of Google dorks if you want to locate Oracle systems. The red database security guy wrote some really good white papers on using those. Sometimes they come pre-owned. I don't know if you can see that one. But I found that one doing some Google dorks. Logged in with Scott Tiger. And he was already DBA. So someone got to that one before I did. Happens actually quite a bit if you, not that I would ever encourage you to go look for open Oracle boxes. But if you do, you'll probably find quite a lot of them are already owned. So determining version is obviously key. We need to know, we need to know what version things are. So we know what exploits and SQL injection things to tailor toward it. So what we do here, you know what? I'm all in Mario's slide. Go ahead. Okay. So what we do here is we send a TNS version packet with the TNS mix in. And it just parses out the results. And I haven't come across any issues with this ever not working for me. So that's pretty handy. Oracle needs to know, the instant client needs to know the version it's talking to. So it can do its handshake and make sure that it's allowed to talk. Mario's also at some point going to be pushing out some code that will query dbnsmp.exe that will do some information leakage. Which will help us see installed paths for Oracle. I think we also pushed out the TNS command one, right? There's also a port of tnscommand.pearl. It's now tnscommand.rb. Which will allow you to basically send whatever commands or information you want to via TNS. Which is pretty handy. There's a video I'll be pushing out later. Which you can set log files to whatever and do the old school Oracle 9 hacking with that. I think that's it. Oh, we have also all these scanner modules. Also have the report mixing built in. So if you want to use the database stuff, you can actually output that stuff to a database. You want to talk about that? Well, the big piece of that is because eventually we're going to go to the dbautopone stuff. So it makes things really easy to own massive stuff. So, yeah. So we get the data. We save it. And we get ready for some mass exploitation. Alright, cool. So determining the SID. This is the crucial thing. You can usually come across a username and password. Either social engineering or finding it on someone's desk or whatever. What's sometimes hard to find is that SID. It's critical. If you don't know the SID, you could know everything else. It could be a vulnerable Oracle box. If you can't connect to it, you can't do anything with it. So we've got a few modules that we built that actually help with that process. The first one is so with 9.2.0.8 and below, if you just send a status packet at it, it will actually give you the answer back. It will say, hey. My SID is ACMS. My service name is ACMS. And I've got all this other stuff running. After that, you'll get a listener protected. So the little code at the bottom there is showing that it was against an Oracle 10 box. And it's not going to give you anything. So if we won't give it to us directly, we've got a few other methods that we can kind of go after it. First thing we do is we can brute force for default SIDs. So we take the SID list from Red Database Security. Feel free to add to it. Mine's growing every day. And it just rips through and asks the Oracle instance, oh, are you Oracle? Are you DBMS? Are you Oracle 9? Whatever. And if it's right, it will give you a different error message back and parse that out for you. Or we can query other components that actually will contain the Oracle SID. The Enterprise Manager will show it to you. There's a couple Java servlets that will actually have the Oracle in the HTML. And what we've done is wrote some auxiliary modules that will actually run through the class C and check and see if they're there and then log those for you. So in this case at the bottom, we can see that the servlet spy is running. And we run the module and it found that the SID was Oracle. So if Enterprise Manager console is running, this is what you'll see if you just browse to the web page. But if you're auditing a big network or you're trying to automate some of these things, you don't want to browse to every page and then write down the answer. So we've got an OAS SID module down there at the bottom that will actually go through and parse out that HTML and give you the answer. Do you want to talk about some of the other modules? Well, I just want to kind of emphasize that we are logging everything. We're using another mixin called the report mixin and log everything to a local MySQL database or SQLite database. So as you're going through the network scanning and looking for potential targets, everything is saved. We don't want to waste any data. We don't want to rescan it. We don't have to. And, you know, unfortunately, we don't want to get caught either, though, too. All right. Next step, username and password. So, like I said, if you can't come across it by any other means or you've been had your scope restricted enough that you're going to have to do something that in the real world will get you caught, we have a login root script. We'll actually throw all the default Oracle usernames and passwords at the database. And if you get one that defines one that's right, it will actually, you know, log that for you. Again, using the reports mixin. So as we progress with DB autopone, all that stuff should automatically do stuff for you. And I should have updated the slide, but the actual output from the DB notes, we also saved the SID that we used. So, again, we don't have to go back and rescan. That's actually really important. All right. So privilege escalation via SQL injection. If anyone's unaware, there is a ton of default Oracle packages with SQL injection. Most of it is executable by public, which means if I can get any username and password, I can call that SQL injection. I'm not going to give a SQL injection 101 class, but the regular SQLI means you need to have a connect privilege. And if you don't have that, there's a cursor SQL injection that works in 9 and 10, requires a little bit less privileges. All right. I'll put out some more notes on that later. Go ahead. All right. So I guess we're going to step through a really generic module that we wrote. What we're highlighting here, okay, well, everything in black is just metadata of the module. It's just information. You can see the name of it, we're actually, we kind of picked this. The SIS.LTEFINDRICSET is the actual vulnerable package. And we're going to use the SIS.LTEFINDRICSET. Procedure that we're going to be exploiting in a short demo here We kind of chose this because a lot of other talks used the same injection method. We just put our own little twist to it The red is our actual I hate to say the word but our payload is what we want aren't you know our injection to to Perform and by default we grant the DBA Privileges to the user that we've used to log in and potentially exploit right What's what's handy, but what's handy about that is it doesn't always have to be grant DBA to Scott So if you just need to change your permission on a table or a file or something You can actually just use your sequel injection to do that versus grant and DBA because a lot of things as Mario's gonna talk About a grant DBA across the wire or in memory might flag on some things And it's fun just to grant DBA to your buddies too when you don't need it So now this part the nice thing about running your DBA is that you don't have to run your DBA Using the framework that we get a lot of access to other API to do some obfuscation of like Variable names function names and the name equals is just doing that we kind of randomize The function name in our what we what we declared as a function The off ID current user as is pretty much just a run this as whoever invoked it pragma autonomous transaction again, this is just a cookie cutter create and We create a replace function the problem Is that it's pretty much a but a problem that does a very member, right? It's been so long that I've done this stuff, man a Fork and join of the main process to the sub process It's been a long time since I wrote one of these so I'm sorry Then we just jump into our actual actual we begin execute immediate our foo and then return something You know fortunately returning a zero because we're returning and we want to return a number on top, but we're hackers We don't really care about the errors. We don't return shit And then we end it And then the actual vulnerable call to or the actual call to the vulnerable package And this again in this isn't it's assist LT find a rig set at which I think to find the LT has to do Was the workspace manager to find a rig set procedure? deals with versioning of a table name and The injection happens in the first argument, which is a table name the next thing we do is we Well, so we actually throw our injection. We we call it By calling our function and then we go back and we try to be somewhat clean and remove any residue that we left So we drop our function And you know, it's really simple. I mean, it's really The sequel is like maybe all together eight lines of code after we've done all the heart, you know All the work has been done up front So all you really got to do is when you're auditing these things is just focus on the vulnerability and then You can own a lot of stuff Anything else? The big thing for that is as you create new as you want to pour over the public sequel injection That package is really the only thing that you need to change Everything else is going to stay the same and you just need to change the package So instead of having to worry about all the pro code all the stuff that's handling all the connects disconnect You just need to worry about the actual injection. You're trying to exploit So hopefully that's pretty easy for everyone as they you know fuzz all the things and look at the Oracle CPUs, that's all you have to change one line of code All right, so everyone's probably seen this if you're familiar with the framework And these are also the four things I talked about that we needed to connect Set our remote host to set our IP the port our user password and the SID and then lastly we have that that payload Our sequel injection variable of whatever we want to run. So in this case, we're going to grant DBA to Scott Yeah And so this is kind of what it looks like when you're running it So again, we set our set our sequel it runs it creates the first function which is going to be some random function name Perform the actual injection and then remove the function So we clean up some that stuff still be in the transaction logs, but we're not leaving We're not leaving anything hanging for someone to find later Hopefully not And so that we can kind of see did it work it did you know now? After the injection Scott is now DBA. Yay, we can start on with the other fun Well, which works but you know, I'm a little more paranoid than most when I'm hacking so So, you know the previous slides it was really easy to take some code else public, you know Make it work and it did cool stuff but you know when you do that you kind of Let everything down and you get caught the screenshot of pretty much is a screenshot of the base interface that SAR attacked actually What you know signature flagged what function what package or procedure was called and what you know what it did? That's not fun So, yeah, you get caught real fast doing you know pretty much, you know hacking naked So I kind of saw that this, you know I kind of put in a couple of examples in the framework to do just bypassing snort They have some static signatures for these particular This particular bug Really easy on the Metasploit side We just kind of base 64 encode our entire entire, you know intact our entire function and then our call to the vulnerable package or procedure and Then on the DBMS side we use some UTL tricks to actually decode it And if you know you read from right to left we take that, you know, those is which you know It could be the package or the functioning whatever We read that back through the database So we take the 64 decode that the decode library the database has We throw that back in the string then we go ahead and execute that that works fine for almost any signature based ideas that's looking for these type of attacks a Little overkill anybody does real SQL can see that I'm not that good at it. I just don't want to get caught I just don't want to get caught That works on 10 and 11, not on 9 I'll have to fix that I'll have to fix that Well, I mean we can add that evasion but if anybody's familiar with the Centrigo Hedgehog suite it's a like a Database hips and they have an Oracle agent that it's really cool It caught the x white because it kind of decodes everything from memory so over the network we came clean but the hips just flagged us and Gave up all of our access and you know And you know now the response team is like what the hell happened? Now we know who it is when they did it how they did it and then what they did Again, I'm not picking on Hedgehog. I just you know, that's what they claim they do this and they do that fairly well But we we can we can beat that stuff sometimes This slide is probably the hardest side for me to put in here because it's probably the most important It's just kind of bring brings back to yes And before I even get into it it kind of bring you back to the essence of you know what their framework is? about really So on the main side you see there's like these three things it's good for the the pen tester It gets for the researcher and it's good for people who write signatures Up to this point, you know, we're good for the pen tester and you know forthcoming slides is good for the pen tester but this one slide is is really why I wrote the stuff was to actually find other vulnerabilities or you know extend other vulnerabilities and you know fuzz and Yeah, and so what it did give me a really quick way of doing this stuff So again, it's Hedgehog again. We're attacking Hedgehog and I think in 06 there was a CVE that came out for the DBS meta packet metadata package having SQL vulnerabilities Then I think maybe a month two months later I'm not sure how long but there was this pro script that actually exploited one of the functions in the package so When I when I actually wrote that initial exploit that we were just pointing stuff over to make sure people had coverage for Certain things we ran this I ran this exploit against the Hedgehog and you know, it sought flawless You know what Hedgehog says that they're you know, they're able to catch Oday and you know things like that Well, even though it doesn't so much Oday is that there's other vulnerabilities within the same package that they're not covering so So I'd probably spend about you know using the new mixin and about me I don't know an hour worth of scrubbing the actual contents of the The package itself what a quick little fuzzer, you know And came up with like three other injects that for the same package that bypassed the hips Yeah, and you know again, I'm not I'm not picking on them but you know just don't trust your vendor to cover your butts when You know, I'm using old stuff and not even doing any evasion not doing any encoding Anything just coming through the network hacking naked and it still didn't see me although it did catch the grant DBA But the response team is you know They're like, what the hell causes grant DBA Which was some old, you know injection flow that they should have had covered for Yeah, so nothing against Pete Finnegan or Alvin Kornburt because they're I'm like They're all sharp cash. They do real DBA stuff So this is kind of a list of the initial push that we put out and the respective CVS That's by not by far. Not all the stuff stuff we have. We just wanted to do an initial push, let the community take a look at how we were doing this, how we were pushing out the SQL injection. What's in there is a good breadth of regular SQL injection, cursor SQL injection, and some of those modules are using Mario's, I'll call it IDS evasion, but it's not totally IDS evasion. But it should give everyone in the community that wants to start porting the rest of that SQL injection the ability to take a look at those modules, change the one line of code that they need to change, and push those back out to us, and we'll push them back out into the framework for everyone to use. Also, that's a good, it covers both 9s, both 10s, and 11s. So you should have something to play with for whatever you've got in your lab. So some post-exploitation stuff. I think this one's mine. So we could argue whether the data is more important. I think in most cases, the data actually is more important to us. So if we're DBA in the box, we now have access to pretty much any table or any data that we want. And if you're getting tasked to do a good pen test, this is where you need it to be, because you wanted to show them, I got access to this data. But using the SQL.RB thing, we can basically run commands, we can check access, we can make sure things are working right. So data's nice. This is Metaspoil. Everyone loves shells. So I love shells. I love breaking into stuff. So several published methods that have been around a while for actually running OS commands on the database, once you've got DBA access. So you can do it via Java. You can make some Java packages and classes. Xproc backdoors. Run OS commands via DBMS scheduler. Or, I mean, you can really roll your own. You can run any PL, SQL, or Java you want. And now with the post-exploitation modules we're pushing out, you can see that it's really easy just to write your own post-exploitation stuff. Use that prepare exec method in the API to run whatever you want. So it's pretty powerful. So the first one we'll talk about is Win32 exec. This is actually in the framework now. What you need to do is grant JavaSys privs to whatever user you're running as. From there, we can run the Win32 exec module to just run OS commands, and that's via Java. So net user ads, you can TFTP your Trojan over, do FTP batch scripts, I've also got a video out on the net of doing a net user ad to Metasploit, and then if we're on the LAN, we can do a PS exec to Meterpreter shell, which is pretty handy. Yeah, so that's kind of what it looks like. We set the command to whatever OS command we want to run, so we're adding a user DBA and a password. Creates the class, creates the procedure, runs the command, and it cleans up. It's not in the screenshot, but those also delete the Java classes that we create there, too. Anything to add on there? Yeah, I guess the stuff takeaway from this is that, you know, it's cool that we got the data, and if you're doing a pen test, the data's probably the important thing to show, but you know, if you want to escalate to the network a little more, it's probably better to break out of the Oracle sandbox and get to the operating system. And again, this is just one way of doing it. So some examples, some things you can do. You can echo over your FTP batch script via a util file, and then you can use DBMS schedule to run some things, and I did a video of this. It's on the Vimeo site, and the URL for that will be at the end. Just showing you some examples of some things you can do. Because Oracle is awesome, and it installs Perl with every install, on any kind of the Nix environments, you can actually just use the same util file and echo over a Perl shell, and then execute that. So that's something handy if you're on any kind of Unix environments. Good? Do you want to say something? Yeah, I did have a Nix variant. Of the Win32 exec stuff, it's not too clean, because everything has to be at the absolute path of what you want to execute. It does work, and you can use some server-side scripting, or decoding, like UU encode, UU decode, to do a lot of nasty stuff, too. So again, I'm a little paranoid when I hack. Evil. All right, so some other things we can do, external proc factors via directory traversals. So if you find yourself on an old Oracle box, you can actually use this method to just directory traverse out into either Windows LAN for MSV, CRT, DLL, or a libc, if you're on any kind of Linux environment or Nix environment, and we'll actually just allow you to invoke system commands that way. We'll be pushing that module out next week, once I make sure that it's cleaned up and working. That's kind of what it looks like. You set the path to wherever your Oracle binary or bin directory is, which you can use. You use your SQL.rb module to actually find that out for you. It's just one quick kind of look up. Just navigates out and calls it and lets you run your commands. Again, we're just using a net user add. Pretty simple, but sky's the limit on whatever OS commands you want to execute. Just showing that it worked, I added a Metasploit user. I also added him to the admin group. No big deal. Alex from Digital Security Research Group, who's actually put out a lot of SQL injection code. We've got a same external product backdoor, but in this case, instead of directory traversal-ing out, you can actually just copy the binary into your Oracle bin directory, so when Oracle patched the old vulnerability, it didn't really fix this one. This works on all the newer Oracles, so late 10Gs and Oracle 11 and 11.6 and 11.7, so it works pretty good, and we'll be pushing that out as well. All right. So the guys from our JPEG team, they're going to be doing a demo of this. So I'm going to have Dennis back in 2005 push out some code that would actually allow you to grab a binary from a remote web server and pull that back down into the, or back onto the OS, and then we can use the Win32 exec module to actually execute that binary. We'll be showing you a demo of that in a second. Again, DBMS scheduler backdoors. Alex sent that in. We'll be adding that to the SYN very soon. And he's going to talk about this in the end. Oh, yeah. I kind of alluded to this earlier, but this Oracle NTLM scheduler is the shit. I mean, all you really need is a user that has connect and resource privileges, and you just force, you know, use some CTX context, or ctxcontext.sys. Man, it's awesome, because you don't really have to inject anything, you just need a valid account. And again, you kind of go, you don't get back into the database, you go straight to the operating system using, you know, pass the hash type of stuff. Yeah, Alex rocks. That's actually a really good attack when, I mean, by default, Oracle will run a system, but a lot of people recommend to actually make it be an admin, run it as a different domain account, so this is a good example of, you know, obviously system doesn't have any domain cred, so your SMB relay is not going to work, because there's no way to log into that. But if it's running as an admin, you can now do the half LMs and SMB relay type stuff. And he wrote, actually, a whole white paper on why you would do that, so I highly recommend you go read it, because it's really good, and it's really, really solid. It's slick. I never even thought of that, and the way he did it, so. Yeah. Yeah, go ahead. Yeah, yeah. If the instance is running as a domain user or a domain account, yeah. That's when it works. By default, it'll go by system, and you have to go and click and free that, so it runs like an administrator user or something like that. So, yeah, it only works then, of course. But, yeah. Yeah. That's that special case when you, when they've actually done some hardening, and it's not running as system, so some of those other tricks aren't going to work for you. Mario says no, so I'm going to listen to him. No, no, no. Oh, it will? Yeah, it will. I'm sorry. Yes, it will. There you go. All right. So, one of the other modules that Mario pushed out is a simple CGI scanner. So, it'll help you kind of look for some of those vulnerable servlets and things that we were looking for earlier when we were trying to identify our SIDS. Just a little extra bonus. I mean, that's about it, right? Yeah. Yeah. Nothing special. Just. Okay. So, I guess before we get into Chris' demo, the way ahead, again, it goes back to the researching piece of what the framework is about. The reason why I kind of wrote this stuff was the same packages are vulnerable to overflows. It's not no secret that there's a lot of them out there. There's hundreds of packages, you know, that are executed by public. But, you know, under Windows, the point being is that, yeah, we have exploits for them. Eventually, we'll push them out. I kind of got them scattered about. They're not really clean. So, yeah. So, yeah. Overflow is where it's at. Okay. I'll add a little more to that because what's handy about this is if you've looked at any of the POCs for a lot of the memory corruption bugs that get pushed out. They're kind of confusing to look at and it's hard to reimplement that. So, what's really cool about the mixin and the stuff that Mario wrote is you don't have to worry about the setup, the connect or any of the other stuff. The mixin is doing that for you. All you really have to worry about now is the actual string that's doing the overflow. And that's kind of what this slide is supposed to be showing you that all the back end stuff is now handled for you by Metasploit. You don't need to worry about all that. You just need to focus on doing the vulnerability, you know, and exploit dev stuff. All right. So, I have a demo. I'm a little gun shy so I recorded it. Sorry. All right. So, the first thing we're going to do is run the TNLS listener version command which is going to give you the version of the TNS listener which is usually the same as the DB version but not always. Next thing we're going to do is try to do the sit enum. Because this is a 10 box, it's going to fail. But I just wanted to kind of show what kind of what it looks like when you try to run it. So, we've got a listener protected which we knew was going to happen because it was Oracle 10. Next thing we're going to try to do is try to brute force the SID. I added in a sleep variable. So, if you're doing this across the LAN, .1 is probably good. If you've got to go across a WAN, if you're kind of going after someone remote, you may need to LinkedIn that out to kind of help with some false positives. Now we're doing the account brute forcing. What's handy about this is it runs pretty fast and we actually just left the output so you could see that something was going on because sometimes it could take a long time over the net. And it writes all that out to a log file in your data word listing. So, you can actually query that later to make sure that it's there. So, you can see we found two accounts. These are the two default accounts for Oracle 10. So, DBSNP and Skype. This is Scott Tiger. We'll go after Scott because he's going to have the connect and resource privileges. So, this is the SQL.RB module. This allows us to kind of check our work, make sure that all the things that we found, the SID and the account are actually working. And it just allows you to run simple queries. And then this is kind of what Carlos is extending to do some of the admin checks. So, we just fill in our gaps, you know, the SID we found, the username and password. We're going to check his privileges and see what kind of permissions he's got that he has. So, he's got connect and resource. So, the next thing we need is we need to escalate him to DBA so we can do some fun things. So, we're just going to use the LTFindRigsetCursor method. I did my best to put where I got most of this stuff. So, if I missed something, just send me an email and I'll be happy to add it for you guys. Again, so we're just sending our SQL to grant DBA to Scott, filling in all the gaps. And that's it. Creates the method. Creates the function. Executes it. And then deletes itself. Go back and check again. Now he's DBA. To use all the Win32 exec and Win32 upload, we need to have the JavaSys privs added. So, we just do that real quick on the command line. So, it's there. So, the next thing we're going to do is we're going to do the Win32 upload. Because I already had a demo showing doing it across SMB. You don't always have SMB access. So, let's try to do it remotely. So, we're going to grab a interpreter binary from my web server and write it to the C drive on the Oracle instance. I'm just showing that it's not there. You'll have to trust me. It wasn't. This is the remote box that's actually going to catch the callback on the web server. So, we'll just use the exploit multi handler to catch the callback. All right. So, we're listening. We're ready to run it on the other end. All right. So, it's creating the Java source file. It's creating the Java procedure. Actually downloading the binary from the web server and putting it on the remote box. And then cleaning up. So, we delete all that stuff. And you can see it's there. Again, you'll have to trust me. I could have just put it there. But it works. Then we're going to use the Win32 exec module to actually execute the OS. What? No. You can talk to HC. I mean, he has that whole post and all those tricks of how to make the meterpreter shell not flag on AV. So, we called it math.exe. And so, we're just running it. And then you can see it's running it and cleaning it up. And then on the remote side, we've got the shell. That's it. Yeah. So, what we've done is we just created an extension to the framework to do other stuff. Just to help the pen tester and the researcher and hopefully the security community as far as the defensive side to do. So, that's what we're going to use to see some of the stuff that could happen and it probably will happen.