CompTIA PenTest+ (PT0-002) — Question 333
A penetration tester compromised a system and wants to connect to a port on the system from the attacking machine in order to control the system. Which of the following commands should the tester run on the compromised system?
Answer options
- A. nc 10.0.0.1 5555
- B. nc 127.0.0.1 -e /bin/bash
- C. nc localhost 5555
- D. nc -nvlp 5555 - bin/bash
Correct answer: D
Explanation
The correct command is D because it sets up a listener on port 5555, allowing the attacker to connect back to the compromised system. Options A and C do not establish a listening service on the compromised machine, while option B attempts to connect to localhost instead of listening for incoming connections.