🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: news.software.nntp
Article #64992

Re: xBin library version 0.1

#64992
From: Curt Welch
Date: Wed, 23 Apr 2003 21:47
310 lines
18191 bytes
"Mirco Romanato" <painlord2k@yahoo.it> wrote:
> "Curt Welch" <curt@kcwc.com> ha scritto nel messaggio
> news:20030421201204.318$Ng@newsreader.com...
>
> > Unfortunately, they have missed the file size problem when you try to
> > securely transport partial file segments and don't submit the entire
> > file to the network for transport.
>
> I posted to the Bitzi board to have info about your issue.
> This is the reply by Gordon Mohr <gojomo@yahoo.com>
> I have a very high respect for the skill and knowledge of Gordon in the
> cryptographic area, and I trust his reply and his opinion.
> If this don't solve your doubts about using the TigerTree hash, I advice
> you to subscribe to the http://zgp.org/mailman/listinfo/p2p-hackers and
> raise the issue.

I'll talk with him directly.  Or, I guess I just cc this to him and we can
talk this over in e-mail.  Or he can follow up in usenet if he likes.  He
just hasn't seen the issue I'm talking about yet.  He will.

> There are many experts that can solve your doubts in the list, and give
> good advices.
>
> Posted by:  gojomo <http://bitzi.com/bitizen/gojomo>

> I don't quite know what Curt Welch means by "the file size problem"
> that he believes remains, and browsing over more of the conversation
> at news.software.nntp hasn't helped me understand.

Let me explain the "file size" problem...

We are trying to create a system where you can examine a single Usenet
article which contians a portion of a file and know for a fact that all the
information you have about that chunk is valid.  We need to do this because
people at times have actively tried to post fake articles in an attempt to
prevent files from being transfered over Usenet.

Right now, this act of corrupting a mutipart file post is trivial.  Parts
are matched up right now simply by subject.  To post fake data into the
middle of a post, all you need to do is put bogus data in an article with
the correct subject.  This alone is enough to break far too many of the
currend download tools.  However, most downloads on usenet are not done
automatically today.  It's all semi-automatic.  Most the time, the user is
shown a list of articles, and they have the power to spot things that don't
look right and fix them.

Also, large files are split up using tools like rar into multiple smaller
files.  If a "bad guy" manages to post articles and corrupt some of the rar
files, he is only likely to have corrupted all of them.  When this happens,
and when the users can't figure out why the rar file is corrupted, they
simply get someone to repost the entire rar file.

However, with the xBin standard we are working on, all file transfers can
be fully automated.  The user should never have to look at articles again
to figure out what is broken, and should never have to step in to "fix"
transfers corrupted by the trouble makers.

But, if everything is automated, it has to be fool-proof.  We need to do
everything we can to make sure that no form of abuse can be used to prevent
a file from being trasferred.

Using a tree hash is a big first step in making this happen.  It allows us
to use the tree hash as the unique file-id for the file.  So when the user
decides to download a file, it's based on the tree hash.  He askes his
download tool to get a file with a tree hash of XYZ.  We still have the
problem of someone posting a file and describing it to be something other
than it is, but there other options to addressing that (as you know).

But, the intent is that "secure outside channels" are never going to be the
norm for usenet.  So it can not be assumed that most poeple will know the
truth about the file they want before they spot it on usenet and before
they choose to download it.

Now, with each article, will be the data from the file, as well as the
informatain about where that data is located in the full file (it's offset
and size), the total size of the file, it's tree-hash (which is the file-id
for the file), and the minimal number of tree hash nodes to prove that the
data is in fact from the file with the given root tree hash value.

Now, it's easy to prove all that data is self-consistent, expect for the
file size.  The size of the data obvious has to match the amount of data in
the article, and it's offset defines where it falls in the hash tree, so
the hash tree values supplied prove that the information provided is in
fact located where it says it is in the file.  And of course the fact that
the root hash can be re-calcuted and shown to match proves that the
root-hash is correct as well.

The file size, however, is impossible to prove correct (whitin limits).
Depending on how much tree data you provide, it's trival to take the data
from a reall 2GB file, and post a chunk of the file and lie about the size.
You can claim it's only slightly larger than 1GB for example if the chunk
of data is from the first half of the real file.

This is not a "killer" problem, but it's a problem.  Because someone could
post fake data about the file makeing the users and the dwonload tools
think the file was half the size it really was, or posting mutliple fake
articles all with slightly different sizes.  One of the featues of xBin is
that it would allow news servers to know how large the fill file was so
that servers could filter articles based on the full file size instead of
just the article size.  Servers that were not able to keep up with a full
feed could use this as a better way to filter "files" form the feed instead
of just filtering articles.

If the file size can be faked, we could no longer trust the file size and
could no longer do things like filter feeds by file size.

If a user decided to download a file, they want to know how large it is
before they start to download it so the download tool can accurately report
how long it will take, and how much of the file is currently avaiable on
the server.  If you don't have a valid file size, you can't report any of
this.  Or if you falsely "trust" the file size reported in the article you
see, the users, and the tools, can be tricked by anyone wanting to abuse
the system.

Also, the advantage of having a verified file size is that the file size
bits can be combined with the hash bits to create a larger effective hash
to further reduce the probability of collisions.  This is useful for xBin
because we are placing the file hash, along with the file size, the data
offset, and the data size, all into the Usenet Message-Id of the article.
But, because large Message-Ids cause issues on Usenet, we want to keep this
as small as possible, and we are talking about not including the full hash
in the Message-ID (though it would be available in the header and the full
hash would be used when verifying the data).  Because the full file size is
in the Message-Id as well, download tools could use the partial tree hash
combined with the file size to create an effective file-id hash which had
more bits.  It could use this effictive larger hash to uniquely keep track
of all the files it had in the users personal database of files he had
either 1) already downloaded in the past, or 2) was currently trying to
download now.

The fact that the file size needs to be in the Message-Id means that if
it's verified as valid, we can justify including less of the full tree hash
in the message-id.

> TigerTree (or other THEX tree-arranged hash) should be ideal for the
> issue of Usenet posts split into many parts. If it is necessary to
> know exactly where a part fits into the whole, and the size of the
> whole, with every part, then you should include (a portion of) the
> full tree with each part.
>
> That portion could be (1) all generations of the serialized tree from
> the node which includes the sent part on up to the root (in which case
> you could use the THEX serialized form); or (2) all the nodes in the
> same generation as the node which includes the sent part; or (3) an
> even more compact "proof", which only contains the barest minimum
> other node values to "paint in" the sent part's value, up to the root.
>
> So considering a file broken into 8 parts, A B C D E F G H, and
> assuming you're sending part C:
>
> The tree is:
>
> ......O.......
> ..M...+...N...
> I.+.J...K.+.L.
> A+B.C+D.E+F.G+H
>
> Under strategy (1), you'd send all interim values A B C D E F G H I J
> K L M N O (the full THEX tree) along with the data for part C. The
> recipient would know for certain the whole file's size, the whole
> file's treehash, C's size, where C fits in, and every interim hash at
> C's level and higher.

No, even with the entire top of the tree, you don't know how much data is
in part H.  The full file size can be reported as being +- the size of part
H and there is no way to veryify it.  i.e., you know the true number of
blocks, but not the number of bytes in the file.  We need to know file
length down to the byte.

We however can't really justify sending that much hash data in Usenet.
It's way too much data to be included in each article for the larger files.
If you have a 500 MB file broken into 500KB articles (typical of what is
done today on Usenet), you have 1024 articles in the post.  That generates
a tree depth of 10 and about 2047 hash values to include in each articles.
If Tiger is the underlying hash function, you are talking about 50KB of
hash data before encoding.  We really can't (well - don't need to) justify
sending that much extra data with each 500KB article.

> Under strategy (2), you'd send just the bottom interim values A B C D
> E F G H along with the data for part C -- because I J K L M N O are
> all trivially calculatable from the bottom generation. Again, the
> recipient would know for certain the whole file's size, the whole
> file's treehash, C's size, where C fits in, and every interim hash at
> C's level and higher.

That cuts the size of the hash data in half but still doesn't solve the
problem of knowing the correct size of block H.

> Under strategy (3), you'd only send the barest minimum of other values
> to prove where C fits in -- D I N -- along with the data for C.

This is exactly what the xBIn plan is.  The data is sent in the more useful
order I D N however.  This allows the hash data to fit into the headers of
a Usenet articles which is very advantageous because the NNTP protocol
allows you to download the header of an article without downloading the
entire article.  NNTP also does not provide any clean way of downloading
only part of an article, so if the hash data was located at the begining of
the article body, there's no clean way of downloading that and not the
entire article.

Also, putting the hash data into the header makes it far cleaner to be
backward compatiable with current article formats.  All current tools will
ignore extra data in the headers but it will be much harder to put data
into the body without causing problems with current (non xBin aware)
download tools.

> (D
> with C is enough to calculate J, J with I is enough to calculate M, M
> with N is enough to calculate O.) Here, the recipient would know for
> certain the whole file's size, the whole file's treehash, C's size,
> where C fits in, and the interim hashes between C and the root value.

But with the minimal hash data, it's trival to lie about the true size of
the file.  I can post the same article as in your example, which includes
the real data for chunk C, and includes the hash values I D N, but instead
of claming the file is 8 blocks long, I can claim it's only 5 blocks long -
that block E is in fact the last block of the file instead of H.  If it's a
2GB file, I can in fact claim it's only 1GB+1 byte long.

> -- Even the "send the whole (top of) the tree" strategy #1 is a small
> amount of overhead compared to large files: Splitting a 1GB file into
> 1024 1MB segments only requires a full tree of 2048 interim values,
> ~48K. That's under 5% overhead per 1MB part. (For strategy #2, that'd
> be 1024 interim values: 24K, <2.5% overhead. For strategy #3, that'd
> be just 10 interim values, 240bytes, <0.03% overhead -- but much more
> complicated code as random parts come in.)

It's imporant that the "overhead" be included with each article and not
transmitted separately.  This allows each article to be verified as a
stand-alone entity which is exactly how Usenet works.  usenet servers
transport "articles", not files, so decisions about filtering or blocking
articles will work best if they can be done on an article by article basis.
The hash tree using the minimal hash format allows this with very minimal
overhead and a large amount of backward compatibility with current article
formats and download tools.

But the minimal format allows you to lie about the length by  +- the size
of the data covered by the last hash block in the set which can be up to
50% of the true file size.

Any P2P like file-sharing network which allows partial files to be posted
and transported by the network will share this same problem.  If I submit a
partital file, with hash tree data, to any network, you have to trust that
the file size I'm telling you is correct because without access to more
data, the network has no way of verifying I'm telling the truth about the
size of the file.  And, if you use bitprint, or any form of full-file flat
hash (I use that term to describe any non-tree hash), like SHA-1, you
likewise have to trust what I tell you about that hash because since I am
only transporting a partial file segment, the network can not verify what I
claim the SHA-1 hash of the full file is, or that the length I claim for
the full file is correct.

This is the "file size problem" I speak of.  It happens in any network
which can not trust the people submitting the data and which allows partial
files to be transported.

So, lets look at possible solutions...

From your example above, one thing we can do is include the hash of the
last block in the file, and only the minimal set of hash values above that
requied to prove that the hash value is valud. So, instead of just
including I D N, we could replace N with H and other values needed to prove
our "H" which would include I D K G H.  That doesn't solve the file size
problem, but it reduces the amount of possible "lie" to +- the size of H.

To prove the size of H (down to the byte), the only solution is to include
the data from the last hash block (block H) in every article instead of
just the hash of H, so that makes the proof data in the above example (I D
K G Block-H).  For a block size of 1024 bytes, that could be done (within
the amount of data we can justify adding to every usenet article), but it's
messy.  And it couldn't easilly be done only in the headers which is a
problem for Usenet.

Another solution is to fold the file size into the hash. There are various
options for doing that.  To maintain some degree of compatibility with the
TigerTree hash used by Bitzi, we could fold the full size of the file into
the hash only at the top level.

So, the xBin hash would be calculated as H(TTH+FullFileSize).  That is, we
would concatenate the Bitzi root TigerTree hash, with the full file size
(in some well defined format), and hash all that to come up with the xBin
hash which was used within the xBin standard to uniquely identify files
posted to usenet.  It would now be impossible to lie about the true size of
the file associated with ID XYZ. You could now prove that all the data
within a single article (with no help of any outside source), was
self-consistent and came from the file with hash XYZ and size ABC.  And, we
would still have the Bitzi compatible TTH for the data for anyone wanting
to take advantage of that.

Yet another, cleaner, but non-compatible, way to deal with the file size
problem is to use a hash tree algorithm which folded the size of the
underlying data into the hash at every level.  This would allow you to use
the same hash function at both the leaf and and internal node levels of the
tree.  IT would be H(data+size) for all levels.  If the file was less than
one hash block in size, the hash would simply be H(data+size). (+ is
contatenation).  For a file of 1124 bytes in length with a 1024 byte hash
size, the hash function would be:

  H(H(B1+1024)+H(B2+100)+1124)

Where B1 is the data from Block 1 (the first 1024 bytes of the file), and
B2 was the rest of the data in the file.

This is what I would choose as the hash function if we decided that
compatibilty with the bitzi work was not important.

-- 
Curt Welch                                            http://CurtWelch.Com/
curt@kcwc.com                          Webmaster for http://NewsReader.Com/
Technical Details
Message-ID: <20030423174743.167$Fo@newsreader.com>
Path: mbox-mo1.pugleaf.net!archive.usenet.blueworldhosting.com!illumos!news.pugleaf.net!.TX!archive.pugleaf.net!archive.newsdeef.eu!mbox2nntp-news.software.nntp.mbox.zip!archiver1.google.com!news1.google.com!newsfeed.stanford.edu!cyclone.bc.net!news.maxwell.syr.edu!feed2.newsreader.com!newsreader.com!news2.newsreader.com!ellis.newsreader.com!not-for-mail
References: <pan.2003.04.08.05.21.36.142899@canada.com> <l_Cka.19193$iy5.537691@twister2.libero.it> <pan.2003.04.08.17.40.39.978437@canada.com> <20030421115343.200$MS@newsreader.com> <VkWoa.55726$iy5.1660618@twister2.libero.it> <20030421201204.318$Ng@newsreader.com> <dcypa.60689$iy5.1814855@twister2.libero.it>

Show Full Headers
Complete Article Headers
Message-ID: <20030423174743.167$Fo@newsreader.com>
Subject: Re: xBin library version 0.1
Date: Wed, 23 Apr 2003 21:47:43 +0000
From: curt@kcwc.com (Curt Welch)
References: <pan.2003.04.08.05.21.36.142899@canada.com> <l_Cka.19193$iy5.537691@twister2.libero.it> <pan.2003.04.08.17.40.39.978437@canada.com> <20030421115343.200$MS@newsreader.com> <VkWoa.55726$iy5.1660618@twister2.libero.it> <20030421201204.318$Ng@newsreader.com> <dcypa.60689$iy5.1814855@twister2.libero.it>
Path: mbox-mo1.pugleaf.net!archive.usenet.blueworldhosting.com!illumos!news.pugleaf.net!.TX!archive.pugleaf.net!archive.newsdeef.eu!mbox2nntp-news.software.nntp.mbox.zip!archiver1.google.com!news1.google.com!newsfeed.stanford.edu!cyclone.bc.net!news.maxwell.syr.edu!feed2.newsreader.com!newsreader.com!news2.newsreader.com!ellis.newsreader.com!not-for-mail
Organization: NewsReader.Com
Newsgroups: news.software.nntp
X-Trace: NewsReader.Com +i=t_nA4n8@EERKf@aDAs=bYW4N=ay=fpuEzfw8_h9oG_Eia
X-Face: "p}G*1KH{+F7EYGKLb>ogDguabZ+%,?^epeFB!nzu`)`$=QcvL1KF6<0GH!Tbc!Sqo[|tV5
  %IW48mQf3K=Ci&gZ7]]aazx@]Y-nq!r5{yH/#,?@lDdUDvOfByB2hVW0.@OM%{l/{cT'{w
X-Url: http://CurtWelch.Com/
User-Agent: NewsReader.Com
Lines: 309