tag:blogger.com,1999:blog-81260828471523611832008-01-17T22:27:50.747+02:00PierrePierrehttp://www.blogger.com/profile/08942940816209614597noreply@blogger.comBlogger5125tag:blogger.com,1999:blog-8126082847152361183.post-82797575064281003942008-01-13T23:09:00.000+02:002008-01-14T00:09:09.563+02:00Scapy: using p0fI've recently released a not-yet-applied <a href="http://trac.secdev.org/scapy/ticket/76">patch</a> for <a href="http://www.secdev.org/projects/scapy/">scapy</a> which improves the use of <a href="http://lcamtuf.coredump.cx/p0f.shtml">p0f</a> functionalities.<br /><br />First, p0f now comes with databases designed for other TCP packets than only SYN packets (one database for SYN/ACK packets, one for RST and RST/ACK packets, and the last one for "stray" ACK packets). Those new databases are slightly different than the original one, and an effort was required to enable scapy's p0f functions to use them.<br /><br />Now, scapy is able to deal with any kind of TCP packets :<br /><blockquote><span style="font-family:courier new;">>>> sniff(prn=prnp0f, filter='tcp')</span><br /><span style="font-family:courier new;">192.168.0.97:33721 - Linux 2.6 (newer, 2) (up: 128 hrs)</span><br /><span style="font-family:courier new;">-> 147.210.19.96:www </span><span style="font-weight: bold;font-family:courier new;" >(S)</span><span style="font-family:courier new;"> (distance 0)</span><br /><span style="font-family:courier new;">147.210.19.96:www - UNKNOWN [49980:52:1:64:N,N,T,M1460,N,W0,N,N,S:AT:?:?] (up: 946 hrs)</span><br /><span style="font-family:courier new;">-> 192.168.0.97:33721 </span><span style="font-weight: bold;font-family:courier new;" >(SA)</span><br /></blockquote><br />The (S) and (SA) denote the database used (regular p0f.fp for S, and p0fa.fp for SA).<br /><br />While working on this I've had two ideas of cool features to add, and I've added them.<br /><br />The first one is a function to get signatures for the local system. This is done by sniffing packets generated by the use of socket functions, in a function I called p0f_getlocalsigs(). For now, I only use the loopback interface, which causes to generate different signatures than the one generated on regular network interfaces. I'm thinking to add other tests using other interfaces, but nothing is done for now.<br /><br />Knowing that scapy is not only a sniffing tool, but is also great to forge, manipulate and send packets, the second one is a function that modifies a packet so that it matches a given signature. This work is done by a function called p0f_impersonate:<br /><blockquote style="font-family: courier new;">>>> pkt = p0f_impersonate(IP(dst='www.google.fr')/TCP(sport=12345, dport=80, flags='S'), osgenre='Linux')<br />>>> prnp0f(pkt)<br />192.168.0.97:12345 - Linux 2.4 (Google crawlbot) (up: 7326 hrs)<br />-> Net('www.google.fr'):www (S) (distance 0)<br />>>> send(pkt)<br /></blockquote><br />A (real) p0f running in another window shows:<br /><blockquote style="font-family: courier new;"># p0f<br />p0f - passive os fingerprinting utility, version 2.0.8<br />(C) M. Zalewski <lcamtuf@dione.cc>, W. Stearns <wstearns@pobox.com><br />p0f: listening (SYN) on 'eth1', 262 sigs (14 generic, cksum 0F1F5CA2), rule: 'all'.<br />192.168.0.97:12345 - Linux 2.4 (Google crawlbot) (up: 7326 hrs)<br />-> 209.85.135.99:80 (distance 0, link: (Google/AOL))<br /></wstearns@pobox.com></lcamtuf@dione.cc></blockquote>Pierrehttp://www.blogger.com/profile/08942940816209614597noreply@blogger.comtag:blogger.com,1999:blog-8126082847152361183.post-30642878339691389692007-04-11T19:28:00.000+02:002007-04-11T19:29:11.837+02:00Scapext : Scapy Extended<a href="http://www.secdev.org/projects/scapy/">Scapy</a> is a great tool for network packets manipulation (sniff, dissect, create, send,...).<br /><br />When I use this tool, I lack some features. So I have written an extension (called Scapext) that, for now, includes :<br /><ul><li>GeoIP support (through Maxmind GeoIP <a href="http://www.maxmind.com/download/geoip/api/python/">Python API</a>). This is faster than the method used in Scapy for now, and easier.</li><br /><li>PFLog pcap type (used by the OpenBSD <a href="http://www.openbsd.org/faq/pf/">Packet Filter</a> to log packets ; this allows PF to store valuable information on what happened to the packets logged).</li><br /><li>Early SunRPC support with state handling.</li></ul><br />Interested ? See <a href="http://pierre.droids-corp.org/scapy/">my page</a> about Scapy.Pierrehttp://www.blogger.com/profile/08942940816209614597noreply@blogger.comtag:blogger.com,1999:blog-8126082847152361183.post-64563862398895857892007-04-11T13:54:00.000+02:002007-04-11T14:50:30.614+02:00Metasploit Automated Exploitation on N800As suggested by <a href="http://pierre-droids.blogspot.com/2007/04/msfweb-on-n800.html#comment-9053968639604255120">spaceaquarium</a>, I've tried to get Metasploit <a href="http://blog.metasploit.com/2006/09/metasploit-30-automated-exploitation.html">Automated Exploitation</a> (one of the killer features of Metasploit Framework 3) working on my N800. And that's easy.<br /><br />You need Ruby and RubyGems, then install ActiveRecord with gem (for these steps, see my posts about <a href="http://pierre-droids.blogspot.com/2007/04/n800-with-scapy-and-metasploit.html">Metasploit Framework</a> and <a href="http://pierre-droids.blogspot.com/2007/04/msfweb-on-n800.html">msfweb</a> on N800). Now, install <a href="http://rubyforge.org/projects/sqlite-ruby/">sqlite3-ruby</a> (you may use <a href="http://pierre.droids-corp.org/maemo/">my package</a> for that).<br /><br />Last but not least... you need <a href="http://www.insecure.org/nmap/">Nmap</a>. You can use this <a href="http://www.mulliner.org/nokia770/">repository</a>.<br /><br />UPDATE : you can also use <a href="http://pierre.droids-corp.org/maemo/">my package</a> for Nmap, as it's the latest stable version.<br /><br />Now, run msfconsole, then :<br /><blockquote>msf > load db_sqlite3<br />msf > db_autopwn<br />[*] Usage: db_autopwn [options]<br /> [...]<br /><br />msf > db_nmap -p 22,445 [TARGET]<br /><br />Starting Nmap 3.95 ( http://www.insecure.org/nmap/ ) at 2007-04-11 13:52<br /> [...]<br />Nmap finished: [...]<br />msf > db_autopwn -p -t<br />[*] Analysis completed in [...]<br />[...]</blockquote><br />Nice ! More about this feature <a href="http://blog.metasploit.com/2006/09/metasploit-30-automated-exploitation.html">here</a>.Pierrehttp://www.blogger.com/profile/08942940816209614597noreply@blogger.comtag:blogger.com,1999:blog-8126082847152361183.post-78060993556646063372007-04-10T15:42:00.000+02:002007-04-10T16:16:16.328+02:00msfweb on N800As I said <a href="http://pierre-droids.blogspot.com/2007/04/n800-with-scapy-and-metasploit.html">earlier</a>, I wanted to have msfweb (the <a href="http://www.metasploit.com/">Metasploit</a> Framework web interface) running on my N800, because it could be far more easy to use on that kind of devices. Finally it works !<br /><br />First of all, install Metasploit (read <a href="http://pierre-droids.blogspot.com/2007/04/n800-with-scapy-and-metasploit.html">this</a>).<br /><br />Then, you "only" need to get <a href="http://rubygems.org/">RubyGems</a> (you can try my <a href="http://pierre.droids-corp.org/maemo/">package</a>), and get gem files for <a href="http://www.rubyonrails.org/">Rails</a> and its dependencies (you'll find the whole set <a href="http://pierre.droids-corp.org/maemo/gems/">here</a>). Install each dependency, then Rails itself (run "gem install package-version.gem").<br /><br />You should be able to run from an xterm (in the directory where you've put Metasploit) the command ./msfweb.<br /><br />It's a bit slow to start, but it seems to work :<br /><br /><a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://bp3.blogger.com/_D5jO1Y8kvi8/Rhubz9kjkTI/AAAAAAAAAAM/xRiprRmqxsU/s1600-h/screenshot-2007-04-10-16-11-11.png"><img style="margin: 0px auto 10px; display: block; text-align: center; cursor: pointer;" src="http://bp3.blogger.com/_D5jO1Y8kvi8/Rhubz9kjkTI/AAAAAAAAAAM/xRiprRmqxsU/s400/screenshot-2007-04-10-16-11-11.png" alt="" id="BLOGGER_PHOTO_ID_5051802724029665586" border="0" /></a>Pierrehttp://www.blogger.com/profile/08942940816209614597noreply@blogger.comtag:blogger.com,1999:blog-8126082847152361183.post-49159409432722138452007-04-05T13:22:00.000+02:002007-04-05T13:54:01.384+02:00N800 with scapy and metasploitThanks to the <a href="http://www.python.org/">python</a> package provided by the <a href="http://repository.maemo.org/">Maemo</a> "Extras" repository and to the <a href="http://maemo-hackers.org/wiki/OssoXterm">osso-xterm</a> provided by the <a href="http://www.maemo-hackers.org/">Maemo-Hackers</a> repository, I have had scapy running on my Nokia N800 for a while.<br /><br />I have seen that <a href="http://erratasec.blogspot.com/2007/02/needs-more-cowbell.html">some people</a> had the <a href="http://www.metasploit.com/">Metasploit Framework</a> running, thanks to an unreleased <a href="http://www.ruby-lang.org/">Ruby</a> package.<br /><br />As there is a Ruby file with <a href="http://mud-builder.garage.maemo.org/">mud-builder</a>, I have built a Ruby package (you can get it <a href="http://pierre.droids-corp.org/maemo/">here</a> if you are too lazy to build it yourself) for N800, and... that's it. Just get Metasploit, and run msfcli from an xterm, it works.<br /><br />As it's not that easy to work with an xterm on the N800 (as on any pocket-sized device), we really need a GUI. For metasploit, one could think of using msfweb plus the integrated web browser. But msfweb does not work for now (needs at least <a href="http://rubygems.org/">RubyGems</a> and <a href="http://www.rubyonrails.org/">Rails</a>).Pierrehttp://www.blogger.com/profile/08942940816209614597noreply@blogger.com