all groups > iis security > january 2004 >
You're in the

iis security

group:

Opening cmd.exe to IUSR_<machine>


Opening cmd.exe to IUSR_<machine> Brad Watson
1/27/2004 10:38:01 PM
iis security:

Hi,

I'm developing a publicly accessible Perl CGI
script that needs to run shell commands such as:

my $suggestions = `echo misspelt | aspell.exe -a`;

Perl requires use of cmd.exe in order to execute
this command and on Windows 2003/IIS 6.0 this is
not possible under the default security permissions
since IUSR_<machine> doesn't have read/execute
permission on cmd.exe.

Since it would be a bad idea to grant
IUSR_<machine> read/execute access on cmd.exe
(please correct me if I'm wrong) I was thinking
of making a copy of cmd.exe elsewhere in the
file system and changing the permissions on
the copy. If the copy was renamed then it seems
unlikely that a malicious user could find it
in order to exploit it.

Any thoughts on this would be greatly appreciated.

Cheers,

Brad
Re: Opening cmd.exe to IUSR_<machine> David Wang [Msft]
1/28/2004 5:22:08 PM
The default ACLs on CMD.EXE (indeed, all of the command line EXE programs in
the System32 directory) make it inaccessible to any user identity logged on
by IIS except for administrators. This is intentional.

Your code does not actually need access to the command shell. It needs
access to the CreateProcess Win32 API call.

Simply renaming cmd.exe is not security.

--
//David
IIS
This posting is provided "AS IS" with no warranties, and confers no rights.
//
[quoted text, click to view]

Hi,

I'm developing a publicly accessible Perl CGI
script that needs to run shell commands such as:

my $suggestions = `echo misspelt | aspell.exe -a`;

Perl requires use of cmd.exe in order to execute
this command and on Windows 2003/IIS 6.0 this is
not possible under the default security permissions
since IUSR_<machine> doesn't have read/execute
permission on cmd.exe.

Since it would be a bad idea to grant
IUSR_<machine> read/execute access on cmd.exe
(please correct me if I'm wrong) I was thinking
of making a copy of cmd.exe elsewhere in the
file system and changing the permissions on
the copy. If the copy was renamed then it seems
unlikely that a malicious user could find it
in order to exploit it.

Any thoughts on this would be greatly appreciated.

Cheers,

Brad

Re: Opening cmd.exe to IUSR_<machine> Brad Watson
1/28/2004 7:33:53 PM

Thankyou very much for the input.

However, adding read/execute permission
does enable me to execute the shell command
whereas without it, the command fails so
I think the permission I need is related
to cmd.exe. Also, I believe that I've already
got access to CreateProcess because I'm
able to launch new processes as long as
they don't contain redirecting or piping
commands such as > and |.

If I wasn't to rename cmd.exe is there any
other way I could use > and | from a public
CGI script without causing security problems?

I'm suprised this doesn't seem to have
been an issue to anyone in the past.

Brad

[quoted text, click to view]
Re: Opening cmd.exe to IUSR_<machine> Leythos
2/2/2004 4:08:36 AM
In article <009e01c3e569$46940b60$3501280a@phx.gbl>,
anonymous@discussions.microsoft.com says...
[quoted text, click to view]

If you manage to expose CMD to IIS you are going to get hacked, it's not
IF, but when!

Don't do it, there has got to be a better method - even if you have to
create a ISAPI dll, but still don't use CMD. I never leave a web server
setup so that anyone but a local account (not a group) can use it just
in case it gets hacked.


--
--
spamfree999@rrohio.com
Re: Opening cmd.exe to IUSR_<machine> David Martin
2/2/2004 9:53:55 AM
Your are almost certain to get hacked

Host User At Proc Time Received Sent Status Operation Target Param
81.56.179.194 - 02/02/2004 06:22:45 0 80 4184 404 GET
/<Rejected-By-UrlScan> ~/c/winnt/system32/cmd.exe
81.56.179.194 - 02/02/2004 06:22:35 0 70 4184 404 GET
/<Rejected-By-UrlScan> ~/MSADC/root.exe
81.56.179.194 - 02/02/2004 06:22:26 0 72 4184 404 GET
/<Rejected-By-UrlScan> ~/scripts/root.exe
81.56.179.194 - 02/02/2004 05:53:29 0 70 4184 404 GET
/<Rejected-By-UrlScan> ~/MSADC/root.exe
81.56.179.194 - 02/02/2004 05:53:19 0 72 4184 404 GET
/<Rejected-By-UrlScan> ~/scripts/root.exe
210.54.179.254 - 02/02/2004 05:33:53 94 59 4184 404 GET
/<Rejected-By-UrlScan> ~/scripts/..%255c%255c../winnt/system32/cmd.exe
218.72.20.40 - 02/02/2004 00:50:50 0 61 4203 404 GET
/<Rejected-By-UrlScan> ~211.150.96.26:25
81.56.179.194 - 02/02/2004 00:30:20 0 96 4184 404 GET
/<Rejected-By-UrlScan> ~/scripts/..%252f../winnt/system32/cmd.exe
81.56.179.194 - 02/02/2004 00:30:19 0 100 4184 404 GET
/<Rejected-By-UrlScan> ~/scripts/..%25%35%63../winnt/system32/cmd.exe
81.56.179.194 - 02/02/2004 00:30:18 0 96 4184 404 GET
/<Rejected-By-UrlScan> ~/scripts/..%%35c../winnt/system32/cmd.exe
81.56.179.194 - 02/02/2004 00:30:17 0 98 4184 404 GET
/<Rejected-By-UrlScan> ~/scripts/..%%35%63../winnt/system32/cmd.exe
81.56.179.194 - 02/02/2004 00:30:16 0 97 4184 404 GET
/<Rejected-By-UrlScan> ~/scripts/..%c1%9c../winnt/system32/cmd.exe
81.56.179.194 - 02/02/2004 00:30:15 0 97 4184 404 GET
/<Rejected-By-UrlScan> ~/scripts/..%c0%af../winnt/system32/cmd.exe
81.56.179.194 - 02/02/2004 00:30:14 0 97 4184 404 GET
/<Rejected-By-UrlScan> ~/scripts/..%c0%2f../winnt/system32/cmd.exe
81.56.179.194 - 02/02/2004 00:30:12 0 97 4184 404 GET
/<Rejected-By-UrlScan> ~/scripts/..%c1%1c../winnt/system32/cmd.exe
81.56.179.194 - 02/02/2004 00:30:10 0 145 4184 404 GET
/<Rejected-By-UrlScan>
~/msadc/..%255c../..%255c../..%255c/..%c1%1c../..%c1%1c../..%c1%1c../winnt/s
ystem32/cmd.exe
81.56.179.194 - 02/02/2004 00:30:08 0 117 4184 404 GET
/<Rejected-By-UrlScan>
~/_mem_bin/..%255c../..%255c../..%255c../winnt/system32/cmd.exe
81.56.179.194 - 02/02/2004 00:30:06 15 117 4184 404 GET
/<Rejected-By-UrlScan>
~/_vti_bin/..%255c../..%255c../..%255c../winnt/system32/cmd.exe
81.56.179.194 - 02/02/2004 00:30:04 0 96 4184 404 GET
/<Rejected-By-UrlScan> ~/scripts/..%255c../winnt/system32/cmd.exe
81.56.179.194 - 02/02/2004 00:30:01 0 80 4184 404 GET
/<Rejected-By-UrlScan> ~/d/winnt/system32/cmd.exe
81.56.179.194 - 02/02/2004 00:29:59 0 80 4184 404 GET
/<Rejected-By-UrlScan> ~/c/winnt/system32/cmd.exe
81.56.179.194 - 02/02/2004 00:29:56 0 70 4184 404 GET
/<Rejected-By-UrlScan> ~/MSADC/root.exe
81.56.179.194 - 02/02/2004 00:29:54 297 72 4184 404 GET
/<Rejected-By-UrlScan> ~/scripts/root.exe


Dave.

[quoted text, click to view]

AddThis Social Bookmark Button