Nmap Development mailing list archives

[PATCH] ncat proxy client fixes


From: Joachim Henke <free.software () gmx com>
Date: Fri, 29 Mar 2013 19:05:03 +0100

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

Thanks and regards,
Joachim Henke

Attachment: ncat_proxy_addrlen.diff.gz
Description:

Attachment: ncat_proxy_url.diff.gz
Description:

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

Current thread: