There are two sentences which I don't understand in Tor dir-spec ver 3. (https://gitweb.torproject.org/torspec.git/tree/dir-spec.txt)


Descriptors are downloaded by the hash of the descriptor, not by the relay's identity key: this prevents directory servers from attacking clients by giving them descriptors nobody else uses.


Descriptors were indexed by their digests, in order to prevent malicious caches >from giving different version of a server descriptor

I think the advantage of using hash instead of using identity key directly is to store more descriptors and to search fast in consensus document using hash indexing.

So, I don't understand why using hash prevent attackers.

1 Answer 1


Hash and Digest in those sentences are the same thing: you're noting/referring-to/counting/distinguishing descriptors by their has, as a primary key/id. So - that disarms the potential forgery attack with serving old version of the descriptor: an old and new versions are having different hash/checksum, so they will be referenced "by difficult ids", so attacker won't be able to give you an old version by request of a new one. Also keep in mind, that hashes like md5 and sha1 and sha256 are usually hardware-accelerated by most CPU's and MCU's, so using them as an ID is a very good choice: it's fast, unique and have a fixed size(by definition of the hash itself).

  • So, I think it is possible for attacker to give not an old version but malicious & new version. Is there any mechanism to check integrity of consensus document? I think it is possible to forge some information not related to authorities' signing part on consensus document.
    – 장석인
    Oct 10, 2016 at 0:03
  • @장석인 nope, the hash is taken from all the descriptor data, so malicious descriptor will have some different contents - and just will have different hash. That's why the hashes were selected. You can even speculate that you've forged some data and injected a malicious descriptor - but you won't be able to force the forged descriptor to have the same hash as an original one
    – Alexey Vesnin
    Oct 10, 2016 at 9:25
  • The meaning what you said is that there is hash value of all descriptors on consensus in somewhere, and client compare the old consensus with new consensus whenever client received consensus document. Can I get some links about how this works more detail? I understood client just compare not all descriptors but the most recent descriptor using hash index on consensus previously. Am I wrong?
    – 장석인
    Oct 10, 2016 at 14:43
  • @장석인 I recommend to start here and follow the links deeper
    – Alexey Vesnin
    Oct 10, 2016 at 14:45
  • Hmmm... what I want to say is that if I control directory cache, I can inject completely new descriptor of relay which I already controlled on consensus. According to dir-spec.txt, client just download consensus document periodically, and check whether there are missing descriptors on consensus through comparing the most recent descriptors which client had. So, client will learn about that injected descriptor. Nope?
    – 장석인
    Oct 11, 2016 at 2:14

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .