網站偵掃時遇到這兩個問題可否請教一下 怎麼去修訂他
一、Cross site scripting (verified)
URL encoded GET input page was set to 1'"()&%Z7rQ(9817)
從這檔案得到的風險
Print.ASP?id=&page=1'"()%26%25<ScRiPt%20>Z7rQ(9817)
HTTP/1.1
Cookie: ASPSESSIONIDSAAQDTAT=DBKFBBPBBIDPPOAGJKPHAOOO
Accept: text/html,application/xhtml+xml,application/xml;q=0.9,/;q=0.8
Accept-Encoding: gzip,deflate
Host:my wed url
User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like
Gecko) Chrome/73.0.3683.103 Safari/537.36
Connection: Keep-alive
--------------------------------分隔線--------------------------------------------------------------------------------------------------------------------
二、SQL injection
URL encoded GET input id was set to -1 OR 321=6 AND 000655=000655
Tests performed:
-1 OR 2+655-655-1=0+0+0+1 => TRUE
-1 OR 3+655-655-1=0+0+0+1 => FALSE
-1 OR 32<(0+5+655-655) => FALSE
-1 OR 32>(0+5+655-655) => FALSE
-1 OR 2+1-1+1=1 AND 000655=000655 => FALSE
-1 OR 32=5 AND 000655=000655 => FALSE
-1 OR 32=6 AND 000655=000655 => TRUE
-1 OR 320=6 AND 000655=000655 => FALSE
-1 OR 321=6 AND 000655=000655 => TRUE
Original value: 1
從這檔案得到的風險
Print.ASP?id=-1%20OR%20321=6%20AND%20000655=000655&page= HTTP/1.1
X-Requested-With: XMLHttpRequest
Referer: my wed url
Cookie: ASPSESSIONIDSAAQDTAT=DBKFBBPBBIDPPOAGJKPHAOOO
Accept: text/html,application/xhtml+xml,application/xml;q=0.9,/;q=0.8
Accept-Encoding: gzip,deflate
Host:my wed url
User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like
Gecko) Chrome/73.0.3683.103 Safari/537.36
Connection: Keep-alive
看來這兩個都因該有在sql碼中用到了$_GET這類的參數造成的。
找一下看看吧。
因為也不清楚你的程式碼無法確定。
一、Cross site scripting (verified)
簡單說就是page參數要把單雙引號還有一些特殊符號都給過濾掉
給你個參考
http://wordpress.bestdaylong.com/blog/archives/14912
二、SQL injection
你的id參數被人塞入-1 OR 2+655-655-1=0+0+0+1還可執行,你都不會覺得怪怪的嗎?
執行sql時就會變成 SELECT ... FROM [你的table] WHERE id=-1 OR 2+655-655-1=0+0+0+1
可以簡化成
SELECT ... FROM [你的table] WHERE id=-1 OR 1=1
結果就是原本只是要抓一筆資料,變成把整個table資料都帶出來了
所以解法就是去檢查id輸入的格式是否正確
此例中的id應該是檢查參數是否為純數字,還有長度限制
修正的概念大致就是這樣