Nmap Development mailing list archives

Re: [PATCH] ncat proxy client fixes


From: David Fifield <david () bamsoftware com>
Date: Sun, 5 May 2013 03:40:53 -0700

On Fri, Mar 29, 2013 at 07:05:03PM +0100, Joachim Henke wrote:
Hi,
connecting to a proxy via IPv6 and trying to reach an IPv4 target does not
work:

~$ ncat --proxy ::1:8080 127.0.0.1 80
Ncat: Proxy connection failed: Invalid argument.

With strace, we can see that the address_len argument is wrong:

connect(3, {sa_family=AF_INET6, sin6_port=htons(8080), inet_pton(AF_INET6,
"::", &sin6_addr), sin6_flowinfo=0, sin6_scope_id=0}, 16) = -1 EINVAL
(Invalid argument)

16 is too short (that would be just be enough for the address itself without
port and other information...) and therefore the address is cut to "::".
That happens because, while coping the sockaddr structs around, the length
information of the structs is not copied.

The attached patch 'ncat_proxy_addrlen.diff' fixes this issue.

Additionally, I found that the URL in the CONNECT command looks wrong for
IPv6 addresses:

CONNECT [::1]:80] HTTP/1.0

I think that should be fixed with the attached patch 'ncat_proxy_url.diff'.

Thank you Joachim, both patches are applied now.

David Fifield
_______________________________________________
Sent through the dev mailing list
http://nmap.org/mailman/listinfo/dev
Archived at http://seclists.org/nmap-dev/


Current thread: