Techniques
Sample rules
Reverse Shell Created via Named Pipe
- source: elastic
- technicques:
- T1059
Description
Identifies a reverse shell via the abuse of named pipes on Linux with the help of OpenSSL or Netcat. First in, first out (FIFO) files are special files for reading and writing to by Linux processes. For this to work, a named pipe is created and passed to a Linux shell where the use of a network connection tool such as Netcat or OpenSSL has been established. The stdout and stderr are captured in the named pipe from the network connection and passed back to the shell for execution.
Detection logic
sequence by host.id with maxspan = 5s
[process where host.os.type == "linux" and event.type == "start" and process.executable : ("/usr/bin/mkfifo","/usr/bin/mknod") and process.args:("/tmp/*","$*")]
[process where host.os.type == "linux" and process.executable : ("/bin/sh","/bin/bash") and process.args:("-i") or
(process.executable: ("/usr/bin/openssl") and process.args: ("-connect"))]
[process where host.os.type == "linux" and (process.name:("nc","ncat","netcat","netcat.openbsd","netcat.traditional") or
(process.name: "openssl" and process.executable: "/usr/bin/openssl"))]