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

iis security

group:

Protecting asp include files


Protecting asp include files Jonathan Allen
9/30/2004 9:40:09 AM
iis security:
I need a way to protect asp include files. My fear is that a user may
stumble across one, causing who knows what to happen.

As a first step, I want to rename all the include files from .asp to .inc.
Then I want to lock down IIS so that users will get a 404 error whenever
they try to access a inc file.

1. Is this a reasonable course of action?
2. If so, how to I tell IIS to not expose inc files.

Note: I cannot move any file. Our directory structure is too well
established. Also, I have over 5000 asp files, so I cannot simply make sure
the include files will fail safely.

--
Jonathan Allen


Re: Protecting asp include files Jonathan Allen
9/30/2004 12:04:08 PM
[quoted text, click to view]

The problem is I don't want them to be executed. Example...

/main.asp
/include_dbAccess.asp

If someone were to type...
http://mycompany/main.asp
....then include_dbAccess.asp will get executed safely.

If someone were to type...
http://mycompany/include_dbAccess.asp
....then include_dbAccess.asp will be executed in an untested way and
something really bad might happen.

--
Jonathan Allen


[quoted text, click to view]

Re: Protecting asp include files Jonathan Allen
9/30/2004 1:32:54 PM
[quoted text, click to view]

It can. For example, say the include file does something based on form
variables. But the code to ensure that the form variables are valid is in a
different file.

(Yea, I know this is a bad way to write code, but it already exists and I'm
just trying to minimize damage.)

[quoted text, click to view]

I would like to, but there are over 5000 files. It is going to be a long
road.

--
Jonathan Allen


[quoted text, click to view]

Re: Protecting asp include files Kristofer Gafvert
9/30/2004 7:10:22 PM
Hello,

I would keep the asp extension. *.asp files will be executed on the server,
and will not be exposed as clear text to the user.

--
Regards,
Kristofer Gafvert
http://www.ilopia.com


[quoted text, click to view]

Re: Protecting asp include files jeff.nospam NO[at]SPAM zina.com
9/30/2004 8:25:03 PM
[quoted text, click to view]

"Somehting really bad" would happen either way. The action of a
script doesn't change just because you included it.

Either use the URLScan method of stopping .inc files from being sent
to the browser as text, or fix your included files so "something
really bad" doesn't happen.

Re: Protecting asp include files Kristofer Gafvert
9/30/2004 10:28:09 PM
Okay.

So, install URLScan, and prevent the extension .inc.

"How to configure the URLScan Tool"
http://support.microsoft.com/default.aspx?scid=kb;EN-US;326444

--
Regards,
Kristofer Gafvert
http://www.ilopia.com


[quoted text, click to view]

Re: Protecting asp include files jeff.nospam NO[at]SPAM zina.com
10/1/2004 2:29:27 AM
[quoted text, click to view]

Launching the inlcude alone wouldn't also launch the form that
provides the variables, would it?

[quoted text, click to view]

It's also not terribly efficient, at least in most instances.
Includes are for repetitive code, usually subroutines or functions,
not for something like reacting to form input (with the exception of a
routine to verify/purge input maybe).

[quoted text, click to view]

It will either way. That's one of the joys of redoing your
programming techniques in mid production. But start on the easier and
more used ones and you'll accomplish something.

Re: Protecting asp include files Ken Schaefer
10/1/2004 9:36:58 AM
Start refactoring your include files so that they contain routines
(functions/subs) or classes only. Then if someone requests one of these
files, nothing "bad" will ever happen, as there is no call to any of these
things.

Cheers
Ken

[quoted text, click to view]

AddThis Social Bookmark Button