Opened 8 years ago

Closed 8 years ago

Last modified 7 years ago

#4259 closed defect (fixed)

[PATCH] Tor crashes when nodes restrictions are changed at runtime

Reported by: Tey' Owned by:
Priority: Medium Milestone:
Component: Core Tor/Tor Version: Tor: 0.2.2.32
Severity: Keywords: tor-client
Cc: teyut@… Actual Points:
Parent ID: Points:
Reviewer: Sponsor:

Description

Hi,

Changing nodes restrictions using a controller while Tor is doing DNS resolution could makes Tor crashes (on WinXP at least). The problem can be repeated by trying to reach a non-existent domain using Tor:

curl --socks4a 127.0.0.1:9050 inexistantdomain.ext

.. and changing the ExitNodes parameter through the control port before Tor returns a DNS resolution error (of course, the following command won't work directly if the control port is password protected):

echo SETCONF ExitNodes=TinyTurtle | nc -v 127.0.0.1 9051

Using a non-existent domain is needed to repeat the issue so that Tor takes a few seconds for resolving the domain (which allows us to change the configuration). Tor will crash while processing the configuration change.

The bug is located in the addressmap_clear_excluded_trackexithosts method which iterates over the entries of the addresses map in order to check whether the changes made to the configuration will impact those entries. When a DNS resolving is in progress, the new_adress field of the associated entry will be set to NULL. The method doesn't expect this field to be NULL, hence the crash.

I attached a patch that fixes the problem.

Child Tickets

Attachments (1)

addressmap_clear_excluded_trackexithosts.patch (524 bytes) - added by Tey' 8 years ago.

Download all attachments as: .zip

Change History (7)

comment:1 Changed 8 years ago by rransom

Status: newneeds_review

comment:2 Changed 8 years ago by rransom

Looks good! How do you want to be credited in the changes/ file?

comment:3 Changed 8 years ago by nickm

Resolution: fixed
Status: needs_reviewclosed

Looks fine to me too; adding a changes/ entry and appeasing check-spaces. Crediting the fix to "Tey'" : if you'd like us to use another name, just say.

Thanks again!

comment:4 Changed 8 years ago by Tey'

Cc: teyut@… added

My ego is ok to be credited that way :) Thanks for the inclusion in the official source code.

comment:5 Changed 7 years ago by nickm

Keywords: tor-client added

comment:6 Changed 7 years ago by nickm

Component: Tor ClientTor
Note: See TracTickets for help on using tickets.