<?xml version="1.0" encoding="utf-8"?>
<feed xmlns="http://www.w3.org/2005/Atom">
    <title>Rory.Blog</title>
    <link rel="alternate" type="text/html" href="http://www.mccune.org.uk/blog/" />
    <link rel="self" type="application/atom+xml" href="http://www.mccune.org.uk/blog/atom.xml" />
    <id>tag:www.mccune.org.uk,2009-02-22:/blog//1</id>
    <updated>2010-01-05T18:08:54Z</updated>
    <subtitle>A weblog about things that Interest me, mostly Security with a little Networking a dash of IT and the odd Cat.</subtitle>
    <generator uri="http://www.sixapart.com/movabletype/">Movable Type Pro 4.32-en</generator>

<entry>
    <title>Ruby SSL Checker</title>
    <link rel="alternate" type="text/html" href="http://www.mccune.org.uk/blog/2010/01/ruby-ssl-checke.html" />
    <id>tag:www.mccune.org.uk,2010:/blog//1.536</id>

    <published>2010-01-04T20:43:45Z</published>
    <updated>2010-01-05T18:08:54Z</updated>

    <summary>After reading a post by Gursev Kalra here, I decided to have a shot at putting together a slightly expanded version of his ssl Cipher suite checking code in ruby. I&apos;ve got it working reasonably well in my tests and...</summary>
    <author>
        <name>Rory2</name>
        <uri>http://www.mccune.org.uk</uri>
    </author>
    
    
    <content type="html" xml:lang="en" xml:base="http://www.mccune.org.uk/blog/">
        <![CDATA[<p>After reading a post by Gursev Kalra <a href="http://gursevkalra.blogspot.com/2009/09/ruby-and-openssl-based-ssl-cipher.html">here</a>, I decided to have a shot at putting together a slightly expanded version of his ssl Cipher suite checking code in ruby.</p>

<p>I've got it working reasonably well in my tests and it can chuck out reports in text and XML .  The code for the main script and a Metasploit module which does the same is <a href="http://wiki.mccune.org.uk/index.php/RubySSLChecker"> here</a>.  Any feedback/suggestions welcome :)</p>]]>
        
    </content>
</entry>

<entry>
    <title>Tools I use - Burp</title>
    <link rel="alternate" type="text/html" href="http://www.mccune.org.uk/blog/2010/01/tools-i-use---b.html" />
    <id>tag:www.mccune.org.uk,2010:/blog//1.535</id>

    <published>2010-01-04T19:14:25Z</published>
    <updated>2010-01-04T19:30:05Z</updated>

    <summary>I&apos;ve been meaning to do a post on burp for a while, and courtesy of my new years resolution to stop procrastinating, here it is :) I was thinking of a way to sum up burp, so far the best...</summary>
    <author>
        <name>Rory2</name>
        <uri>http://www.mccune.org.uk</uri>
    </author>
    
        <category term="Penetration Testing" scheme="http://www.sixapart.com/ns/types#category" />
    
        <category term="Web Security" scheme="http://www.sixapart.com/ns/types#category" />
    
    
    <content type="html" xml:lang="en" xml:base="http://www.mccune.org.uk/blog/">
        <![CDATA[<p>I've been meaning to do a post on <a href="http://portswigger.net/">burp</a> for a while, and courtesy of my new years resolution to stop procrastinating, here it is :)</p>

<p>I was thinking of a way to sum up burp, so far the best I've got is "If you're doing web application testing and not using Burp, you're missing out !", it is that useful...</p>

<p>Burp has been around for a while now as one of a group of handy web application proxy tools along with the likes of <a href="http://www.owasp.org/index.php/Category:OWASP_WebScarab_Project">Web Scarab</a> and <a href="http://www.parosproxy.org/download.shtml">Paros</a>.  Over time it's developed a huge range of handy features, which make web app. testing a lot more productive.</p>

<p>There's the basics, in terms of intercepting and modifying requests, which all the tools in this category tend to do quite well, but on top of that there's just loads of other things that Burp does. </p>

<p>The Web app scanner is a good targetable way to test for several types of common web app vulnerabilities.  As an add-on in the latest beta, there's a wizard which lets you reduce the number of requests that Burps going to make, by removing duplicates and similar requests.  If you've used many commercial web app. scanners you'll know that volume of requests generated can be a real problem, so anything that can help bring down the load is useful.</p>

<p>Another stand-out feature of Burp for me, is intruder which lets you pick a specific parameter or set of parameters from a request and easily modify them.  As an example pretty much every time I see a URL that looks like <b>request.asp?id=123</b> , it's going to be worth running burp Intruder over that parameter to see what pops up when you change that value.</p>

<p>One of the things I have found about burp is that it's easy to miss functions that are available and not get the best out of it.  Luckily there's a <a href="blog.portswigger.net">blog</a> which covers a lot of the new features as they come out.  Also I need to mention the Burp Tip of the Day series of posts on <a href="http://cktricky.blogspot.com/search?q=BTOD">Cktricky's blog</a> which has loads of good tips on getting more out of Burp.</p>]]>
        
    </content>
</entry>

<entry>
    <title>... And we&apos;re back</title>
    <link rel="alternate" type="text/html" href="http://www.mccune.org.uk/blog/2009/12/-and-were-back.html" />
    <id>tag:www.mccune.org.uk,2009:/blog//1.534</id>

    <published>2009-12-31T14:26:13Z</published>
    <updated>2009-12-31T14:59:55Z</updated>

    <summary>So, we&apos;re back from a bit of an unscheduled break for my web server. The hosting company had a bit of a problem with disks, so my VM has been out of action for a week or so. Luckily, my...</summary>
    <author>
        <name>Rory2</name>
        <uri>http://www.mccune.org.uk</uri>
    </author>
    
    
    <content type="html" xml:lang="en" xml:base="http://www.mccune.org.uk/blog/">
        <![CDATA[<p>So, we're back from a bit of an unscheduled break for my web server.  The hosting company had a bit of a problem with disks, so my VM has been out of action for a week or so.</p>

<p>Luckily, my backups worked pretty well so minimal content lost.  I'm using the rather unorthodox backup over SMTP, which seems to work pretty well for smaller files.  I knocked up a ruby class called <a href="http://wiki.mccune.org.uk/index.php/Ruby_Backup_Class">Rbackup</a> and just have a script running in cron nightly...</p>

<p>Actually had a trio of hardware failures over the festive period (2 hard disks and a graphics card), which just goes to show that checking backups (and restores!) is very important and not to be put off...</p>]]>
        
    </content>
</entry>

<entry>
    <title>Nokia N900 - Ultimate Hackers Phone?</title>
    <link rel="alternate" type="text/html" href="http://www.mccune.org.uk/blog/2009/12/nokia-n900---ul.html" />
    <id>tag:www.mccune.org.uk,2009:/blog//1.533</id>

    <published>2009-12-20T12:30:33Z</published>
    <updated>2009-12-20T12:44:39Z</updated>

    <summary>I got a Nokia N900 the other week and I&apos;ve started playing around with the software. At heart it runs Maemo Linux which is based on debian, so in theory any software that runs on debian should run on the...</summary>
    <author>
        <name>Rory2</name>
        <uri>http://www.mccune.org.uk</uri>
    </author>
    
    
    <content type="html" xml:lang="en" xml:base="http://www.mccune.org.uk/blog/">
        <![CDATA[<p>I got a <a href="http://europe.nokia.com/find-products/devices/nokia-n900#/main/landing"> Nokia N900</a> the other week and I've started playing around with the software.</p>

<p>At heart it runs <a href="http://www.maemo.org">Maemo Linux</a> which is based on debian, so in theory any software that runs on debian should run on the phone !</p>

<p>Also unlike other smart phones which can be coaxed into running linux, the N900 has a shell out of the box and getting root access just requires a package install and issuing the "sudo gainroot" command.</p>

<p>So far I've found the ssh client pretty handy, and openvpn is available in the maemo-testing repository for all your vpn needs.</p>

<p>In terms of the hardware it's got a variety of interfaces which could be pretty cool for hacking testing.  There's wifi and GPS for war-driving/walking and obviously having 3G data is pretty useful when out and about :)</p>

<p>Getting software to run on it, isn't always quite as straightforward as just apt-get, as the repositories don't have the breadth of the debian ones yet.  So if it's not already available in maemo-extras/testing/devel then cross-compiling is the way to go.</p>

<p>The Cross-compile environment is reasonably straightforward to get <a href="http://www.forum.nokia.com/info/sw.nokia.com/id/c05693a1-265c-4c7f-a389-fc227db4c465/Maemo_5_SDK.html">set-up</a> and there's instructions on the maemo wiki for <a href="http://wiki.maemo.org/Documentation/Maemo_5_Developer_Guide/Packaging,_Deploying_and_Distributing#Making_Application_Packages">packaging apps</a></p>

<p>So far I've ported nmap 5.00 across to it, and that runs just fine, kismet seems to run ok but the default console colours make it a bit unreadable, so more work there.</p>

<p>Ruby 1.8.7 is available in the repositories and I've had Metasploit running (albeit a bit slowly).</p>

<p>All in all it's definitely smarter than your average smart phone!</p>]]>
        
    </content>
</entry>

<entry>
    <title>OWASP Scotland - November Meeting</title>
    <link rel="alternate" type="text/html" href="http://www.mccune.org.uk/blog/2009/11/owasp-scotland-1.html" />
    <id>tag:www.mccune.org.uk,2009:/blog//1.532</id>

    <published>2009-11-19T20:14:19Z</published>
    <updated>2009-11-19T20:16:37Z</updated>

    <summary>OWASP Scotland November meeting is next Thursday, the 26th. We&apos;ve got something a bit different lined up with the main presentation being one on physical security and lock picking (hey if you can break into the server room and take...</summary>
    <author>
        <name>Rory2</name>
        <uri>http://www.mccune.org.uk</uri>
    </author>
    
    <category term="owaspscotland" label="OWASP Scotland" scheme="http://www.sixapart.com/ns/types#tag" />
    
    <content type="html" xml:lang="en" xml:base="http://www.mccune.org.uk/blog/">
        <![CDATA[<p>OWASP Scotland November meeting is next Thursday, the 26th.  We've got something a bit different lined up with the main presentation being one on physical security and lock picking (hey if you can break into the server room and take the box, who needs SQL injection ;oP )</p>

<p>More information <a href="http://www.owasp.org/index.php/Scotland#Local_News">here</a></p>]]>
        
    </content>
</entry>

<entry>
    <title>Tools I use - Dradis</title>
    <link rel="alternate" type="text/html" href="http://www.mccune.org.uk/blog/2009/10/tools-i-use---d.html" />
    <id>tag:www.mccune.org.uk,2009:/blog//1.530</id>

    <published>2009-10-28T20:43:57Z</published>
    <updated>2009-10-28T20:55:07Z</updated>

    <summary>I&apos;ve been using Dradis for a couple of months now. It&apos;s an interesting piece of software that&apos;s designed to help teams of people share information on penetration tests. That said I find it useful on the tests I do even...</summary>
    <author>
        <name>Rory2</name>
        <uri>http://www.mccune.org.uk</uri>
    </author>
    
        <category term="Penetration Testing" scheme="http://www.sixapart.com/ns/types#category" />
    
    
    <content type="html" xml:lang="en" xml:base="http://www.mccune.org.uk/blog/">
        <![CDATA[<p>I've been using <a href="http://dradisframework.org">Dradis</a> for a couple of months now.  It's an interesting piece of software that's designed to help teams of people share information on penetration tests.</p>

<p>That said I find it useful on the tests I do even when I work alone.</p>

<p>Essentially Dradis provides the base environment for users to work in, either from the command line or the <a href="http://rubyonrails.org/">rails</a> based web interface, and then pretty much lets them get on with it, so it can be a bit difficult to work out how you want to use it at first, but once you get used to it it's very handy!</p>

<p>What I've done is started to create templates for information that I need to collect during a test and areas to review, that way it reduces the number of times I get into writing the report and realised I've missed something ;o). Once you create the tree structure in Dradis, containing any information you want,  you can export it as a single file and then re-use it as a template on future tests (for example one for web application tests, one for infrastructure etc)</p>

<p>you can also import information from other tools (nmap, nikto, nessus and burp at the moment) into Dradis, meaning you've got a single place to view all the information relating to the test.</p>

<p>It's well worth a look, as it's under active development there are new features coming pretty frequently.  Also there are guides on the site for prospective developers and as it's all done in ruby it's nice and easy to start coding for!</p>]]>
        
    </content>
</entry>

<entry>
    <title>OWASP Scotland - September Meeting</title>
    <link rel="alternate" type="text/html" href="http://www.mccune.org.uk/blog/2009/09/owasp-scotland.html" />
    <id>tag:www.mccune.org.uk,2009:/blog//1.528</id>

    <published>2009-09-11T09:26:07Z</published>
    <updated>2009-09-11T09:31:48Z</updated>

    <summary>The OWASP Scotland september meeting is all set for Tuesday the 15th of September. We&apos;ve got three good speakers lined up so, it&apos;s shaping up to be a good meeting. More details here . Meeting is open to all, but...</summary>
    <author>
        <name>Rory2</name>
        <uri>http://www.mccune.org.uk</uri>
    </author>
    
    
    <content type="html" xml:lang="en" xml:base="http://www.mccune.org.uk/blog/">
        <![CDATA[<p>The OWASP Scotland september meeting is all set for Tuesday the 15th of September.  </p>

<p>We've got three good speakers lined up so, it's shaping up to be a good meeting.</p>

<p>More details <a href="http://www.owasp.org/index.php/Scotland#September_Chapter_Meeting"> here </a> .  Meeting is open to all, but if you're planning to come along, please RSVP to me at <a href="mailto:rorym@nmrconsult.net">this address</a>, so we can get an idea of numbers.</p>]]>
        
    </content>
</entry>

<entry>
    <title>Testing SNMPv3</title>
    <link rel="alternate" type="text/html" href="http://www.mccune.org.uk/blog/2009/08/testing-snmpv3.html" />
    <id>tag:www.mccune.org.uk,2009:/blog//1.527</id>

    <published>2009-08-26T10:50:43Z</published>
    <updated>2009-08-26T15:43:45Z</updated>

    <summary>After encountering some SNMPv3 servers recently and looking into the differences from a pen. test perspective, I thought it may be worth a quick write-up. SNMPv1 and v2 do not respond when traffic is sent their way unless there is...</summary>
    <author>
        <name>Rory2</name>
        <uri>http://www.mccune.org.uk</uri>
    </author>
    
        <category term="Penetration Testing" scheme="http://www.sixapart.com/ns/types#category" />
    
    
    <content type="html" xml:lang="en" xml:base="http://www.mccune.org.uk/blog/">
        <![CDATA[<p>After encountering some SNMPv3 servers recently and looking into the differences from a pen. test perspective, I thought it may be worth a quick write-up.</p>

<p>SNMPv1 and v2 do not respond when traffic is sent their way unless there is a valid community string in the message, a fact used by scanners like <a href="http://labs.portcullis.co.uk/application/onesixtyone/"> onesixtyone </a>.  So traditionally the theory is unless there's a known community string, the service running has a vulnerability or you can get in-line to sniff traffic, there's not a lot to get from SNMP services.</p>

<p>Turns out that SNMPv3 behaves differently from v1 and v2.  Firstly the notion of using community strings for authentication is gone, replaced by username/passwords.  Second the traffic can be encrypted to limit sniffing opportunites.</p>

<p>However it's not all bad from a testers perspective! unlike earlier versions SNMPv3 will respond to correctly formatted requests and provide some information about itself as part of the reply.  This allows confirmation of the servers existence.</p>

<p>To get these responses there's a couple of different tools we can use.  <a href="http://nmap.org/">Nmap</a> with version detection will confirm that a SNMPv3 service is running and looking at the traffic in wireshark <span class="mt-enclosure mt-enclosure-image" style="display: inline;"><img alt="wireshark-nmap-snmpv3.png" src="http://www.mccune.org.uk/blog/wireshark-nmap-snmpv3.png" width="866" height="802" class="mt-image-center" style="text-align: center; display: block; margin: 0 auto 20px;" /></span></p>

<p>From this there's a couple of interesting pieces of information.  The Engine Enterprise ID field seems to identify the server type that's running, net-snmp in this case and the msgAuthoritativeEngineTime parameter shows the time in seconds since the service was started (according to <a href="http://www.cisco.com/web/about/ac123/ac147/archived_issues/ipj_1-3/snmpv3.html"> this page</a> ).</p>

<p>In addition to using nmap, it's possible to use the inbuilt snmp tools to get some information out of the service including possible username enumeration and brute-force password attacks.</p>

<p>Issuing the snmpwalk command with an invalid username like so:</p>

<p><b>snmpwalk -v 3 -n '' -l noAuthNoPriv -u "invaliduser" 192.168.207.142 IF-MIB::ifName</b></p>

<p>provides the response <b><i>snmpwalk: Unknown user name</i></b></p>

<p>but if we use a valid username and no password like so: </p>

<p><b>snmpwalk -v 3 -n '' -l noAuthNoPriv -u "snmpUser" 192.168.207.142 IF-MIB::ifName</b></p>

<p>we get <b><i>Error in packet. Reason: authorizationError (access denied to that object)</i></b></p>

<p>So it's possible by parsing responses to figure out valid usernames for the service. </p>

<p><b>Update : </b>  Here's a ruby script (should work on linux with snmp tools and ruby installed) which iterates over a list of usernames and a list of IPs and attempts to guess whether the username is valid or not <a href="http://www.mccune.org.uk/code/snmpv3enum.rb">snmpv3enum.rb</a></p>

<p>A similar technique works with specification of passwords which would allow for brute-forcing those as well, (although that said the snmp tools try to stop people choosing passwords less than 8 characters, so unless a dictionary word is used it isn't too likely to be successful.</p>

<p>Additionally for people who're fond of metasploit, I've knocked up a very basic SNMPv3 scanner.  At the moment all it does it take a range of IP addresses and say whether a valid SNMPv3 packet provokes a response from the server, but could be handy.  it's <a href="http://www.mccune.org.uk/code/snmpv3.rb">here</a>.</p>

<p>There's some good references on setting up and using SNMPv3 <a href="http://www.sysadmin.md/snmpv3-users-cheatsheet.html">here</a>, <a href="http://tomclegg.net/snmpv3-cacti">here</a> and <a href="http://wmunguiam.blogspot.com/2009/07/howto-use-snmpv3-ubuntu.html">here</a>.</p>]]>
        
    </content>
</entry>

<entry>
    <title>Defcon 17</title>
    <link rel="alternate" type="text/html" href="http://www.mccune.org.uk/blog/2009/08/defcon-17.html" />
    <id>tag:www.mccune.org.uk,2009:/blog//1.526</id>

    <published>2009-08-09T15:07:38Z</published>
    <updated>2009-08-09T15:59:36Z</updated>

    <summary>So I got across to Defcon this year (and of course security Bsides) There were several interesting presentations , here&apos;s some notes on some of the ones that I got along to. The CD is up at defcon.org, and you...</summary>
    <author>
        <name>Rory2</name>
        <uri>http://www.mccune.org.uk</uri>
    </author>
    
        <category term="Penetration Testing" scheme="http://www.sixapart.com/ns/types#category" />
    
    
    <content type="html" xml:lang="en" xml:base="http://www.mccune.org.uk/blog/">
        <![CDATA[<p>So I got across to Defcon this year (and of course security Bsides)</p>

<p>There were several interesting presentations , here's some notes on some of the ones that I got along to.  The CD is up at <a href="https://media.defcon.org/dc-17/DEFCON-17-CD.rar">defcon.org</a>, and you can get the slides for most of the presentations there.</p>

<p>SSL Talks - There were several presentations on ways to bypass or subvert SSL. From my point of view the drive was around 2 themes.  The difficulty in correctly parsing SSL certs due to the complexity of the relevant RFCs and also the weaknesses in the issuing processes of some CAs (which is exacerbated by the fact that any CA can issue a "valid" cert. for any domain).  Dan Kaminsky's white paper on the subject is <a href="http://www.ioactive.com/pdfs/PKILayerCake.pdf"> here</a>, Moxie's blackhat presentation is <a href="http://tinyurl.com/nyh462"> here </a> and Michael Zusmans' blackhat presentation is <a href="http://tinyurl.com/ll5nlq">here</a> (the defcon presentations are on the CD linked above).</p>

<p>Metasploit - The Metasploit team had a whole track to themselves on Saturday and there's a load of interesting stuff in there, basically looks like Metasploit will have some coverage for most types of assessment eventually, which is very handy!</p>

<p>Egypts presentation on client-side attacks with Metasploit had some great content on browser fingerprinting (not just relying on User-Agent) and client side attacks with Metasploit.</p>

<p>The Oracle presentation from mc and Chris Gates  had some good content on going through the steps of an Oracle attack purely using Metasploit (more information on this on CG's <a href="http://carnal0wnage.attackresearch.com">blog</a></p>

<p>Druid had a good talk on the war-dialer that he's added to the framework (unfortunately the slides for that one aren't on the CD, but I'd guess that they'll be around soon). Another interesting thing in the Metasploit track was the demos of the Mac OSX and POSIX versions of meterpreter which are both in active development.</p>

<p>Other Ruby Tools - There was a bit of a theme of ruby tools across some of the presentations.  In addition to all the Metasploit stuff, there was a mobile device fuzzer (although the website for it, www.fuzzit.com isn't up yet).  Also there was a good presentation on <a href="http://dradisframework.org"> Dradis </a>from etd , which is a Pen test management and reporting tool written in Ruby and Rails.</p>

<p>Password Cracking - There was a good presentation, from Matt Weir,  on approaches to password cracking, speeding up brute-force attacks and picking good dictionary files .  There's more informaton on this one on his <a href="http://reusablesec.blogspot.com/"> blog </a> as well as on the presentation slides.</p>

<p>Router Hacking - FX had some more information on how to create reliable exploits on Cisco devices and the difficulties in doing so (amazing to think that Cisco Maintain thousands of discreete monolithic router builds!).  Slides from the Blackhat presentation are <a href="http://www.blackhat.com/presentations/bh-usa-09/LINDNER/BHUSA09-Lindner-RouterExploit-SLIDES.pdf"> here</a> and White paper <a href="http://www.blackhat.com/presentations/bh-usa-09/LINDNER/BHUSA09-Lindner-RouterExploit-PAPER.pdf"> here </a> </p>

<p>USB Hacking - Interesting presentation from a guy from <a href="http://labs.mwrinfosecurity.com/">MWR </a> on how they approached an assignment to assess the security of a USB device and the approaches to fuzzing that they took.  Slides are up on their site <a href="http://labs.mwrinfosecurity.com/files/Publications/mwri_usb-attacks-defcon17_2009-08-02.pdf"> here </a></p>]]>
        
    </content>
</entry>

<entry>
    <title>Preparing for Defcon</title>
    <link rel="alternate" type="text/html" href="http://www.mccune.org.uk/blog/2009/07/preparing-for-d.html" />
    <id>tag:www.mccune.org.uk,2009:/blog//1.525</id>

    <published>2009-07-26T17:45:50Z</published>
    <updated>2009-07-26T17:59:22Z</updated>

    <summary>So I&apos;m off to Defcon and security BSides next week, and I thought a couple of precautions were in order before I go... 1. Tunnel all traffic through SSH to a trusted host, instructions here 2. Set iptables up to...</summary>
    <author>
        <name>Rory2</name>
        <uri>http://www.mccune.org.uk</uri>
    </author>
    
    
    <content type="html" xml:lang="en" xml:base="http://www.mccune.org.uk/blog/">
        <![CDATA[<p>So I'm off to <a href="http://www.defcon.org/html/defcon-17/dc-17-index.html"> Defcon </a>and <a href="http://www.securitybsides.com/BSidesLasVegas">security BSides</a> next week, and I thought a couple of precautions were in order before I go...</p>

<p>1. Tunnel all traffic through SSH to a trusted host, instructions <a href="http://wiki.freaks-unidos.net/weblogs/azul/firefox-ssh-tunnel">here</a><br />
2. Set iptables up to explicitly deny any traffic not travelling through the tunnel<br />
3. Turn off any vaguely network related features on my iPhone!</p>]]>
        
    </content>
</entry>

<entry>
    <title>Oracle Mixin hits Metasploit trunk</title>
    <link rel="alternate" type="text/html" href="http://www.mccune.org.uk/blog/2009/07/oracle-mixin-hi.html" />
    <id>tag:www.mccune.org.uk,2009:/blog//1.524</id>

    <published>2009-07-15T07:18:27Z</published>
    <updated>2009-07-15T07:22:18Z</updated>

    <summary>The oracle mix-in is now in metasploit trunk so should be a snap to get working. Installation instructions are up here. Especially note the requirements for specific versions of the dbi and oci8 gems, later versions don&apos;t always work as...</summary>
    <author>
        <name>Rory2</name>
        <uri>http://www.mccune.org.uk</uri>
    </author>
    
    
    <content type="html" xml:lang="en" xml:base="http://www.mccune.org.uk/blog/">
        <![CDATA[<p>The oracle mix-in is now in metasploit trunk so should be a snap to get working.  Installation instructions are up <a href="https://metasploit.com/trac/wiki/OracleUsage">here</a>.  </p>

<p>Especially note the requirements for specific versions of the dbi and oci8 gems, later versions don't always work as expected with some of the oracle exploit plugins.</p>]]>
        
    </content>
</entry>

<entry>
    <title>More Metasploitin&apos; - My first module.</title>
    <link rel="alternate" type="text/html" href="http://www.mccune.org.uk/blog/2009/06/more-metasploit-2.html" />
    <id>tag:www.mccune.org.uk,2009:/blog//1.522</id>

    <published>2009-06-14T10:30:00Z</published>
    <updated>2009-06-14T11:35:06Z</updated>

    <summary>I thought I&apos;d have a shot at writing a quick metasploit module as a good way to get to know the framework a bit better. I&apos;m basing this on a project I did for my GSOC gold where I wrote...</summary>
    <author>
        <name>Rory2</name>
        <uri>http://www.mccune.org.uk</uri>
    </author>
    
        <category term="Database Security" scheme="http://www.sixapart.com/ns/types#category" />
    
        <category term="Metasploit" scheme="http://www.sixapart.com/ns/types#category" />
    
        <category term="Penetration Testing" scheme="http://www.sixapart.com/ns/types#category" />
    
    
    <content type="html" xml:lang="en" xml:base="http://www.mccune.org.uk/blog/">
        <![CDATA[<p>I thought I'd have a shot at writing a quick metasploit module as a good way to get to know the framework a bit better.  I'm basing this on a project I did for my GSOC gold where I wrote a POC oracle security scanner in ruby called <a href="http://rorascanner.rubyforge.org">rorascanner</a>.  Seems like a good idea to move the checks I was doing there into a metasploit module.</p>

<p>At the moment its very rough and just basically carries out a series of SQL queries (based on mc's Oracle module) and dumps the results out to a file for later use.  I thought it could be useful for people wanting to quickly get some data out of the database for later analysis (kinda' like winenum).</p>

<p>Anyway code is <a href="http://www.mccune.org.uk/code/ora_enum.rb">here</a> .  Any thoughts suggestions welcome :)</p>]]>
        
    </content>
</entry>

<entry>
    <title>Scotland on Rails Videos online</title>
    <link rel="alternate" type="text/html" href="http://www.mccune.org.uk/blog/2009/05/scotland-on-rai-1.html" />
    <id>tag:www.mccune.org.uk,2009:/blog//1.520</id>

    <published>2009-05-27T18:48:06Z</published>
    <updated>2009-05-27T18:51:48Z</updated>

    <summary>All the Scotland on Rails videos are now online here courtesy of the nice folks at Engine Yard. The video for my presentation is here , slides are on slideshare over here...</summary>
    <author>
        <name>Rory2</name>
        <uri>http://www.mccune.org.uk</uri>
    </author>
    
        <category term="Ruby On Rails" scheme="http://www.sixapart.com/ns/types#category" />
    
        <category term="Web Security" scheme="http://www.sixapart.com/ns/types#category" />
    
    
    <content type="html" xml:lang="en" xml:base="http://www.mccune.org.uk/blog/">
        <![CDATA[<p>All the Scotland on Rails videos are now online <a href="http://www.engineyard.com/community/scotland-on-rails/">here</a> courtesy of the nice folks at Engine Yard.</p>

<p>The video for my presentation is <a href="http://scotland-on-rails.s3.amazonaws.com/2B07_RoryMcCune-SOR.mp4">here</a> , slides are on slideshare over <a href="http://www.slideshare.net/raesene/web-appliction-security-scotland-on-rails-presentation">here</a>  </p>]]>
        
    </content>
</entry>

<entry>
    <title>Some Metasploit and Oracle Notes - Part 2</title>
    <link rel="alternate" type="text/html" href="http://www.mccune.org.uk/blog/2009/05/some-metasploit-1.html" />
    <id>tag:www.mccune.org.uk,2009:/blog//1.519</id>

    <published>2009-05-12T19:41:55Z</published>
    <updated>2009-05-16T17:02:29Z</updated>

    <summary>So More Oracle and Metasploit stuff tonight. as CG pointed out on the last post, most of this has been covered on his series of posts at the carnal0wnage blog (and lots more besides), this is just my working through...</summary>
    <author>
        <name>Rory2</name>
        <uri>http://www.mccune.org.uk</uri>
    </author>
    
        <category term="Metasploit" scheme="http://www.sixapart.com/ns/types#category" />
    
        <category term="Penetration Testing" scheme="http://www.sixapart.com/ns/types#category" />
    
    
    <content type="html" xml:lang="en" xml:base="http://www.mccune.org.uk/blog/">
        <![CDATA[<p>So More Oracle and Metasploit stuff tonight.  as CG pointed out on the last post, most of this has been covered on his series of posts at the carnal0wnage blog (and lots more besides), this is just my working through the process for my own benefit and hopefully pointing out some of the potential things to think about as I go along....</p>

<p>ok so where I left off <a href="http://www.mccune.org.uk/blog/2009/05/some-metasploit.html">last time</a> we'd got found our database, enumerated the SIDs and guessed a handily set default username/password (the infamous SCOTT/TIGER).  So at this point we've got an account which can access the database, but now we need some more privileges...</p>

<p><b>4. Escalate privileges to get DBA level access</b>To do this we're going to use the metasploit droptable_trigger module, which works slightly differently from some exploit modules in Metasploit as executing the code generates a file that you can then run against the database to elevate your privileges.</p>

<p>Setting this up is very simple</p>

<pre>use auxiliary/admin/oracle/droptable_trigger </pre>

<p>Handily the default SQL command that gets run by this exploit is "grant DBA to SCOTT" which is exactly what we're looking for.</p>

<p>once we've run this module a .sql file is generated in the data/exploit directory.  Probably the easiest way of running this is to use sqlplus, like so</p>

<pre>sqlplus SCOTT/TIGER@[your_target_IP_here]/[your_target_SID_here] < msf.sql </pre>

<p>Assuming all goes well with the attack (from my experimentation with 10GR2 this one works fine) you can query the user_role_privs view in Oracle to confirm </p>

<p><i><br />
SQL> select * from user_role_privs;</p>

<p>USERNAME                  GRANTED_ROLE          ADM DEF OS_<br />
------------------------------ ------------------------------ --- --- ---<br />
SCOTT                          CONNECT                     NO  YES NO <br />
<b>SCOTT                          DBA                               NO  YES NO</b><br />
SCOTT                          RESOURCE                   NO  YES NO<br />
</i></p>

<p>It's worth noting that some of these Oracle modules (there's 9 in the current Metasploit svn versions) have required privilege levels (dbms_cdc_publish for example in a vanilla 10GR2 setup needs EXECUTE_CATALOG_ROLE to run which only SYS and users with the DBA role have...), so it's worth trying out several to fit different scenarios...</p>

<p>So here we are with DBA, which to be honest for a lot attackers is all that's needed.  The data in the database is likely to be the "crown jewels" which the attackers looking for, but hey we can go further with the wonders of Metasploit and execute code on the underlying operating system...</p>

<p><b>5. Leverage Oracles functionality to get access to the underlying operating system</b>
So at the moment I don't see a metasploit option for doing this in *nix (there's a win32 command execution module on <a href="http://www.metasploit.com/users/mc/oracle/win32exec.rb">mc's </a>page), however that's not a serious problem as it turns out the nice guys at Oracle provide ways to do this easily.</p>

<p>A quick google around revealed <a href="http://www.oracle.com/technology/tech/java/jsp/pdf/calling_shell_commands_from_plsql_1.1.pdf">this paper</a> from Oracle on command execution from a database user and from my running of it, it works fine (although requires creation of new database objects so best suited to an environment that can be rolled back easily...).</p>

<p>So there you go, from nothing to OS access in 5 easy steps, courtesy of Metasploit...</p>]]>
        
    </content>
</entry>

<entry>
    <title>Some Metasploit and Oracle Notes - Part 1</title>
    <link rel="alternate" type="text/html" href="http://www.mccune.org.uk/blog/2009/05/some-metasploit.html" />
    <id>tag:www.mccune.org.uk,2009:/blog//1.517</id>

    <published>2009-05-10T08:03:49Z</published>
    <updated>2009-07-27T13:04:08Z</updated>

    <summary>Todays fun with Metasploit is exploiting Oracle... There&apos;s lots of good information on this on the Carnal 0wnage blog and the metasploit page for mc. First things first, we&apos;ll need the relevant ruby modules (dbi and oci8) installed and working...</summary>
    <author>
        <name>Rory2</name>
        <uri>http://www.mccune.org.uk</uri>
    </author>
    
        <category term="Metasploit" scheme="http://www.sixapart.com/ns/types#category" />
    
    
    <content type="html" xml:lang="en" xml:base="http://www.mccune.org.uk/blog/">
        <![CDATA[<p>Todays fun with Metasploit is exploiting Oracle...  There's lots of good information on this on the <a href="http://carnal0wnage.blogspot.com">Carnal 0wnage</a> blog and the metasploit page for <a href="http://metasploit.com/users/mc/">mc</a>.</p>

<p>First things first, we'll need the relevant ruby modules (dbi and oci8) installed and working for some of this. </p>

<p>dbi can be installed using the usual 'sudo gem install dbi' but oci8 has some more prerequisites and steps to get working.  The best thing to do is follow the instructions <a href="http://ruby-oci8.rubyforge.org/en/InstallForInstantClient.html">here </a>.  As a note you'll probably want to add the LD_LIBRARY_PATH to your bash profile to avoid setting it manually every time you want to use it (in Ubuntu this can be done system wide in /etc/bash.bashrc)</p>

<p>Once you've done that it should be possible to make basic connections to oracle from ruby ok...</p>

<p>So on to what Metasploit can do for you in a test with Oracle systems..  This walkthrough is heavily based on this video <a href="http://carnal0wnage.blogspot.com/2009/02/attacking-oracle-with-metasploit.html">here</a> from shmoocon this year.</p>

<p>One set of rough steps for converting "hmm there's an oracle system here" to "w00t I've got admin access to the server" might be<br />
<ol><br />
<li>Discover the version of Oracle Running</li><br />
<li>Find out what the SID of the database is</li><br />
<li>Get valid credentials to the database</li><br />
<li>Escalate those credentials to DBA level access</li><br />
<li>Leverage Oracles functionality to get access to the underlying operating system</li><br />
<li>...</li><br />
<li>Profit!!</li><br />
</ol></p>

<p>Luckily Metasploit can help us with pretty much all of this....</p>

<p><b>1. Discover the version of Oracle running on the server</b>
This is very useful as it allows for targeting of exploits (no point in trying use an exploit for something that's been patched on the target).  </p>

<p>From msfconsole</p>

<pre>use auxiliary/scanner/oracle/tnslsnr_version </pre>
<pre>set RHOSTS [your_target_ip_here]
run </pre>

<p>from this you should see something like<br />
<pre>[*] Host 192.168.1.203 is running: Linux: Version 10.2.0.1.0 - Production<br />
[*] Auxiliary module execution completed<br />
</pre></p>

<p>which tells us we've got 10gR2 on Linux running.</p>

<p><b>2. Find out what the SID of the database is</b>
In order to connect to the database we're going to need to know what the SID is.  Pre 10GR2 we could just use the metasploit sid_enum module (in auxiliary/scanner/oracle) to find this but after that we'll need to brute-force it.  Not to worry there's a module for that too :)</p>

<p>As of 3.3-dev 6537 the sid_brute module doesn't appear to be included, but it can be downloaded from <a href="http://metasploit.com/users/mc/oracle/sid_brute.rb">mc's page</a>.  For this module you'll also need a list of common SIDs for Oracle.  One of those can be found on the<a href="http://www.red-database-security.com/scripts/sid.txt"> Red Database Security</a> site.</p>

<p>so once you've put the sid_brute module in the right place (I used modules/auxiliary/scanner/oracle) and your sid.txt file somewhere (I used the default from the module of data/exploits) you can do the following...</p>

<pre> use auxiliary/scanner/oracle/sid_brute</pre>
<pre> set RHOST [your_target_ip_here]</pre>

<p>and hopefully you'll get some output like</p>

<pre>[*] Found SID 'ORCL' for host 192.168.1.203.</pre>

<p>So we've now got the SID of the database, on to usernames and passwords.</p>

<p><b>3. Get valid credentials to the database</b>
Now Oracle databases are pretty notorious for having a wide range of default usernames and passwords installed on them.  This isn't so true for modern releases but if your're running against older releases, it's well worth checking. </p>

<p>So to do this we'll need the brute_login metasploit module and a list of usernames and passwords.  The module again can be found on <a href="http://metasploit.com/users/mc/oracle/brute_login.rb">mc's page</a> and the canonical list of Oracle usernames and passwords is on <a href="http://www.petefinnigan.com/default/oracle_default_passwords.csv">Pete Finnigans</a> site.</p>

<p>Also we'll need to get the oracle mixin at this point from <a href="http://metasploit.com/users/mc/oracle/oracle.rb">here</a> and copy that to lib/msf/core/exploit/ .  Now at this point I was getting a module loading error but reading <a href="http://carnal0wnage.blogspot.com/2008/11/oracle-pwnage-with-metasploit-oracle.html">this</a> and <a href="http://carnal0wnage.blogspot.com/2008/08/metasploit-and-file-format-bugs.html">this</a> led me to the idea of modifying the brute_login.rb file adding</p>

<pre>require 'msf/core/exploit/oracle'</pre>

<p>to the top of the file (just under the other requires) to get it all loaded up ok (also found out that a lot of this ground's been covered before but hey :) ! )</p>

<p>So with those saved in appropriate places (same as last time) we can see what's there</p>

<pre>use auxiliary/scanner/oracle/brute_login </pre>

<pre> set RHOST [your_target_ip_here]
run</pre>

<p>Now wtih any luck you'll get a file called oracle_success.log popping up in the data/exploits directory which will contain some entries like this</p>

<pre>Found user/pass of: SCOTT/TIGER on 192.168.1.203...</pre>

<p>which tells us the creds we need to make a valid connection and move on to the next stage.</p>

<p>So now we've got a valid account on the database, but it's not got that magic DBA level of privilege</p>

<p>Next time I'll follow-up on using metasploit to get down the OS</p>

<p></p>

<p></p>

<p><br />
</p>]]>
        
    </content>
</entry>

</feed>
