Print Page | Close Window

Session variable safe to track user?

Printed From: Web Wiz Forums
Category: General Discussion
Forum Name: Classic ASP Discussion
Forum Description: Discussion on Active Server Pages (Classic ASP).
URL: https://forums.webwiz.net/forum_posts.asp?TID=22354
Printed Date: 29 March 2026 at 10:25am
Software Version: Web Wiz Forums 12.08 - https://www.webwizforums.com


Topic: Session variable safe to track user?
Posted By: snapey
Subject: Session variable safe to track user?
Date Posted: 07 January 2007 at 11:51pm
I have a simple CMS system that allows me to post news items to a webpage. The pages are held in Access database.
 
The Access Database is held below the root of the site meaning it cannot be easily downloaded.
 
I have just noticed that the site has been hacked by 'DP Hack Team' / 'Hakan'. The only change to the site was a new entry in the database which had code to hide the entry so that it did not appear on the site but was trying to install some active-x content in the clients browser when they accessed my site.
 
I have scanned the server and cannot find any other files that have been created.
 
The question is, the security of the database editing pages is using a simple login form and then checking the results in an ASP page. If the admin is validated then a session variable is set and access to the admin pages is granted. Each admin page checks the status of the session variable before doing anything else.
 
Could this method be hacked through the use of session variables, or is it more likely that access came some other way such as a dictionary attack on the login page?
 
I have used the above method quite a few times on different sites so I'm concerned that I'm not aware of some issue.
 
Any advice for securing your ASP pages (shared host environment).
 
Regards
 



Replies:
Posted By: MadDog
Date Posted: 08 January 2007 at 12:23am
They most likely used a SQL injection hack. Check to make sure all your SQL statements are filtered to prevent SQL injection.

-------------
http://www.iportalx.net" rel="nofollow">


Posted By: snapey
Date Posted: 08 January 2007 at 12:51am
Thanks MD.
Is it as simple as ensuring that semicolon cannot be passed in and end up in the SQL string? Do I need to worry about other representations of the character?
 
A typical SQL might be
 
 "SELECT stuff FROM mytable WHERE ID=" & strID & ";"
 
and strID might have been passed in the URL.
 
Ta


Posted By: MadDog
Date Posted: 08 January 2007 at 12:55am
Removing the semicolon will prevent against SQL injection.

But if you have any forms that submit data to the database, make sure you format out HTML or someone can use a XSS hack to make it look like your site has been hacked.


-------------
http://www.iportalx.net" rel="nofollow">


Posted By: snapey
Date Posted: 08 January 2007 at 1:07am
I always use recordsets for posting data to the database, and normally substitute all "<" with "{" however I have recently learned that I perhaps need to check chr()'s. Any comment?


Posted By: MadDog
Date Posted: 08 January 2007 at 1:09am
just replacing < > with something else doesn't always work. You need to take a look at character encoding and how easy it is to include xss into normal "harmless" code.

-------------
http://www.iportalx.net" rel="nofollow">


Posted By: snapey
Date Posted: 08 January 2007 at 6:59pm
So, SQL injection aside, are session variables 'safe' to keep track of an authenticated user?


Posted By: MadDog
Date Posted: 08 January 2007 at 7:23pm
Yes, just as long as you filter out SQL injection and XSS.

-------------
http://www.iportalx.net" rel="nofollow">



Print Page | Close Window

Forum Software by Web Wiz Forums® version 12.08 - https://www.webwizforums.com
Copyright ©2001-2026 Web Wiz Ltd. - https://www.webwiz.net