You are absolutely right. Apache's sidtype was set to NONE.
C:\Windows\system32>sc qsidtype Apache2.2
[SC] QueryServiceConfig2 SUCCESS
SERVICE_NAME: Apache2.2
SERVICE_SID_TYPE: NONE
So I tried setting to UNRESTRICTED and Apache won't start.
Faulting application httpd.exe, version 2.2.6.0, time stamp 0x46deb625,
faulting module libapr-1.dll, version 1.2.11.0, time stamp 0x46deb5c1,
exception code 0xc0000005, fault offset 0x000038dc, process id 0x1664,
application start time 0x01c8546211dbeb42.
Fault bucket 521614349, type 1
Event Name: APPCRASH
Response: None
Cab Id: 0
Problem signature:
P1: httpd.exe
P2: 2.2.6.0
P3: 46deb625
P4: libapr-1.dll
P5: 1.2.11.0
P6: 46deb5c1
P7: c0000005
P8: 000038dc
P9:
P10:
I haven't set any permission to the Apache service user in Apache's
installation files. So I guess Apache developers didn't have Windows in mind
when they developed it.
Then I'll create a user for it and follow your
steps.
Those were awesome posts about new Windows Vista security! I've read them
all. I really liked the new security measures on the new OS.
Thank you
Microsoft for that!
Thanks for the comment about the book.
Today I would of course use
Process Monitor to do this, but the procedure remains the same.
Creating an account that is hidden from the logon screen is really simple.
Just run this command from an elevated command prompt:
reg add "HKLM\Software\Microsoft\Windows
NT\CurrentVersion\WinLogon\SpecialAccounts\UserList" /v foo /t REG_DWORD /d 0
You're welcome.
I didn't know Process Monitor showed access to registry
as well. I will give it a try. And thank you for the tip on how to hide the
user account. That would be extremely useful.
I'm not sure what you mean by "IIS service respectes the IIS_IUSRS group
permissions"? The impersonation identity used by IIS to access web content
stored in the file system is a member of IIS_IUSRS. Is that what you mean? It
is not that IIS respects any permissions. It is that it spawns a process
running as a low-privileged user and then accesses data as that user. That is
all documented in the books too.
I am sorry, I wasn't so clear. I 've read about IIS in your book too (and on
iis.net website). IIS uses the Application Pools to separate worker process
and their "users". So these users are added to the IIS_IUSRS group when the
worker process is created. But I still need to study a little deeper how all
that works. You see, when I used IIS as my webserver, my web applications
(written in PHP) could access my entire computer, even folders that didn't
have explicit permissions set to the IIS_IUSRS group.
My web application is used to password protect files so I can download them
anywhere. These files are not located in the web folder (where the .php and
..html files are), so they can't be directly accessed with a URL. These files
are in a completely separated folder in my computer where PHP reads them and
handles the download. Now, I fear there could be a security breach on the php
that would allow someone to modify my files (since PHP can handle any normal
file operation and even run system commands!). Specially because it wasn't
entirely written by me (think like MediaWiki and how it deals with file
download). So I am desperately trying to block any write access to my files.
I did several tests with both IIS and Apache. My problem with IIS was that
even when I set IIS_IUSRS deny full control on my files, the PHP could still
read and modify them (I used a special script of mine for testing). Could
that be due to the CGI binary and its permission? And now it is the same with
Apache and NT SERVICE\Apache user because of its sid type. The only test it
worked was when I created a new user for Apache and I've got access denied
for both reading and writing when setting deny full control for the Apache
user. So I guess this is the way to go.
As I said before, I am still waiting for Vista SP1 to try IIS and FastCGI
again (I've had issues with it). My testing with IIS was before I read your
book so I think I still have some work to do to make it secure.
I confess
I haven't read your book completely yet, I'll give it a good read when put my
testing into practice.
Thank you very much for your help.
Sincerely,
Andre