user_profiles
Differences
This shows you the differences between two versions of the page.
| Next revision | Previous revision | ||
| user_profiles [2018/12/06 21:05] – created 91.177.234.129 | user_profiles [2020/10/25 13:51] (current) – external edit 127.0.0.1 | ||
|---|---|---|---|
| Line 1: | Line 1: | ||
| - | ====== | + | Pete Finnigan has a set of scripts not only to hack and find exploits but also to find things like users with privileges they should not have. |
| + | * [[http:// | ||
| + | |||
| + | ==== script to show schema / user profile and the profile setup ==== | ||
| + | < | ||
| + | set lines 200 pages 1000 | ||
| + | col username | ||
| + | col dba for a5 head " | ||
| + | col status | ||
| + | col lock_date | ||
| + | col expiry_date | ||
| + | col default_tablespace for a20 head " | ||
| + | col profile | ||
| + | col pwd_verify | ||
| + | col plt for a4 head " | ||
| + | col fla for a8 head " | ||
| + | col rum for a5 head " | ||
| + | col pgt for a5 head " | ||
| + | col pwd_lok | ||
| + | |||
| + | with profile_detail as | ||
| + | ( | ||
| + | select dbp.profile | ||
| + | , dbp.resource_name | ||
| + | , decode(dbp.limit,' | ||
| + | from | ||
| + | , | ||
| + | , | ||
| + | | ||
| + | | ||
| + | ) def | ||
| + | where 1=1 | ||
| + | and dbp.resource_name | ||
| + | order by 2,1 | ||
| + | ) | ||
| + | select dbu.username | ||
| + | , decode(dba.grantee, | ||
| + | , replace( replace( replace( replace(dbu.account_status,' | ||
| + | , dbu.lock_date | ||
| + | , dbu.expiry_date | ||
| + | , dbu.default_tablespace | ||
| + | , dbu.profile | ||
| + | , pwd.limit pwd_verify | ||
| + | , plt.limit plt | ||
| + | , fla.limit fla | ||
| + | , rum.limit rum | ||
| + | , pgt.limit pgt | ||
| + | , plk.limit pwd_lok | ||
| + | from | ||
| + | , | ||
| + | | ||
| + | | ||
| + | ) dba | ||
| + | , profile_detail pwd | ||
| + | , profile_detail plt | ||
| + | , profile_detail fla | ||
| + | , profile_detail rum | ||
| + | , profile_detail pgt | ||
| + | , profile_detail plk | ||
| + | where 1=1 | ||
| + | and pwd.profile | ||
| + | and pwd.resource_name = ' | ||
| + | and plt.profile | ||
| + | and plt.resource_name = ' | ||
| + | and fla.profile | ||
| + | and fla.resource_name = ' | ||
| + | and rum.profile | ||
| + | and rum.resource_name = ' | ||
| + | and pgt.profile | ||
| + | and pgt.resource_name = ' | ||
| + | and plk.profile | ||
| + | and plk.resource_name = ' | ||
| + | and dbu.username | ||
| + | order by expiry_date | ||
| + | / | ||
| + | </ | ||
| + | |||
| + | ==== Password verification function for user profile ==== | ||
| + | < | ||
| + | FUNCTION verify_function_11g | ||
| + | (username varchar2, | ||
| + | password varchar2, | ||
| + | old_password varchar2) | ||
| + | RETURN boolean IS | ||
| + | n boolean; | ||
| + | m integer; | ||
| + | | ||
| + | | ||
| + | | ||
| + | | ||
| + | | ||
| + | | ||
| + | | ||
| + | | ||
| + | | ||
| + | | ||
| + | | ||
| + | |||
| + | BEGIN | ||
| + | | ||
| + | | ||
| + | | ||
| + | |||
| + | -- Check for the minimum length of the password | ||
| + | IF length(password) < 8 THEN | ||
| + | raise_application_error(-20001, | ||
| + | END IF; | ||
| + | |||
| + | |||
| + | -- Check if the password is same as the username or username(1-100) | ||
| + | IF NLS_LOWER(password) = NLS_LOWER(username) THEN | ||
| + | | ||
| + | END IF; | ||
| + | FOR i IN 1..100 LOOP | ||
| + | i_char := to_char(i); | ||
| + | if NLS_LOWER(username)|| i_char = NLS_LOWER(password) THEN | ||
| + | raise_application_error(-20005, | ||
| + | END IF; | ||
| + | END LOOP; | ||
| + | |||
| + | -- Check if the password is same as the username reversed | ||
| + | |||
| + | FOR i in REVERSE 1..length(username) LOOP | ||
| + | | ||
| + | END LOOP; | ||
| + | IF NLS_LOWER(password) = NLS_LOWER(reverse_user) THEN | ||
| + | | ||
| + | END IF; | ||
| + | |||
| + | -- Check if the password is the same as server name and or servername(1-100) | ||
| + | | ||
| + | if NLS_LOWER(db_name) = NLS_LOWER(password) THEN | ||
| + | raise_application_error(-20004, | ||
| + | END IF; | ||
| + | FOR i IN 1..100 LOOP | ||
| + | i_char := to_char(i); | ||
| + | if NLS_LOWER(db_name)|| i_char = NLS_LOWER(password) THEN | ||
| + | raise_application_error(-20005, | ||
| + | END IF; | ||
| + | END LOOP; | ||
| + | |||
| + | -- Check if the password is too simple. A dictionary of words may be | ||
| + | -- maintained and a check may be made so as not to allow the words | ||
| + | -- that are too simple for the password. | ||
| + | IF NLS_LOWER(password) IN (' | ||
| + | ' | ||
| + | raise_application_error(-20006, | ||
| + | END IF; | ||
| + | |||
| + | -- Check if the password is the same as oracle (1-100) | ||
| + | simple_password := ' | ||
| + | FOR i IN 1..100 LOOP | ||
| + | i_char := to_char(i); | ||
| + | if simple_password || i_char = NLS_LOWER(password) THEN | ||
| + | raise_application_error(-20007, | ||
| + | END IF; | ||
| + | END LOOP; | ||
| + | |||
| + | -- Check if the password contains at least one letter, one digit | ||
| + | -- 1. Check for the digit | ||
| + | | ||
| + | m := length(password); | ||
| + | FOR i IN 1..10 LOOP | ||
| + | FOR j IN 1..m LOOP | ||
| + | IF substr(password, | ||
| + | isdigit: | ||
| + | GOTO findchar; | ||
| + | END IF; | ||
| + | END LOOP; | ||
| + | END LOOP; | ||
| + | |||
| + | IF isdigit = FALSE THEN | ||
| + | raise_application_error(-20008, | ||
| + | END IF; | ||
| + | |||
| + | -- 2. Check for the character | ||
| + | << | ||
| + | | ||
| + | FOR i IN 1..length(chararray) LOOP | ||
| + | FOR j IN 1..m LOOP | ||
| + | IF substr(password, | ||
| + | ischar: | ||
| + | GOTO findpunct; | ||
| + | END IF; | ||
| + | END LOOP; | ||
| + | END LOOP; | ||
| + | IF ischar = FALSE THEN | ||
| + | raise_application_error(-20009, | ||
| + | END IF; | ||
| + | |||
| + | -- 3. Check for the punctuation | ||
| + | << | ||
| + | | ||
| + | FOR i IN 1..length(punctarray) LOOP | ||
| + | FOR j IN 1..m LOOP | ||
| + | IF substr(password, | ||
| + | ispunct: | ||
| + | GOTO endsearch; | ||
| + | END IF; | ||
| + | END LOOP; | ||
| + | END LOOP; | ||
| + | IF ispunct = FALSE THEN | ||
| + | raise_application_error(-20010, | ||
| + | END IF; | ||
| + | |||
| + | |||
| + | << | ||
| + | -- Check if the password differs from the previous password by at least | ||
| + | -- 3 letters | ||
| + | IF old_password IS NOT NULL THEN | ||
| + | | ||
| + | |||
| + | | ||
| + | IF differ < 3 THEN | ||
| + | IF length(password) < length(old_password) THEN | ||
| + | m := length(password); | ||
| + | | ||
| + | m := length(old_password); | ||
| + | END IF; | ||
| + | |||
| + | FOR i IN 1..m LOOP | ||
| + | IF substr(password, | ||
| + | | ||
| + | END IF; | ||
| + | END LOOP; | ||
| + | |||
| + | IF differ < 1 THEN | ||
| + | | ||
| + | old password by at least 1 characters' | ||
| + | END IF; | ||
| + | END IF; | ||
| + | END IF; | ||
| + | -- Everything is fine; return TRUE ; | ||
| + | | ||
| + | END; | ||
| + | </ | ||
| - | =====Password verification function for user profile===== | ||
| - | < | ||
user_profiles.1544130327.txt.gz · Last modified: 2018/12/06 21:05 by 91.177.234.129
