[tor-bugs] #20871 [Core Tor/Torsocks]: Regression in Torsocks 2.2.0 breaks wget, among others

Tor Bug Tracker & Wiki blackhole at torproject.org
Sun Dec 4 06:33:12 UTC 2016


#20871: Regression in Torsocks 2.2.0 breaks wget, among others
-------------------------------+-----------------------------------
 Reporter:  cypherpunks        |          Owner:  dgoulet
     Type:  defect             |         Status:  needs_information
 Priority:  High               |      Milestone:
Component:  Core Tor/Torsocks  |        Version:
 Severity:  Major              |     Resolution:
 Keywords:                     |  Actual Points:
Parent ID:                     |         Points:
 Reviewer:                     |        Sponsor:
-------------------------------+-----------------------------------

Comment (by sysrqb):

 Replying to [comment:2 cypherpunks]:

 > In 2.2.0 in `src/lib/gethostbyname.c`, there's an if statement which
 checks if `name` is a valid IPv4 address. If it is valid IPv4 address, it
 should return 1, otherwise a negative value. What's weirder still is in
 `src/common/utils.c`, the `check_addr()` function is written in such a way
 that it cannot possibly return 0, only 1 or -1 (which both evaluate true
 in C).

 Nice catch, indeed that is likely broken and should be corrected. However,
 wget doesn't use gethostbyname(), it uses getaddrinfo(). Can you provide
 debug level logs that show how the name is being resolved (as dgoulet
 requested)? Setting something like `TORSOCKS_LOG_LEVEL=5
 TORSOCKS_LOG_FILE_PATH=torsocks.log` should be sufficient. Logging to a
 file maybe better than stdio.

 Debug logging shows:
 {{{
 1480831284 DEBUG torsocks[11468]: Setting up a connection to the Tor
 network on fd 5 (in setup_tor_connection() at torsocks.c:367)
 1480831284 DEBUG torsocks[11468]: Socks5 sending method ver: 5, nmethods
 0x01, methods 0x00 (in socks5_send_method() at socks5.c:229)
 1480831284 DEBUG torsocks[11468]: Socks5 received method ver: 5, method
 0x00 (in socks5_recv_method() at socks5.c:262)
 1480831284 DEBUG torsocks[11468]: [socks5] Resolve for www.torproject.org
 sent successfully (in socks5_send_resolve_request() at socks5.c:639)
 1480831284 DEBUG torsocks[11468]: [socks5] Resolve reply received
 successfully (in socks5_recv_resolve_reply() at socks5.c:716)
 1480831284 DEBUG torsocks[11468]: [getaddrinfo] Node www.torproject.org
 resolved to 82.195.75.101 (in tsocks_getaddrinfo() at getaddrinfo.c:107)
 }}}

 Specifically:
 {{{
 amnesia at amnesia:~/torsocks$ git show --pretty=oneline | head -n 1
 e54d80bc9595beeceac637b03e5c5395c07e62f7 Update version to v2.2.0
 amnesia at amnesia:~/torsocks$ git describe
 v2.2.0
 amnesia at amnesia:~/torsocks$ /usr/lib/wget/wget -V | head -n 3
 GNU Wget 1.16 built on linux-gnu.

 +digest +https +ipv6 +iri +large-file +nls +ntlm +opie +psl +ssl/gnutls
 }}}

 {{{
 amnesia at amnesia:~/torsocks$ TORSOCKS_CONF_FILE=doc/torsocks.conf
 TORSOCKS_LOG_LEVEL=5 TORSOCKS_LOG_FILE_PATH=torsocks.log
 LD_PRELOAD=src/lib/.libs/libtorsocks.so.0.0.0 /usr/lib/wget/wget --spider
 https://www.torproject.org/
 Spider mode enabled. Check if remote file exists.
 --2016-12-04 06:16:22--  https://www.torproject.org/
 Resolving www.torproject.org (www.torproject.org)... 82.195.75.101
 Connecting to www.torproject.org
 (www.torproject.org)|82.195.75.101|:443... connected.
 HTTP request sent, awaiting response... 200 OK
 Length: 15845 (15K) [text/html]
 Remote file exists and could contain further links,
 but recursion is disabled -- not retrieving.
 }}}

--
Ticket URL: <https://trac.torproject.org/projects/tor/ticket/20871#comment:3>
Tor Bug Tracker & Wiki <https://trac.torproject.org/>
The Tor Project: anonymity online


More information about the tor-bugs mailing list