rapid7 / metasploit-framework

Metasploit Framework
https://www.metasploit.com/
Other
33.77k stars 13.89k forks source link

[-] Handler failed to bind to xxxxxx:4444(external ip adress) #6084

Closed kofx closed 8 years ago

kofx commented 8 years ago

hi i have an issue on multi/handler the handler failed when i try to use an external ip.. it's work on internal ..

[-] Handler failed to bind to 160.x.x.1x:4444 [*] Started reverse handler on 0.0.0.0:4444

[*] Starting the payload handler...

the payload was windows/meterpreter/reverse_tcp

OJ commented 8 years ago

This is not a bug, this is by design. If the public IP is not assigned to an interface on your machine, then it can't bind to it. It falls back to 0.0.0.0, which is "all interfaces".

kofx commented 8 years ago

mm thank you OJ for the quick reply , yeah really i know it's not a bug on metasploit but i didn't find a solution , if you could help me or guide me to a source ..

OJ commented 8 years ago

@kofx what do you need a solution to? There's no problem here, it's just how things work. A program can't bind to an IP address that doesn't exist on the machine it's running on.

Sounds to me like your external IP is allocated to a modem/router/etc and you need to forward ports.

Corleanus commented 6 years ago

I have the same problem, and although I have forwarded ports, and have been using metasploit in external network, after update I have the same problem...

h00die commented 6 years ago

This is a 2yr old closed ticket. Start a new issue. This is not a bug, that's when you create an issue. The answer you seek is well documented. Try https://www.corelan.be/index.php/2014/01/04/metasploit-meterpreter-and-nat/ as it has your answer. Don't reply here, if you need HELP, go to IRC #metasploit

ghost commented 6 years ago

I kind of follow u but not really can we just do it with visual design signage and SensorInteract symbols and tracebuild+qrassets frack eg with cubes and I can just see ur patterns and just use symbols plus embedded contracts with in multiple locations and organize a email data base and smedia order of thoughts 💭

ghost commented 6 years ago

Previous symbol in post is a 📺 icon like Asian lanthem with my crypto partner bcuz when u r over ur head ... p’s like applications where I use ur name and email address and my vice Vera’s. I made mistake at beginning 🤔 any contact is a good one but was right and wrong but it makes a perfect public address and I use non touched accountability. I am good with concepts and good with finding shortcuts Astro’s.com. Crypto is not the complete answer but it’s close u need me to have a hosting biz to put gis locations in with tags 🔬 with creative design 🤔 teams I have everyone of ur. I will start a private crypto fantasy league stock that runs with ur job and I integrate it into scarcitydigital leverage system that uses 3 sports design rules vision ... ‘Mining data cleanly

bcoles commented 6 years ago

@tdoskocil What would you do if you were wandering the desert and found a distressed turtle lying on its back?

85Terminator commented 6 years ago

i am using kali linux in vmware 9 X86 so what lhost i put in the payload , is it the one in the pc or in the vmware please reply fast

bcoles commented 6 years ago

@85Terminator GitHub issue tracker is for reporting bugs. It would be best to ask on #metasploit on Freednode IRC.

That said, lhost will be the IP address of Kali in VMWare. However, if the target host cannot route traffic to the virtual machine then you will not get a session. You may or may not want to bridge the virtual machine. You may or may not want to port forward a port from your router to the virtual machine. It depends where on the planet the target system is located, and what network route it will use to route packets to Metasploit.

85Terminator commented 6 years ago

Thanks bcoles

andresh0816 commented 6 years ago

This isn't a error or bug, you can solve trying this:

set LHOST (public ip or private, you choice were attack) set LPORT (port, in my case 8080) set ReverseListeningBindAddress (ip private o public)

exploit -j -x

DroneMaki commented 5 years ago

@OJ I know this is not bug, but I did using a payload 3 time after that this is not work when I use payload and hit exploit so [-]Handler failed to bind to 192.168.XX.X:2323:- - [*] Started reverse TCP handler on 0.0.0.0:2323

basem3214 commented 5 years ago

i have the same issus plz someone fxied

Ashwin2459B commented 5 years ago

hi i have an issue on multi/handler the handler failed when i try to use an external ip.. it's work on internal ..

[-] Handler failed to bind to 160.x.x.1x:4444 [*] Started reverse handler on 0.0.0.0:4444

[*] Starting the payload handler... the payload was windows/meterpreter/reverse_tcp

help me to solve this please iam running kali linux in vm ware workstation

bcoles commented 5 years ago

@Ashwin2459B

Presumably 160.x.x.1x is not a valid IP address for any of your network interfaces.

The options you're looking for are ReverseListenerBindAddress andReverseListenerBindPort.

Set LHOST and LPORT to your public IP and public port. Set ReverseListenerBindAddress and ReverseListenerBindPort to your local IP and local port.

set LHOST 160.x.x.1x
set ReverseListenerBindAddress <your local IP address for a network interface>

If you don't set ReverseListenerBindAddress, and it can't bind to LHOST, it'll fall back on 0.0.0.0. Make sure everything is routing correctly, and make sure your payload can egress to your handler.

That's all. Please take support to IRC or e-mail in the future. GitHub is primarily for code contributions, bug reports, and feature requests. Thanks!

Reference:

devopslinux commented 4 years ago

The solution for me it's apt install bind9 service bind9 start netstat -ntlup <-To verify service and port running And then: msfconsole

hichemkanon commented 4 years ago

the reason of this error mostly coming from mistake writing the public ip adress in where you must write the private ip adress, that happened to me and i solved it follow the exemple bellow

firstlty check your port in router if you don't have create one name: kali -// server ip adress (your private ip of device "ifconfig") /// - tcp - //// PORT: 8080 or any port you choose .

if you want hack over router ....

then when you create/bind payload using msfvenom or any other tool 1 -- for exemple ; android/meterpreter/reverse_http 2 -- set lhost "public ip - get it from here https://whatismyipaddress.com " 3 -- set lport (the port that you opened in router)

and when you open the meterpreter write :

1-- use exploit/multi/handler 2-- set payload android/meterpreter/reverse_http 3-- set lhost (((here you write your personal/private ip "get it from ifconfig") 4-- set lport (((here you write the port that you opened in router))))) 5-- exploit

that is the correct way which will work correctly with you

sunnyrud commented 3 years ago

@kofx what do you need a solution to? There's no problem here, it's just how things work. A program can't bind to an IP address that doesn't exist on the machine it's running on.

Sounds to me like your external IP is allocated to a modem/router/etc and you need to forward ports.

how to do this?

sunnyrud commented 3 years ago

the reason of this error mostly coming from mistake writing the public ip adress in where you must write the private ip adress, that happened to me and i solved it follow the exemple bellow

firstlty check your port in router if you don't have create one name: kali -// server ip adress (your private ip of device "ifconfig") /// - tcp - //// PORT: 8080 or any port you choose .

if you want hack over router ....

then when you create/bind payload using msfvenom or any other tool 1 -- for exemple ; android/meterpreter/reverse_http 2 -- set lhost "public ip - get it from here https://whatismyipaddress.com " 3 -- set lport (the port that you opened in router)

and when you open the meterpreter write :

1-- use exploit/multi/handler 2-- set payload android/meterpreter/reverse_http 3-- set lhost (((here you write your personal/private ip "get it from ifconfig") 4-- set lport (((here you write the port that you opened in router))))) 5-- exploit

that is the correct way which will work correctly with you

again same issue can you give your whatsapp num i can contact

The-Hustler-Hattab commented 3 years ago

the LHOST is ur machines ip address (NOT THE TARGET) in both the handler and the payload. I had the same problem it took me an hour and half figure out that I messed up.

u0a377 commented 3 years ago

I found the solution. Write Lhost 0.0.0.0 and port As you wish. And run

palanivelu90 commented 2 years ago

How can slove the problem

bcoles commented 2 years ago

How can slove the problem

https://github.com/rapid7/metasploit-framework/issues/6084#issuecomment-500388041

Starry-Trace-Sky commented 2 years ago

Please set lhost as your kali ip address

OJ commented 2 years ago

LHOST is the "callback address". That is, it's the address that the payload will attempt to connect back to. That has to be reachable from the victim's machine. In a scenario where you're expecting a callback from a machine across the Internet, using your local IP address here is always wrong. Make sure you set LHOST to a host or IP address that the victim's machine can reach.

If the host that Metasploit is running on is either behind a firewall, and therefore unable to bind to that address, then Metasploit will fail to bind to it. As a result, an error will be shown indicating that binding to that address failed. It should then fall back to 0.0.0.0 as a catch-all. If you want Metasploit to listen on a specific interface that is different to the LHOST value, then set ReverseListenerBindAddress to that address.

Again LHOST is what the victim tries to reach, and hence for things to work, it must be reachable from that host.

OJ commented 2 years ago

3-- set lhost (((here you write your personal/private ip "get it from ifconfig")

This is not correct.

Alif0x1 commented 1 year ago

then how to solve it

bcoles commented 1 year ago

then how to solve it

https://github.com/rapid7/metasploit-framework/issues/6084#issuecomment-500388041

bcoles commented 1 year ago

Locking this issue as the question has been answered.