Web Wiz - Green Windows Web Hosting

  New Posts New Posts RSS Feed - Session variable safe to track user?
  FAQ FAQ  Forum Search   Events   Register Register  Login Login

Session variable safe to track user?

 Post Reply Post Reply
Author
snapey View Drop Down
Newbie
Newbie


Joined: 28 July 2002
Location: United Kingdom
Status: Offline
Points: 33
Post Options Post Options   Thanks (0) Thanks(0)   Quote snapey Quote  Post ReplyReply Direct Link To This Post Topic: Session variable safe to track user?
    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
 
Back to Top
MadDog View Drop Down
Mod Builder Group
Mod Builder Group
Avatar

Joined: 01 January 2002
Status: Offline
Points: 3008
Post Options Post Options   Thanks (0) Thanks(0)   Quote MadDog Quote  Post ReplyReply Direct Link To This Post 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.
Back to Top
snapey View Drop Down
Newbie
Newbie


Joined: 28 July 2002
Location: United Kingdom
Status: Offline
Points: 33
Post Options Post Options   Thanks (0) Thanks(0)   Quote snapey Quote  Post ReplyReply Direct Link To This Post 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


Edited by snapey - 08 January 2007 at 12:54am
Back to Top
MadDog View Drop Down
Mod Builder Group
Mod Builder Group
Avatar

Joined: 01 January 2002
Status: Offline
Points: 3008
Post Options Post Options   Thanks (0) Thanks(0)   Quote MadDog Quote  Post ReplyReply Direct Link To This Post 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.
Back to Top
snapey View Drop Down
Newbie
Newbie


Joined: 28 July 2002
Location: United Kingdom
Status: Offline
Points: 33
Post Options Post Options   Thanks (0) Thanks(0)   Quote snapey Quote  Post ReplyReply Direct Link To This Post 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?
Back to Top
MadDog View Drop Down
Mod Builder Group
Mod Builder Group
Avatar

Joined: 01 January 2002
Status: Offline
Points: 3008
Post Options Post Options   Thanks (0) Thanks(0)   Quote MadDog Quote  Post ReplyReply Direct Link To This Post 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.
Back to Top
snapey View Drop Down
Newbie
Newbie


Joined: 28 July 2002
Location: United Kingdom
Status: Offline
Points: 33
Post Options Post Options   Thanks (0) Thanks(0)   Quote snapey Quote  Post ReplyReply Direct Link To This Post Posted: 08 January 2007 at 6:59pm
So, SQL injection aside, are session variables 'safe' to keep track of an authenticated user?
Back to Top
MadDog View Drop Down
Mod Builder Group
Mod Builder Group
Avatar

Joined: 01 January 2002
Status: Offline
Points: 3008
Post Options Post Options   Thanks (0) Thanks(0)   Quote MadDog Quote  Post ReplyReply Direct Link To This Post Posted: 08 January 2007 at 7:23pm
Yes, just as long as you filter out SQL injection and XSS.
Back to Top
 Post Reply Post Reply

Forum Jump Forum Permissions View Drop Down

Forum Software by Web Wiz Forums® version 12.08
Copyright ©2001-2026 Web Wiz Ltd.


Become a Fan on Facebook Follow us on X Connect with us on LinkedIn Web Wiz Blogs
About Web Wiz | Contact Web Wiz | Terms & Conditions | Cookies | Privacy Notice

Web Wiz is the trading name of Web Wiz Ltd. Company registration No. 05977755. Registered in England and Wales.
Registered office: Web Wiz Ltd, Unit 18, The Glenmore Centre, Fancy Road, Poole, Dorset, BH12 4FB, UK.

Prices exclude VAT at 20% unless otherwise stated. VAT No. GB988999105 - $, € prices shown as a guideline only.

Copyright ©2001-2026 Web Wiz Ltd. All rights reserved.