Thread View: news.software.nntp
3 messages
3 total messages
Started by Curt Welch
Thu, 17 Apr 2003 23:08
[xBin] file size problem
Author: Curt Welch
Date: Thu, 17 Apr 2003 23:08
Date: Thu, 17 Apr 2003 23:08
73 lines
5015 bytes
5015 bytes
With xBin, the size of the entire file is going to be transmitted in every article along with the data has the hash values so clients (and servers) can verify the article as being valid. The file size would be included in the Message-Id along with a partal tree hash value and the offset and size of the data chunk included in the article. I had though that all this information could be proven consistent by recalculating the hash using the data and partial hash tree values from the ariticle. However, this is not the case for the file size. The file size can be faked, or intentionally corrupted in an effort to "break" things. The file size defines the size of the hash tree, and determines to some extent, what hash values get included with the article. So,m generally speaking, the size as documented in the article must match the hash values given in the article. However, it's possible to change it to some extent. The number of bytes in the last hash block can not be verified if the current article doesn't also include the last hash block of the file. You can put any size (in bytes) you want in the message-id as long as the number of the hash blocks is the same and change nothing else in the article. You can also shorten or lengthen the file size by any number of blocks within the section of the file covered by the last hash value in the signature and the verification system would not be able to tell if the value as specified was correct for the file or not. What this means is that if someone posts a large file with xBin labels, it would be possible for anyone to post fake versions of the file, which included real data, and real hash values, but a fake file size. Looking at the single article, it would be impossible to tell if the file size as documented in the article was valid or not. This strikes me as a problem. One answer to the problem is to just understand that the file size is not to be trusted. But if that's the case, then we should remove it from the article. It should not be part of the Message-Id. If you leave it in the article, then it will only tend to encourage people to write code which assumes it's valid. And that's the code which will break when someone starts to post forged articles which invalid file sizes. If you don't include the file size, then when you get one segment of the file, you don't know the full file size. That seems to me to suck. You can't for example acurately tell the user how large the full file is so you can't let them know how long it will take to download or how much space it will take up. The other answer I see is to hash the file size with the data. This is probably best done at the top level of the tree. You build the tree hash the normal way, but instead of using the top level tree hash value as the "full file hash", you concatenate that hash value, with the file size (in some well defined format), and hash all that data to get the xBin file hash. The file hash is what you put in the Message-ID (or at least part of it), and is what the xBin system as a whole uses as the unique file-id for all file segments transport by the system. Doing this ties all the data, including the full file size, to the file-id. It allows you to know for sure that the file size as specified in the article is correct and matches the data in the article and the file-id. The downside for doing this means that even if we used a tiger tree hash in an attempt to be compatible with other P2P systems, we will no longer be compatible. The hash used as the "file id" for xBin would not be the same as what is used in the P2P systems. However, the tiger tree hash value would still be easy to calcuate from any xBin article, and could even be include in the header to make it easy to access without recalculating it. Any thoughts about this??? -- Curt Welch http://CurtWelch.Com/ curt@kcwc.com Webmaster for http://NewsReader.Com/
Re: [xBin] file size problem
Author: Mirco Romanato
Date: Fri, 18 Apr 2003 12:39
Date: Fri, 18 Apr 2003 12:39
36 lines
2373 bytes
2373 bytes
Curt Welch wrote: > With xBin, the size of the entire file is going to be transmitted in > every article along with the data has the hash values so clients (and > servers) can verify the article as being valid. > The file size would be included in the Message-Id along with a partal > tree hash value and the offset and size of the data chunk included in > the article. > I had though that all this information could be proven consistent by > recalculating the hash using the data and partial hash tree values > from the ariticle. However, this is not the case for the file size. > The file size can be faked, or intentionally corrupted in an effort > to "break" things. I researched your issue and yes is an issue. http://zgp.org/pipermail/p2p-hackers/2002-November/000997.html http://zgp.org/pipermail/p2p-hackers/2002-November/000998.html But these are messages from the 2002, so I suppose THEX and TigerTree was fixed for this. I know that TigerTree algoritm was changed 3 times in the last year because weakness and error of implementation was discovered. And few day ago, the official TigerTree implementation was fixed and published. You could ask to Gordon Mohr <gojomo@yahoo.com> (of Bitzi) and Justin Chapweske <justin@chapweske.com> (of OCN) this topic. Mirco
Re: [xBin] file size problem
Author: Curt Welch
Date: Fri, 18 Apr 2003 19:09
Date: Fri, 18 Apr 2003 19:09
48 lines
3514 bytes
3514 bytes
"Mirco Romanato" <painlord2k@yahoo.it> wrote: > Curt Welch wrote: > > With xBin, the size of the entire file is going to be transmitted in > > every article along with the data has the hash values so clients (and > > servers) can verify the article as being valid. > > > The file size would be included in the Message-Id along with a partal > > tree hash value and the offset and size of the data chunk included in > > the article. > > > I had though that all this information could be proven consistent by > > recalculating the hash using the data and partial hash tree values > > from the ariticle. However, this is not the case for the file size. > > The file size can be faked, or intentionally corrupted in an effort > > to "break" things. > > I researched your issue and yes is an issue. > > http://zgp.org/pipermail/p2p-hackers/2002-November/000997.html > http://zgp.org/pipermail/p2p-hackers/2002-November/000998.html Very interesting. They are proposing the same type of fix of hashing the size for what is actually a slightly different reason. And the cleaner and stronger solution is to include the size of the data you are building a hash for at every node of the hash tree, not just the top node. The reason being is that if the root hash is calcuated as R = H(A|B) where A and B are the hash values of the sub nodes, and | is just concatenation, then it's trivial to create a collision. If you made a file which was just the bytes A|B, that file would have the same tree hash as the larger file which had A and B as the hash values of top nodes below the root. So it's trivial for anyone to create a short file which the same hash as a file with greater than one hash block in size - but it would have a different length. So, if you change to a hash function of H(A|B|Length-of-data), the problem seems to be solved. This no doubt is also why that Merkel document talked about using a different hash function for the leaf data blocks than for the tree nodes by adding extra constant data to the input but including the size seems to be stronger. I didn't see the point before but I do now. > You could ask to Gordon Mohr <gojomo@yahoo.com> (of Bitzi) and Justin > Chapweske <justin@chapweske.com> (of OCN) this topic. Thanks for the pointers. -- Curt Welch http://CurtWelch.Com/ curt@kcwc.com Webmaster for http://NewsReader.Com/
Thread Navigation
This is a paginated view of messages in the thread with full content displayed inline.
Messages are displayed in chronological order, with the original post highlighted in green.
Use pagination controls to navigate through all messages in large threads.
Back to All Threads