Oracle Database Protection Mechanism Bypass

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,, and are affected.

MD5 | b8dbe3dfe417d57ece64f6942338e272

Advisory ID:               SYSS-2021-061 
Product: Database
Manufacturer: Oracle
Affected Version(s):,, 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



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


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

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

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.

> ./ --targethost --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 [...]
[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 - Production\nVersion'

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[...]'



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


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

More information: (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



[1] Product website for Oracle Database
[2] SySS Security Advisory SYSS-2021-061
[3] SySS Responsible Disclosure Policy
[4] Paper "Oracle Native Network Encryption"



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

E-Mail: [email protected]
Public Key:
Key ID: 0x768EFE2BB3E53DDA
Key Fingerprint: 2C8F F101 9D77 BDE6 465E CCC2 768E FE2B B3E5 3DDA



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.



Creative Commons - Attribution (by) - Version 3.0

Related Posts