Article View: news.software.nntp
Article #61781Re: There's more (was Re: Someone is sending head-only articles out to Usenet????
From: Curt Welch
Date: Mon, 04 Nov 2002 05:56
Date: Mon, 04 Nov 2002 05:56
140 lines
8299 bytes
8299 bytes
andrew@supernews.com wrote: > In article <20021103152721.486$ih@newsreader.com>, Curt Welch wrote: > > This 3.3 version of Diablo is seriously broken when it comes to it's > > ability to correctly parse an NNTP stream. It thinks NL terminates > > lines on NNTP, so if you send it X LF DOT DOT LF it will strip that > > first DOT off. That's just wrong. > > Since that's not a valid NNTP stream, then there is no "correct" way to > parse it. We have talked about how binary files move over NNTP for over 5 years now. We have been working to make usenet 8 bit clean for years, and this includs dealing correctly with CR and LF. No matter how vague the old RFCs may be, or how broken old code may be, there's only one day to correctly parse NNTP data streams. DOT CR LF is a "null file" stream, <8bit>* CR LF DOT CR LF is a non-null stream. Within the <8bit>* data, all occurences of CR LF DOT is turned into CR LF DOT DOT on transmission (plus the special handling requied for the first line) and translated back to CR LF DOT when received. The _only_ invalid NNTP data stream is one which has CR LF DOT <not-dot> (which it seems might have been sent by some server in this case but I still haven't been able to figure out what did that yet - maybe I'm just dense). The data in this problem, CR LF DOT LF CR LF is the data in the article, not the data sent over NNTP. And that's valid. When I fetch the article from easynews, --- of fuck, I see it now. I was dense... When I read the article from news.easynews.com, it sends the data back as: CR LF DOT LF CR LF without escaping the DOT as it should!!! So, the broken newsreader that posted the article probably both failed to dot escape the article correctly, and failed to terminate the line with a CR LF instead of just an LF. And if easynews transmits the article like that (which it no doubt does), all the various wire-format servers will simply reproduce the "dot-error". But then, the frist old-style diablo server which receives that will truncate the article there. I know my server would not detect that problem. It's a pure wire-format server and never checks to see if all leading dots are correctly followed by a second dot. > Treating a bare LF as a line delimiter is just as good a way of > handling the incorrectness as any other (_especially_ on an initial post, > since clients screw that one up on a regular basis). no, no, no. A bare LF should be treated as valid data. NNTP servers should not be line-orented when dealing with the data stream anyway. Once you have correctly parsed the data stream, and have an article, then it's fair to debate what should be done with a bare LF. But the low-level code that parses the NNTP stream should be 8 bit clean and have no problem passing pure binary data that conatins lone LFs, lone CRs, and NULLs, as well as all the other possible 8 bit characters. Dot stuffing must _only_ be done for CR LF DOT, not for just LF DOT, or CR DOT. But that's not even the real problem here. The real problem, as I think I now understand it, is that most (maybe all?) wire-format servers (which includes I suspect all the Highwind servers, and Diablo, and my server), do not check for lines with a single leading dot and reject the article as invalid, they just accept it and pass it on as it was received. And when that article hits an old-style diablo server, we have a real security problem. Think about what happens when the orginal article looks like this: CR LF DOT LF T A K E T H I S <xx@yyy> CR LF P a t h : ... ..... DOT CR LF Have fun tracing where that stealth article came from. I'm going to go fix my server now.... > It's malformed BECAUSE THE DOT HAS NOT BEEN ESCAPED. Ok, I'm with you now. I assume it had been. I missed that all along in this discussion. And that's why I didn't see the dot at first and didn't get what your problem was with the "dot" in the article. The tool I used to download the article removed the leading dot so I never saw it. It was only later when I used a raw-download option that I saw the dot. > As for the bare-LF issue, RFC 977 is not explicit on the subject, so we > turn to the reference implementation, and find that it always treats LF > as a line terminator, with or without the CR. The draft replacement for > 977 explicitly forbids either CR or LF appearing alone. So where you get > this insane idea of yours about bare LFs being valid, I have no idea; you > may think that things would work better that way, but the actual real > implementations and documentation disagrees. It's just a matter of me being right and the rest of the world being wrong. :) But, all wire-format servers I know allow bare LF and bare CR and have no problems with it. It's clearly the right way to do it because it allows pure binary to be moved over usenet and there's really no reason not to do it that way. > you're missing the point that the dot-doubling is _not_ done when the > article was stored on disk in wire format (because the sending server is > presumed to have done it). hermes.visi.com had stored on its spool a > wireformat article containing CR LF DOT LF CR LF, which it had received > exactly like that from easynews (and recent Diablo in wireformat mode > does not recognise DOT LF as end-of-article). If it tries to send that > out to another Diablo running in non-wireformat mode, or to a reference > NNTP, then the article _will_ be truncated at that point (because it will > be sent exactly as it was stored). Yeah, I got it now. I just didn't see it because I _assumed_ dot escaping was being done correctly. > the whole point of "wire format" is that you store exactly what you > receive, and exactly what you're going to send out again, without any > changes to either the line endings or the dot-escapes. So it stores the > double dot in the spool. But, because of this security issue, we need to fix all the wire-format servers _now_. Any article which isn't correctly dot escaped needs to be rejected (or at least any article with a line begining with DOT LF). There might be too many articles without correct dot escaping floating around usenet already that filtering all of them might be an issue. But they should be rejected on POST, and at elast anything with DOT LF beginning a line should be dropped by all transit servers. Time to go code.... -- Curt Welch http://CurtWelch.Com/ curt@kcwc.com Webmaster for http://NewsReader.Com/
Technical Details
Message-ID:
<20021104005657.337$yO@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!headwall.stanford.edu!newsfeed.news2me.com!feed1.newsreader.com!newsreader.com!news2.newsreader.com!ellis.newsreader.com!not-for-mailReferences:
<20021102220425.532$Ov@newsreader.com> <us954gpfjs492a@corp.supernews.com> <20021102222437.838$Mm@newsreader.com> <slrnas967a.8p9.andrew+nonews@trinity.supernews.net> <20021102225642.902$eT@newsreader.com> <slrnas98f6.8p9.andrew+nonews@trinity.supernews.net> <20021102232508.136$0f@newsreader.com> <aq2alp$61b2a$1@ID-80930.news.dfncis.de> <20021103001847.653$nw@newsreader.com> <slrnas9drt.8p9.andrew+nonews@trinity.supernews.net> <20021103005855.983$iI@newsreader.com> <slrnas9fja.8p9.andrew+nonews@trinity.supernews.net> <20021103152721.486$ih@newsreader.com> <slrnasbhrd.8p9.andrew+nonews@trinity.supernews.net>Show Full Headers
Complete Article Headers
Message-ID: <20021104005657.337$yO@newsreader.com>
Subject: Re: There's more (was Re: Someone is sending head-only articles out to Usenet????
Date: Mon, 04 Nov 2002 05:56:57 +0000
From: curt@kcwc.com (Curt Welch)
References: <20021102220425.532$Ov@newsreader.com> <us954gpfjs492a@corp.supernews.com> <20021102222437.838$Mm@newsreader.com> <slrnas967a.8p9.andrew+nonews@trinity.supernews.net> <20021102225642.902$eT@newsreader.com> <slrnas98f6.8p9.andrew+nonews@trinity.supernews.net> <20021102232508.136$0f@newsreader.com> <aq2alp$61b2a$1@ID-80930.news.dfncis.de> <20021103001847.653$nw@newsreader.com> <slrnas9drt.8p9.andrew+nonews@trinity.supernews.net> <20021103005855.983$iI@newsreader.com> <slrnas9fja.8p9.andrew+nonews@trinity.supernews.net> <20021103152721.486$ih@newsreader.com> <slrnasbhrd.8p9.andrew+nonews@trinity.supernews.net>
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!headwall.stanford.edu!newsfeed.news2me.com!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 0HBbQ7-JZ7kwpn+=1spJiJ/gC5Lz1x_Ny-mZY4BCQWG30fK-
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: 139