So last weekend I spent 15 minutes extracting the code from the PL/SQL cracker and making it into an installable function. I have created a function called "testpwd" and its available in a file called testpwd.sql and also available via my Oracle security tools page. The function is easy to use. Simply create a user, grant CREATE SESSION, CREATE PROCEDURE and as SYS GRANT SELECT ON SYS.USER$ to the user and install the function. Then test it. The set up is shown here:
|
Then its simple to test the function. Imagine you want to verify that SCOTT's password is TIGER - which it is in this database then the function simply returns "Y" and then if a wrong password, in this case BLOB is passed the function returns "N". This means that the function can be used to verify passwords. Here is the sample test:
|
We can now do what is possible inside the password verification function but outside that function. If you change passwords and want to check whether the same password is reused in a password verification function this is done because both the old and new passwords are available to test. This is not the case anywhere else and sometimes it is desirable to be able to verify old and new passwords.
Hopefully this function is useful?
May 11th, 2009 at 04:46 pm
Pete Finnigan says:
Dear mr. Finnigan
Great function, I really enjoy your posts.
You might want to include a few calls to the upper function before checking the username/password OR include a comment in the code, that input should be in upper case as the following test shows.
Best wishes,
Kennie Nybo Pontoppidan
SQL> create user pete identified by pete;
User created.
SQL> select testpwd('pete', 'pete' ) from dual;
TESTPWD('PETE','PETE')
---------------------------------------------------
N
SQL> select testpwd('PETE', 'pete' ) from dual;
TESTPWD('PETE','PETE')
---------------------------------------------------
N
SQL> select testpwd('pete', 'PETE' ) from dual;
TESTPWD('PETE','PETE')
---------------------------------------------------
N
SQL> select testpwd('PETE', 'PETE' ) from dual;
TESTPWD('PETE','PETE')
---------------------------------------------------
Y