top of page
Writer's pictureMajestic Logic

Whats Portbending and how to detect it?

Portbendng (also known as port forwarding) is a type of networking technique that allows users to redirect data from one port to another within a given network. This technique is particularly useful in scenarios where services need to be exposed on a public network, such as when hosting a website or game server.


Portbending on Linux systems is relatively easy to set up, as long as the user is familiar with the operating system. The first step is to determine the IP address of the machine that needs to be portbent. This can be done by entering the command “ifconfig” in the terminal. Once the IP address has been determined, the next step is to determine which port needs to be forwarded. This can be done by entering the command “netstat -an” and looking for the port number associated with the service that needs to be exposed.


The next step is to configure the port forwarding rules. This can be done using the iptables command, which is a Linux firewall utility. To add a port forwarding rule, the user needs to enter the following command: “iptables -t nat -A PREROUTING -p tcp --dport <port_number> -j DNAT


How to begin learning about portbending?


1. Install Iptables


The first step to portbending with iptables is to install the iptables package. Most Linux distributions include iptables as part of their default package selection. However, if it is not present on your system, you can install it using your package manager.


For example, on Ubuntu, you can install iptables with the following command:


sudo apt-get install iptables


2. Configure Iptables


The next step is to configure your iptables rules to enable portbend. The syntax for portbend with iptables is as follows:


IPTABLES -t nat -A PREROUTING -i eth0 -p tcp --dport <source_port> -j REDIRECT --to-port <destination_port>


Where:

- eth0 is the interface to use for portbend which can also include "lo" for loopback

- source_port is the port you want to redirect

- destination_port is the port you want


How to detect localhost portbending on Linux?


To detect localhost portbending on Linux, you can use netstat, lsof, or nmap.


Netstat is a command that shows open connections, ports, and the programs using them. It can be used to detect portbending, as it will list all ports and the associated programs.


Lsof stands for “list open files”, and it is a command that can be used to display all open files and the processes that are using them. It can also be used to detect portbending, as it will list all open ports and the associated programs.


Nmap is a command-line tool used for network scanning and security auditing. It can be used to detect portbending by scanning the localhost for open ports and the associated programs.


For a more detailed explaination and walkthrough visit John Hammond video on the topic.

71 views0 comments

Recent Posts

See All

Comments


bottom of page