Groups | Blog | Home
all groups > iis security > september 2004 >

iis security : how to avoid not using first page?


jeff.nospam NO[at]SPAM zina.com
9/20/2004 4:44:51 PM
[quoted text, click to view]

Many ways. Set a session variable on the start page for example,
check for it on the remaining pages and redirect to the start if it
isn't set.

Fred
9/20/2004 5:09:58 PM
Hi,

We have an intranet appliction which begins with a start page, which checks
the login of the user (the security in IIS is set to "Anonymous not
allowed") . In function of that 'remote_user' variable, the user gets a
specific menu (there are normal user menu and admin menu). Suppose an
hacker-user guesses the path name (or he saw it in the browser path line) of
the administration pages. So it's possible for him to type himself e.g.:
http://ourserver/admin.asp and so to get access to that administration menu
without passing by the start page and so not be redirected to the normal
user menu..

How can we prevent this? (There are hundred pages).
Thanks
fred

Fred
9/21/2004 9:12:43 AM
thanks, but i have to check it in all the pages. There are about 800 pages.
You speak about many ways? Is there not a shorter way?


"Jeff Cochran" <jeff.nospam@zina.com> schreef in bericht
news:415508df.244799222@msnews.microsoft.com...
[quoted text, click to view]

jeff.nospam NO[at]SPAM zina.com
9/21/2004 11:48:23 AM
[quoted text, click to view]

That's the shorter way. And any decent editor will do a global search
and replace to add the code as an include. You only mentioned a
single admin page in your post that needed protection.

You might use NTFS permissions to provide the security (you should
anyway) and a custom error page to redirect the user to a more
suitable page.

Jeff

[quoted text, click to view]
MattC
9/30/2004 10:45:47 AM
How about sticking this in the web.config file:

<authentication mode=3D"Forms">=20
<forms loginUrl=3D"login.aspx" name=3D"adAuthCookie" timeout=3D"60" =
path=3D"/"/>
</authentication>

Have you rlogin box here and on submit do something like: (pardon the =
formatting)

if(/*Authenticate user here*/)
{

/*set session variable of user type here*/

FormsAuthenticationTicket authTicket =3D new =
FormsAuthenticationTicket(1,"loggedonuser", DateTime.Now, =
=20
=
DateTime.Now.AddMinutes(Session.Timeout),false,SecurityHandler.ThisUser.I=
D.ToString());
//Encrypt the ticket.
string encryptedTicket =3D FormsAuthentication.Encrypt(authTicket);
//Create a cookie, and then add the encrypted ticket to the cookie as =
data.
HttpCookie authCookie =3D new =
HttpCookie(FormsAuthentication.FormsCookieName, encryptedTicket);
//Add the cookie to the outgoing cookies collection.
Response.Cookies.Add(authCookie);=20
//You can redirect now.
Response.Redirect(FormsAuthentication.GetRedirectUrl(_usernametext.Text, =
false));
}
else
{
//redirect to error page
}

this will authenticate access to any direct page access, however as I'm =
sure you have realised this doesnt solve your user specific problem.

You could possibly have your home pages derive from a secure page =
instead of System.Web.UI.Page, in the OnInit method of your secure page =
you could call a virtual method Secure Page. Then override this method =
in each of the admin or user pages to check the session variable we set =
on login and redirect accordingly, maybe log them out and send them back =
to login page:

System.Web.UI.Page
|
|-------> SecurePage
|
|-------->AdminPage
|-------->UserPage


class SecurePage : System.Web.UI.Page
{
override protected void OnInit(EventArgs e)
{
SecurePage();
InitializeComponent();
base.OnInit(e);
}

protected virtual void SecurePage() {}
}

class AdminPage : SecurePage
{ =20
protected override void SecurePage()
{
//get session variable check user type throw out if neccessary
}
=20
}


MattC


[quoted text, click to view]
AddThis Social Bookmark Button