nerdexam
GIAC

GCIH · Question #500

Analyze the following command. What will this command do? $ nc -1 -p 443 -e /bin/csh

The correct answer is D. Listen on port 443 and return a shell to connecting hosts. The Netcat command nc -l -p 443 -e /bin/csh sets up a listener on port 443 that spawns a C shell for any host that connects to it.

Web Application Attacks & Post-Exploitation

Question

Analyze the following command. What will this command do? $ nc -1 -p 443 -e /bin/csh

Options

  • AProvide an encrypted login shell to act as a proxy relay
  • BConnect to port 443 of a remote host and provide a shell relay
  • CImpersonate the HTTPS process and hide it using a shell process
  • DListen on port 443 and return a shell to connecting hosts

How the community answered

(37 responses)
  • A
    5% (2)
  • B
    3% (1)
  • C
    3% (1)
  • D
    89% (33)

Why each option

The Netcat command `nc -l -p 443 -e /bin/csh` sets up a listener on port 443 that spawns a C shell for any host that connects to it.

AProvide an encrypted login shell to act as a proxy relay

Netcat does not provide encryption and transmits all traffic in cleartext, so this command cannot create an encrypted login shell.

BConnect to port 443 of a remote host and provide a shell relay

The `-l` flag means listen mode, not connect mode - this command waits for incoming connections rather than connecting outbound to a remote host.

CImpersonate the HTTPS process and hide it using a shell process

Listening on port 443 does not impersonate or interact with the HTTPS protocol because no SSL/TLS is involved and the command simply binds that port number to a shell process.

DListen on port 443 and return a shell to connecting hostsCorrect

The `-l` flag puts Netcat into listen mode, causing it to wait for incoming connections rather than initiating one. The `-p 443` option specifies the local port to listen on, and `-e /bin/csh` executes the C shell and ties its input/output to the network connection. Any remote host that connects to port 443 receives an interactive shell session.

Concept tested: Netcat listen mode with shell execution flags

Topics

#Netcat#bind shell#port 443#backdoor listener

Community Discussion

No community discussion yet for this question.

Full GCIH Practice