Thread View: news.software.nntp
9 messages
9 total messages
Started by Andrew Gierth
Mon, 03 May 1999 00:00
some INN 2.2-stable issues
Author: Andrew Gierth
Date: Mon, 03 May 1999 00:00
Date: Mon, 03 May 1999 00:00
49 lines
2802 bytes
2802 bytes
I've just been setting up a small INN transit feeder (running a
2.2-stable snapshot in a CNFS transit-only configuration, carrying
just the big-8 and uk.*, offers of additional peering welcome), and came
across the following issues.
1. No path verification
INN seems to be well behind the times on this; Diablo and Cyclone
both can do path verification, and I believe that NNTPrelay can
too. Even INN's old 'add the IP address if running in -a mode'
behaviour seems to have fallen by the wayside.
The antics of people like Empire2, and the ludicrous number of
unqualified and unregistered path entries in use, have demonstrated
quite clearly that you can *not*, in general, trust your newspeers
to give you reliable path info unless you pick them very carefully.
Unless this is already being addressed in 2.3, I plan to fix this myself.
2. innconfval doesn't honour INNCONF environment variable
Call me insane if you like, but one thing I'm trying to do is to run
two or more innds on one box using the same binaries, by using
different inn.conf files. innconfval's insistence on using the
compiled-in path unless actually overridden on the command line is a
pain.
Sticking:
if (!(innconffile = getenv("INNCONF")))
innconffile = _PATH_CONFIG;
at the beginning of main() in innconfval.c seems to fix that.
Of course, another program that doesn't honour INNCONF is inndstart,
which deletes it from the environment. I'm not sure if this would be a
security hole or not (inndstart should only be executable by the news
user anyway), but for now I've worked around the problem by running
innd on a nonprivileged port and not using inndstart.
3. Not a transit issue, but one associated with some new posting code
I've been working on: I want to be able to specify nnrpdposthost as a
path to a Unix-domain socket. I've done this by moving the unix-domain
functionality from NNTPlocalopen into NNTPconnect.
--
Andrew.
Re: some INN 2.2-stable issues
Author: Forrest J. Cavalier III
Date: Wed, 05 May 1999 00:00
Date: Wed, 05 May 1999 00:00
24 lines
1540 bytes
1540 bytes
In article <87r9oym8wx.fsf@erlenstar.demon.co.uk>, andrew@erlenstar.demon.co.uk wrote... [snip] > > Of course, another program that doesn't honour INNCONF is inndstart, > which deletes it from the environment. I'm not sure if this would be a > security hole or not (inndstart should only be executable by the news > user anyway), but for now I've worked around the problem by running > innd on a nonprivileged port and not using inndstart. The security hole is that INNCONF sets what programs are executed. inndstart must be SUID root, and unless the code changed, inndstart then sets the UID based on the ownership of a directory. This means that unless INNCONF is secure, you can get user news privs easily, (and that might be enough to get root as well.) This was discussed on inn-workers@isc.org a while back, and that would be an appropriate forum to discuss the items you raised. [snip]
Re: some INN 2.2-stable issues
Author: bill davidsen
Date: Wed, 05 May 1999 00:00
Date: Wed, 05 May 1999 00:00
46 lines
2930 bytes
2930 bytes
In article <7gprlk$21b$1@news1.epix.net>, Forrest J. Cavalier III <mibsoft@mibsoftware.com> wrote: | In article <87r9oym8wx.fsf@erlenstar.demon.co.uk>, andrew@erlenstar.demon.co.uk wrote... | [snip] | > | > Of course, another program that doesn't honour INNCONF is inndstart, | > which deletes it from the environment. I'm not sure if this would be a | > security hole or not (inndstart should only be executable by the news | > user anyway), but for now I've worked around the problem by running | > innd on a nonprivileged port and not using inndstart. | | The security hole is that INNCONF sets what programs are executed. | inndstart must be SUID root, and unless the code changed, inndstart | then sets the UID based on the ownership of a directory. But as he said, inndstart should not be runnable by everyone, and this is just a tip of the problems if it is. | This means that unless INNCONF is secure, you can get user news | privs easily, (and that might be enough to get root as well.) | | This was discussed on inn-workers@isc.org a while back, and that | would be an appropriate forum to discuss the items you raised. Given the many policy issues discussed here, I don't think this is appropriate. Implementation might be better discussed on the list, but I think this is a valid issue here. Granted I don't see any great use for this, the hack is simple if you want to allow it, the security is based on having only news able to run the inndstart, and the usefulness of multiple innd versions on a single machine seems pretty low. The place this is useful is for multiple versions of nnrpd, and since nnrpd in daemon mode lacks a -I flag to set the interface (why is that?) this is not totally easy either. -- bill davidsen <davidsen@tmr.com> CTO, TMR Associates, Inc One common problem is mistyping an email address and creating another valid, though unintended, recipient. Always check the recipient's address carefully when sending personal information, such as credit card numbers, death threats or offers of sexual services.
Re: some INN 2.2-stable issues
Author: Andrew Gierth
Date: Thu, 06 May 1999 00:00
Date: Thu, 06 May 1999 00:00
21 lines
1598 bytes
1598 bytes
>>>>> "bill" == bill davidsen <davidsen@tmr.com> writes: bill> But as he said, inndstart should not be runnable by everyone, bill> and this is just a tip of the problems if it is. Incidentally, startinnfeed does *not* clobber INNCONF. > | This was discussed on inn-workers@isc.org a while back, and that > | would be an appropriate forum to discuss the items you raised. bill> Given the many policy issues discussed here, I don't think bill> this is appropriate. Implementation might be better discussed bill> on the list, but I think this is a valid issue here. Working on INN is only an occasional thing for me; I'm not on inn-workers. -- Andrew.
Path verification for INN (was: Re: some INN 2.2-stable issues)
Author: Andrew Gierth
Date: Sat, 08 May 1999 00:00
Date: Sat, 08 May 1999 00:00
42 lines
2616 bytes
2616 bytes
>>>>> "AG" == Andrew Gierth <andrew@erlenstar.demon.co.uk> writes: AG> Unless this is already being addressed in 2.3, I plan to fix AG> this myself. Well, nobody spoke up and said "this is in 2.3", so I fixed it myself. Here is the spec: the patches against 2.2-stable (as of about a week ago) will follow shortly (after I update the docs). The code is currently running on news-feed.riddles.org.uk and seems to be behaving itself now (a bunch of spurious .MISMATCHes got leaked during testing). I've implemented it by adding a new parameter to incoming.conf, "pathmatch:", which takes a comma-delimited list of wildmat patterns. Incoming articles from a peer have their first path entry compared against this list, and an nnn.nnn.nnn.nnn.MISMATCH entry is added if no match is found. The first mismatch arriving over any given connection is logged to syslog; the count of the number of mismatches also appears on the status page. The presence of a MISMATCH entry suppresses the "don't add the same path twice" logic for obvious reasons. If no pathmatch parameter is supplied for a feed, the feed name is used (as a literal match not a wildmat). To disable path checking you have to use an explicit "*" pattern (can be done at group or default level). Feeds over unix-domain sockets are exempt from checks so that rnews still works properly. If no unix-domain sockets, then the internally-generated localhost feed entry gets a "*" pathmatch parameter. If you run in promiscuous transfer mode (-a) then incoming feeds not listed in incoming.conf get their IP addresses inserted in the path (but without .MISMATCH or anything in syslog). Entries in incoming.conf are not affected. -- Andrew.
Re: some INN 2.2-stable issues
Author: Russ Allbery
Date: Sun, 09 May 1999 00:00
Date: Sun, 09 May 1999 00:00
17 lines
1413 bytes
1413 bytes
Andrew Gierth <andrew@erlenstar.demon.co.uk> writes: > Here's the kicker, though: inndstart *DOES ITSELF* respect the INNCONF > environment variable! It simply does not pass it on to innd, but as the > code stands (at least in the 2.2-stable snapshot I'm working with) the > path to the innd binary *is* obtained from the file specified in > INNCONF. This is obviously inconsistent and therefore I'd call it a bug. Which way to fix the bug is, however, a harder question. I think hard-coding both paths makes me more comfortable; I'd rather obtain the functionality that you're looking for via more direct support in innd itself. -- Russ Allbery (rra@stanford.edu) <URL:http://www.eyrie.org/~eagle/>
Re: some INN 2.2-stable issues
Author: Andrew Gierth
Date: Mon, 10 May 1999 00:00
Date: Mon, 10 May 1999 00:00
51 lines
2905 bytes
2905 bytes
>>>>> "Forrest" == Forrest J Cavalier <mibsoft@mibsoftware.com> writes: >> But as he said, inndstart should not be runnable by everyone, and >> this is just a tip of the problems if it is. Forrest> Why allow a user news compromise to turn into a root Forrest> compromise? Why should this happen? Your analysis is flawed in several respects, notably the fact that inndstart restores the 'news' user before execing innd. Here's the kicker, though: inndstart *DOES ITSELF* respect the INNCONF environment variable! It simply does not pass it on to innd, but as the code stands (at least in the 2.2-stable snapshot I'm working with) the path to the innd binary *is* obtained from the file specified in INNCONF. This obviously already allows a member of the 'news' group to obtain a shell as the 'news' user, but it should only allow root exploits if inndstart is vulnerable to data overruns etc. from bogus data in inn.conf. Forrest> That's the remote exploit. Any local user who could set Forrest> INNCONF in the environment, then launch a SUID inndstart Forrest> would be able to do the same thing, so having inndstart Forrest> runnable only as user news is prudent, as was pointed out. inndstart is runnable only by root and the news group, in the standard configuration. If you have untrusted users in your news group I suspect you're vulnerable in other ways. Forrest> If something is SUID root, its behavior must be totally Forrest> defined by root owned information. It can't be getting Forrest> information from non-root environments, the command line, or Forrest> even inn.conf not owned by root. Then inndstart is already broken. Forrest> I think changing the code is even more appropriate in this Forrest> case, which is why I suggested inn-workers. I'm not on inn-workers, and I am reluctant to join since INN is something I only rarely have occasion to hack on. -- Andrew.
Re: some INN 2.2-stable issues
Author: Forrest J. Cavalier III
Date: Mon, 10 May 1999 00:00
Date: Mon, 10 May 1999 00:00
83 lines
4108 bytes
4108 bytes
In article <7gqe8k$aj0$1@newssvr01-int.news.prodigy.com>, davidsen@tmr.com wrote...
>
>In article <7gprlk$21b$1@news1.epix.net>,
>Forrest J. Cavalier III <mibsoft@mibsoftware.com> wrote:
>| In article <87r9oym8wx.fsf@erlenstar.demon.co.uk>, andrew@erlenstar.demon.co.uk wrote...
>| [snip]
>| >
>| > Of course, another program that doesn't honour INNCONF is inndstart,
>| > which deletes it from the environment. I'm not sure if this would be a
>| > security hole or not (inndstart should only be executable by the news
>| > user anyway), but for now I've worked around the problem by running
>| > innd on a nonprivileged port and not using inndstart.
>|
>| The security hole is that INNCONF sets what programs are executed.
>| inndstart must be SUID root, and unless the code changed, inndstart
>| then sets the UID based on the ownership of a directory.
>
>But as he said, inndstart should not be runnable by everyone, and this
>is just a tip of the problems if it is.
Why allow a user news compromise to turn into a root compromise?
Holes discovered and fixed in 1997 were shell exploitable, There has
been a lot of code added and changed since then.
I don't particularly like the code/methods in inndstart, but
here's the scenario it allows....
1. Get shell as user news. (Hypothetical. I know of no exploits,
but I haven't audited the code either.)
2. Replace pathrun in inn.conf with some directory that is UID:GID
root:root.
When inndstart is run (it is SUID root), it will check pathrun,
and then leave the UID as 0, then run innd.
3. Replace innd (or anything that innd calls) with your favorite
trojan, or something that creates your favorite trojan.
4. Kill innd. Someone will notice the news server has stopped,
and restart it.
Bonus points if you include in step #3 something that switches
inn.conf back to the original, and erases the trail.
That's the remote exploit. Any local user who could set INNCONF in
the environment, then launch a SUID inndstart would be able to do
the same thing, so having inndstart runnable only as user news
is prudent, as was pointed out.
There are some systems where the persons with user news access
don't have root access. (This is very rare, but I've seen it.)
Having inndstart under a 0700 user news directory helps keep the
local users out. But in my opinion, it is terrible practice
to have any SUID root program, (or anything that root executes) under
any non-root owned directories. (It is unlikely that the init scripts
are checking the ownership of the files they execute, much less
likely that the ownership of the parent directories are being
checked.)
If something is SUID root, its behavior must be totally defined by
root owned information. It can't be getting information from
non-root environments, the command line, or even inn.conf not
owned by root.
There are lots of possible ways to secure INN startup according to your
personal preferences and definitions of security. But having
a fixed (compile time) path to inn.conf,
and inn.conf owned by root
help a lot to prevent using the existing code to get root from a user
news compromise.
I think changing the code is even more appropriate in this
case, which is why I suggested inn-workers. I wasn't trying
to hide anything. Obscurity is not security.
Forrest
Re: some INN 2.2-stable issues
Author: Forrest J. Cavalier III
Date: Mon, 10 May 1999 00:00
Date: Mon, 10 May 1999 00:00
78 lines
3191 bytes
3191 bytes
In article <87emkpmtws.fsf@erlenstar.demon.co.uk>, andrew@erlenstar.demon.co.uk wrote...
>
>>>>>> "Forrest" == Forrest J Cavalier <mibsoft@mibsoftware.com> writes:
>
> >> But as he said, inndstart should not be runnable by everyone, and
> >> this is just a tip of the problems if it is.
>
> Forrest> Why allow a user news compromise to turn into a root
> Forrest> compromise?
>
>Why should this happen?
>
>Your analysis is flawed in several respects, notably the fact that
>inndstart restores the 'news' user before execing innd.
Here's the relevant code from inndstart....
GID_T NewsGID;
UID_T NewsUID;
if (ReadInnConf() < 0) exit(1);
/* Make sure INND directory exists. */
if (stat(innconf->pathrun, &Sb) < 0 || !S_ISDIR(Sb.st_mode)) {
syslog(L_FATAL, "inndstart cant stat %s %m", innconf->pathrun);
exit(1);
}
NewsUID = Sb.st_uid;
NewsGID = Sb.st_gid;
. . .
. . .
(void)setuid(NewsUID);
>
>Here's the kicker, though: inndstart *DOES ITSELF* respect the INNCONF
>environment variable! It simply does not pass it on to innd, but as the
>code stands (at least in the 2.2-stable snapshot I'm working with) the
>path to the innd binary *is* obtained from the file specified in INNCONF.
>
I just looked. The ReadInnConf code is not what I remember it. Either
it changed, or my memory changed. inndstart should NOT be using the
INNCONF from the environment because of the code in inndstart and
the reasons I discussed.
Since ReadInnConf() allows the use of INNCONF environment variable,
user news could change pathrun to point to a root:root owned
directory and get root when inndstart was run.
>
>Then inndstart is already broken.
Seems so.
>
> Forrest> I think changing the code is even more appropriate in this
> Forrest> case, which is why I suggested inn-workers.
>
>I'm not on inn-workers, and I am reluctant to join since INN is
>something I only rarely have occasion to hack on.
It's just a mailing list, not a secret society. Join for two weeks
and then drop off. No reason to debate maillist vs Usenet discussion,
the maillist is more appropriate, but if I've explained the problem
so you can understand it, Andrew, then I think you will probably
just fix it and post the patch. I know you.
In that case, there is no reason for a discussion on inn-workers
after all.
Forrest
Thread Navigation
This is a paginated view of messages in the thread with full content displayed inline.
Messages are displayed in chronological order, with the original post highlighted in green.
Use pagination controls to navigate through all messages in large threads.
Back to All Threads