🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: news.software.nntp
Article #64909

[xBin] file size problem

#64909
From: Curt Welch
Date: Thu, 17 Apr 2003 23:08
73 lines
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/
Technical Details
Message-ID: <20030417190800.277$iY@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!news-spur1.maxwell.syr.edu!news.maxwell.syr.edu!feed1.newsreader.com!newsreader.com!news2.newsreader.com!ellis.newsreader.com!not-for-mail

Show Full Headers
Complete Article Headers
Message-ID: <20030417190800.277$iY@newsreader.com>
Subject: [xBin] file size problem
Date: Thu, 17 Apr 2003 23:08:00 +0000
From: curt@kcwc.com (Curt Welch)
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!news-spur1.maxwell.syr.edu!news.maxwell.syr.edu!feed1.newsreader.com!newsreader.com!news2.newsreader.com!ellis.newsreader.com!not-for-mail
Organization: NewsReader.Com
Newsgroups: news.software.nntp
X-Trace: NewsReader.Com wqu5+dXSb=Ypv0lI4b6,Efi9LULSr28rH_ZPXO5DCFTz_q1s0W
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: 72