ValueError when connecting via loopback
See original GitHub issueBug Description
This is normally only a testing problem, as practically, you aren’t often connecting to localhost. That being said, when connecting to a bind shell on the local machine, pwncat is unable to use localhost
. Getting the peer name from the socket apparently results in a different return value for the loopback device vice a normal IP address.
You can use 127.0.0.1
, and it works just fine. This should be relatively easy to test/fix. I just need to figure out what exactly the expected return value is for a loopback device.
pwncat version
Provide the output of pwncat --version
or a commit hash if working from
a development branch.
$ pwncat --version
0.4.3
Target System (aka “victim”)
My local machine, which is an Arch Linux host.
Steps to Reproduce
Steps to reproduce the behavior:
- Start a listener with
ncat -e /bin/bash -klnvp 4444
- Attempt to connect to the listener with
pwncat localhost 4444
- See error
Expected Behavior
A connection is established in the same way as using 127.0.0.1
in place of localhost
.
Issue Analytics
- State:
- Created 2 years ago
- Comments:5 (5 by maintainers)
Top GitHub Comments
I have seen this before. This happens when we create the bind shell using
IPv6
protocol orAF_INET6
address family And thus we do not get(host, port)
pair tuple as the return value which is whatpwncat
expects.I did thought about fixing it 😁 , but I thought who is using
IPv6
anyway. And the current implementation for parsing the host and port using anIPv6
address will throw an error as well.