Contents

About the Authors

Preface

Acknowledgments

Introduction

Part I Introduction

Chapter 1 Why Care About Database Security?

Which Database Is the Most Secure?

The State of Database Security Research

Classes of Database Security Flaws

Unauthenticated Flaws in Network Protocols

Authenticated Flaws in Network Protocols

Flaws in Authentication Protocols

Unauthenticated Access to Functionality

Arbitrary Code Execution in Intrinsic SQL Elements

Arbitrary Code Execution in Securable SQL Elements

Privilege Elevation via SQL Injection

Local Privilege Elevation Issues

So What Does It All Mean?

Finding Flaws in Your Database Server

Don't Believe the Documentation

Implement Your Own Client

Debug the System to Understand How It Works

Identify Communication Protocols

Understand Arbitrary Code Execution Bugs

Write Your Own “Fuzzers”

Conclusion

Part II Oracle

Chapter 2 The Oracle Architecture

Examining the Oracle Architecture

Oracle Processes and Oracle on the Network

The Oracle TNS Listener

The Oracle RDBMS

The Oracle Intelligent Agent

Oracle Authentication and Authorization

Database Authentication

Authorization

Key System Privileges

EXECUTE ANY PROCEDURE

SELECT ANY DICTIONARY

GRANT ANY PRIVILEGE / ROLE / OBJECT PRIVILEGE

CREATE LIBRARY

Oracle Auditing

Chapter 3 Attacking Oracle

Scanning for Oracle Servers

Common Ports

The TNS Listener

Oracle's PL/SQL

PL/SQLInjection

Injecting into SELECT Statements

A Simple Example

Injecting Attacker-Defined Functions to Overcome Barriers

Doing More Than Just SELECT

Injecting into DELETE, INSERT, and UPDATE Statements

Injecting into INSERT Statements

Real-World Examples

Injecting into Anonymous PL/SQL Blocks

Real-World Examples

Executing User-Supplied Queries with DBMS_SQL

Real-World Examples

PL/SQL Injection and Database Triggers

PL/SQL and Oracle Application Server

Summary

Chapter 4 Oracle: Moving Further into the Network

Running Operating System Commands

Running OS Commands with PL/SQL

Running OS Commands with DBMS_SCHEDULER

Running OS Commands with Java

Accessing the File System

Java and the File System

Accessing the Network

Database Links

PL/SQL and the Network

UTL_TCP

UTL_HTTP

UTL_SMTP

Summary

Chapter 5 Securing Oracle

Oracle Security Recommendations

Oracle TNS Listener

Set a TNS Listener Password

Turn on Admin Restrictions

Turn on TCP Valid Node Checking

Turn off XML Database

Turn off External Procedures

Encrypt Network Traffic

Oracle Database Server

Accounts

Lock and Expire Unused Accounts

New Account Creation

Passwords

Roles

New Role Creation

Roles for User Accounts

DBARole

Auditing

PL/SQL Packages, Procedures, and Functions

Triggers

Patching

Security Audits

New Database Installs

New Database Creation

Part III DB2

Chapter 6 IBM DB2 Universal Database

Introduction

DB2 Deployment Scenarios

DB2 on the Network

Header

Commands

Datatypes

DB2 Processes

DB2 Physical Database Layout

DB2 on Windows

DB2 on Linux

DB2 Logical Database Layout

DB2 Authentication and Authorization

Authorization

The DBAUTH View

The TABAUTH View

The ROUTINEAUTH View

Summary

Chapter 7 DB2: Discovery, Attack, and Defense

Finding DB2 on the Network

Chapter 8 Attacking DB2

Buffer Overflows in DB2 Procedures and Functions

Other Overflows in DB2

DB2 Set Locale LCTYPE Overflow

DB2 JDBC Applet Server Buffer Overflow

DB2 Remote Command Server

Running Commands Through DB2

Gaining Access to the Filesystem Through DB2

The Load Method

XMLFunctions

Local Attacks Against DB2

Summary

Chapter 9 Securing DB2

Securing the Operating System

Securing the DB2 Network Interface

Securing the DBMS

Remove Unnecessary Components

And Finally . . .

Part IV Informix

Chapter 10 The Informix Architecture

Examining the Informix Architecture

Informix on the Network

Connecting to a Remote Informix Server

The Informix Logical Layout

Understanding Authentication and Authorization

Connect

Resource

DBA

Object Privileges

Privileges and Creating Procedures

Chapter 11 Informix: Discovery, Attack, and Defense

Attacking and Defending Informix

Post-Authentication Attacks

Shared Memory, Usernames, and Passwords

Attacking Informix with Stored Procedural Language (SPL)

Running Arbitrary Commands with SPL

Loading Arbitrary Libraries

Reading and Writing Arbitrary Files on the Server

SQL Buffer Overflows in Informix

Local Attacks Against Informix Running on Unix Platforms

Summary

Chapter 12 Securing Informix

Keep the Server Patched

Encrypt Network Traffic

Revoke the Connect Privilege from Public

Enable Auditing

Revoke Public Permissions on File Access Routines

Revoke Public Execute Permissions on Module Routines

Preventing Shared Memory from Being Dumped

Preventing Local Attacks on Unix-Based Servers

Restrict Language Usage

Useful Documents

Part V Sybase ASE

Chapter 13 Sybase Architecture

Sybase Background

History

Stand-Out Features

Java-In-ASE

XML Support (Native and via Java)

Cross-Platform Support

Wider “Device” Support (for Raw Disk Partitions)

Support for Open Authentication Protocols

Deployment Scenarios

Client/Server

Web Applications

Development Environments

Firewall Implications for Sybase

Communicating with Sybase

Privilege Model

Login Account Basics

Passwords and Password Complexity

Roles

Sybase File Layout

Service Interaction

Extended Stored Procedures

Starting New Listeners

Chapter 14 Sybase: Discovery, Attack, and Defense

Finding Targets

Scanning for Sybase

Sybase Version Numbers

Snooping Authentication

Attacking Sybase

SQL Injection in Sybase

SQL Injection Basics

MS SQL Server Injection Techniques in Sybase

Comments

Union Select

Error Messages

@@version

Having/Group By

SQL Batch Injection

xp_cmdshell

xp_regread

Custom Extended Stored Procedures

CHAR Function to Bypass Quote Filters

SHUTDOWN

Audit Evasion via sp_password

Linked Servers

Using Time Delays as a Communications Channel

VARBINARY Literal Encoding and Exec

External Filesystem Access

Defending Against Attacks

Older Known Sybase ASE Security Bugs

CAN-2003-0327 — Remote Password Array Overflow

DBCC CHECKVERIFY Buffer Overflow

DROP DATABASE Buffer Overflow Vulnerability

xp_freedll Buffer Overflow

Sybase Version Tool

Chapter 15 Sybase: Moving Further into the Network

Accessing the Network

Connecting to Other Servers with Sybase

Java in SQL

JSQL TDS Client

JSQL TCP Proxy

Trojanning Sybase

Grant a User sa or sso_role

Allow Direct Updates to System Tables, Grant Access to Selected System Tables

Chapter 16 Securing Sybase

Sybase Security Checklist

Background

Operating System

Sybase Users

Sybase Configuration

Background

Operating System

Sybase Users

Sybase Configuration

Part VI MySQL

Chapter 17 MySQL Architecture

Examining the Physical Database Architecture

Deployment

WinMySQLAdmin Autostart

Default Usernames and Passwords

Protocol

Bugs in the Authentication Protocol

Basic Cryptographic Weakness in the Authentication Protocol Prior to 4.1

Authentication Algorithm Prior to 3.23.11

CHANGE_USER Prior to 3.23.54

Authentication Algorithm in 4.1.1, 4.1.2, and 5.0.0

Examining the Logical Database Architecture

MySQL Logical Database Architecture

Storage Engines

Filesystem Layout

Query Batching

Examining Users and Groups

Exploiting Architectural Design Flaws

User-Defined Functions

Flaws in the Access Control System

Missing Features with Security Impact

Missing Features That Improve Security

Chapter 18 MySQL: Discovery, Attack, and Defense

Finding Targets

Scanning for MySQL

MySQL Version Numbers

Snooping Authentication

Hacking MySQL

SQL Injection in MySQL

UNION SELECT

LOAD_FILE Function

LOAD DATA INFILE Statement

SELECT . . . INTO OUTFILE

Time Delays and the BENCHMARK Function

Known MySQL Bugs

Trojanning MySQL

Adding a User

Modification of an Existing User's Privileges

Cracking Password Hashes

The MySQL One-Bit Patch

Dangerous Extensions: MyLUA and MyPHP

Local Attacks Against MySQL

Race Conditions

Overflows

The MySQL File Structure Revisited

Chapter 19 MySQL: Moving Further into the Network

MySQL Client Hash Authentication Patch

Running External Programs: User-Defined Functions

User-Defined Functions in Windows

Summary

Chapter 20 Securing MySQL

MySQL Security Checklist

Background

Operating System

MySQLUsers

MySQLConfiguration

Routine Audit

Background

Operating System

MySQLUsers

MySQLConfiguration

Routine Audit

Part VII SQL Server

Chapter 21 Microsoft SQL Server Architecture

SQL Server Background

SQL Server Versions

Physical Architecture

Tabular Data Stream (TDS) Protocol

Network Libraries

SQL Server Processes and Ports

Authentication and Authorization

OPENROWSET Re-Authentication

Logical Architecture

Stored Procedures

Stored Procedure Encryption

Bypassing Access Controls

Uploading Files

Extended Stored Procedure Trojans

Global Temporary Stored Procedures

Triggers

Users and Groups

Account Information

Common Accounts

Roles

Password Encryption

SQL Server Agent Password

Role Passwords

DTS Package Passwords

Replication Passwords

Chapter 22 SQL Server: Exploitation, Attack, and Defense

Exploitation

Exploiting Design Flaws

The SQL Slammer Overflow

x08 Leading Byte Heap Overflow

x0A Leading Byte Network DoS

Client Overflows

SQLInjection

System-Level Attacks

Alternative Attack Vectors

Time Delays

Stored Procedures

Port Scanning

Batched Queries

Defending Against SQL Injection

Covering Tracks

Three-Byte Patch

XSTATUS Backdoor

Start-Up Procedures

Chapter 23 Securing SQL Server

Installation

Step 1: Authentication

Step 2: Password Strength

Step 3: Operating System Lockdown

Step 4: Post-Installation Lockdown

Configuration

Step 5: Configure Network Libraries

Step 6: Configure Auditing and Alerting

Step 7: Lock Down Privileges

Step 8: Remove Unnecessary Features and Services

Step 9: Remove Stored Procedures

Step 10: Apply Security Patches

Part VIII PostgreSQL

Chapter 24 The PostgreSQL Architecture

Examining the Physical Database Architecture

Secure Deployment

Common Deployment Scenarios

Terminology

The PostgreSQL File Structure

Protocols

Authentication

The System Catalogs

Examining Users and Groups

Stored Procedures

Chapter 25 PostgreSQL: Discovery and Attack

Finding Targets

The PostgreSQL Protocol

Network-Based Attacks Against PostgreSQL

Network Sniffing

ARP Spoofing and TCP Hijacking

Ident Spoofing

Information Leakage from Compromised Resources

Known PostgreSQL Bugs

Configuration Vulnerabilities

Code Execution Vulnerabilities

Vulnerabilities in PostgreSQL Components

SQL Injection with PostgreSQL

Useful Built-In Functions

Using Time Delay on PostgreSQL 8.0

SQL Injection in Stored Procedures

SQL Injection Vulnerabilities in Other Applications

Interacting with the Filesystem

Large Object Support

Using Extensions via Shared Objects

The LOAD Command

Summary

Chapter 26 Securing PostgreSQL

Appendix A Example C Code for a Time-Delay SQL Injection Harness

Appendix B Dangerous Extended Stored Procedures

Registry

System

E-Mail

OLE Automation

Appendix C Oracle Default Usernames and Passwords

Index

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
3.145.50.183