Techniques
Sample rules
Netcat Listener Established via rlwrap
- source: elastic
- technicques:
- T1059
Description
Monitors for the execution of a netcat listener via rlwrap. rlwrap is a ‘readline wrapper’, a small utility that uses the GNU Readline library to allow the editing of keyboard input for any command. This utility can be used in conjunction with netcat to gain a more stable reverse shell.
Detection logic
process where host.os.type == "linux" and event.type == "start" and
event.action in ("exec", "exec_event", "start", "ProcessRollup2") and
process.name == "rlwrap" and process.args in ("nc", "ncat", "netcat", "nc.openbsd", "socat") and
process.args : "*l*" and process.args_count >= 4
File Transfer or Listener Established via Netcat
- source: elastic
- technicques:
- T1059
Description
A netcat process is engaging in network activity on a Linux host. Netcat is often used as a persistence mechanism by exporting a reverse shell or by serving a shell on a listening port. Netcat is also sometimes used for data exfiltration.
Detection logic
process where host.os.type == "linux" and event.type == "start" and
event.action in ("exec", "exec_event", "start", "ProcessRollup2", "executed", "process_started") and
process.name in ("nc","ncat","netcat","netcat.openbsd","netcat.traditional") and
process.args like~ (
/* bind shell to specific port or listener */
"-*l*","-*p*",
/* reverse shell to command-line interpreter used for command execution */
"-*e*",
/* file transfer via stdout/pipe */
">","<", "|"
)