William Ahern <
wil...@wilbur.25thandClement.com> writes:
> Rainer Weikusat <
rwei...@mssgmbh.com> wrote:
> <snip>
>> That someone else already wrote the code is another tangential fact and -
>> strange how it always seems to come back to that
>
> I mention it not because someone else wrote it, because that someone was the
> vendor, and what the vendor provided is being hammered on by every user and
> is a focal point for code inspection. As opposed to ad hoc privsep
> implementations.
All of which together means exactly nothing: The code itself is
relevant for determining the technical properties of some piece of
software, not who wrote or who used or how many people allegedly used
it or to which degree one group of people writing code is admired
while other groups are despised.
>> it is equally true for PAM.
>
> It is equally true for PAM, but not I'm criticing the code quality of PAM,
> but the design decision to use loadable modules, and in particular, not to
> interpose a process boundary between the authenticating agent and the
> authentication mechanism. And by authenticating agent, I mean crap like a
> PHP web application.
But that's not a design descision made by the people who designed PAM:
It's the way UNIX(*) authentication has always worked until some guy,
after a streak of security errors in his code, thought that he really
needed this 'process barrier' to be at least remotely safe from crap
he and his buddies wrote together themselves in earlier times. I'm not
going to question the wisdom of this descision, at least not
seriously (OpenSSH became a lot more 'quiet' in his respect shortly
afterwards), but I question the universality of this experience: Just
because the people who nowadays champion BSD auth have a history of
creating 'security issues' and generally consider it 'hard' to avoid
them doesn't mean this is true for everyone (side note: The so-called
'Dunning-Kruger effect' might make for an interesting read in this
context :->. The more someone is convinced to be the measure of all
things created, the less likely is it that he actually is).
>> Provided that any specific implementation of 'BSD Authentication
>> framework' + 'OS kernel supposed to enforce the isolation' is free of
>> errors with security impact, applications can use it 'securely' but again,
>> the exact same thing is true for PAM.
>
> Wrong. The difference is that PAM is loaded into the process.
If it were free of errors, as I wrote above, this wouldn't matter. It
only matters because you have chosen to assume that 'the process' is a
lot more likely to contain security-relevant errors than 'the code
written by the vendor'. So far, I haven't used a non-trivial piece of
software written by a third party were I didn't have to fix some bugs
already contained in it and I've certainly never written something
non-trivial which didn't have bugs: All software contains coding
errors and is partially built on design errors. The reason for the
latter is usually that one's understanding of a specific problem is
greatly improved by writing code supposed to deal with it: Afterwards,
you'll know what you should have been doing instead.
> I think it's fair to argue that an authenticating agent, like a PHP
> web application or IMAP server, has far more potentially exploitable
> surface area than PAM + kernel (or BSD Auth + kernel) alone.
The kernel is larger than most programs. And 'the exploitable surface
area' of any piece of code is usually rather small: Only the parts
where untrusted data enters the system. Again, the kernel is much
worse in this respect than a typical application because it is
overwhelmingly concerned with providing services to untrusted
applications and consequently, it has a real lof of these entry
points.
[...]
>> Specifically, privilege separation is supposed to mitigate yet unknown
>> coding errors in the applications using the mechanism and from the
>> application standpoint, a facility protecting the application from yet
>> unknown bugs in the authentication code and the kernel would seem just as
>> necessary. "We must do something. This is something. Therefore, we must do
>> it." didn't become any better as rational justification of anything in the
>> meantime. There's also the issue that some programs do nothing but perform
>> privileged operations and consequently, this scheme doesn't even work as
>> 'sysadmin peace of mind' device for them. So what does 'BSD
>> Authentication' offer for such an application, if it actually offers
>> anything, that PAM doesn't offer?
>
> Here's how I understand your argument:
>
> a) Privsep merely protects a broken authenticating program from itself. If
> the authenticating program is broken, then it doesn't matter whether it has
> root privileges because
>
> b) the attacker will just use a kernel exploit, which usually doesn't
> require root privileges.
>
> c) All kernels are exploitable.
It is actually much simpler: I don't think facilities supposed to
mitigate 'unknown errors' are a good idea because 'an unknown problem'
can be anything and be located everywhere, including the code
implementing the facility itself: It may help. Or it may make matters
even worse. Or have no practically relevant effects at all (Software
mechanisms intended to avoid buffer overruns or mitigate the effects
of buffer overruns don't do anything for SQL injection attacks, the
more modern consequence of broken or absent validation of untrusted
input data). And nobody knows which of it will be until 'something has
happened'[*]. Because of this, I'm much more interested in useful
features provided by 'other software' than in 'safeguards which will
hopefully help in case of nebulous future dangers'.
[*] Practical example from a completely different area: I live in a
basement flat with a small garden at the backside, separated from the
yard/ parking space behind it by a wooden door which is about my
height (1.7m). At the other side of this yard is a public footpath
commonly used by people walking home in the early morning hours after
getting drunk and drugged while partying in town. Since I like fresh
air, I usually sleep with the garden-side door of the flat
open. Strange people have entered my place by scaling the outer garden
door in the night at least twice. When this happened for the second
time, my sole winter jacket, a company-provided mobile and my piggy
bank were stolen. This naturally made me put some thought into
measures for avoiding this in future which would nevertheless enable
me to keep the garden door open. Running 2 metres of NATO barbed-wire
across the door and fence (of the same height) at the other side of
the garden would have worked nicely, but - as could be guessed - the
lettings agency people representing the flat owner found this idea
rather queer and I'm not allowed to do that (one of the arguments
brought forth against it was actually that someone who tries to enter
my flat in this way might hurt himself when coming into contact with
the barbed wire and 'might sue someone' because of this :->). Because
of his, I then did the next best thing which came to my mind: Secure
the door with rope in a way I learnt in the Navy for 'fixing' the end
of a rope such that it won't give way under heavy pressure (eg, when
mooring(term?) a ship). This will help little against someone carrying
a moderately large knife or a pair of scissors but nobody will be
able to force the open door by pulling violently, at least not without
breaking the door itself completely. I decided that guarding
against the 'common' case --- random drunk idiot trying to impress an
equally drunk women by performing 'a daring feat' which doesn't really
cost him much effort unprepared --- ought to be sufficient. So far,
this mechansim as survived at least one attempt to get past it, and
even one conducted in a more intelligent way than I had
imagined. 'Some unkown future danger' might render it completely
ineffective but until then, I prefer to sleep instead of worrying
about 'stuff which could also happen'.