🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: news.software.nntp
Article #90035

Re: No colon-space in header field check in INN

#90035
From: Russ Allbery
Date: Wed, 01 Feb 2023 16:00
41 lines
2703 bytes
Jesse Rehmer <jesse.rehmer@blueworldhosting.com> writes:

> It is probably against a RFC to accept these messages, but I'm not
> concerned about the User-Agent header. I went looking for a way to relax
> the check, but is strict for all headers in innd/art.c:

>     /* Find first colon */
>     if ((colon = memchr(header, ':', size)) == NULL || !ISWHITE(colon[1])) {
>         if ((p = memchr(header, '\r', size)) != NULL)
>             *p = '\0';
>         snprintf(cp->Error, sizeof(cp->Error),
>                  "%d No colon-space in \"%s\" header field",
>                  ihave ? NNTP_FAIL_IHAVE_REJECT : NNTP_FAIL_TAKETHIS_REJECT,
>                  MaxLength(header, header));
>         if (p != NULL)
>             *p = '\r';
>         return;
>     }

> I know there are potential implications for accepting messages with
> empty headers, but do we need to treat all headers so strictly?

We do need to be pretty strict, since otherwise you can get into really
nasty situations with ambiguous parses where two servers may disagree
about something fundamental like the message ID of the article.

I think if someone wanted to send a patch that added the ability to accept
articles with headers that (a) weren't part of the protocol (so not
Message-ID, Path, etc.), (b) specifically ended in a colon and a newline
and no other variation, and (c) did not have a continuation, and it was
configurable with the syntaxchecks setting and was off by default, that
would be worth considering.  I wouldn't want to relax the checks any
farther than that.  (It may be a bit difficult to wedge that into innd's
code, though, since the above error happens at a fairly low level of the
parse.)

-- 
Russ Allbery (eagle@eyrie.org)             <https://www.eyrie.org/~eagle/>

          Please post questions rather than mailing me directly.
     <https://www.eyrie.org/~eagle/faqs/questions.html> explains why.
Technical Details
Message-ID: <87bkmdnzo2.fsf@hope.eyrie.org>
Path: mbox-mo1.pugleaf.net!archive.usenet.blueworldhosting.com!illumos!news.pugleaf.net!.TX!archive.pugleaf.net!archive.newsdeef.eu!apf1.newsdeef.eu!not-for-mail
References: <trd09m$1369$1@nnrp.usenet.blueworldhosting.com>

Show Full Headers
Complete Article Headers
Message-ID: <87bkmdnzo2.fsf@hope.eyrie.org>
Subject: Re: No colon-space in header field check in INN
Date: Wed, 01 Feb 2023 08:00:45 -0800
From: Russ Allbery <eagle@eyrie.org>
References: <trd09m$1369$1@nnrp.usenet.blueworldhosting.com>
Path: mbox-mo1.pugleaf.net!archive.usenet.blueworldhosting.com!illumos!news.pugleaf.net!.TX!archive.pugleaf.net!archive.newsdeef.eu!apf1.newsdeef.eu!not-for-mail
Newsgroups: news.software.nntp
Organization: The Eyrie
Mime-Version: 1.0
Content-Type: text/plain
Injection-Info: hope.eyrie.org; logging-data="20486"; mail-complaints-to="news@eyrie.org"
User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/28.2 (gnu/linux)
Cancel-Lock: sha1:PjOg6UvaKAFI0CzvD1cXeFFXa1c=