public inbox for cygwin@cygwin.com
 help / color / mirror / Atom feed
From: Andrew McGill <list2009@lunch.za.net>
To: cygwin@cygwin.com
Subject: Write access for BUILTIN\USERS - cygwin privilege escalation vulnerability for Windows 2008 default installation
Date: Mon, 21 Sep 2009 08:41:00 -0000	[thread overview]
Message-ID: <200909211041.17032.list2009@lunch.za.net> (raw)

Hi,

I ran setup.ext to install cygwin in c:\cygwin on a (fairly) fresh 
installation of Windows Server 2008.  On this server, the permissions of C:\ 
were set to allow new files to be created in subdirectories by BUILTIN\Users.  

The cygwin folder inherited from the default permissions on C:\ the following 
ACL:

[C:\cygwin] icacls c:\cygwin
c:\cygwin NT AUTHORITY\SYSTEM:(I)(OI)(CI)(F)
          BUILTIN\Administrators:(I)(OI)(CI)(F)
          BUILTIN\Users:(I)(OI)(CI)(RX)
          BUILTIN\Users:(I)(CI)(AD)   <<<<<<< AAAAAAAARGH!
          BUILTIN\Users:(I)(CI)(WD)   <<<<<<< AAAAAAAARGH!
          ZEROTOOL\Administrator:(I)(F)
          CREATOR OWNER:(I)(OI)(CI)(IO)(F)

This allows ANY member of BUILTIN/Users, including nt authority\network 
service to create files.  I can pwn the box from IIS by writing content to 
these files -- and not much creativity is needed to think of many more:

	c:/cygwin/home/Administrator/.ssh/authorized_keys
	c:/cygwin/home/Administrator/.bashrc
	c:/cygwin/home/Administrator/.bash_logout
	c:/cygwin/home/Administrator/.bash_profile
	c:/cygwin/home/Administrator/.vimrc

This permission was default on the system - it seems to be there on Windows 
2003 as well, and maybe before that.  Folders like c:\windows and c:\inetpub 
have explicit permissions for builtin/users.  Perhaps this is some kind of 
secret best practice that cygwin is missing out on?  If not, it's merely a 
series of unfortunate events that adds up to a privilege escalation 
vulnerability, and you really should understand windows ACL's before running 
cygwin.

Feature request: The cygwin installer should set permissions on c:\cygwin to 
be the same as %windir%, and not trust the operating system to do the "right 
thing".  

--
Problem reports:       http://cygwin.com/problems.html
FAQ:                   http://cygwin.com/faq/
Documentation:         http://cygwin.com/docs.html
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple

             reply	other threads:[~2009-09-21  8:41 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-09-21  8:41 Andrew McGill [this message]
2009-09-21 16:05 ` Dave Korn
2009-09-21 18:39   ` Christopher Faylor
2009-09-23  6:26   ` Andrew McGill
2009-10-22  6:53     ` Andrew McGill

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=200909211041.17032.list2009@lunch.za.net \
    --to=list2009@lunch.za.net \
    --cc=cygwin@cygwin.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).