11.07.2015 Views

Improving Web Application Security: Threats and - CGISecurity

Improving Web Application Security: Threats and - CGISecurity

Improving Web Application Security: Threats and - CGISecurity

SHOW MORE
SHOW LESS

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

580 Part IV: Securing Your Network, Host, <strong>and</strong> <strong>Application</strong> To configure database access for your ASP.NET application1. Use the Computer Management tool to change the password of the local ASPNETaccount on the <strong>Web</strong> server to a known strong password.You need to do this so that you can create a mirrored account on the databaseserver.2. Change the password attribute on the element in Machine.configso that the ASP.NET worker process continues to run using the ASPNET account.Use Aspnet_setreg.exe to store the encrypted credentials in the registry.3. Create a local account on the database server with the same name (ASPNET) <strong>and</strong>strong password on the database server.4. Create a local Windows group, such as ASPNET<strong>Web</strong>App, on the database server,<strong>and</strong> then add the local ASPNET account to the group.5. Grant the Windows group access to SQL Server by creating a new login, asfollows:sp_grantlogin 'MACHINE\ASPNET<strong>Web</strong>App'Note Replace MACHINE with your database server name.6. Grant the SQL login access to the database. The following T-SQL creates adatabase user called <strong>Web</strong>AppUser to which the login is associated.USE YourDatabaseGOsp_grantdbaccess 'MACHINE\ASPNET<strong>Web</strong>App', '<strong>Web</strong>AppUser'7. Create a user-defined database role.USE YourDatabaseGOsp_addrole '<strong>Web</strong>AppUserRole'8. Add the database user to the new database role.USE YourDatabaseGOsp_addrolemember '<strong>Web</strong>AppUserRole', '<strong>Web</strong>AppUser'9. Configure permissions in the database for the database role. Ideally, grant executepermissions only for the stored procedures that the application uses to query thedatabase <strong>and</strong> do not provide direct table access.grant execute on sprocname to <strong>Web</strong>AppUserRole

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!