When it comes to the conception and implementation of a central user administration of Oracle databases, authentication is one of the central topics. Often there is a need for integration with an existing directory service or IAM solution. Whereby usually MS Active Directory is involved. But Oracle Databases and MS Active Directories are not yet best friends. In this blog post we will explain why this is so, with a focus on authentication.
A few Basics
Oracle Databases does provide a couple of authentication methods. This includes among others the following:
- Password authentication
- OS authentication
- Kerberos authentication
- SSL authentication
All methods have their advantages and disadvantages and thus their justification. But now let’s speak about password authentication. This works basically always the same way, no matter if database or directory based. The picture below shows the schematic diagram of the password authentication process.
- The user does send the logon request with its username to the database.
- The database generates a session key, to encrypt communication.
- The client generates the password hash and sends it encrypted to the DB server.
- The database now compares the password hashes.
- either the hash from USER$
- or the hash from the directory server
The key aspect is that the database always verifies the password hashes. Either with the hash in the database or, in case of directory-based authentication, with the hash from the directory. The process is used when using Oracle Centrally Managed Users (CMU) but also with Oracle Enterprise User Security in combination with an Oracle Directory e.g. Oracle Unified Directory EUS AD Proxy. In case of a regular LDAP directory, the hash is read from userPassword or another attribute. However, this is not possible in MS Active Directory, where passwords are stored internally in the Security Account Manager (SAM) and cannot be read directly. This is one of the reasons why Active Directory is not fully LDAP v3 compliant. But that is an other story 😉
This is now the moment where the Oracle password filter comes into play. Microsoft does provide a functionality within Windows called password filter. These filters provide a way to implement password policies and change notification. When a password change request is made, the Local Security Authority (LSA) calls the password filters registered on the system. Each password filter is called twice: first to validate the new password and then, after all filters have validated the new password, to notify the filters that the change has been made. The following illustration shows this process.
Oracle Password Filter
The Oracle password filter solves relatively simply the problem that the hash cannot be read. The filter uses the password change notification and stores the password accordingly in an additional LDAP attribute. The database or directory server on the other hand is then able to read the user password hash. Oracle Databases and Active Directory starts to like each other 🤓. But usually Windows or Security Admins are not so happy any more. The fact that a foreign DLL has to be installed on the domain controller sometimes causes headaches or just endless discussions…
The latest version of the password filter is delivered as EXE file opwdintg.exe. It is part of any Oracle Database binaries as of release 18c. Older version of Oracle Database, Oracle Internet Directory and Oracle Unified Directory do also include the password filter in an other form e.g. setup.exe or a jar file. Nevertheless it is crucial, that you get the latest version which is right now part of Oracle Database 19.8.0.0. This is also the valid version when you use OUD or OID, see MOS Note 2640135.1 How to Get the Latest oidpwdcn.dll (New Name orapwdfltr.dll). Alternatively you can also download a generic patch 23191994 for fusion middleware.
But what exactly happens when you install the Oracle password filter? Oracle performs the following steps during installation:
- Add an Active Directory schema extension for an additional user attribute orcleCommonAttribute. Once installed a schema extension can not be removed any more.
- Create some generic groups to control the password filter plugin. The filter will only update the orcleCommonAttribute attribute for users which are part directly or indirectly of one of the group.
- ORA_VFR_MD5 is required when the Oracle Database WebDAV client is used
- ORA_VFR_11G enables the use of the Oracle Database 11G password verifier
- ORA_VFR_12C enables the use of the Oracle Database 12C password verifier
- Install the Oracle password filter DLL orapwdfltr.dll. This requires a reboot of the domain controller.
The following screenshots show the installation of the Oracle password filer.
After a reboot the installation of the Oracle password filter is finished. Now let’s see what’s new there. First we review the AD schema change. This can be done by starting the Microsoft Management Console (MMC) and open the Active Directory Schema Snap-In. See the old documentation install the Schema Snap-In if the snap-in is not available. The following screenshot does show the details about the new attribute.
In the registry we see under LSA an additional entry for the notification packages. orapwdfltr the name of the DLL installed on the domain server.
And finally the new groups and the new attribute orcleCommonAttribute.
Although the attribute orcleCommonAttribute in the picture below does only get propagated after a password reset. The user KING is part of the group Trivadis LAB Users. This group itself is member of ORA_VFR_11G.
Yeah, but it’s an Oracle tool…
In one of my many conversations with customers about these password filters I was asked if they could examine the source code. Mmm, no! It is quite common that neither Oracle nor Microsoft publish their source code. In this case Oracle uses an API or functionality defined and documented by Microsoft. But this does not convince everyone. That’s why I have tried to investigate this in detail. One of my first attempts was a test if I can decompile the DLL. This would be possible if it is written in .net or something similar, but not with C or C++. You can use an online disassembler, but the result will not help you.
Analysis of the executable installation file opwdintg.exe with exiftool, reveal that it is only a self extracting cabinet.
exiftool opwdintg.exe
ExifTool Version Number : 12.00
File Name : opwdintg.exe
Directory : .
File Size : 193 kB
File Modification Date/Time : 2020:09:04 06:17:15+02:00
File Access Date/Time : 2020:09:04 06:18:43+02:00
File Inode Change Date/Time : 2020:09:04 06:17:15+02:00
File Permissions : rw-r--r--
File Type : Win64 EXE
File Type Extension : exe
MIME Type : application/octet-stream
Machine Type : AMD AMD64
Time Stamp : 2013:10:14 08:48:22+02:00
Image File Characteristics : Executable, Large address aware
PE Type : PE32+
Linker Version : 11.0
Code Size : 32768
Initialized Data Size : 163840
Uninitialized Data Size : 0
Entry Point : 0x7f1c
OS Version : 6.3
Image Version : 6.3
Subsystem Version : 5.2
Subsystem : Windows GUI
File Version Number : 11.0.9600.16428
Product Version Number : 11.0.9600.16428
File Flags Mask : 0x003f
File Flags : (none)
File OS : Windows NT 32-bit
Object File Type : Executable application
File Subtype : 0
Language Code : English (U.S.)
Character Set : Unicode
Company Name : Microsoft Corporation
File Description : Win32 Cabinet Self-Extractor
File Version : 11.00.9600.16428 (winblue_gdr.131013-1700)
Internal Name : Wextract
Legal Copyright : © Microsoft Corporation. All rights reserved.
Original File Name : WEXTRACT.EXE .MUI
Product Name : Internet Explorer
Product Version : 11.00.9600.16428
You can invoke the executable with two additional parameters C and T to extract the content into the directory specified with T.
c:\vagrant>opwdintg.exe /C /T:c:\vagrant\opwdintg
In the directory you will find three files:
- instpflt.bat Batch file used to install the password filter.
- etadschm.bat Batch file used to do the schema extension for orcleCommonAttribute and create the 3 AD groups.
- orapwdfltr.dll the Oracle password filter dll itself.
Even if you cannot decompile orapwdfltr.dll, you can still examine the batch files. As expected, the batch files do exactly what we have already verified graphically above. Schema extension, create groups and register Oracle password filter.
With pev, a PE file analysis toolkit, we can check other stuff like the functions exported by the DLL. As you can see in the output below, the functions correspond to Microsoft’s specifications for password filters. An indication that the DLL does what it should. However, pev provides other tools to analyse the DLL, hashes, import functions etc. But we will skip that at this point.
readpe --exports orapwdfltr.dll
Exported functions
Library
Name: orapwdfltr.dll
Functions
Function
Ordinal: 1
Address: 0x1080
Name: InitializeChangeNotify
Function
Ordinal: 2
Address: 0x2ea0
Name: PasswordChangeNotify
Function
Ordinal: 3
Address: 0x1080
Name: PasswordFilter
A few words about Security
But what about security? There are basically two aspects. First, the fact that the DLL is a rather critical component. There are known malware that exploit exactly this method to get the passwords. It is therefore a best practice to configure LSA security to allow only signed DLLs for LSA. Ok, besides that you should also know which DLL you have installed and why. But here we are at the point where it gets a bit difficult. Oracle has forgotten to sign orapwdfltr.dll in the past. Therefore, if LSA security is enabled the password filter will not work. See also MOS note 2612535.1 or 2616566.1. Among other things, Oracle has proposed to turn off the LSA security. Certainly not the way to go. But luckily there is already a bug 31134430 and patch 23191994 available for this issue. The fix does include a signed version of the orapwdfltr.dll, as you can see in the following code block.
signtool.exe verify /pa /v orapwdfltr.dll
Verifying: orapwdfltr.dll
Signature Index: 0 (Primary Signature)
Hash of file (sha256): 2A14712107D424FF5577EF5C3D111CF66DB40F6226047ADC4F31389D69F437EB
Signing Certificate Chain:
Issued to: VeriSign Class 3 Public Primary Certification Authority - G5
Issued by: VeriSign Class 3 Public Primary Certification Authority - G5
Expires: Wed Jul 16 16:59:59 2036
SHA1 hash: 4EB6D578499B1CCF5F581EAD56BE3D9B6744A5E5
Issued to: Symantec Class 3 Extended Validation Code Signing CA - G2
Issued by: VeriSign Class 3 Public Primary Certification Authority - G5
Expires: Sun Mar 03 16:59:59 2024
SHA1 hash: 5B8F88C80A73D35F76CD412A9E74E916594DFA67
Issued to: Oracle America Inc.
Issued by: Symantec Class 3 Extended Validation Code Signing CA - G2
Expires: Wed Jan 27 16:59:59 2021
SHA1 hash: 1CB08E9B70B917E64407A4F2665799D58B171F89
The signature is timestamped: Wed Apr 22 18:33:05 2020
Timestamp Verified by:
Issued to: DigiCert Assured ID Root CA
Issued by: DigiCert Assured ID Root CA
Expires: Sun Nov 09 17:00:00 2031
SHA1 hash: 0563B8630D62D75ABBC8AB1E4BDFB5A899B24D43
Issued to: DigiCert SHA2 Assured ID Timestamping CA
Issued by: DigiCert Assured ID Root CA
Expires: Tue Jan 07 05:00:00 2031
SHA1 hash: 3BA63A6E4841355772DEBEF9CDCF4D5AF353A297
Issued to: TIMESTAMP-SHA256-2019-10-15
Issued by: DigiCert SHA2 Assured ID Timestamping CA
Expires: Wed Oct 16 17:00:00 2030
SHA1 hash: 0325BD505EDA96302DC22F4FA01E4C28BE2834C5
Successfully verified: orapwdfltr.dll
Number of files successfully Verified: 1
Number of warnings: 0
Number of errors: 0
Alternatively you can also check the windows property of orapwdfltr.dll.
The other security challenge is the password hash itself. In a regular LDAP, ACIs are usually defined to restrict access to password attributes. However, no ACIs are defined when installing the Oracle password filter. It is therefore strongly recommended to restrict access to this attribute. Generally only the Oracle service accounts, which are used to setup Oracle AD integration, has to read it.
Conclusion
When my workmate Martin Berger published his blog post about the issue with LSA and the password filter, there was no official solution beside disabling LSA security. Fortunately it is a bit better in the meantime. The bug fix did found its way in the latest release of Oracle Database 19c (19.8.0.0) and in the generic fusion middleware patch 23191994. This official signed version of the password filter can be used for either Oracle Centrally Managed Users (CMU), Oracle Enterprise User Security (EUS) or Oracle Unified Directory DIP. It is a fact that this password filter means a change on the domain server. Every change represents a potential risk. Nevertheless, this change is comprehensible and is, according to Microsoft, a documented procedure. By carefully assigning the Oracle groups (ORA_VFR_11g, ORA_VFR_11C, etc), you can ensure that only those users who need the hash in orcleCommonAttribute have set it. It is also recommended to define ACIs to limit access to orcleCommonAttribute restrictively.
SSL and Kerberos authentication are basically secure methods. Additionally these authentication methods allow Single Sign On. Unfortunately, practice shows that many tools cannot handle this. Password authentication on the other hand offers greater flexibility. The Oracle password filter is not bad nor dangerous. In my humble opinion it is worth to consider this solution.
References
A few links related to this blog post:
- Blog post by my workmate Martin Berger about Oracle EUS authentication with LSA activated on AD Thanks for bringing up this topic at Trivadis as well with Oracle Support
- Oracle Enterprise User Security AD Integration
- Oracle Support Note 2640135.1 OUD 12c – How to Get the Latest oidpwdcn.dll (New Name orapwdfltr.dll)
- Oracle Support Note 2612535.1 EUS Login Failure of AD Users Proxied by OUD: LdapErr: DSID-0C090CE0, comment: Error in attribute conversion operation
- Oracle Support Note 2616566.1 OUD 11g – OIDPWDCN.DLL Plug-in Fails On AD 2012 R2 With Error “The password notification DLL oidpwdcn failed to load with error 577”
- Oracle Bug 31134430 need to have orapwdfltr.dll signed by Microsoft.
- Oracle Patch 23191994 “signed” version of the oidpwdcn.dll for Oracle Unified Directory.
- Microsoft Windows Dev Center Password Filter Programming Considerations
- Microsoft Windows Dev Center Installing and Registering a Password Filter DLL
- Microsoft Windows Dev Center Password Filter
- Microsoft Windows Dev Center Password Filter Functions
- pev the PE file analysis toolkit
- ExifTool by Phil Harvey
- stackoverflow discussion about the signtool
Amazing and very detailed post. Thanks for sharing all this info and research!
Thank you. I hope this will make it easier to install the password filter in some projects.