漏洞解決方案 口令複雜度校驗

2021-10-23 17:59:07 字數 1451 閱讀 6173

在當今很多地方以使用者名稱和口令作為鑑權的世界,口令的重要性就可想而知了。口令就相當於進入家門的鑰匙。口令複雜度不強,很容易被他人猜到或破解,因此,應用系統應對複雜度進行校驗,防止弱口令的產生。

威脅描述:

如果口令被他人猜到或者破解,他人即可登入系統,進行非授權操作,造成不必要的損失。

涉及功能點:

密碼設定、密碼修改、密碼重置、登入。

應用系統在密碼設定、密碼修改、密碼重置時,應對口令複雜度進行校驗,防止弱口令的產生;

亦可在登入模組,對口令複雜度進行校驗,發現弱口令可拒絕登入或通過其他認證方式(如簡訊驗證碼)修改登入密碼;

避免使用預設口令,如使用預設口令,應在使用者第一次登入時,強制修改預設口令。

安全開發例項:

public

class

passwordutil

]+";

// 數字

static string regex_lower =

"[\\p]+"

;// 小寫字母

static string regex_upper =

"[\\p]+"

;// 大寫字母

static string regex_char =

"[\\p]+"

;// 特殊字元

public

static

boolean

matchespass

(string user_username,string user_password)

if(user_password==user_username)

if(user_password.

length()

<8)

if(user_password.

matches

(regex_number)

|| user_password.

matches

(regex_upper)

|| user_password.

matches

(regex_lower)

|| user_password.

matches

(regex_char)

)return

true;}

}

正規表示式校驗密碼複雜度

public

static

void

main

(string[

] args)

throws exception $";if

(!password.

matches

(regex)

|username==password)

}

修改密碼複雜度校驗

linux對應的密碼策略模組有 pam passwdqc 和 pam pwquality 其中pam passwdqc模組對應的是 etc login.defs,pam pwquality對應的是 etc security pwquality.conf 模組的新增方法 etc pam.d passw...

linux 身份鑑別口令複雜度整改

口令複雜度 1 首先安裝apt install libpam cracklib y 2 vim etc pam.d common password 3 在第2步末尾新增password requisite pam cracklib.so retry 3 minlen 10 difok 3 ucred...

漏洞解決方案 交易重放

重放攻擊 replay attacks 又稱重播攻擊 回放攻擊,是指攻擊者傳送乙個目的主機已接收過的包,來達到欺騙系統的目的,主要用於身份認證過程,破壞認證的正確性。重放攻擊可以由發起者,也可以由攔截並重發該資料的敵方進行。攻擊者利用網路監聽或者其他方式盜取認證憑據,之後再把它重新發給認證伺服器。重...