nerdexam
GIAC

GCIH · Question #399

Computer 'remus' has traffic coming in on port 53. You want to forward the traffic to system 'romulus' on port 1234. Which command would you run on 'remus' to complete this task?

The correct answer is A. nc -l -p 53 | nc romulus 1234. Netcat can chain a listener and an outbound connection with a pipe to relay traffic from one port to another host.

Vulnerability Exploitation & Privilege Escalation

Question

Computer 'remus' has traffic coming in on port 53. You want to forward the traffic to system 'romulus' on port 1234. Which command would you run on 'remus' to complete this task?

Options

  • Anc -l -p 53 | nc romulus 1234
  • Bnc romulus 1234 < remus 53
  • Cwhile [1]; nc -l -p 53; nc romulus -p 1234; done
  • Dnc -l -p remus 153 -e remus 1234

How the community answered

(55 responses)
  • A
    76% (42)
  • B
    13% (7)
  • C
    7% (4)
  • D
    4% (2)

Why each option

Netcat can chain a listener and an outbound connection with a pipe to relay traffic from one port to another host.

Anc -l -p 53 | nc romulus 1234Correct

The command `nc -l -p 53 | nc romulus 1234` starts netcat in listen mode on port 53 and pipes all received data to a second netcat instance that connects outbound to romulus on port 1234, creating a one-way traffic relay. This is the standard netcat port-forwarding idiom using POSIX pipes.

Bnc romulus 1234 < remus 53

The syntax `nc romulus 1234 < remus 53` attempts to redirect a filename called 'remus' as input, which is not valid for port forwarding between hosts.

Cwhile [1]; nc -l -p 53; nc romulus -p 1234; done

The while loop syntax is malformed - netcat invocations are not properly chained and the semicolons cause each command to run sequentially rather than piping data between them.

Dnc -l -p remus 153 -e remus 1234

The flags `-p remus` and `-e remus 1234` misuse netcat options; `-p` expects a port number, not a hostname, making this command syntactically invalid.

Concept tested: Netcat port forwarding and traffic relay

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

Topics

#netcat#port forwarding#traffic redirection#post-exploitation tools

Community Discussion

No community discussion yet for this question.

Full GCIH Practice