← All write-ups

Nibbles

Overview

Nibbles เป็น Linux machine ระดับ easy ของ HackTheBox เป็นเครื่องที่ retired แล้ว จุดเด่นคือมันสอน 2 เรื่องหลักในเครื่องเดียว — web application exploitation กับ Linux privilege escalation พื้นฐาน อยู่ใน TJnull's OSCP prep list เลยเป็นเครื่องคลาสสิกที่คนเตรียมสอบ OSCP และมือใหม่สาย pentest ควรผ่าน

Enumeration

nmap -sV -p- 10.10.10.X

หน้าเว็บแสดงแค่ "Hello world" แต่พอดู page source จะเจอ comment ที่ชี้ไปโฟลเดอร์ /nibbleblog/ ตรงนี้สอนนิสัยสำคัญคือ อย่ามองข้าม HTML source พอเข้าไปจะเจอว่ารันด้วย Nibbleblog ซึ่งเป็น CMS ตัวเล็ก ๆ ที่เขียนด้วย PHP

Exploitation

Nibbleblog's "My Image" plugin allows authenticated file uploads without proper extension filtering. After locating/using valid credentials, upload a PHP web shell disguised as an image, then trigger it via its stored path to get code execution as www-data.

curl -F "image=@shell.php" http://10.10.10.X/nibbleblog/content/private/plugins/my_image/upload.php

Privilege Escalation

Checking sudo -l as the low-privileged user shows a script under /home/nibbler that can be run as root — and the script itself is world-writable. Appending a reverse shell (or chmod/cp payload) to it and re-running with sudo yields a root shell.

sudo -l
find / -perm -4000 -type f 2>/dev/null

Lessons Learned / Remediation

  • web enumeration + การระบุ CMS, การ exploit file upload ใน CMS plugin, credential guessing, การ abuse sudo misconfiguration เพื่อ privesc, kernel exploit เป็นทางเลือก, และ reverse shell + shell upgrading พื้นฐาน