🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: news.software.nntp
Article #61104

Re: [FNTP] 'in-completeness'

#61104
From: Curt Welch
Date: Sun, 06 Oct 2002 20:52
274 lines
15709 bytes
Kjetil Torgrim Homme <kjetilho@haey.ifi.uio.no> wrote:
> [Curt Welch]:
> >
> >   Kjetil Torgrim Homme <kjetilho@haey.ifi.uio.no> wrote:
> >   > the "answer" to part N-1 and N+1 must be a hash of their content.
> >   > anything else will allow the attacker to keep the answers and
> >   > replace the content.  assumption: we trust part 1.  it is therefore
> >   > part 1 which must contain the information allowing us to trust part
> >   > 2.  (and so on by recursion.)
> >   >
> >   > with such a hash in place (put it in a random header, it's
> >   > acceptable to use HEAD to choose the right candidate), the idea of
> >   > using overlapping parts is unnecessary.
> >
> >   Ah, but we want to be able to trust reposts even if they have
> >   nothing to do with the orginal post.
>
> mm, yes?  I'll be more explicit.  article 1 contains the segment
> 0..500k.  it includes the header:
>
> X-Next-Segment: offset=500000 size=5000000
>   md5=2ca809d77efa7254482d3350eb5abe53
>
> article 2 includes the header:
>
> X-Next-Segment: offset=1000000 size=5000000
>   md5=9cfe84382574173a6bf0af0333e30ed1
>
> if you want to repost a segment, you presumably have the complete
> file, and can calculate the MD5 hash of the byte range following your
> segment.  this scheme allows the reposts to use a different segment
> size than the original, it only makes the code for the verification in
> the client a little more complicated.
>
> the main issue is the loss of part 1.  then you've lost your anchor,
> and trust in the other parts is reduced.  but you can still piece the
> parts together into chains when the hashes matches.
>
>   real  1 2 3   5 6 7
>   fake        4 5
>
> you download parts 1 2 3 4.  you notice that the hash of 4 doesn't
> match the header of 3.  you download both 5, and notice that the hash
> of the fake 5 matches the header of the fake 4.  so you trust the
> other 5 more (but you're still not safe), download 6 and 7, and see
> that they form a chain.  you do know that you need to keep a look out
> for the real 4 to get a complete message.  when the real 4 arrives,
> you will know whether the chain 5-6-7 is genuine.
>
> if part 1 goes missing, nothing is certain, but the principle is the
> same.
>
> if part 1 is fake, we have a problem.  my best suggestion is to look
> at chain lengths.

Your system helps, but it doesn't solve the problem.

What if they post a fake 4 which has valid data (so it does match
the hash from real 3), but then a fake hash for segment 5?
Then they post a fake 5 with fake data that matches the hash in
their fake 4.

Then, you post a fake 4 which has fake data so it doesn't match
the hash in the real part 3.  But it's hash for 5 is the real
hash for the real 5.  Does that make your download tool assume the
"real 5" is a fake?

What about an entire set of fake posts starting with part 1
which all match each other?

So what does this leave you with?  It means that the download tool
can't assume anthing about anything.  It _never_ knows that any
article it has is fake or real.  If the hash included in the
article for the next segment doesn't match, it tells the tool
nothing.  The next segment it has might be fake or it might be
real.  A match with a previous hash tells you nothing about which
is fake or which is real just like a failure to match tells you nothing.

What you do know is that you need a chain of matching hash values
from start to finish, but if the guy posting the fake sends an entire
set of fakes along with a bunch of false connections between
the the "real chain" and the "fake chain", the download tool ends
up with a problem that's so complex you once again you have nothing
but the full-file hash to fall back to.

The only thing you can do is piece together the entire file from
a set of these posts, calcualte the full hash, and see if it matches
the hash in the Message-ID.

If you double link your chain so the previous segment hash and the next
segment hash is included in each post (you can even make it circular so
the last points to the first and the first to the last), then you know
you are looking for a set of posts which create a complete chain, and
that will help, but it still requires you do download all the fakes, and
search through them.

My hash system allows the fakes to blocked at post time without scanning
the entire set (which won't happen at first, but could be added if the
system became a standard).  That won't prevent people from finding
non-proteced systems to send their fakes from, but it makes it a lot harder
for them to cause any real trouble so it's not likelty to be done.

> >   There must be some clever way to make this work.  If there are
> >   lots of "fakes" posted, I don't think there is anyway to avoid
> >   having to download a lot of the fake articles, but once you have
> >   them all downloaded, you want the job of reconstructing this
> >   jig-saw puzzle to be resonable.
>
> it's hard to avoid downloading fake data.  I think X-Prev-Segment can
> help there, actually.  from the example above, if you look at that
> header in both copies of 5, and see that one of them matches the fake
> 4, then you know which 5 is fake.

Not if the "next" hash is faked (or made real) for the purpose of throwing
your code off.

> >   One thing I was thinking about was trying to find a hash function
> >   that would allow you to calculate the file hash if you had hash
> >   values for each segment, without having to make a pass over all
> >   the raw data.
> >
> >   [...]
> >   The problem with a simple sum of course is that it's completely
> >   trivial to generate fake data which produces the correct sum.  So
> >   it offers no protection against forged data.
>
> exactly.
>
> >   Is there some way to get the security of a strong hash but yet
> >   still have a way to calculate the file hash from the segment
> >   hashes so you can mix-and-match various segments quickly without
> >   having to recalculate an entire file hash over the file?
>
> I suspect it is impossible to have a hash like that, and still make it
> cryptographically secure.

My other article about hashing blocks, and then hashing the hash values in
blocks until you get down to a single hash I believe solves that.

> >   What if you did something like calculate a real hash of fixed
> >   sized blockes from the file (say 1024 bytes?), then define the
> >   file hash to be simply the sum, or XOR of all the block hash
> >   values?
> >
> >   If all segments posted in this new system were required to be
> >   split on these 1K block boundries, then every article posted could
> >   have it's "hash" value included in the header (i.e. the sum of the
> >   hash of each of the blocks in that segment).
>
> it could work for our purposes.  I'd put that in a separate header,
> and use the "real" hash in the msgid.

This "hash of hash" idea is a "real hash". It's just not a straight
MD5 or SHA1 hash.  If something like this works to allow us to verify
a single article without having access to the rest of the data, why
wouldn't we use this as the "real" hash instead of an MD5 or SHA1 hash?

To veryify the data, you need a good sized set of data (logically a list
of hash values for the rest of the file), included with every post.  But
we could make that optional for now and only start including that if the
abuse problem became a real issue.  But using the correct hash to allow
this to be added later should be done now.

> >   Maybe something like this would give enough security from fake
> >   data but also make the job of sorting though real and fake
> >   articles fast enough to be practical?  If so, all you could gain
> >   by posting fake articles is to make people waste time downloading
> >   them - they wouldn't prevent you from getting the real data.
>
> I must ask, is terrorism such as this common?  I have a feeling this
> is all very theoretical.

Usenet terrorism is _very_ common.  But, this form of abuse where you
try to corrupt binary posts by posting fakes I've never seen, so even if it
has been done, I don't think it's a big problem right now.  But, a lot of
matching up posts today is done by hand (or can be hand-assisted) when the
machine algorithm fails.  So the abuse today I think is harder to make
work, and harder to get away with.

Part of where I see this message-ID system taking us is to a world where
automatic combining of posts _always_ works and you never have to step in
and hand-pick the correct articles for the software to combine.

For example, I've been thinking that with this system, you could start
a convention of posting a part 0 style header article which describes
the binary post and provides a link the file in the form of a fake
message-id which includes the file hash and file size, but nothing
else.  i.e. something like this:

  <~UB~h95b2e4ed3379e4~S61583b69~~@isp.com>

This Message-Id (like any real Usenet Binary Message-ID) is all you need
to pass to your download tool for it to start hunting down all the
file segments for you.

So you read this part-0 article, decide you want the file, and you
click on the Messaage-ID.  Your download tool asks if you want
to download the file, so you say yes, and it adds that file identification
(the hash and size) to it's list of stuff to find for you. Or, it starts to
hunt down the parts and tells you what it found and then asks if you want
to add that to the download list.

The actual binary posts can then be stuck in a sub-newsgroup, like a .b
group which no one normally looks at.  The Subjects of the files are
no longer important like they are today, so the subject could be either
left out or something very small (a few bytes from the hash just to
make the articles sort together if you did look at the group?) (which
reduces the size of the XOVER downloads which are required today).

If we get to that point, we must have a system which prevents someone from
posting a single fake article and causing the entire 10GB file post to be
corrupted.  For example, someone that wants to cause trouble can look for a
large post and notice where a few segments are missing, then post fakes to
fill in the missing gaps.  It's very little work considering what damage it
could be done for a very large file.

Right now, people break up the huge files into rar files (or other systems)
so each sub-file can be verified.  We don't want them to have to do that.
If they are going to post a 10GB file, we want them to be able to post it
as a 10,000 part post over a 6 month period if that is what it takes.

It's not only terrorism/abuse we need to protect against, you also want to
protect against broken software and broken hardware.

For example, what if someone downloaded that 10GB file last year, and is
trying to help re-post it now, or post fills for people.  But his hard
drive is having problems and it's sometimes corrupting data as it's read.
His download tool calculated the hash and it was fine, but then, when the
file was read for the second time to post it, the data was different.  The
posting tool adds the yEnc pcrc to it, so it the article "looks" good (its
got a valid crc), but in fact, the data is not valid and when combined with
all the other 10,000 segments, it will not produce the correct full-file
hash.  Anyone that downloads his segment will end up with a corrupt version
of the 10GB file with no easy way to figure out which segment is corrupted.

Even if you "play" the file and find that it's corrupted at some point, how
do you tell the download tools that something is wrong at 2 hours and 31
minutes into the video and that that's where the tool should look for
alternate segments to download?  The point is to get away from all that.

My system i think would fix all that.  Not only would it allow everyone
that downloads the segment to know it's good or bad, the posting tool would
be checking it before it's posted as well so it knows that the file is
corrupted.  If the posting computer has hardware problems between the
computer's memory (where everything was checked for accuracy before it was
posted) and the news server, then the news server can also check the
article for accuracy before it's sent out to the world (without having
access to all the other parts).

What you need is a way to prove that a chunk of data matches the file id
(i.e the hash) in the Message-ID without having access to any other
segments of the file.  I think my hash does that.  Why use something like
SHA1 which can't do it if we have something that can?

BTW, this hash-of-hash system is easy to do on a single pass.  You just
need to keep N hash states where N is the depth of the tree you are working
with instead of one hash state. (and in my example the tree depth was only
6 for a file larger that most posted to Usenet).  The performance of this
hash should be almost identical to the performance of the hash it's built
on, so that shouldn't be an issue either.

The harder part of the system is creating the hash data that must be
included with every post.  But even that is computationally as simple as
calculating the hash in the first place, it just requires more memory to
save all the hash values from the top of the hash tree (but still only
something only in the 50K range even for huge files).

And this of course, like other hash code, is something you would right once
and publish in a reference standard for everyone to copy.

-- 
Curt Welch                                            http://CurtWelch.Com/
curt@kcwc.com                          Webmaster for http://NewsReader.Com/
Technical Details
Message-ID: <20021006165224.658$WE@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!newsfeed.berkeley.edu!news-hog.berkeley.edu!ucberkeley!news.cis.ohio-state.edu!news.maxwell.syr.edu!feed2.newsreader.com!newsreader.com!news2.newsreader.com!ellis.newsreader.com!not-for-mail
References: <58068.n92202@archiver.winews.net> <20020924011222.716$tx@newsreader.com> <3147e.o92204@archiver.winews.net> <20020924234811.264$g2@newsreader.com> <15518.p9220c@archiver.winews.net> <20020926003453.621$EG@newsreader.com> <38427.r92204@archiver.winews.net> <1rofajcuom.fsf@vingodur.ifi.uio.no> <20020928124251.046$Da@newsreader.com> <39167.u92203@archiver.winews.net> <slrnapgpct.qiq.andrew+nonews@trinity.supernews.net> <3113g.u92200@archiver.winews.net> <slrnaph54l.qiq.andrew+nonews@trinity.supernews.net> <43236.1a2205@archiver.winews.net> <20021001093905.267$sh@newsreader.com> <30416.2a2200@archiver.winews.net> <20021002113832.345$xh@newsreader.com> <anf7os$me7$1@bob.news.rcn.net> <20021002223806.641$Bd@newsreader.com> <8Y9ochx3cDC@3247.org> <1rbs6behtt.fsf@atta.ifi.uio.no> <20021003220607.229$1n@newsreader.com> <1r8z1e9pv2.fsf@vingodur.ifi.uio.no>

Show Full Headers
Complete Article Headers
Message-ID: <20021006165224.658$WE@newsreader.com>
Subject: Re: [FNTP] 'in-completeness'
Date: Sun, 06 Oct 2002 20:52:24 +0000
From: curt@kcwc.com (Curt Welch)
References: <58068.n92202@archiver.winews.net> <20020924011222.716$tx@newsreader.com> <3147e.o92204@archiver.winews.net> <20020924234811.264$g2@newsreader.com> <15518.p9220c@archiver.winews.net> <20020926003453.621$EG@newsreader.com> <38427.r92204@archiver.winews.net> <1rofajcuom.fsf@vingodur.ifi.uio.no> <20020928124251.046$Da@newsreader.com> <39167.u92203@archiver.winews.net> <slrnapgpct.qiq.andrew+nonews@trinity.supernews.net> <3113g.u92200@archiver.winews.net> <slrnaph54l.qiq.andrew+nonews@trinity.supernews.net> <43236.1a2205@archiver.winews.net> <20021001093905.267$sh@newsreader.com> <30416.2a2200@archiver.winews.net> <20021002113832.345$xh@newsreader.com> <anf7os$me7$1@bob.news.rcn.net> <20021002223806.641$Bd@newsreader.com> <8Y9ochx3cDC@3247.org> <1rbs6behtt.fsf@atta.ifi.uio.no> <20021003220607.229$1n@newsreader.com> <1r8z1e9pv2.fsf@vingodur.ifi.uio.no>
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!newsfeed.berkeley.edu!news-hog.berkeley.edu!ucberkeley!news.cis.ohio-state.edu!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 Io@Z+s=DCzhKCwYR0U32cPtK3=vV.sygAE@syeGCto4vo.XO
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: 273