A reverse shell is a type of shell in which the target server connects back to the attacker machine. For example, an attacker finds a target server with port 21/tcp, 80/tcp and 443/tcp in OPEN state and the FTP service running on port 21/tcp is vulnerable. Let's say an attacker exploits this port in order to open another port 1337/tcp on the target server for shell connection, as shown in the following diagram:
The problem arises when the attacker tries to connect to the target server on port 1337/tcp. The attacker is not able to connect to port 1337/tcp. Why? Because the firewall blocked that port. The firewall can only allow port 21/tcp, 80/tcp and 443/tcp for incoming connections and it will block all other ports, as shown in the following diagram:
This...