HTML注入-存盤型

這是一個存盤型的漏洞,有一個留言功能,可以嘗試xss彈窗
在level low下
輸入<script>alert(/bee/)</script>后點擊提交,就會執行該陳述句并顯示彈窗
也可以讀取用戶cookie,<script>alert(document.cookie)</script>

根據原始碼找到了資料存盤的地方

(已經被我刪了)

在查看原始碼后,三個級別都使用了sqli_check_3函式進行陳述句轉義


下列字符受影響:
\x00
\n
\r
\
'
"
\x1a
如果成功,則該函式回傳被轉義的字串,如果失敗,則回傳 false,
當設定等級為medium時,呼叫xss_check_4進行防xss保護
1 function xss_check_4($data) 2 { 3 // addslashes - returns a string with backslashes before characters that need to be quoted in database queries etc. 4 // These characters are single quote ('), double quote ("), backslash (\) and NUL (the NULL byte). 5 // Do NOT use this for XSS or HTML validations!!! 6 return addslashes($data); 7 }
(不論是medium級別還是high級別均無法進行注入)
當設定等級為high時,呼叫xss_check_3進行防xss保護
1 function xss_check_3($data, $encoding = "UTF-8") 2 { 3 // htmlspecialchars - converts special characters to HTML entities 4 // '&' (ampersand) becomes '&' 5 // '"' (double quote) becomes '"' when ENT_NOQUOTES is not set 6 // "'" (single quote) becomes ''' (or ') only when ENT_QUOTES is set 7 // '<' (less than) becomes '<' 8 // '>' (greater than) becomes '>' 9 return htmlspecialchars($data, ENT_QUOTES, $encoding); 10 }
轉載請註明出處,本文鏈接:https://www.uj5u.com/qita/38794.html
標籤:其他
上一篇:【bWAPP】0X02 HTML Injection - Reflected (URL)
下一篇:Cache地址映射與計算方式
