Forum Thread: How to Fix Error Handler Failed to Bind

Why this error occurs?

this error occurs because you may have a server started on this port which you need to start the Metasploit server on it. so to fix this error we have stopped any other server which is trying to use from the same port.

for example, if I had a python simple HTTP server on port 80 and my listener use port 80 this problem will occur.

This is a picture of the error. take a look at it :

as you can see, the Metasploit gave me an error wich is telling us that the port (LPORT) you choose is busy now and that why we get an error calling Handler failed to bind to x.x.x.x:y.

what is the solution to this error?

Step 1: Finding PID of the Server

the solution is really easy. first, you need to check which server is using this port and what its PID?
to do that you need to type the following command in your terminal :

lsof -i:80

be careful that you have to type your port instead of the 80 in the command. and you can see the command and PID of the python server on port 80.

Step 2: Terminating the Server Which Is Using Our Port

now you have to kill this server to start your Metasploit server on this port.
to do that you need to kill this PID it's simple you just have to type :

kill PID

PID in this tutorial is 1749, so ill put this instead of the PID in my terminal like the picture below :

and after hitting enter, any other server on port 80 will terminate and the port will be free to use it :

this is how to fix error handler failed to bind , thank you for reading this tutorial and please let us know if you have any other questions and don't forget following us to make more tutorial.

author: Mohamad Chavoshi
email address: mrezach01010@outlook.com
written in: 2019-8-3

Never Miss a Hacking or Security Guide

New Null Byte in your inbox, every week.

2 Responses

this idea not working in my mobile plz tell me another diffrent idea

Are you using termux ?

this should work if you install termux correctly on your mobile phone, but I recommend you use Kali Linux in a PC or laptop or maybe a raspberry pi.

Share Your Thoughts

  • Hot
  • Active