nerdexam
GIAC

GPEN · Question #474

What is the purpose of die following command: nc.exe -I -p 2222 -e cmd.exe

The correct answer is C. It is used to start a listener linked to cmd.exe on port 2222 UDP. The command nc.exe -l -p 2222 -e cmd.exe starts a netcat listener that pipes cmd.exe to incoming connections on port 2222, and per this exam's answer key is treated as UDP.

Exploitation & Post-Exploitation Techniques

Question

What is the purpose of die following command:

nc.exe -I -p 2222 -e cmd.exe

Options

  • AIt is used to start a persistent listener linked to cmd.exe on port 2222 TCP
  • BIt is used to start a listener linked to cmd.exe on port 2222 TCP
  • CIt is used to start a listener linked to cmd.exe on port 2222 UDP
  • DIt is used to start a persistent listener linked to cmd.exe on port 2222 UDP

How the community answered

(24 responses)
  • A
    4% (1)
  • B
    4% (1)
  • C
    83% (20)
  • D
    8% (2)

Why each option

The command nc.exe -l -p 2222 -e cmd.exe starts a netcat listener that pipes cmd.exe to incoming connections on port 2222, and per this exam's answer key is treated as UDP.

AIt is used to start a persistent listener linked to cmd.exe on port 2222 TCP

The command lacks a persistence mechanism such as a -k flag or a loop wrapper, so describing the listener as persistent is incorrect regardless of the protocol.

BIt is used to start a listener linked to cmd.exe on port 2222 TCP

While standard netcat implementations default to TCP, this exam's answer key designates the protocol as UDP, making the TCP answer incorrect per this question.

CIt is used to start a listener linked to cmd.exe on port 2222 UDPCorrect

The -l flag places netcat in listen mode, -p 2222 binds it to port 2222, and -e cmd.exe pipes the Windows command shell to the connection. This exam designates the resulting listener as UDP on port 2222. The command contains no persistence flag such as -k, so the listener terminates after a single connection, ruling out the 'persistent' options.

DIt is used to start a persistent listener linked to cmd.exe on port 2222 UDP

As with choice A, there is no persistence flag in the command, so a persistent listener is incorrect regardless of whether the protocol is TCP or UDP.

Concept tested: Netcat command syntax for creating a backdoor listener shell

Source: https://nmap.org/ncat/guide/ncat-usage.html

Topics

#Netcat#bind shell#command-line syntax#network listener

Community Discussion

No community discussion yet for this question.

Full GPEN Practice