Beginner’s Guide to Conquering PermX on HackTheBox

The CyberSec Guru

Updated on:

Beginner's Guide to Conquering PermX 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

  • Unravel the challenges of conquering PermX on HackTheBox as a beginner.
  • Explore the significance of CTFs in enhancing cybersecurity skills within the HackTheBox community.
  • Equip yourself with essential tools like nmap scan and SSH for effective penetration testing.
  • Master the step-by-step approach to conquer PermX, from initial recon to covering your tracks.
  • Learn valuable tips for new hackers, including avoiding common pitfalls and following best practices in ethical hacking.

Introduction

PermX Homepage

Embark on an exhilarating journey through cybersecurity with PermX on HackTheBox. As you delve into the realm of web applications, open ports, and nmap scans, sharpen your skills in Linux and server exploitation. Prepare for the adrenaline rush of privilege escalation, reverse shells, and cracking passwords. With tools like LinPEAS and Chamilo LMS at your disposal, brace yourself for a thrilling adventure in the world of ethical hacking. Let’s unravel the mysteries of PermX together.

Getting to Know PermX on HackTheBox

Delve into the realm of PermX on HackTheBox, a challenging cybersecurity scenario awaiting your expertise. Unveil the intricacies of this web application, discover open ports through meticulous nmap scans, and unravel the mysteries of privilege escalation. With a keen eye on IP addresses and a knack for exploiting vulnerabilities, navigate the world of cybersecurity with finesse. PermX beckons, offering a platform to hone your skills in Linux, SSH, and server manipulation. Are you ready to embark on this exhilarating journey of cyber exploration?

Overview of the PermX Machine

Located on HackTheBox, PermX is a web application penetration testing challenge designed to enhance cybersecurity skills, including addressing vulnerabilities like CVE management. The machine may contain multiple open ports for exploration through Nmap scans. To conquer PermX, mastering privilege escalation techniques, including initial enumeration, using a Bash script, and understanding password reuse, as well as `sudo` misconfigurations, is crucial. This Linux-based challenge may involve obtaining an IP address, establishing a reverse shell, and navigating through various security measures. Understanding the significance of documentation and utilizing tools like LinPEAS can greatly aid in uncovering credentials for progression.

Understanding CTFs and Their Importance

Capture the essence of cybersecurity challenges with Capture The Flags (CTFs). These simulated cyber warfare scenarios test skills in a safe environment. Decode security puzzles, unlock new techniques, and enhance problem-solving abilities. CTFs are invaluable for mastering NLP techniques such as reverse shell, privilege escalation, and remote code execution, and more. Dive into the world of cyber challenges to fortify your skills and become a proficient hacker. Understanding CTFs is a gateway to the depths of cybersecurity knowledge.

Preparing for Your HackTheBox Adventure

Before diving into your HackTheBox adventure, ensure you have essential tools like nmap for scanning open ports and analyzing vulnerabilities, including specialized resources found on a webpage, such as the admin login page. Set up your environment with Linux and cybersecurity tools like LinEnum or Linpeas for privilege escalation, and be ready for a new virtual host. Familiarize yourself with using SSH for access and documenting your progress while having an exploit script ready. Gather credentials for potential access, and practice maintaining stealth using techniques like reverse shells. Being well-prepared enhances your experience on HackTheBox.

Essential Tools and Resources You Will Need

To effectively tackle PermX on HackTheBox, arm yourself with essential tools and resources. Ensure you have Nmap for detailed scans, SSH for secure access, and LinPEAS for privilege escalation. Familiarize yourself with Linux commands for seamless navigation. Documentation is key, so keep meticulous records. Stay updated on cybersecurity trends and methodologies. Remember, having the right tools at your disposal can make all the difference in your hacking journey.

Setting Up Your Environment

To prepare your environment for the PermX challenge on HackTheBox, ensure you have the necessary tools like Nmap for scanning open ports and identifying vulnerabilities. Familiarize yourself with Linux commands and privilege escalation techniques. Securely store any obtained credentials and leverage tools like LinPEAS for enumeration. Set up a virtual lab for practicing without causing harm to live systems. Document your progress and findings to enhance your cybersecurity skills. Configure your SSH settings and server access control lists (ACLs) for a secure environment.

ALSO READ: COMPREHENSIVE GUIDE TO NMAP: UNLEASHING THE POWER OF NETWORK SCANNING

Step-by-Step Guide to Conquering PermX

  • Step 1: Perform an extensive Nmap scan to uncover open ports and services on the target machine.
  • Step 2: Conduct thorough enumeration to identify potential vulnerabilities.
  • Step 3: Exploit the discovered vulnerabilities to gain initial access, possibly through obtaining credentials or leveraging a web application exploit.
  • Step 4: Aim for privilege escalation to elevate your access privileges on the machine.
  • Step 5: Secure your foothold by covering tracks and ensuring persistent access to the system.
  • Step 6: Document your findings and methodology for further cybersecurity analysis.

Step 1: Initial Recon and Information Gathering

To kick off conquering PermX, initiate an in-depth exploration of the target. Conduct an Nmap scan to uncover open TCP ports and scrutinize any vulnerabilities. Identify the IP address and delve into the web application and associated app, which may include a static website, potentially leading to an admin panel for further investigation and entry points. Document all findings meticulously, from exposed services to possible weak spots. Utilize tools like LinPEAS and MTZ to extract valuable credentials that may pave the way for further penetration. Remember, meticulous reconnaissance sets the stage for a successful hack.

NMap Scan of the Machine
NMap Scan of the Machine
Website Hosted on the Machine
Website Hosted on the Machine
Fuzzing Subdomains
Fuzzing Subdomains
Visiting lms.permx.htb presents a Chamilo login page
Visiting lms.permx.htb presents a Chamilo login page

Step 2: Identifying Vulnerabilities

To identify vulnerabilities effectively, perform a thorough initial Nmap scan to uncover open ports and services running on the target machine. Analyze the results for potential entry points and weak spots in the system. Utilize tools like LinPeas and LMS to search for misconfigurations, sensitive files, and credentials that could be exploited. Pay close attention to any discovered weak points which could be leveraged for further exploitation during the cybersecurity assessment. Understanding these vulnerabilities is crucial for a successful penetration test.

Chamilo Exploit
Chamilo Exploit

Step 3: Exploiting the Vulnerabilities

Once vulnerabilities are identified through your reconnaissance efforts, the next crucial step in conquering PermX on HackTheBox is exploiting these weaknesses. Leveraging tools like Metasploit or manual exploitation techniques based on your findings is essential. Look for misconfigurations, outdated software, or poor access controls to launch your attack. Remember, successful exploitation can lead to gaining a foothold on the system. Execute your exploit carefully to avoid raising suspicions and maintain stealth during this critical phase of the cybersecurity challenge.

Saving the Reverse Shell
Saving the Reverse Shell
Successfully Connected
Successfully Connected

Step 4: Gaining Access

To gain access to PermX on HackTheBox, leverage the vulnerabilities identified during your reconnaissance, including potential flaws in the subdomain. Utilize the acquired user credentials, including those from the /etc/passwd file, to authenticate and access the target system. Employ techniques like exploiting misconfigurations found in the config file, looking for a potential root shell, or utilizing weak credentials to penetrate the system. This step involves breaking through security measures to establish a foothold within the machine. Execute this phase carefully to ensure a successful intrusion without alerting any security mechanisms.

Username found via Home Directory
Username found via Home Directory
Password found via LinPEAS
Password found via LinPEAS

Step 5: Privilege Escalation

To proceed with privilege escalation, exploit discovered vulnerabilities to gain higher access levels. Enumerate the system for weaknesses, searching for misconfigurations or outdated software such as PHP. Utilize techniques like kernel exploits, weak directory permissions that are often present by default, and misconfigured services. Escalate privileges to gain control over the system beyond initial access rights. Execute post-exploitation activities carefully to maintain stealth and persistence. Remember, thorough understanding of the target system is crucial for successful privilege escalation. Utilize tools like LinEnum, LinPeas, and GTFOBins for efficient privilege escalation.

Logging in via SSH
Logging in via SSH

After discovering that the current user can run “/opt/acl.sh” as root, we make a script called “acl.sh” for privilege escalation

#!/bin/bash

if [ "$#" -ne 3 ]; then
    /usr/bin/echo "Usage: $0 user perm file"
    exit 1
fi

user="$1"
perm="$2"
target="$3"

if [[ "$target" != /home/mtz/* || "$target" == *..* ]]; then
    /usr/bin/echo "Access denied."
    exit 1
fi

# Check if the path is a file
if [ ! -f "$target" ]; then
    /usr/bin/echo "Target must be a file."
    exit 1
fi

/usr/bin/sudo /usr/bin/setfacl -m u:"$user":"$perm" "$target"

This script allows the user mtz to change permissions on a file for any user, as long as the target file is within the mtz user’s home directory. We use this fact to create a symlink to the sudoers file:

mtz@permx:~$ ln -s /etc/sudoers /home/mtz/sudoers
mtz@permx:~$ sudo /opt/acl.sh mtz rw /home/mtz/sudoers

After using the following NOPASSWD attribute, we get access to root

mtz ALL=(ALL:ALL) NOPASSWD: ALL
Finding the root Flag
Finding the root Flag

ALSO READ: Mastering Linux Privilege Escalation With Linpeas

Tips and Tricks for New Hackers

Always document your progress in cybersecurity tasks. Avoid overlooking the importance of proper documentation to refer back to in case of any setbacks. Be meticulous with your approach, especially when dealing with sensitive information. Stay updated on new NLP terms and tools in the cyber landscape to enhance your skills continually. Embrace a proactive attitude towards learning, and don’t hesitate to seek guidance from the community. Remember, persistence and a thirst for knowledge are key to becoming a proficient hacker.

Common Pitfalls and How to Avoid Them

Common pitfalls in cybersecurity challenges like PermX include overlooking detailed documentation, misinterpreting results from tools like nmap scans, and underestimating the importance of thorough web application enumeration, such as identifying the version of Chamilo and verifying the username. Avoid these by documenting your progress, verifying findings, and conducting a comprehensive analysis of open ports, especially in relation to vulnerabilities like SQL injection. Stay vigilant against overlooking critical details, such as weak credentials or misconfigured access controls. By maintaining a methodical approach and staying attentive to the nuances of each step, you can navigate around these common pitfalls and enhance your hacking skills.

Best Practices for Effective Hacking

Regularly update your cybersecurity knowledge. Practice on various platforms like HackTheBox. Document every step for future reference. Use reputable tools like Nmap for scans. Respect systems and data. Emphasize ethical hacking practices. Understand and follow rules of engagement. Prioritize learning over just finding flags. Strengthen your Linux skills. Network with like-minded individuals. Always secure permissions before testing on systems. Adopt a continuous learning mindset. Practice responsible disclosure. Stay curious and persistent in your hacking endeavors. Remember, ethical behavior is paramount in cybersecurity.

Conclusion

In conclusion, mastering PermX on HackTheBox requires a blend of technical skills and strategic thinking. By delving into the nuances of web applications, open ports, and privilege escalation, you expand your knowledge in cybersecurity. Remember, the journey doesn’t end here. Stay curious, keep exploring new challenges, and constantly enhance your hacking prowess. Embrace the ethos of continuous learning in the dynamic realm of cybersecurity. Cheers to your HackTheBox adventures!

Frequently Asked Questions

What to Do If You Get Stuck?

When stuck, consult online forums or walkthroughs. Take breaks to gain fresh perspectives. Don’t hesitate to ask for help via email from the HackTheBox community. Stay persistent and keep learning from challenges to enhance your skills.

How Often Are New Machines Like PermX Released on HackTheBox?

New machines like PermX are released periodically on HackTheBox (HTB), offering fresh challenges for the hacking community. These releases keep the platform engaging and dynamic, catering to both beginners and experienced hackers.

Can I Collaborate with Others on HackTheBox?

Discover the benefits of collaborating with other hackers on HackTheBox to enhance your learning and problem-solving skills. Engage in team challenges, share knowledge, and tackle complex machines together for a more rewarding experience.

Explore online platforms like TryHackMe and CyberSecLabs for interactive learning. Books such as “The Web Application Hacker’s Handbook” and “Penetration Testing: A Hands-On Introduction to Hacking” are also highly recommended. Joining cybersecurity forums like Hack Forums can provide valuable insights.

How to Stay Updated with HackTheBox Challenges?

Explore active forums, follow HackTheBox social media accounts for announcements, join Discord servers for real-time updates, participate in community challenges, and regularly check the HackTheBox platform for new challenges. Stay connected to the hacking community to stay ahead of the game.

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