Beginner’s Guide to Conquering Chemistry on HackTheBox

The CyberSec Guru

Updated on:

Beginner’s Guide to Conquering Chemistry 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 Chemistry challenges on HackTheBox with this beginner’s guide.
  • Discover essential steps for conquering cybersecurity challenges through practical exercises.
  • Gain insights into the basics of HackTheBox and the skills necessary to excel in cybersecurity.
  • Navigate through initial reconnaissance and identify clues for successful hacking attempts.
  • Equip yourself with the knowledge and skills required to excel in cybersecurity through hands-on practice.

Introduction

Welcome to the fascinating world of Chemistry on HackTheBox! As you embark on this journey, you will dive into the depths of cybersecurity and hone your skills through hands-on challenges. Understanding the basic principles is crucial, so gear up to unravel the mysteries of HackTheBox. Get ready to enhance your soft skills and technical expertise as you navigate through the captivating realm of cyber exploration. Let’s elevate your knowledge and capabilities in this exhilarating domain. Exciting experiences and valuable insights await!

Getting Started with Chemistry on HackTheBox

To embark on your journey with Chemistry challenges on HackTheBox, familiarize yourself with the platform’s interface and the HTB Academy modules. Develop essential soft skills crucial for cybersecurity challenges. Understanding privilege escalation and basic hacking concepts is key. Begin by exploring the initial reconnaissance phase and gradually move on to identifying the first clues. Dive into YouTube tutorials for additional insights. Remember, mastering these fundamentals is pivotal for excelling in Chemistry challenges.

Understanding the Basics of HackTheBox

To excel in HackTheBox, grasp the fundamentals. Familiarize yourself with the HTB Academy and essential soft skills. Cybersecurity concepts like privilege escalation are crucial. Understand modules on YouTube; delve into the cookie policy. Mastering these basics lays a strong foundation for conquering chemistry challenges on HackTheBox. Start your journey equipped with this foundational knowledge.

What You Need to Begin

To excel in Chemistry challenges on HackTheBox, you need a blend of technical prowess and soft skills. Familiarize yourself with HTB Academy modules and stay updated on cybersecurity trends. Prioritize learning about privilege escalation techniques and hacking methodologies. A keen eye for details and a hunger to solve complex puzzles will be your allies in this journey. Remember, on this platform, every clue matters, and every step counts towards mastering the art of cyber exploration. Stay curious, stay focused.

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

Step-by-Step Guide to Tackling Chemistry Challenges

Navigating Chemistry challenges on HackTheBox involves a systematic approach. Begin by mastering the initial reconnaissance phase, followed by identifying key clues strategically. Utilize your soft skills along with cybersecurity knowledge to excel in these challenges. Remember, privilege escalation is crucial for success. HTB Academy modules and YouTube tutorials can enhance your understanding. Stay updated on the latest cyber trends to stay ahead in the game. Approach each challenge with a hacker mindset to conquer Chemistry on HackTheBox.

Initial Reconnaissance

When delving into Chemistry challenges on HackTheBox, initiating with thorough reconnaissance is crucial. Utilize soft skills like observation and critical thinking. Familiarize yourself with the HTB Academy modules, especially on privilege escalation. Analyze the challenge context and goals efficiently. Understand the significance of initial data gathering for further progress. This initial phase sets the tone for successful navigation through the chemistry challenges, enhancing your cyber expertise.

NMAP

Let’s perform an NMap Scan on the machine for open ports and services

Chemistry.htb NMap Scan
Chemistry.htb NMap Scan

Visiting on port 5000 reveals the presence of a CIF Analyzer operating on that port, which constitutes a specialized tool intended for the analysis of CIF (Crystallographic Information Files) files utilized across a variety of applications. This analytical tool appears to provide functionalities that facilitate the evaluation of data integrity and quality, thereby assisting users in deriving significant insights into their workflows. Upon further exploration, one may observe that the CIF Analyzer features a user-friendly interface, which enables straightforward navigation and interaction, thus making it accessible to both technical and non-technical users.

Chemistry.htb CIF Analyzer
Chemistry.htb CIF Analyzer

Let’s try signing up (registering) here.

Chemistry.htb CIF Signup
Chemistry.htb CIF Signup

Then we see an upload functionality that requires a valid CIF file. At this point, I had no idea what a CIF file was, so I turned to Google to gather some information about it. After some research, I discovered that CIF stands for Crystallographic Information Files, which is often used in various applications for data representation. Intrigued by this, I decided to delve deeper to understand its structure and potential exploits better. My curiosity led me to explore ways to manipulate this file type, as I was particularly interested in vulnerability assessments. I started learning techniques to abuse the functionality surrounding the CIF file upload, hoping to uncover any security flaws that could potentially allow me to achieve Remote Code Execution (RCE) and ultimately obtain a reverse shell. To aid my understanding of the CIF format, I downloaded an example.cif file, analyzing its contents to discern how it operates and to identify any weaknesses that I could exploit in further testing.

Chemistry.htb File Upload Dashboard
Chemistry.htb File Upload Dashboard

The contents of the example.cif file doesn’t give me anything useful in particular.

Contents of example.cif File
Contents of example.cif File

Identifying the First Set of Clues

As you delve deeper into the Chemistry challenges on HackTheBox, honing your skills in identification becomes crucial. The second step involves keenly spotting the initial clues presented before you. Utilize your soft skills to decipher hidden patterns and connections. Familiarize yourself with the cookie policy of the platform to navigate efficiently. This phase marks a significant leap in your understanding of cyber challenges. Embrace this opportunity to enhance your proficiency in hack methodologies.

Let’s see if there are CVEs on this CIF by searching on Google.

Searching for CIF CVE
Searching for CIF CVE

Found some vulnerabilities but nothing useful in particular.

Then I turned to the official discussion for this machine on HTB. After conducting extensive research, I uncovered valuable information regarding exploitation tactics. This journey led me to two very informative links that delve into the details of an important vulnerability. The first link provides insights on CVE-2024-23346, which describes an arbitrary code execution vulnerability in Pymatgen due to insecure handling. This source is particularly useful for anyone looking to understand the implications of the vulnerability and how it can be exploited in practical scenarios.

Moreover, I also found crucial information on the official advisory from GitHub, available at this link, which outlines the security issues and provides context on the versions affected. The advisory offers a comprehensive view of how this vulnerability arose, the impact it could have, and the best practices to mitigate any associated risks.

Using the knowledge gathered from these sources, I proceeded to craft a payload that exploits this specific vulnerability. This payload is designed to demonstrate the exploit’s effectiveness in a controlled environment, allowing for a better understanding of the underlying mechanics.

CIF Exploit PoC
CIF Exploit PoC

The above code contains a CIF (Crystallographic Information File) structure description, but with an embedded command attempting to exploit Python’s attribute resolution to create a reverse shell.

Upload the malicious CIF file to the designated portal, and once the upload is successful, the view button will appear prominently on your screen.

View Button in Portal
View Button in Portal

Triggering the Reverse Shell

  • The modified payload was uploaded to the website.
  • By clicking the “View” button on the website, the payload was executed on the server, resulting in a reverse shell connection back to the attacker’s machine.

The reverse shell provided interactive access to the target system’s shell.

Enumerating the File System

With shell access in hand, standard enumeration commands (e.g., ls -la, find / -type f) were used to map the system. A directory named instance was discovered containing a SQLite database file, database.db.

Chemistry.htb database.db file
Chemistry.htb database.db file

Accessing the SQLite Database

Using the sqlite3 tool, the database was queried:

sqlite3 instance/database.db

A query to list user data revealed stored usernames and MD5-hashed passwords.

Cracking the MD5 Hash

  • The MD5 hash for the user “rosa” was extracted.
  • The hash was submitted to CrackStation, an online cracking tool, to retrieve the plaintext password.
Credentials for "Rosa"
Credentials for “Rosa”

With the credentials for “rosa” now in hand, the next step was to gain further access via SSH.

SSH Connection

Using the obtained credentials for user “rosa”, an SSH session was initiated:

ssh rosa@10.10.11.38

The connection was successful and access to the user account was established. The user flag was located within the user’s home directory.

Chemistry User Flag
Chemistry User Flag

Service Discovery on Port 8080

Further reconnaissance identified another service running on port 8080. Analysis of the service banner revealed that it was running aiohttp/3.9.1, a popular asynchronous HTTP framework for Python.

Service on Port 8080
Service on Port 8080

CVE-2024-23334: Local File Inclusion (LFI) & Path Traversal

  • Vulnerability Details:
    The vulnerability (CVE-2024-23334) is a Local File Inclusion (LFI) and path traversal issue in the aiohttp library. It arises due to insufficient sanitization when handling static file requests. Attackers can traverse the directory structure to access sensitive files.

Exploiting the LFI

  • A curl command was crafted to exploit the vulnerability. By carefully manipulating the file path in the request, it was possible to traverse directories and access files that should not have been exposed.
  • The crafted request successfully retrieved the root flag by exploiting the LFI vulnerability.

Example exploitation command (simplified):

curl http://10.10.11.38:8080/../../../../etc/passwd

(Note: The actual payload was tailored to retrieve the root flag.)

Root Flag

Chemistry.htb Root Flag
Chemistry.htb Root Flag

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

Conclusion

Embarking on the HackTheBox Chemistry journey necessitates a fusion of technical prowess and problem-solving finesse. By integrating foundational concepts with adeptness in cybersecurity, participants can unravel the encryption puzzles that await. Mastering Chemistry not only enhances one’s cyber skill set but also nurtures essential soft skills crucial for success in the digital realm. Remember, perseverance and continuous learning are the keys to conquering the diverse challenges presented within the Chemistry module. So, dive in, explore, and elevate your cyber expertise to new heights.

Frequently Asked Questions

What is HackTheBox and how can it help beginners learn about cybersecurity?

HackTheBox is a virtual lab where users can practice cybersecurity skills in a legal environment. It offers challenges and scenarios to simulate real-world hacking situations, making it an ideal platform for beginners to learn and hone their cybersecurity skills.

Do I Need Any Special Software or Equipment to Get Started?

To begin your journey in conquering Chemistry on HackTheBox, all you need is a standard web browser and an internet connection. No special software or equipment is required, making it accessible for beginners to dive into the challenges.

By following the step-by-step guide and understanding the basics, beginners can effectively tackle chemistry challenges on HackTheBox. Identifying clues through initial reconnaissance is crucial in progressing. What tools to begin with?

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