明文提交敏感數據,使用明文通訊方式傳輸、提交敏感數據java
加密後再提交或使用加密的通訊方式傳輸、提交敏感數據。web
使用了不夠隨機的隨機值算法
使用足夠隨機的隨機值,如使用java自帶Random生成隨機數,則可添加必定算法。安全
如:cookie
public void Use_of_Insufficiently_Random_Values(){session
String rans = new Random().nextInt() + "";dom
}函數
修復爲:加密
public void Use_of_Insufficiently_Random_Values_Fix(){spa
String rans = new Random().nextDouble() + "";
}
使用了沒有添加鹽值的單向散列函數
添加鹽值。
如:
public void Use_of_a_One_Way_Hash_without_a_Salt(){
String text = "";
String dtext = "";
MessageDigest md = MessageDigest.getInstance("SHA");
byte[] dbts = md.digest(text.getBytes());
dtext = new String(dbts);
}
修復爲:
public void Use_of_a_One_Way_Hash_without_a_Salt_Fix(){
String text = "";
String dtext = "";
MessageDigest md = MessageDigest.getInstance("SHA");
md.update(("" + new Random().nextDouble()).getBytes());
byte[] dbts = md.digest(text.getBytes());
dtext = new String(dbts);
}
啓用了Cookie功能。
關閉Cookie功能,只有http協議使用。
在web.xml中添加或設置以下屬性:
<session-config>
<cookie-config>
<http-only>true</http-only>
</cookie-config>
</session-config>
程序在一個未經受權的用戶能夠訪問的位置存儲了與用戶或軟件自己相關的安全狀態信息。