circuit_extend checks ExtendAllowPrivateAddresses, but by then it's too late, we've already connected in circuit_handle_first_hop.
This seems to be a DoS risk.
onionskin_answer handles local connections as a special case using channel_is_local, so we might actually be making some that serve some useful purpose. (What is that purpose?)
Do we really need to allow connections to our own address from ourselves?
It might be a good idea to refuse to build circuits to ourselves in circuit_handle_first_hop if ExtendAllowPrivateAddresses is 0, and then see what falls over. Unfortunately, this can't be tested using chutney.
To upload designs, you'll need to enable LFS and have an admin enable hashed storage. More information
Child items ...
Show closed items
Linked items 0
Link issues together to show that they're related.
Learn more.
This is a general case of the bug reported in #8976 (moved).
From IRC:
teorwe believe whatever address and port are sent to us in rendezvous protocol versions 2 & 3dgouletoh rly!?teorwithout checking the consensusdgouletI vaguely remember being a feature of tor that is being able to exit at an address that is _not_ an exitteorSo for HS, this means that a three-hop circuit can be made to an arbitrary addressdgoulet(or not in consensus)teorFor RSOS, this means that a one-hop circuit can be made to an arbitrary addressIn either case, there should be a check for a private addressasni thought this was fixed by robert at some pointteorFacebook's logs suggest it has not been, and I can't see it in the codeasnbut i see how it's worse for RSOSteorCertainly Tor will refuse to send cells, but it will still connectI don't think we need that feature, unless we sometimes connect to ourselvesI think Robert fixed it by refusing to send cells to extend to a private addressWhich doesn't handle the RSOS one-hop case, or any other case where Tor connects directly to a private address
It modifies circuit_handle_first_hop to refuse any connections to a private address with a protocol error, unless ExtendAllowPrivateAddresses is set.
This should catch this issue with relay extends, and hidden service / RSOS rendezvous from badly behaved clients.
I've played around with this. I've modified a tor client to change the RP extend info to be a IP/PORT I control (nc -l PORT basically). The result, and somehow expected is that the remote HS second middle when trying to extend to the RP does a TLS connection to my IP/PORT.
I've modified an HS I own to always pick the second middle to be a relay that I controlled (thus could look at the log). I then changed the RP info to 127.0.0.1. I see that my pinned relay is logging me:
Dec 07 17:31:56.000 [warn] Client asked me to extend to a private address
Which is denied by circuit_extend. So maybe the use case I've tested is wrong but it doesn't seem we go through "handle_first_hop" when extending to the RP (for hidden service). I would be curious why RSOS doesn't also use circuit_extend then?
(All this testing required me to change the HS, client and middle relay so I might have gone wrong).
It modifies circuit_handle_first_hop to refuse any connections to a private address with a protocol error, unless ExtendAllowPrivateAddresses is set.
This should catch this issue with relay extends, and hidden service / RSOS rendezvous from badly behaved clients.
I've played around with this. I've modified a tor client to change the RP extend info to be a IP/PORT I control (nc -l PORT basically). The result, and somehow expected is that the remote HS second middle when trying to extend to the RP does a TLS connection to my IP/PORT.
This is the behaviour the patch is intended to prevent - we don't want clients being able to convince HSs to make a TLS connection to anywhere on the Internet via their rendezvous second middle relay.
I've modified an HS I own to always pick the second middle to be a relay that I controlled (thus could look at the log). I then changed the RP info to 127.0.0.1. I see that my pinned relay is logging me:
{{{
Dec 07 17:31:56.000 [warn] Client asked me to extend to a private address
}}}
Which is denied by circuit_extend. So maybe the use case I've tested is wrong but it doesn't seem we go through "handle_first_hop" when extending to the RP (for hidden service). I would be curious why RSOS doesn't also use circuit_extend then?
The current behaviour of HSs is to make a TLS connection from the second middle, then refuse to send the extend cell in "circuit_extend".
The first hop uses "handle_first_hop". Subsequent hops use "circuit_extend".
Since a RSOS only makes one-hop rendezvous circuits, we need to stop this in "handle_first_hop" as well.
(All this testing required me to change the HS, client and middle relay so I might have gone wrong).
This is the behaviour the patch is intended to prevent - we don't want clients being able to convince HSs to make a TLS connection to anywhere on the Internet via their rendezvous second middle relay.
Oops, I meant: "a TLS connection to the relay's private network".