2021年7月7日 星期三

[研究][ASP.NET]Fortify SCA 報告Password Management: Empty Password 和 Hardcoded Password

[研究][ASP.NET]Fortify Static Code Analyzer (SCA) 報告Password Management: Empty Password 和 Hardcoded Password

2021-07-07
2022-06-13

Password Management: Empty Password



string oldPwd = "";   

改成


string oldPwd = "empty";   
  

掃描結果不再 Empty Password 問題,但是出現 Password Management: Hardcoded Password 問題

改成 ( 其他地方 oldPwd 都改名 oldPawd)


string oldPawd = "";   

疑似 Fortify SCA 源碼檢檢測時把 Pwd 當成是密碼相關設定,變數名稱不要包含它就好。

目前已知,變數名稱包含 Pwd 或 Password 則  Fortify SCA 會懷疑它可能是密碼;變數名稱包含 PW 或 Pawd 不會。

ASP.NET 控制項(Control) 的名稱包含 Password 就沒關係,例如 TextBox 的名稱是 TextBoxPassword 是不會被報告的。

********************************************************************************

2022-06-13

Credentials那行賄出現 Password Management: Hardcoded Password 問題

SmtpClient smtp1 = new SmtpClient("SMTP郵件伺服器網址");
smtp1.Credentials = new System.Net.NetworkCredential("寄信帳號", " 寄信密碼");

Recommendations:

請勿將密碼硬式編碼,且通常應該要將密碼模糊化,並於外部資源中進行管理。 將密碼以純文字方式儲存於系統的任一處,任何有足夠權限的人都可以讀取密碼,並可能誤用密碼。

Microsoft(R) 提供了一個工具,可以與 Windows Data Protection application programming interface (DPAPI) 一起使用以保護組態設定檔案中敏感的應用程式項目 [1]。

Tips:

1. 為識別 null、Empty Password 或 Hardcoded Password,預設規則只考慮包含 password 一詞的欄位及變數。然而,Fortify Custom Rules Editor 會提供 Password Management 精靈,方便您建立規則來偵測自訂名稱欄位與變數的密碼管理問題。

(完)

相關

[研究][ASP.NET]Fortify SCA 報告Password Management: Empty Password 和 Hardcoded Password
http://shaurong.blogspot.com/2021/07/aspnetfortify-sca-password-management.html

[研究][ASP.NET]Fortify Static Code Analyzer (SCA) 報告從資料庫取得資料直接顯示於 Label 可能 Cross-Site Scripting: Persistent (XSS)
https://shaurong.blogspot.com/2021/07/aspnetfortify-static-code-analyzer-sca.html

[研究] Microsoft Anti-XSS Library V4.3 (Anti-Cross Site Scripting Library) 與 AntiXssEncoder.HtmlEncode
http://shaurong.blogspot.com/2017/06/microsoft-anti-xss-library-v43-anti.html

[研究] Microsoft Anti-XSS Library V4.3 (Anti-Cross Site Scripting Library)
https://shaurong.blogspot.com/2017/06/microsoft-anti-xss-library-v43-anti.html

AntiXssEncoder.HtmlEncode 方法 (System.Web.Security.AntiXss) | Microsoft Docs
https://docs.microsoft.com/zh-tw/dotnet/api/system.web.security.antixss.antixssencoder.htmlencode?view=netframework-4.8

[研究][ASP.NET] 用了 AntiXssEncoder.HtmlEncoder 仍被 Fortify SCA v17.20 說有問題
https://shaurong.blogspot.com/2018/04/aspnet-antixssencoderhtmlencoder.html

[研究] [ASP.NET] DropDownList1 的 Cross-site scripting (XSS) (Reflected XSS) 修正
https://shaurong.blogspot.com/2017/09/aspnet-dropdownlist1-cross-site.html

[研究] [ASP.NET] Cross-Site Scripting(XSS) 防範,白名單輸入驗證
https://shaurong.blogspot.com/2019/06/aspnet-cross-site-scriptingxss.html

[研究] X-XSS Protection
https://shaurong.blogspot.com/2017/06/x-xss-protection.html

[研究][ASP.NET][C#]Fortify SCA 報告 Eval()有 Cross-Site Scripting: Persistent解法
https://shaurong.blogspot.com/2020/10/aspnetcfortify-sca-eval-cross-site.html

[研究] Fortify SCA 19.10 與 jquery-3.3.1-vsdoc.js, line 812 (Dynamic Code Evaluation Code Injection)
https://shaurong.blogspot.com/2019/07/fortify-sca-1910-jquery-331-vsdocjs.html

[研究] Fortify SCA 報告 Web.Config 連線資訊有 Insecure Transport: Database 問題
https://shaurong.blogspot.com/2018/12/fortify-sca-webconfig.html

[研究][ASP.NET] Fortify SCA v17.20 報告 Web.config ( Insecure Transport: Datbase) Critical 問題
https://shaurong.blogspot.com/2018/04/aspnet-fortify-sca-v1720-webconfig.html

[研究][JavaScript] CKeditor 4.9.1 與 Fortify SCA v17.20
https://shaurong.blogspot.com/2018/04/javascript-ckeditor-491-fortify-sca.html

[研究][ASP.NET][JavaScript] hideShowPassword 與 Fortify SCA 白箱測試
https://shaurong.blogspot.com/2018/04/aspnetjavascript-hideshowpassword.html



沒有留言:

張貼留言