Machine Information
- Platform: Linux
- Difficulty: Easy
- IP Address: 10.10.10.75
Initial Enumeration
Nmap Scan
Starting Nmap 7.80 ( https://nmap.org ) at 2020-04-13 17:26 EDT Nmap scan report for 10.10.10.75 Host is up (0.038s latency). PORT STATE SERVICE VERSION 22/tcp open ssh OpenSSH 7.2p2 Ubuntu 4ubuntu2.2 (Ubuntu Linux; protocol 2.0) | ssh-hostkey: | 2048 c4:f8:ad:e8:f8:04:77:de:cf:15:0d:63:0a:18:7e:49 (RSA) | 256 22:8f:b1:97:bf:0f:17:08:fc:7e:2c:8f:e9:77:3a:48 (ECDSA) |_ 256 e6:ac:27:a3:b5:a9:f1:12:3c:34:a5:5d:5b:eb:3d:e9 (ED25519) 80/tcp open http Apache httpd 2.4.18 ((Ubuntu)) |_http-server-header: Apache/2.4.18 (Ubuntu) |_http-title: Site doesn't have a title (text/html). Service Info: OS: Linux; CPE: cpe:/o:linux:linux_kernel
Service Enumeration
Web Application
The main page shows a simple “Hello world!” message with nothing of interest. However, viewing the page source reveals a comment:
<!-- /nibbleblog/ directory. Nothing interesting here! -->
Navigating to http://10.10.10.75/nibbleblog/ reveals a blog powered by Nibbleblog.
Directory Enumeration
=============================================================== Gobuster v3.0.1 by OJ Reeves (@TheColonial) & Christian Mehlmauer (@_FireFart_) =============================================================== [+] Url: http://10.10.10.75/nibbleblog/ [+] Threads: 30 [+] Wordlist: /usr/share/wordlists/dirb/common.txt [+] Status codes: 200,204,301,302,307,401,403 [+] Extensions: html,php =============================================================== http://10.10.10.75/nibbleblog/admin.php (Status: 200) http://10.10.10.75/nibbleblog/admin (Status: 301) http://10.10.10.75/nibbleblog/content (Status: 301) http://10.10.10.75/nibbleblog/index.php (Status: 200) http://10.10.10.75/nibbleblog/plugins (Status: 301) http://10.10.10.75/nibbleblog/themes (Status: 301) ===============================================================
The admin.php page is a login portal. After trying common credentials, admin:nibbles successfully authenticates.
Exploitation
Nibbleblog File Upload Vulnerability
Once logged in as admin, I navigated to Plugins → My Image which allows file uploads. Nibbleblog has a known vulnerability where arbitrary PHP files can be uploaded despite the “Images only” restriction.
Reference: Exploit-DB: Nibbleblog File Upload
Creating PHP Reverse Shell
I uploaded shell.php through the My Image plugin interface. The file was uploaded successfully to:
/nibbleblog/content/private/plugins/my_image/image.php
Triggering the Shell
Then navigate to: http://10.10.10.75/nibbleblog/content/private/plugins/my_image/image.php
b02ff32bb332deba49eeaed21152c8d8Post-Exploitation Enumeration
The user can run /home/nibbler/personal/stuff/monitor.sh as root without a password. This script doesn’t exist yet, giving us full control over what runs as root!
Privilege Escalation
Creating Malicious monitor.sh
b6d745c0dfb6457c55591efc898ef88c/home/nibbler/personal/stuff/monitor.sh as root, but the script doesn’t exist. Since the nibbler user owns the /home/nibbler/ directory, we can create the entire path structure and write our own malicious script that will execute as root.Loot
Credentials
adminnibbles10.10.10.75Key Takeaways
- HTML source comments can reveal hidden directories and sensitive information
- Nibbleblog’s file upload plugin doesn’t properly validate file types, allowing PHP upload
- Default/weak credentials like
admin:nibblesare still commonly found in CTF boxes and real systems - Sudo wildcards and missing files create privilege escalation opportunities - if you can create the file that sudo will execute, you control what runs as root
- Always check for zip files or archives in user home directories - they may contain useful information or scripts