MinhCyber

HackTheBox - Example Machine Writeup

โ€ข1 min read
#htb#web#sql-injection

๐Ÿ“‹Challenge Info

Platform
๐ŸŸขHackTheBox
Difficulty
medium
Points
30 pts
Category
๐ŸŒWeb
Completed
February 15, 2024

HackTheBox - Example Machine ๐Ÿ”—

This is a sample CTF writeup demonstrating the content structure for CTF challenges.

Machine Info ๐Ÿ”—

  • Platform: HackTheBox
  • Difficulty: Medium
  • Points: 30
  • Category: Web

Enumeration ๐Ÿ”—

First, let's start with a basic nmap scan:

nmap -sV -sC -oA example 10.10.10.100

Results show:

  • Port 22 (SSH)
  • Port 80 (HTTP)
  • Port 3306 (MySQL)

Initial Foothold ๐Ÿ”—

The web application has a login form vulnerable to SQL injection:

' OR '1'='1' --

Privilege Escalation ๐Ÿ”—

After gaining initial access, we find a misconfigured sudo permission:

sudo -l
# User can run /usr/bin/vim as root

Flag ๐Ÿ”—

The root flag was found at /root/root.txt.

Lessons Learned ๐Ÿ”—

  • Always sanitize user input
  • Principle of least privilege for sudo permissions
  • Regular security audits are essential

Comments