question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

ValueError when connecting via loopback

See original GitHub issue

Bug 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.

image

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:

  1. Start a listener with ncat -e /bin/bash -klnvp 4444
  2. Attempt to connect to the listener with pwncat localhost 4444
  3. 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:closed
  • Created 2 years ago
  • Comments:5 (5 by maintainers)

github_iconTop GitHub Comments

1reaction
Mitul16commented, Jul 18, 2021

I have seen this before. This happens when we create the bind shell using IPv6 protocol or AF_INET6 address family And thus we do not get (host, port) pair tuple as the return value which is what pwncat expects.

0reactions
Mitul16commented, Jul 18, 2021

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 an IPv6 address will throw an error as well.

Read more comments on GitHub >

github_iconTop Results From Across the Web

How do I continue looping, even through an error? Python
I have the following code, but so far it will loop back if the first is true and the second is false. Any...
Read more >
Interfaces not detected/recognized on Win Server 2012 r2 + ...
Well scapy only detects one single interface: the loopback one. Please check that you are connected to Internet :/ If you think there...
Read more >
ipaddress — IPv4/IPv6 manipulation library — Python 3.11.1 ...
A ValueError is raised if the integer is negative or too large to be an IPv4 IP address. Represent an address as 16...
Read more >
Socket Programming in Python (Guide)
In this in-depth tutorial, you'll learn how to build a socket server and client with Python. By the end of this tutorial, you'll...
Read more >
Troubleshoot custom functions - Office Add-ins | Microsoft Learn
Troubleshoot common problems with Excel custom functions. ... A #VALUE error typically indicates an error in the functions' script file.
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found