2019-06-25
原始
string caption = DropDownList1.SelectedValue; GridView1.Caption = caption; |
修改後 (白名單 White List 做檢查),分別使用 caption0 和 caption 變數
// Cross-site scripting (XSS) (Reflected XSS) 修正 string caption0 = DropDownList1.SelectedValue; switch (caption0) { case "香蕉": caption = "香蕉"; break; case "香蕉": caption = "香蕉"; break; } GridView1.Caption = caption; |
失敗的修改 (沒有另外使用變數,白箱測試工具 ( 源碼檢測) 可能仍會判斷為有問題
// Cross-site scripting (XSS) (Reflected XSS) 修正 string caption = DropDownList1.SelectedValue; switch (caption) { case "香蕉": caption = "香蕉"; break; case "香蕉": caption = "香蕉"; break; } GridView1.Caption = caption; |
(待續)
相關
[研究] Microsoft Anti-XSS Library V4.3 (Anti-Cross Site Scripting Library)
https://shaurong.blogspot.com/2017/06/microsoft-anti-xss-library-v43-anti.html
[研究][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
沒有留言:
張貼留言