Resubmission of cygwin_daemon patch.
Sun Jun 23 10:40:00 GMT 2002
"Robert Collins" <email@example.com> wrote:
> From: "Conrad Scott" <Conrad.Scott@dsl.pipex.com>
> > About instance detection: you're right that something better could
> > done here. What I've ended up with is really a security patch:
> > possible for another process to create an instance of a named
> > wait for clients to connect and then impersonate them.
> It will always be possible to do that. Anyone can build the
> insert hostile code into their build. Code interception is a
> technique for reverse engineering, runtime patching and the like.
No: the problem is that someone without privileges on a machine could
create a server that listens on that named pipe and then wait for
other (more privileged) clients to connect to their "server", so that
they could impersonate them and then do what they want with the
privileges. There's code lying around on the internet to do exactly
this: it creates an instance of a named pipe and listens for
connections, then impersonates the client and launches a shell or
whatever else you want. If the cygserver itself were to connect to
such a fake server it would be giving it a chance to impersonate a
privileged process. Unclever. The usual case is if the attacker can
race the server to create the first pipe instance: since cygserver
will start as a system process of some kind, it ought to be up and
running before anything has a chance to run, so that's less likely as
> In terms of preventing someone hostilely opening the same
> have thought windows prevented multiple listening pipes with the
The idea is that multiple listening pipes *are* created, usually by
multiple threads in the same process (tho' this isn't quite what
cygserver does). You've got to control the rights on the pipe to avoid
other people also creating instances of the same pipe (as I understand
it: I've read the references but I've not tried it). Actually, since
cygserver will run as a privileged process, unprivileged processes may
not have enough privilege to create such duplicates anyhow, but there
is a particular privilege that cygserver ought to exclude on creating
the named pipe to deny other processes also creating pipe instances.
Again, there are exploits on the web for this. And a whole sequence of
MS security patches for, e.g., telnet, where they got it wrong. This
is why the new file flag got added, as before that it was impossible
for a server to protect itself against some of these attacks.
Cheers for the moment,
More information about the Cygwin-patches