nerdexam
CompTIA

PT0-001 · Question #210

A penetration tester has compromised a system and wishes to connect to a port on it from the attacking machine to control the system Which of the following commands should the tester run on the…

The correct answer is B. nc -nvlp 4423 -?/bin/bash. To let an attacker connect inbound to a compromised host, the compromised system must run netcat in listen mode to create a bind shell.

Post-exploitation and lateral movement

Question

A penetration tester has compromised a system and wishes to connect to a port on it from the attacking machine to control the system Which of the following commands should the tester run on the compromised system?

Options

  • Anc looalhot 4423
  • Bnc -nvlp 4423 -?/bin/bash
  • Cnc 10.0.0.1 4423
  • Dnc 127.0.0.1 4423 -e /bin/bash

How the community answered

(49 responses)
  • A
    12% (6)
  • B
    80% (39)
  • C
    2% (1)
  • D
    6% (3)

Why each option

To let an attacker connect inbound to a compromised host, the compromised system must run netcat in listen mode to create a bind shell.

Anc looalhot 4423

Connecting to 'localhost 4423' only attempts an outbound connection to the machine's own loopback interface, establishing no externally accessible listener for the attacker.

Bnc -nvlp 4423 -?/bin/bashCorrect

The command 'nc -nvlp 4423 -e /bin/bash' tells netcat to listen (-l) on port 4423, with verbose output (-v) and numeric IP display (-n), executing /bin/bash when a connection is received. This creates a bind shell on the compromised machine, so the attacker can initiate a TCP connection from their own host to port 4423 and receive interactive shell control.

Cnc 10.0.0.1 4423

Running 'nc 10.0.0.1 4423' makes the compromised system initiate an outbound connection to the attacker's IP, which is a reverse shell pattern - the opposite of what is needed when the attacker wants to connect inbound to the target.

Dnc 127.0.0.1 4423 -e /bin/bash

Targeting 127.0.0.1 (loopback) means the connection attempt never leaves the compromised host, making it unreachable from the attacker's external machine.

Concept tested: Netcat bind shell listener on compromised system

Topics

#netcat#bind shell#command and control#reverse shell

Community Discussion

No community discussion yet for this question.

Full PT0-001 Practice