How To Create A Database Driven Website On A Computer Or Server Without A Database (Iis) Or A Password (Ict) On A Server (Iip) Or Password (Web) On An Anonymous Guestbook (Iit) On Your



Similar documents
Click Studios. Passwordstate. Installation Instructions

Restoring Sage Data Sage 200

MSSQL quick start guide

SchoolBooking SSO Integration Guide

Testing Web Applications for SQL Injection Sam Shober

Web Application Disassembly with ODBC Error Messages By David Litchfield Director of Security

IIS SECURE ACCESS FILTER 1.3

Secure Messaging Server Console... 2

1. Introduction. 2. Web Application. 3. Components. 4. Common Vulnerabilities. 5. Improving security in Web applications

PDshop.NET Installation Guides (ASP.NET Edition)

Setup Corporate (Microsoft Exchange) . This tutorial will walk you through the steps of setting up your corporate account.

HELP DESK MANUAL INSTALLATION GUIDE

CCM 4350 Week 11. Security Architecture and Engineering. Guest Lecturer: Mr Louis Slabbert School of Science and Technology.

Criteria for web application security check. Version

Web applications. Web security: web basics. HTTP requests. URLs. GET request. Myrto Arapinis School of Informatics University of Edinburgh

TIBCO Spotfire Platform IT Brief

Kentico CMS security facts

Video Administration Backup and Restore Procedures

Click Studios. Passwordstate. Installation Instructions

Web Application Guidelines

How to Configure Captive Portal

Avatier Identity Management Suite

Architecture and Data Flow Overview. BlackBerry Enterprise Service Version: Quick Reference

Troubleshooting guide for errors in Active Server Pages and Microsoft Data Access Components

SharePoint Integration Framework Developers Cookbook

FREQUENTLY ASKED QUESTIONS

WINGS WEB SERVICE MODULE

External Vulnerability Assessment. -Technical Summary- ABC ORGANIZATION

USING MYWEBSQL FIGURE 1: FIRST AUTHENTICATION LAYER (ENTER YOUR REGULAR SIMMONS USERNAME AND PASSWORD)

Table of Contents. Open-Xchange Authentication & Session Handling. 1.Introduction...3

Tableau Server Trusted Authentication

Application Security Testing. Generic Test Strategy

Is Drupal secure? A high-level perspective on web vulnerabilities, Drupal s solutions, and how to maintain site security

NSi Mobile Installation Guide. Version 6.2

Installing and configuring Microsoft Reporting Services

Click Studios. Passwordstate. High Availability Installation Instructions

LISTSERV LDAP Documentation

User Guide Part 7. Status Server

An Newsletter Using ASP Smart Mailer and Advanced HTML Editor

Click-To-Talk. ZyXEL IP PBX License IP PBX LOGIN DETAILS. Edition 1, 07/2009. LAN IP: WAN IP:

What is Web Security? Motivation

Websense Support Webinar: Questions and Answers

Short notes on webpage programming languages

Tableau Server Trusted Authentication

EPiServer Operator's Guide

Netwrix Auditor. Role-Based Access. Version: /27/2015

Callis Reviewer Installation Guide

McAfee One Time Password

ADO and SQL Server Security

Tech Note 813 Troubleshooting Wonderware Information Server (WIS) Part Four: Client License Release

Online Data Services. Security Guidelines. Online Data Services by Esri UK. Security Best Practice

How To Set Up Total Recall Web On A Microsoft Memorybook (For A Microtron)

Server Security. Contents. Is Rumpus Secure? 2. Use Care When Creating User Accounts 2. Managing Passwords 3. Watch Out For Aliases 4

Bitrix Site Manager ASP.NET. Installation Guide

SINGLE SIGN-ON SETUP T ECHNICAL NOTE

Advanced Tornado TWENTYONE Advanced Tornado Accessing MySQL from Python LAB

TIBCO Spotfire Web Player 6.0. Installation and Configuration Manual

Tutorial: How to Use SQL Server Management Studio from Home

Copyright: WhosOnLocation Limited

White Paper BMC Remedy Action Request System Security

Windows XP Exchange Client Installation Instructions

Security IIS Service Lesson 6

How to break in. Tecniche avanzate di pen testing in ambito Web Application, Internal Network and Social Engineering

Active Directory Integration. Documentation. v1.02. making your facilities work for you!

Threat Modeling. Categorizing the nature and severity of system vulnerabilities. John B. Dickson, CISSP

Authentication and Single Sign On

Web Pages. Static Web Pages SHTML

Web Application Attacks and Countermeasures: Case Studies from Financial Systems

Oracle Forms Services Secure Web.Show_Document() calls to Oracle Reports Server 6i

Alert Notification of Critical Results (ANCR) Public Domain Deployment Instructions

BlackBerry Enterprise Service 10. Secure Work Space for ios and Android Version: Security Note

PRiSM Security. Configuration and considerations

5. At the Windows Component panel, select the Internet Information Services (IIS) checkbox, and then hit Next.

Training module 2 Installing VMware View

Xerox DocuShare Security Features. Security White Paper

Zabbix Manual.

Advanced Web Technology 10) XSS, CSRF and SQL Injection 2

GoDaddy (CentriqHosting): Data driven Web Application Deployment

OFFICE OF KNOWLEDGE, INFORMATION, AND DATA SERVICES (KIDS) DIVISION OF ENTERPRISE DATA

Simple Tips to Improve Drupal Performance: No Coding Required. By Erik Webb, Senior Technical Consultant, Acquia

HELP DOCUMENTATION SSRPM WEB INTERFACE GUIDE

IGEL Universal Management. Installation Guide

Content Management System

Sage 200 Web Time & Expenses Guide

If you examine a typical data exchange on the command connection between an FTP client and server, it would probably look something like this:

System Administration Training Guide. S100 Installation and Site Management

Guide to Web Hosting in CIS. Contents. Information for website administrators. ITEE IT Support

User-password application scripting guide

Linking Access to SQL Server

Polar Help Desk Installation Guide

SQL Injection January 23, 2013

Transferring Files to the CU2 Global Secure FTP Site. Login & Access Application Preparation Guide.

Web Plus Security Features and Recommendations

Aradial Installation Guide

Swivel Multi-factor Authentication

Transcription:

Information and Communication Technologies Division Security Notes on Active Server Pages (ASP) and MS-SQL Server Integration Prepared by: Contributor: Reviewed: Richard Grime Chris Roberts Tom Weil Version: 0.1 Page 1 of 1 Date: 9 December 2003

Introduction Using Active Server Pages (based on either Microsoft IIS, or Apache running Sun ONE 1 or the Perl Module Apache::ASP 2 ), a secure and reliable method provide a database driven website can be produced. This document provides guidelines for such a system, based on the security standpoint. It is written assuming that the web server is IIS 5.0 and that the database is running on Microsoft SQL Server 2000. Site Structure Data can either be entered into / retrieved from the database anonymously, or on a per user basis (authenticated). Under the anonymous regime, security can only apply to the whole database. If working on an authenticated basis, then specific data can be protected and only delivered to the correct user. For example: Web Guestbook an anonymous database driven website. A guestbook is added to a website and driven from an SQL server. Any anonymous user can view the entire guestbook. They can also write a new entry into the database. No edit facility is available (as we cannot tell which user wrote which comment), nor can we confirm the identity of the person submitting the new entry is real. Web Magazine Subscriptions an authenticated database driven website. To allow subscribers to change their delivery address, a magazine company adds a web page to their website. The user must log into a secure (HTTPS) website, where their password is checked. They are then given access to their own subscription record. They cannot write over anyone else s data but have full access to their own. Before writing any code or designing any databases, the decision as to which model best fits your website should be taken. User Authentication In order to provide an authenticated web site, we must have a mechanism by which we can identify the user. College websites use the user s college ICT logon account the web server (IIS) then checks with the IC Active Directory to confirm that the users password is correct. Once the identity (logon) has been established the user is allowed to continue into the site, and this logon name is stored in a Server Side 3 variable. 1 http://wwws.sun.com/software/chilisoft/ 2 http://www.apache-asp.org Version: 0.1 Page 2 of 2 Date: 9 December 2003

Now the user has logged in, we can use the server side variable as an argument when talking to the database. However, we cannot talk to the database as if we were that user that is, we cannot assume that users context. To run in the user s context, we require a trusted connection. Trusted Connections We can use Windows Integrated Security 4 to pass the logon name and password (credentials) straight through the web server and to the SQL server. This however has a few caveats: The web server must use basic (plain text) authentication. The web server cannot pass NTLM hashes to the SQL server for authentication. This means that the website must be based on HTTPS for this you will require an SSL certificate. The SQL database must hold a valid account for that user. This means that either SQL Windows Authentication is being used, or a SQL Authentication account has been created. With either model, specific rights need to be assigned to each user individually. This system is unsuitable for a site which has a lot of users. Trusted Connections should be used where the database permission structure is very complicated. For simple data retrieval sites, the management overhead involved with trusted connections is too great. Stored Procedures vs. Inline Code There are two ways of writing out the SQL commands to retrieve and insert data to and from the database. Code can be placed directly inside the web page, or isolated by placing it in a stored procedure. Stored procedures are highly recommended for the following reasons: SQL Code itself is not visible in your web source code. SQL Code can reveal database structures. SQL code should always be kept in server side portions of the web page. However, a simple coding mistake could make these commands visible to the client. Keeping the code in a stored procedure keeps all the DB schema / operation related code in one place. This makes for far simple database maintenance and management. Specifically, SQL code, both in terms of connection strings, and the commands themselves should never be placed in the client side portion of the code. Access to this SQL code may lead to a compromise of your data. 3 Server side variables are held on the web server, and cannot be written to by the client. Client side variables on the other hand are held in the browser and can be changed at will by the user. 4 The Windows Integrated Security uses the Security Support Provider Interface (SSPI) Version: 0.1 Page 3 of 3 Date: 9 December 2003

Assigning User Permissions As with all permissions models, they require some planning. The principle is one of least possible. The fewer accounts, with the lowest permissions possible, that you have the better. You should also remember which user context you are assuming. Model Anonymous Authenticated no Trusted Connection Authenticated Trusted Connection User Context IUSR_<server>, IWAM_<server> 5 or hard coded SYSTEM or hard coded Authenticated User s Login Name In this case hard coded refers to the user name specified in the SQL Connection string. For example, this connection string connects using the anon_user account: Driver={SQL Server}; Server=server_name; Database=database_name; UID=anon_user; PWD=password You can see that the password for this account has to be stored in the Web source which shows that the SQL code should never be accessible by the client. Any accounts that are hard coded or defaults, like SYSTEM, IUSR or IWAM should have the least amount of permission to do their job. For trusted connections, the string would look like: Provider=SQLOLEDB.1;Integrated Security=SSPI;Persist Security Info=False;Initial Catalog=Calc;Data Source=NEWServer In this case, no password or user name is stored but bear in mind the caveats of trusted connections mentioned above. User Accounts for Stored Procedures If you use stored procedures to provide data access for your site (as is recommended), then you can assign a SQL account to each stored procedure. Using the hard coded method mentioned above, each stored procedure then executes in a context of least possible permissions which also fits the recommended security model. Take the web guestbook example, we could have two stored procedures, say: 1) SP_ListGuestbookEntries 2) SP_WriteNewGuestbookEntry Stored procedure 1 queries the database, and returns a recordset containing all of the guestbook entries. This only needs to read the database no write permissions are required. 5 IIS uses these two accounts to represent the anonymous user where <server> is the name of your web server. This is who Version: 0.1 Page 4 of 4 Date: 9 December 2003

Hence, we could create a sql account user_read (although names shouldn t be this obvious!). Once this user exists, we can use the connection string: Driver={SQL Server}; Server=server_name; Database=database_name; UID=user_read; PWD=ReadTheDB Now, for stored procedure 2, this can write only new entries to the guest book. Hence, the user (user_write) for this would only require insert permissions no read, or update etc, is required. Driver={SQL Server}; Server=server_name; Database=database_name; UID=user_write; PWD=WriteTheDB Note that all these models can be mixed. You may wish to use the user_read type scenario just for reading data out of the database. For writing back, you could use a Trusted Connection. This is particularly relevant for the following type of example: Web Guestbook with Administrator Feature A web guestbook is placed on a site, however the owner of the site would like to be able to remove certain entries via a web form. To allow the owner to securely log in as an Administrator, we use a trusted connection. This way, we avoid some of the caveats involved with trusted connections. The only SQL Account we have to maintain is that of the administrator. As the administrator s credentials are never written down in the web code there is no risk of breach. Maintaining Stateful Web Pages More advanced web sites can use a number of mechanisms to store session information. Server Side Variables These are held at the web server. The client has no direct write access, so they cannot be modified by the browser. Commonly seen as ASP (VBScript) variables. Client Side Variables. The browser can also hold a number of variables. This should be considered untrusted, as they can be modified by the client. They are commonly seen in JavaScript variables. If you use Client Side JavaScript code to validate an HTML form before posting back to your database, then you should also double check this validation back at the server. If you do not, then the client will be able to submit data that does not fit your validation rules which compromises your data integrity. Query Strings These variables take the form of additions to the URL. While very convenient for programmers, they provide the most easily exploitable path for users. Consider this query string: Version: 0.1 Page 5 of 5 Date: 9 December 2003

http://www.myweb.com/index.asp?sql_command= select user from users In this case, the query string called sql_command clearly contains some SQL script. Merely by changing this string, a user could access other data. Even slightly less obvious strings such as user_name=joebloggs can be modified very easily. Query Strings should be avoided for anything other than harmless data. They should never contain information which is used to either connect to, or query, a database. They should always be treated as untrusted. Application Variables As a special variant of Server Side Variables, Application Variables provided the best way of storing usernames and passwords in hard coded connections. For example, the connection string might look like: Driver={SQL Server}; Server=server_name; Database=database_name; UID=Application( appvar1 ); PWD=Application( appvar2 ) The application variables are defined in the Global.ASA (under IIS). This way, you can store all the user names and passwords in a common location making is easy to change the passwords used on a regular basis. File Extensions: Server Side Includes (SSI s) When using SSI s in ASP, you should take care to use file extensions that are understood by the ASP interpreter. For example, using the.inc file extension would cause its entire contents to be rendered in plain text to the browser. The same applies for other pages. Do not store files on your servers Web Root that you do not wish to be accessed. Random files like readme.txt or todo.txt will be accessible to any viewer and may contain sensitive information. Version: 0.1 Page 6 of 6 Date: 9 December 2003