35
WEB AND DATABASE SECURITY BEST PRACTICES Presented By: Bryan Miller CCIE, CISSP

Web Database Server Best Practices

Embed Size (px)

DESCRIPTION

Some best practices for building and securing web and database servers, including IIS, Apache, Oracle, MS SQL and MySQL.

Citation preview

Page 1: Web Database Server Best Practices

WEB AND DATABASE SECURITY BEST PRACTICES

Presented By:

Bryan MillerCCIE, CISSP

Page 2: Web Database Server Best Practices

Agenda

Introduction Threats Attack Vectors General Best Practices Web Server Security Database Security Free Tools Questions

Copyright 2009 Syrinx Technologies 2

Page 3: Web Database Server Best Practices

Introduction

Biography

25+ Years in Information Technology Positions at VCU, Circuit City, DiVX,

Cabletron, Dataline, SyCom Technologies, Packet360

CCIE, CISSP, M.S. in Computer Science President, Syrinx Technologies LLC

Copyright 2009 Syrinx Technologies 3

Page 4: Web Database Server Best Practices

Threats

Web and database servers continue to grow in complexity.

Applications are generally written with security as an afterthought.

New vulnerabilities are discovered every day in operating systems, application servers and in the applications themselves.

Exploits have become very easy to obtain and use.

Copyright 2009 Syrinx Technologies 4

Page 5: Web Database Server Best Practices

Attack Vectors

Common web server vulnerabilities

SQL Injection Cross Site Scripting (XSS) Cookie tampering Directory traversals Privilege escalation Session hijacking Web defacements

Copyright 2009 Syrinx Technologies 5

Page 6: Web Database Server Best Practices

Attack Vectors (cont.)

Common database server vulnerabilities

Incorrect permissions Account management Data theft (Confidentiality) Data manipulation (Integrity) Denial of service (Availability)

Copyright 2009 Syrinx Technologies 6

Page 7: Web Database Server Best Practices

General Best Practices

Start with the operating system

Develop a hardening procedure with checklists When building the server, always apply the

latest patches and update as needed. Remove all unnecessary services, protocols,

accounts, applications, etc. Where possible, install some form of host-based

intrusion detection/prevention (IDS/IPS) software.

Copyright 2009 Syrinx Technologies 7

Page 8: Web Database Server Best Practices

General Best Practices (cont.)

Start with the operating system

Develop a hardening procedure with checklists Ensure that all system account passwords are

not easily guessed, cannot be found in dictionaries and comply with all applicable password policies.

Always hardcode TCP/IP configuration information.

Ensure that proper file permissions are configured correctly on all critical directories/files.

Copyright 2009 Syrinx Technologies 8

Page 9: Web Database Server Best Practices

General Best Practices (cont.)

Start with the operating system

Develop a hardening procedure with checklists Configure logging on critical system events, such

as failed logon attempts. Ensure that appropriate anti-virus software is

installed and configured properly. Whenever possible, install and configure the

server in a lab environment without direct access to the corporate network or the Internet.

Copyright 2009 Syrinx Technologies 9

Page 10: Web Database Server Best Practices

General Best Practices (cont.)

Moving on to the Application

After installing the web or database server application, ensure that any hotfixes, security patches or other necessary updates are installed.

Ensure that any application-layer account passwords are not left blank, at their defaults or set to anything that can be easily guessed using brute-force tools.

Ensure proper application-layer permissions are set at every layer of the application.

Copyright 2009 Syrinx Technologies 10

Page 11: Web Database Server Best Practices

General Best Practices (cont.)

Moving On to the Application

Modify the host-based IDS/IPS if necessary to accommodate the new application.

If any remote access or control components are installed, ensure that they use some form of robust encryption (not Telnet!).

Put procedures in place to ensure that any application patches are installed along with operating system patches.

Copyright 2009 Syrinx Technologies 11

Page 12: Web Database Server Best Practices

General Best Practices (cont.)

Moving On to the Application

Enable logging of critical security events. Test the application from a security

perspective before loading any test or live data.

Encrypt data whenever possible – “at rest” and “in motion”

Copyright 2009 Syrinx Technologies 12

Page 13: Web Database Server Best Practices

General Best Practices (cont.)

Don’t forget about the network

Control access to the servers using ACL’s where appropriate

Only open the minimum ports and protocols necessary

Use both ingress and egress filters where appropriate

Copyright 2009 Syrinx Technologies 13

Page 14: Web Database Server Best Practices

Web Server Security

Some general best practices

Install the web application data (the web site) on a different drive than the operating system. This eliminates a class of attacks called “directory traversals”.

Make sure to change all default application-layer passwords.

Copyright 2009 Syrinx Technologies 14

Page 15: Web Database Server Best Practices

Web Server Security (cont.)

Some general best practices

Remove all demo programs and any unnecessary components of the web server application.

Run as many security testing programs as possible before releasing the server for daily use.

Copyright 2009 Syrinx Technologies 15

Page 16: Web Database Server Best Practices

Web Server Security (cont.)

IIS specific best practices

Where possible, use the latest version of the web server software.

Unmap any application mappings not being used.

Where possible, limit the HTTP verbs that specific pages will accept.

For static pages, limit all access to HTTP GET only.

Copyright 2009 Syrinx Technologies 16

Page 17: Web Database Server Best Practices

Web Server Security (cont.)

IIS specific best practices

Remove Internet printing (IPP). Remove all sample/help directories. Rename O/S Administrator account.

Copyright 2009 Syrinx Technologies 17

Page 18: Web Database Server Best Practices

Web Server Security (cont.)

Apache specific best practices

Whenever possible, compile the application from known source code. Always check the MD5 or PGP checksums.

Chroot the server so directory traversal attacks are eliminated.

Run the web server process as a non-root user.

Copyright 2009 Syrinx Technologies 18

Page 19: Web Database Server Best Practices

Web Server Security (cont.)

Apache specific best practices

Change the “Server:” token in the HTTP response header to disguise the web server type.

Lock the password for this user and disable shell access.

Disable any unnecessary modules.

Copyright 2009 Syrinx Technologies 19

Page 20: Web Database Server Best Practices

Web Server Security (cont.)

Apache specific best practices

Remove all unnecessary directories and set proper file permissions.

Create appropriate startup, reload and shutdown scripts.

Copyright 2009 Syrinx Technologies 20

Page 21: Web Database Server Best Practices

Database Security

MS SQL Best Practices

Ensure the SA account has a non-blank password. This also applies to MSDE-based applications

Never configure the SA password to be the same as any other account, especially the O/S Administrator password.

Remove all unnecessary stored procedures, especially “xp..cmdshell”.

Copyright 2009 Syrinx Technologies 21

Page 22: Web Database Server Best Practices

Database Security (cont.)

MySQL Best Practices

Always set a password for the “root” account. Apply application patches as appropriate. Always run the database server process as a

non-root user whenever possible. Delete the “test” database and the default

“user” account.

Copyright 2009 Syrinx Technologies 22

Page 23: Web Database Server Best Practices

Database Security (cont.)

MySQL Best Practices

If remote access is not needed, disable TCP/IP support.

Chroot the database process if possible.

Copyright 2009 Syrinx Technologies 23

Page 24: Web Database Server Best Practices

Database Security (cont.)

Oracle Best Practices Always change the account passwords for the

default Oracle accounts, especially the following:

Copyright 2009 Syrinx Technologies 24

sys system dbsnmp outln ctxsys ordsys mtssys mdsys wksys

Page 25: Web Database Server Best Practices

Database Security (cont.)

Oracle Best Practices

Set the proper permissions for low-privilege accounts such as dbsnmp

Remove the “scott/tiger” account. Disable all unnecessary accounts.

Copyright 2009 Syrinx Technologies 25

Page 26: Web Database Server Best Practices

Database Security (cont.)

Oracle Best Practices

Configure a password in the Listener service. Configure appropriate logging on security-

related events. Apply application patches as appropriate.

Copyright 2009 Syrinx Technologies 26

Page 27: Web Database Server Best Practices

Database Security (cont.)

PHP Best Practices

Run only the latest versions of PHP. Make sure you validate all user input. Use session info instead of cookies. Avoid using variables in Include statements. Turn off the display of error messages. You

can still log them to a file.

Copyright 2009 Syrinx Technologies 27

Page 28: Web Database Server Best Practices

Database Security (cont.)

PHP Best Practices

Be very careful with global variables. Make sure “magic_quotes_gpc ” support is

disabled. Set “safe mode on” – test before production. Set file extension for all include files to “.PHP”. Store include files outside of the document

root directory.

Copyright 2009 Syrinx Technologies 28

Page 29: Web Database Server Best Practices

Free Tools

Operating System

Microsoft Baseline Security Analyzer Microsoft Windows Server Update Services Nessus Nmap Foundstone SuperScan 4 Metasploit

Copyright 2009 Syrinx Technologies 29

Page 30: Web Database Server Best Practices

Free Tools (cont.)

Web Servers

URLScan 3.1 (IIS 5.1-7)

IISLockdown 2.1 (IIS < 6.0)

Nikto (Perl)

N-Stalker (free and commercial)

Copyright 2009 Syrinx Technologies 30

Page 31: Web Database Server Best Practices

Free Tools (cont.)

Web Servers

Nessus

Wget

THCSSLCheck

Proxies: Achilles, Paros, WebScarab

Copyright 2009 Syrinx Technologies 31

Page 32: Web Database Server Best Practices

Free Tools (cont.)

Database Servers

MS SQL

Cain/Abel SQLDict SQLForce SQLPing3

Copyright 2009 Syrinx Technologies 32

Page 33: Web Database Server Best Practices

Free Tools (cont.)

Database Servers

Oracle

Cain/Abel TNSCMD (Perl) WinSID CheckPWD

Copyright 2009 Syrinx Technologies 33

Page 34: Web Database Server Best Practices

Free Tools (cont.)

Database Servers

MySQL

Cain/Abel

Copyright 2009 Syrinx Technologies 34

Page 35: Web Database Server Best Practices

Questions

Thank You Very Much for Your Time and Attention!

Copyright 2009 Syrinx Technologies 35