Database Security CIS 764 Presentation Mazharuddin Mohammad.

Slides:



Advertisements
Similar presentations
Module XIV SQL Injection
Advertisements

OWASP Secure Coding Practices Quick Reference Guide
Security Pertemuan 7 Matakuliah: T0413 Tahun: 2009.
Data and Applications Security Dr. Bhavani Thuraisingham The University of Texas at Dallas Attacks to Databases October 2014.
Understand Database Security Concepts
Securing Oracle Databases CSS-DSG JTrumbo. Audit Recommendations -Make sure databases are current with patches. -Ensure all current default accounts &
Chapter 9 Auditing Database Activities
Information Networking Security and Assurance Lab National Chung Cheng University The Ten Most Critical Web Application Security Vulnerabilities Ryan J.W.
ITS Offsite Workshop 2002 PolyU IT Security Policy PolyU IT/Computer Systems Security Policy (SSP) By Ken Chung Senior Computing Officer Information Technology.
SQL Injection and Buffer overflow
Security in SQL Jon Holmes CIS 407 Fall Outline Surface Area Connection Strings Authenticating Permissions Data Storage Injections.
Chapter 7 Managing Data Sources. ASP.NET 2.0, Third Edition2.
Chapter 10 Overview  Implement Microsoft Windows Authentication Mode and Mixed Mode  Assign login accounts to database user accounts and roles  Assign.
Dec 13 th CS555 presentation1 Yiwen Wang --“Securing the DB may be the single biggest action an organization can take to protect its assets” David C. Knox.
1 Chapter Overview Transferring and Transforming Data Introducing Microsoft Data Transformation Services (DTS) Transferring and Transforming Data with.
Database Security Managing Users and Security Models.
Database Security and Auditing: Protecting Data Integrity and Accessibility Chapter 3 Administration of Users.
Database Security and Auditing: Protecting Data Integrity and Accessibility Chapter 3 Administration of Users.
Introduction to SQL Server 2000 Security Dave Watts CTO, Fig Leaf Software
Analysis of SQL injection prevention using a proxy server By: David Rowe Supervisor: Barry Irwin.
Hamdi Yesilyurt, MA Student in MSDF & PhD-Public Affaris SQL Riji Jacob MS Student in Computer Science.
Protecting Oracle Databases1 Aaron Newman Application Security, Inc.
Today’s Objectives Chapters 10 and 11 Security in SQL Server –Manage server logins and database users. –Manage server-level, database-level, and application.
Lecture slides prepared for “Computer Security: Principles and Practice”, 3/e, by William Stallings and Lawrie Brown, Chapter 5 “Database and Cloud Security”.
Attacking Applications: SQL Injection & Buffer Overflows.
Analysis of SQL injection prevention using a proxy server By: David Rowe Supervisor: Barry Irwin.
Hack-proofing Oracle 9iAS Writing Secure Code in Oracle Aaron Newman Application Security, Inc.
Copyright © The OWASP Foundation Permission is granted to copy, distribute and/or modify this document under the terms of the OWASP License. The OWASP.
Module 14 Configuring Security for SQL Server Agent.
Web Application Security ECE ECE Internetwork Security What is a Web Application? An application generally comprised of a collection of scripts.
Top Five Web Application Vulnerabilities Vebjørn Moen Selmersenteret/NoWires.org Norsk Kryptoseminar Trondheim
Copyright © 2013 Curt Hill Database Security An Overview with some SQL.
 Chapter 14 – Security Engineering 1 Chapter 12 Dependability and Security Specification 1.
Effective Security in ASP.Net Applications Jatin Sharma: Summer 2005.
Analysis of SQL injection prevention using a filtering proxy server By: David Rowe Supervisor: Barry Irwin.
Accessing Your MySQL Database from the Web with PHP (Ch 11) 1.
Managing users and security Akhtar Ali. Aims Understand and manage profiles Understand and manage users Understand and manage privileges Understand and.
Roles & privileges privilege A user privilege is a right to execute a particular type of SQL statement, or a right to access another user's object. The.
Security Attacks CS 795. Buffer Overflow Problem Buffer overflows can be triggered by inputs that are designed to execute code, or alter the way the program.
CIS 450 – Network Security Chapter 14 – Specific Exploits for UNIX.
Sumanth M Ganesh B CPSC 620.  SQL Injection attacks allow a malicious individual to execute arbitrary SQL code on your server  The attack could involve.
REALLY HACKING SQL SERVER 2000 Less Theory – More Action Jasper Smith.
Database Security and Auditing: Protecting Data Integrity and Accessibility Chapter 9 Auditing Database Activities.
Database Role Activity. DB Role and Privileges Worksheet.
CERN IT Department CH-1211 Genève 23 Switzerland t Security Overview Luca Canali, CERN Distributed Database Operations Workshop April
Database Security. Multi-user database systems like Oracle include security to control how the database is accessed and used for example security Mechanisms:
ADO.NET AND STORED PROCEDURES - Swetha Kulkarni. RDBMS ADO.NET Provider  SqlClient  OracleClient  OleDb  ODBC  SqlServerCE System.Data.SqlClient.
Database Security Cmpe 226 Fall 2015 By Akanksha Jain Jerry Mengyuan Zheng.
Security Attacks CS 795. Buffer Overflow Problem Buffer overflow Analysis of Buffer Overflow Attacks.
8 Chapter Eight Server-side Scripts. 8 Chapter Objectives Create dynamic Web pages that retrieve and display database data using Active Server Pages Process.
Copyright © The OWASP Foundation Permission is granted to copy, distribute and/or modify this document under the terms of the OWASP License. The OWASP.
Copyright © The OWASP Foundation Permission is granted to copy, distribute and/or modify this document under the terms of the OWASP License. The OWASP.
SQL Server 2005 Implementation and Maintenance Chapter 6: Security and SQL Server 2005.
Database Security. Multi-user database systems like Oracle include security to control how the database is accessed and used for example security Mechanisms:
Role Of Network IDS in Network Perimeter Defense.
Databases Kevin Wright Ben Bruckner Group 40. Outline Background Vulnerabilities Log File Cleaning This Lab.
Building Secure Web Applications with IDS Michael Chaney Technical Director ChainLink Networking Solutions, Inc.
Microsoft Advertising 16:9 Template Light Use the slides below to start the design of your presentation. Additional slides layouts (title slides, tile.
SQL Injection Attacks S Vinay Kumar, 07012D0506. Outline SQL Injection ? Classification of Attacks Attack Techniques Prevention Techniques Conclusion.
9 Copyright © 2004, Oracle. All rights reserved. Getting Started with Oracle Migration Workbench.
M M Waseem Iqbal.  Cause: Unverified/unsanitized user input  Effect: the application runs unintended SQL code.  Attack is particularly effective if.
Microsoft OS Vulnerabilities April 1, 2010 MIS 4600 – MBA © Abdou Illia.
SQL Database Management
Database and Cloud Security
SQL Injection.
Database System Implementation CSE 507
Information Security Analytics
SQL Server Security & Intrusion Prevention
Introduction to SQL Server 2000 Security
Lecture 2 - SQL Injection
Presentation transcript:

Database Security CIS 764 Presentation Mazharuddin Mohammad

Overview Introduction Understanding Vulnerabilities Oracle Security Microsoft SQL SERVER Security Sybase Security IBM DB2 Security SQL Injection Database Worms Conclusion References

Introduction Database cannot simply be hidden behind a firewall Securing databases involve - establishing strong policy - establishing adequate access policies

Current Database Security Environment Most databases are configured in a way they can be broken into relatively easily. Web Servers are attacked and compromised. Reasons being : There are less databases than web servers. Knowledge of database security has been limited. Getting a version of enterprise databases to learn and test on was difficult. Databases were traditionally behind a firewall.

Understanding Vulnerabilities Vendor bugs : are buffer overflows and other programming errors. Poor Architecture : result of not properly factoring security into the design of how an application works. Misconfigurations : caused by not properly locking down databases. Incorrect Usage : refers to building applications utilizing developer tools in ways that can be used to break into a system. Ex : SQL Injection

Oracle Security Listener Service : -- is a proxy that sets up the connection between client and the database. -- it uses a separate authentication system. Listener Security is Not Database Security : Why is the separation of listener and database security a potential problem? There are a few reasons : -- most people do not even realize that a password must be set on a listener service. -- setting the password on the listener service is not straight forward.

Oracle Security (cont’d) Known Listener Problems : $ORACLE_HOME/bin/lsnrctl LSNRCTL> help start stop status services version reload save_config trace dbsnmp _start dbsnmp_stop dbsnmp_status change_password quit exit set* show* LSNRCTL> help set password rawmode displaymode trc_file trc_directory trc_level log_file log_directory log_status current_listener connect_timeout startup_waittime use_plugandplay save_config_on_stop

Oracle Security (cont’d) TNS Leaks Data to Attacker TNS Header – Size of packet – Protocol Version – Length of Command – Actual Command.T , : (CONNECT_DATA=.) "...(DESCRIPTION=(ERR=1153)(VSNNUM= )(ERROR_STACK=(ERROR=(CO DE=1153)(EMFI=4)(ARGS='(CONNECT_DATA=.)ervices))CONNECT'))(ERROR=(CO (ERROR=(CODE=1153)(EMFI=4)(ARGS='(CONNECT_DATA=.)ervices))CONNECT_DA TA=(SID=orcl)(global_dbname=test.com)(CID=(PROGRAM=C:\Oracle\bin\sql plus.exe)(HOST=host123)(USER=user1))')) (ERROR=(CODE=303)(EMFI=1))))

Microsoft SQL SERVER Security Collecting Passwords : When SQL Server is running using mixed-mode authentication, login passwords are saved in various locations. Some passwords are saved using strong encryption and permissions, but many of them are saved using weak encryption and weak default permissions. SQL AGENT Password : SQL Server Agent can be configured to connect using standard SQL Server authentication with a login in the sysadmin role.

Contd.. Set the login to “sa” and set the password to “a”. The difference between the two SQL statements in SQL Profiler can now be seen: EXECUTE = = 0x6e1c7e83d0a487d623fc7cd689b8e702cc416bcd8d18c28ee0a4ba37c97ccfb5 Performing the same action but setting a password of “aaaaaaaaaa”, we execute the following statement: EXECUTE = = 0x6e1c1f1b809cb8a1a1acd3c2cb1cce7e0a099592a03ab7979f196de0b6898deb

SQL SERVER Security (cont’d) In the stored procedure the following is shown: EXECUTE master.dbo.xp_SQLagent_param 1, Where is the encrypted password saved? One can record the SQL sent through SQL Profiler using the following statement : EXECUTE msdb.dbo.sp_get_SQLagent_properties To determine what users can execute sp_get_SQLagent_properties : EXECUTE sp_helprotect sp_get_SQLagent_properties

Contd.. The results are as follows: Owner Object Grantee Grantor ProtectType Action Column dbo sp_get_SQLagent_properties public dbo Grant Execute. The encrypted version of the password (a) is: 0x6e1c7e83d0a487d623fc7cd689b8e702cc416bcd8d18c28ee0a 4ba37c97ccfb5 The encrypted version of the password (aaaaaaaaaa) is: 0x6e1c1f1b809cb8a1a1acd3c2cb1cce7e0a099592a03ab7979f1 96de0b6898deb Let’s look for the function used by Enterprise Manager to encrypt the password. After some research, it is found that SEMCOMN.DLL (located in SQL Server Instance Binn folder) has a Decrypt() function that can be used to decrypt the password. With this, a simple program can be created to get the clear text password.

SQL SERVER Security (cont’d)  DTS PACKAGE PASSWORDS : DTS packages are another source of passwords (using the SQL Profiler). When we select the location to save the Data Transformation Package, it can be seen in the SQL Profiler that msdb.dbo.sp_add_dtspackage is used to save the data (including the connection passwords) in msdb.dbo.sysdtspackages system table. A quick hack would be to retrieve the package data, insert it to your own SQL Server into the sysdtspackages table, and then open the package and extract the connection passwords from memory or from sniffing the wire by running the package. With further analysis, it is discovered that the most important data (the connection password) is saved in the table msdb.dbo.rtbldmbprops in the field col11120, thus yielding a new password uncovered.

SQL SERVER Security (cont’d) Causing A Denial Of Service : all users can create temporary stored procedures and tables and are authorized to execute the following statements : create table #tmp (x varchar(8000)) exec('insert into #tmp select ''X''') while 1=1 exec('insert into #tmp select * from #tmp')

SQL SERVER Security (cont’d) Recommendations : Keep SQL Server up to date with security fixes. Use Integrated Authentication. Run SQL Server under a low privileged account. Set SQL Server Agent Alerts on critical issues. Run periodicals checks on all system and non system objects permissions. Run periodicals checks on users permissions. Audit as much as you can.

SYBASE Database Security S YBASE DBCC CHECKVERIFY B UFFER O VERFLOW : DBCC CHECKVERIFY accepts a single parameter that is the name of the database to check. DBCC CHECKVERIFY does not validate the length of the string passed into the first parameter. This buffer overflow may allow an attacker to run arbitrary code under the security context of the database. varchar(16384) = replicate('A', 16384) DBCC go * a non-privileged user can use this security hole to take complete control of a Sybase server. This vulnerability can be remedied by applying the following patch:  S YBASE DROP DATABASE B UFFER O VERFLOW :

Contd.. S YBASE XP_FREEDLL B UFFER O VERFLOW V ULNERABILITY: Sybase Adaptive Server provides an extended stored procedure (ESP) called xp_freedll in the database sybsystemprocs. Xp_freedll attempts to copy an overly long string into a small memory buffer. Once the stack pointer is overwritten, execution can be redirected to an arbitrary location in memory and opcodes injected into the long string passed to the ESP can be executed. To fix this vulnerability, execute permissions on the extended stored procedure xp_freedll in the sybsystemprocs database should be revoked from public.

IBM DB2 Security Authentication Types : The authentication type can be specified at the client or at the server. For the server, authentication is defined in the database manager configuration file. When selecting an authentication mechanism, it is important to select a secure mechanism. Issues to be considered: client authentication should not be relied on. client credentials should be encrypted before being sent to the server.  DEFAULT IBM DB2 USERNAME AND PASSWORDS : After installing a database, one should immediately change any default usernames and passwords.

IBM DB2 Security (cont’d) To change the password, use the following command : CONNECT TO [database] USER [userid] USING [password] NEW [new_password] CONFIRM [new_password]  L OCKING DOWN ON IBM DB2 DATABASE PRIVILEGES : IBM DB2 accounts are operating system accounts and authentication is performed under the operating system. Efforts to secure IBM DB2 databases should include the removal of all permissions granted to "public", and carefully review all users within the SYSADM group. Privileges on all the system catalogs should also be revoked.  I NSTALL ALL OF THE LATEST FIXPACKS FOR IBM DB2 : Staying up-to-date on the latest FixPak minimizes your risk of being vulnerable to buffer overflows and other attacks.

SQL INJECTION SQL Injection is not an attack directly on the database. SQL Injection is caused by the way web applications are developed. It works by attempting to modify the parameters passed to a web application to change the SQL statements passed to the database.  SAMPLE : Select * from my_table where column_x = ‘1’ to Select * from my_table where column_x = ‘1’ UNION select password from DBA_USERS where ‘q’=‘q’

SQL INJECTION (cont’d) Package myseverlets; String sql = new String(“SELECT * FROM WebUsers WHERE Username=’” + request.getParameter(“username”) + “’ AND Password=’” + request.getParameter(“password”) + “’” stmt = Conn.prepareStatement(sql) Rs = stmt.executeQuery() Exploiting the problem is much simpler if one can access the source of the web page. Parsing out single quotes is a good first step, but it's recommended that you actually use parameterized SQL statements instead. SELECT * FROM WebUsers WHERE Username=’MAZHAR’ AND Password=’Hardtoguess’ SELECT * FROM WebUsers WHERE Username=’MAZHAR’ AND Password=’Aa’ OR ‘A’=‘A’

PREVENTING SQL INJECTION There are 2 strategies you can use to prevent the attacks : VALIDATE USER INPUT : Validating user input involves parsing a field to restrict the valid characters that are accepted. In most cases, fields should only accept alphanumeric characters. USE PARAMETERISED QUERIES : This involves binding variables rather than concatenating SQL statements together as strings.

DATABASE WORMS The damage caused by a worm is dependent on several factors: 1) The number of targets for the worm 2) The success rate of infection 3) The resilience of the worm

CONCLUSION Few simple tasks that can be performed to reduce security risk at a reasonable level : Stay patched Stay aware of database security holes. Explore possible third-party solutions Provide multiple levels of security : Perform audits and pen tests on your databases regularly Encryption of data in motion Encryption of data at rest within the database Monitor your log files Implement intrusion detection

REFERENCES Paper.pdf Paper.pdf _Injection.pdf _Injection.pdf