慎防國際化中的language引數XSS注入

2021-08-30 19:00:30 字數 961 閱讀 5070

最近使用的xwiki又被安全中心眷顧了,掃瞄到乙個新的xss漏洞。 由於xwiki是乙個國外的開源論壇,做過國際化處理,支援多語言, 於是在頁面上存在一些這樣的**:

注意這些編碼串,全部是動態獲取的,**如下:

於是,**就誕生了!

?language=">&viewer=changes

這段注入**去">

alert()> 嘗試過,該**有做過處理,攻擊不會成功。

/xwiki/templates/htmlheader.vm  

這個公用的頁頭。

目前我的解決方案是,用xwiki提供的模板函式replaceall來過濾特殊字元。<>/

", ">").replaceall("/", " ")" />
下面也順帶把各種過濾條件都列出來,方便後期當手冊翻閱:

html元素過濾字元集合

ignorehtmlelementstable.put('<', "<");

ignorehtmlelementstable.put('>', ">");

ignorehtmlelementstable.put('\'', "'");

ignorehtmlelementstable.put('\"', """);

ignorehtmlelementstable.put('&', "&");

html屬性過濾字元集合

ignorehtmlattributestable.put('=', "=");

ignorehtmlattributestable.put('`', "`");

xml元素、屬性過濾字元集合

ignorexmlelementstable.put('\'', "'");

Vue中的國際化

單純記錄使用過程中遇到的問題,基礎的用法看官網的就行了官網位址 1.script標籤裡面使用國際化,例如在methods裡面使用 methods 在html標籤屬性中使用,例如在placeholder中使用 type lock lock password text placeholder t log...

軟體國際化值頁面國際化

國際化 軟體的國際化 軟體開發時,要使它能同時應對世界不同地區和國家的訪問,並針對不同地區和國家的訪問,提供相應的 符合來訪者閱讀習慣的頁面或資料。國際化又稱為 i18n internationalization 對於軟體中的選單欄 導航條 錯誤提示資訊,狀態資訊等這些固定不變的文字資訊,可以把它們...

spring中配置國際化

先寫好幾個.properties的資源檔案放在classpath下,當然可以放在src下面 我寫了兩個 format.properties 內容 testmsg hello world exception.properties run runtimeexception null nullpointe...