<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0" xmlns:cc="http://cyber.law.harvard.edu/rss/creativeCommonsRssModule.html">
    <channel>
        <title><![CDATA[Stories by Samuel Whang on Medium]]></title>
        <description><![CDATA[Stories by Samuel Whang on Medium]]></description>
        <link>https://medium.com/@klockw3rk?source=rss-4d3cb28f02be------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/2*_TIOPxRp9GLbOjgN7Mqr8w.jpeg</url>
            <title>Stories by Samuel Whang on Medium</title>
            <link>https://medium.com/@klockw3rk?source=rss-4d3cb28f02be------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Tue, 17 Nov 2026 23:36:38 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@klockw3rk/feed" rel="self" type="application/rss+xml"/>
        <webMaster><![CDATA[yourfriends@medium.com]]></webMaster>
        <atom:link href="http://medium.superfeedr.com/" rel="hub"/>
        <item>
            <title><![CDATA[Extracting Hash from Password Protected Microsoft Office Files]]></title>
            <link>https://medium.com/@klockw3rk/extracting-hash-from-password-protected-microsoft-office-files-b206438944d2?source=rss-4d3cb28f02be------2</link>
            <guid isPermaLink="false">https://medium.com/p/b206438944d2</guid>
            <category><![CDATA[hacking]]></category>
            <category><![CDATA[infosec]]></category>
            <category><![CDATA[penetration-testing]]></category>
            <category><![CDATA[cybersecurity]]></category>
            <category><![CDATA[hackthebox]]></category>
            <dc:creator><![CDATA[Samuel Whang]]></dc:creator>
            <pubDate>Wed, 23 Sep 2020 21:04:04 GMT</pubDate>
            <atom:updated>2020-09-27T01:20:41.352Z</atom:updated>
            <content:encoded><![CDATA[<p>I came across a Microsoft Office file that was password protected while working on a lab. Although I attempted to brute force the password by using tools that the infosec community has put out there for the public, the process was taking too long. After shifting focus by looking for another way to tackle this problem, I came across a way to extract the password hash!</p><p>In this example, I am using a Microsoft Word Document called <em>demo.docx</em>, which is password protected. I use a script called <strong><em>office2john.py</em></strong> to extract the hash from <em>demo.docx</em>, which I save to a file called <em>hash.txt</em>.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/677/1*K6mPTDovPeyWd2iVYKK8nQ.jpeg" /></figure><p>When we open up the contents of the hash.txt, we get something like this:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*LLpTpQ6FH6n08-L3RiqhRw.jpeg" /></figure><p>Hashcat is unable to process this hash in its current format, so we need to modify it a bit. To do this, all we need to do is delete the string <em>demo.docx</em>: in front of the hash so that the hash looks like this:</p><pre>$office$*2013*100000*256*16*3d903c8976fd20fd2f819ec284450645*2f8460564d085088be3082639961e0b3*05b6aaa94a2dc99fd27c35a607942457aa3b9926547a25069acb83a7c6c2a19f</pre><p>We can now feed this into hashcat using the following options:</p><pre>./hashcat64.exe -m 9600 -o cracked.txt hash.txt wordlist.txt</pre><p>After hashcat finishes processing, we get the following output that indicates that our hash has been cracked.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/625/1*a_5-Rl1msl9-_ZmBe8fWrA.jpeg" /></figure><p>When we open up <em>cracked.txt</em>, which is the output file we identified in our hashcat command, we can retrieve the password.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/833/1*wihCv78x3Cd8XoeGBkB7Uw.jpeg" /></figure><p><strong>Conclusion</strong></p><p>Although there are open source tools out there that allow attackers to brute force the password of Microsoft Office files, that method is generally inefficient when using large wordlists such as <em>rockyou.txt</em>. Extracting the hash and feeding it to a password cracker, such as hashcat or john, is a lot more productive when larger wordlists are required. Although this example uses a Microsoft Word document, this technique should be applicable to any password protected Microsoft Office files such as Excel and Powerpoint.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=b206438944d2" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Offensive Security Advanced Web Attacks and Exploitations (AWAE): What You Need To Know]]></title>
            <link>https://medium.com/@klockw3rk/offensive-security-advanced-web-attacks-and-exploitations-awae-what-you-need-to-know-349933b72d24?source=rss-4d3cb28f02be------2</link>
            <guid isPermaLink="false">https://medium.com/p/349933b72d24</guid>
            <category><![CDATA[hacking]]></category>
            <category><![CDATA[pentesting]]></category>
            <category><![CDATA[infosec]]></category>
            <category><![CDATA[career-development]]></category>
            <category><![CDATA[cybersecurity]]></category>
            <dc:creator><![CDATA[Samuel Whang]]></dc:creator>
            <pubDate>Sat, 06 Jun 2020 04:04:03 GMT</pubDate>
            <atom:updated>2020-06-06T04:04:03.647Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/482/1*5ns8IJwYLcDTSe7PuSMMvw.png" /></figure><p>After obtaining my Offensive Security Certified Professional (OSCP) status, I started searching for a direction. The most common advice that I’ve received from many professionals, who are far more experienced than I am, was to specialize in something because it’s difficult to be an expert at everything. The difficult part about carving out a direction for your career is getting exposed to the different areas of penetration testing. I decided to tackle Offensive Security’s Advanced Web Attacks and Exploitations (AWAE) course to figure that out. One of the main things that I was pleasantly surprised about was that the course doesn’t benefit strictly white-box web application penetration testers. The content is presented in a way where all penetration testers can greatly benefit.</p><h4>Setting Expectations</h4><p>It’s important to understand that AWAE is not a black-box web application penetration testing course. This is a white-box course which involves auditing large codebases. For those who recently obtained their OSCP status and are looking at AWAE to level up, the course and lab are not set up in the same format as Penetration Testing with Kali (PWK). While the PWK lab is designed for students to apply their knowledge gained from the lab guide and supplemental research, the AWAE lab is designed to correspond with the lab guide to help students follow along closely. I think the AWAE lab format works because it provides students the opportunity to understand what vulnerable code looks like, how to trace the code execution flow and develop a methodology to find potentially vulnerable code. Similar to the PWK labs, supplemental research will be required in this course.</p><h4>Lab Guide</h4><p>The content is provided in the form of case studies where the instructor walks students through the process of tracing code execution flow from the initial vulnerable code in the codebase. In the process of tracing the code execution flow, the instructor incorporates the various topics listed here: <a href="https://www.offensive-security.com/awae-oswe/">https://www.offensive-security.com/awae-oswe/,</a> ultimately chaining multiple vulnerabilities together that results in a shell.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/500/1*gG2v3ukvYEtI7uLx1-5pQQ.jpeg" /></figure><p>In addition to performing the steps mirroring the instructor’s, students are provided with challenging “Extra Mile” tasks. These tasks require students to approach the codebase differently and create a proof of concept exploit accordingly.</p><p>Similarly to the PWK lab guide, the AWAE lab guide provides all the fundamental knowledge. It is incumbent on the students to develop their methodologies and go the extra mile to build proficiency.</p><h4>Lab Environment</h4><p>As briefly mentioned, the lab environment corresponds directly with the lab guide. Students are expected to follow along with the instructor’s step-by-step guidance to understand the characteristics of vulnerable code and to understand the process of following code execution flow within the large codebase to ensure that the code is accessible.</p><p>The lab environment is also critical for reasons other than following the lab guide. The instructor does not necessarily demonstrate, in-depth, the methodology for approaching a large codebase to identify the initial vulnerable code. This is important to note because students are expected to develop their methodologies to quickly identify vulnerable code that is also accessible. With that, the instructor provides enough details to understand the <strong><em>types</em></strong> of things students should look for within a large codebase.</p><h4>Course Preparation</h4><p>Prospective students who already passed their OSCP exam, arguably, have <em>most </em>of the knowledge required to be successful in the AWAE course. Given that the course content revolves around code auditing, it’s paramount that prospective students are comfortable reading various coding languages that are prevalent in web application codebases such as JavaScript, Java, .NET, and PHP. Additionally, it is equally as important for students to be comfortable with writing basic scripts in Python, JavaScript, Perl, Bash, and PHP.</p><h4>Last Remarks</h4><p>Although the obvious audiences for AWAE are security-minded web developers and web application penetration testers, this course is beneficial for all penetration testers. For those trying to find a specialization, this course is still worth taking depending on your level of comfort with reading and writing in various coding languages. Although the content is advanced, the course is presented in a way that allows students to apply the knowledge learned in most assessments involving web applications. Regardless of a students’ specialization route, understanding vulnerabilities is a requirement for penetration testers, which is one aspect that makes AWAE such an awesome course.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=349933b72d24" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[eLearnSecurity Web Application Penetration Testing Course (WAPT) / eWPT]]></title>
            <link>https://medium.com/@klockw3rk/elearnsecurity-web-application-penetration-testing-course-wapt-ewpt-2f7480120b8e?source=rss-4d3cb28f02be------2</link>
            <guid isPermaLink="false">https://medium.com/p/2f7480120b8e</guid>
            <category><![CDATA[cybersecurity]]></category>
            <category><![CDATA[penetration-testing]]></category>
            <category><![CDATA[infosec]]></category>
            <category><![CDATA[hacking]]></category>
            <category><![CDATA[career-development]]></category>
            <dc:creator><![CDATA[Samuel Whang]]></dc:creator>
            <pubDate>Wed, 27 May 2020 12:23:28 GMT</pubDate>
            <atom:updated>2020-06-24T02:08:12.818Z</atom:updated>
            <content:encoded><![CDATA[<p>It’s important to establish a foundation when it comes to becoming a penetration tester. This is exactly the reason for the popularity of courses like Offensive Security’s Penetration Testing With Kali (PWK), eLearnSecurity’s Penetration Testing Student (PTS) and Penetration Testing Professional (PTP) courses. However, one element that these courses have in common is a lack of a comprehensive entry-level instruction on web application vulnerabilities and testing techniques. This is where eLearnSecurity’s Web Application Penetration Testing (WAPT) course fills the gap.</p><h4>Course Expectations</h4><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*DsBiPI3IZ5VPkU4nNI65rA.png" /></figure><p>At the time of writing this review, the current version of WAPT available is version 3 (WAPTv3). The WAPTv3 course (<a href="https://www.elearnsecurity.com/course/web_application_penetration_testing/">https://www.elearnsecurity.com/course/web_application_penetration_testing/</a>) covers black box web application penetration testing techniques. It goes in depth into a wide range of attacks such as XSS, SQLi, Authentication and Authorization, Session Security, XPath Injections, WSDL and SOAP testing. This list is not holistic, but you can download the syllabus on this page for more details: <a href="https://www.elearnsecurity.com/course/web_application_penetration_testing/">https://www.elearnsecurity.com/course/web_application_penetration_testing/</a>. The course material is structured similarly to the eLearnSecurity’s Penetration Testing Student (PTS) course, which I reviewed here: <a href="https://link.medium.com/BXZvt0bVO6">https://link.medium.com/BXZvt0bVO6</a>. The content is very thorough, structured and easy to digest. In order to be successful in WAPTv3, students do not necessary need to have taken PTP or PWK as a prerequisite; however, it is important to have fundamental knowledge of web protocols and basic familiarity with web languages such as PHP.</p><h4>Lab Environment</h4><p>Students who purchased the Full or Elite version of WAPTv3 will have access to the lab environment. eLearnSecurity’s WAPTv3 lab environment is separated by topics. For each module that is being taught, there is a lab environment that is built strictly to practice the technique being taught. For example, if the course is currently going over cross-site scripting (XSS) attacks, there is also a lab machine that is designed to help students practice <em>strictly</em> XSS attacks. The benefit of structuring the lab environment this way is that it enables students to learn and master the technique and attacks being taught without being overwhelmed by any other variables within the lab environment. Additionally, each lab session is dedicated to each student. In other words, the lab environment is not shared among other students. Similar to my review of the PTSv3 labs, the WAPTv3 lab environment lacks a range that students can practice applying their new repertoire of techniques and attacks.</p><h4>Certification</h4><figure><img alt="" src="https://cdn-images-1.medium.com/max/334/1*y3AnHWrHGejOAWbC8DQK4w.png" /></figure><p>The certification exam for eLearnSecurity Web Application Penetration Tester version 1 (eWPTv1), which accompanies the WAPTv3 course, is designed well to accurately validate proficiency in the topics taught by the course. The eWPTv1 exam is a fully hands on exam. Once the exam starts, eLearnSecurity provides 7 days of access to the exam environment. Once the exam VPN access expires, eLearnSecurity provides an additional 7 days of report writing period. During the exam, students are expected to conduct a thorough web application penetration test based on the Letter of Engagement that students will receive immediately after starting the exam. Not only are students expected to conduct a web application penetration test, students are expected to generate a holistic penetration test report. The exam is challenging and will require students to understand how to thoroughly enumerate web applications and test for vulnerabilities. eLearnSecurity is known to stay within scope of the course material when it comes to testing students. This means that students won’t have to research outside materials in order to be successful with the exam.</p><h4>Final Thoughts</h4><p>eLearnSecurity’s WAPTv3 course and eWPTv1 exam is the perfect compliment to eLearnSecurity’s PTP/eCPPTv2 or Offensive Security’s PWK/OSCP. The WAPTv3 course provides students with a comprehensive introductory web application testing knowledge that is lacking in the flagship courses. Given that web applications make up a significant percentage of attack vectors, the knowledge taught in the WAPTv3 course is almost necessary for current penetration testers. Although the course content dives deeper in the web application vulnerabilities and attacks than both the PWK or PTP, the content is still broad enough to be considered fundamental knowledge.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=2f7480120b8e" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Offensive Security PWK 2020 Update: Should you upgrade?]]></title>
            <link>https://medium.com/@klockw3rk/offensive-security-pwk-2020-update-should-you-upgrade-11945465b7f8?source=rss-4d3cb28f02be------2</link>
            <guid isPermaLink="false">https://medium.com/p/11945465b7f8</guid>
            <category><![CDATA[infosec]]></category>
            <category><![CDATA[pentesting]]></category>
            <category><![CDATA[hackthebox]]></category>
            <category><![CDATA[hacking]]></category>
            <category><![CDATA[oscp]]></category>
            <dc:creator><![CDATA[Samuel Whang]]></dc:creator>
            <pubDate>Tue, 05 May 2020 16:16:12 GMT</pubDate>
            <atom:updated>2020-05-05T16:16:12.879Z</atom:updated>
            <content:encoded><![CDATA[<p>Offensive Security’s flagship course, Penetrating Testing with Kali (PWK), recently went through a welcomed update to their course material and lab environment. A lot of topics were added to the course while some pre-existing topics were expanded upon. Some of these topics include Windows Privilege Escalation, Active Directory, and client-side attacks. Of course, these are not the only changes. You can find the full list here: <a href="https://www.offensive-security.com/offsec/pwk-2020-update/">https://www.offensive-security.com/offsec/pwk-2020-update/</a>.</p><p>For those who are currently on the journey towards OSCP, I argue that the decision to upgrade isn’t a difficult one to make; but, what about those who currently hold the OSCP? Is it worth investing in the upgrade and getting into the new PWK lab? For me, the answer is <strong><em>absolutely</em></strong> — let me explain why.</p><h4>OSCP Is Just The Beginning</h4><p>Previously, I’ve written a blog advocating that becoming an OSCP holder isn’t necessarily a goal, but rather a by-product of becoming a solid penetration tester (<a href="https://medium.com/@klockw3rk/my-oscp-guide-a-philosophical-approach-a98232bc818">https://medium.com/@klockw3rk/my-oscp-guide-a-philosophical-approach-a98232bc818</a>). I’ve advocated that penetration testing is a lifestyle and that it requires constant practice and research. This new PWK lab is a fantastic opportunity to fine-tune and improve methodologies, workflows, and techniques.</p><p>After spending some time in the new PWK lab environment, I am very pleased with the changes that I’ve come across. The number of machines in the lab increased dramatically which introduced challenges that are more dynamic than before. Just like in real commercial enterprises, not all systems can be attacked directly. Although this was also true in the previous PWK lab, the additional machines amplify the level of realism that opens up the necessity to practice looting, post-exploitation, client-side attacks, and navigating multiple subnets and Active Directory environments, all of which requires robust methodologies and workflows. This environment provides more opportunities to develop techniques to better understand the enterprise and its users, which is critical to compromising all the machines in the lab. The new PWK lab is an amazing environment that’s designed to teach a wide range of lessons, regardless of if you are an OSCP holder or not.</p><h4><strong>Expand Your Focus</strong></h4><p>One of the benefits of approaching the new PWK lab as an OSCP holder is that the pressure is off, which allows you to focus on more advanced techniques. When I was going through the PWK lab prior to obtaining my OSCP, my focus was generally limited to establishing a fundamental methodology and enumeration process. This is an important foundational skill-set, but it isn’t enough.</p><p>In the past, I spent most of my cycles approaching machines in a vacuum rather than in the context of a wider enterprise. It’s much easier to manage notes and workflows with one or two machines concurrently, but it becomes exponentially more difficult when you need to manage multiple shells, both local and domain, persistence, notes, and loot from multiple machines across the enterprise. This new lab environment provides opportunities for OSCP holders to increase the scope of our workflows and develop techniques and competencies to manage larger sets of data.</p><h4><strong>New Machines = New Lessons</strong></h4><p>It’s important to understand that our hard earned OSCP represents a snapshot of our skill level at the time of passing the exam. Skills are perishable and needs to be updated constantly. In the same way we learned lessons from each machine in the previous lab, the updated environment is a great opportunity to solidify the lessons we’ve already learned and to learn new lessons from both new and updated machines.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=11945465b7f8" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[eLearnSecurity Penetration Testing Student Course (eJPT): The Perfect Starter Pack]]></title>
            <link>https://medium.com/@klockw3rk/elearnsecurity-penetration-testing-student-course-ejpt-the-perfect-starter-pack-7401bec9be0b?source=rss-4d3cb28f02be------2</link>
            <guid isPermaLink="false">https://medium.com/p/7401bec9be0b</guid>
            <category><![CDATA[cybersecurity]]></category>
            <category><![CDATA[infosec]]></category>
            <category><![CDATA[penetration-testing]]></category>
            <category><![CDATA[hacking]]></category>
            <category><![CDATA[hackthebox]]></category>
            <dc:creator><![CDATA[Samuel Whang]]></dc:creator>
            <pubDate>Mon, 13 Apr 2020 06:39:50 GMT</pubDate>
            <atom:updated>2020-04-13T23:12:12.716Z</atom:updated>
            <content:encoded><![CDATA[<h3>eLearnSecurity Penetration Testing Student (PTS) Course / Junior Penetration Tester (eJPT) Certification: The Perfect Starter Pack</h3><p>Getting started in penetration testing isn’t the easiest thing to do. Though there are a lot of resources out there, often times those resources lack the structure that some people need to get started. During my journey towards Offensive Security’s OSCP, I came across eLearnSecurity’s Penetration Testing Student (PTS) Course, which is their introductory course in the penetration testing series. I wish I would’ve known about this course earlier in my journey towards becoming a penetration tester because the course syllabus and format is a perfect starter package for beginners.</p><h3>Course Expectations</h3><p>The PTS Course (<a href="https://www.elearnsecurity.com/course/penetration_testing_student/">https://www.elearnsecurity.com/course/penetration_testing_student/</a>) is designed for students with no penetration testing experience, which is reflected by the course content, the instructor’s delivery of the content, and the lab modules. The course aims to teach introductory knowledge and practical skill-sets that are relevant to penetration testing such as basic networking knowledge, scripting/programming, vulnerability identification, and many more. The course delivers just enough content to help students get comfortable with going through the penetration testing life-cycle without it being overwhelming. The course has a good structure and the instructors deliver the course material in a way that is easy to digest.</p><h3>Lab Environment</h3><p>Students who purchased the Full or Elite version of PTS will have access to the lab environment. If finances allow, I highly encourage purchasing lab access. What I really like about eLearnSecurity’s lab format is that they provide an array of virtual machines that are tailored towards teaching specific skill-sets. This is a fantastic format for beginners because it helps students focus on practicing and developing a specific skill-set. Generally, each topic has a lab machine specifically designed for that particular module. For example, if the course is currently going over cross-site scripting (XSS) attacks, there is also a lab machine that is designed to help students practice <em>strictly</em> XSS attacks. One thing the lab environment lacks is an actual lab range with targets that students can attack. Although students can practice specific skill-sets in the PTS lab, students lack the environment to practice integrating the different techniques they learned to progress through a single machine. With that said, given the audience of the course, I don’t think this detracts from the value that students will gain.</p><h3>Certification</h3><p>The certification exam for eLearnSecurity Junior Penetration Tester (eJPT), which accompanies the PTS course, is designed well to ensure that eJPT is representative of solid introductory penetration testing proficiency. Both the Full and Elite versions of PTS comes with an eLearnSecurity Junior Penetration Tester (eJPT) Certification voucher. The certification exam is based on information and skill-sets taught in the PTS course. The eJPT exam is a practical exam which means students will be interacting with a simulated corporate network to demonstrate that they have mastered the topics taught in the course. The exam is designed in a way that mimics real-world scenarios, while ensuring that the exam is within scope of the PTS syllabus. You can find more information about the eJPT exam here: <a href="https://www.elearnsecurity.com/certification/ejpt/">https://www.elearnsecurity.com/certification/ejpt/</a>.</p><h3>Final Thoughts</h3><p>eLearnSecurity Penetration Testing Student Course and the eJPT Certification Exam make up the perfect starter pack for students looking to get introduced to penetration testing. The PTS course provides students with relevant practical skills through a well structured course delivery model, while the eJPT exam accurately validates proficiency in the course material. Although PTS provides a lot of value through the structure it brings to the course, it’s important for students to understand that penetration testing is a self-driven research intensive career field requiring significant time and dedication to the trade. In a separate blog (<a href="https://medium.com/@klockw3rk/my-oscp-guide-a-philosophical-approach-a98232bc818">https://medium.com/@klockw3rk/my-oscp-guide-a-philosophical-approach-a98232bc818</a>), I discussed how I approached my journey towards becoming a penetration tester. Although I talk about my approach towards OSCP in that blog, the core message is still applicable towards approaching PTS and the eJPT exam.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=7401bec9be0b" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Privilege Escalation: Leveraging misconfigured systemctl permissions]]></title>
            <link>https://medium.com/@klockw3rk/privilege-escalation-leveraging-misconfigured-systemctl-permissions-bc62b0b28d49?source=rss-4d3cb28f02be------2</link>
            <guid isPermaLink="false">https://medium.com/p/bc62b0b28d49</guid>
            <category><![CDATA[infosec]]></category>
            <category><![CDATA[kali-linux]]></category>
            <category><![CDATA[privilege-escalation]]></category>
            <category><![CDATA[pentesting]]></category>
            <category><![CDATA[hacking]]></category>
            <dc:creator><![CDATA[Samuel Whang]]></dc:creator>
            <pubDate>Sun, 03 Nov 2019 20:35:46 GMT</pubDate>
            <atom:updated>2019-11-09T00:30:00.941Z</atom:updated>
            <content:encoded><![CDATA[<h3>Privilege Escalation: Systemctl (Misconfigured Permissions — sudo/SUID)</h3><p>The binary, <em>systemctl</em>, is a process that exists in linux operating systems that is used to start different services, such as apache servers. Because of the level of impact that <em>systemctl</em> can have on the system, it’s generally reserved for privileged users, such as system administrators. There are instances where permissions for <em>systemctl</em> may be misconfigured allowing for opportunities to leverage it into privilege escalation. For example, there may be entries in the /etc/sudoers file that allows a low privileged user to execute systemctl with root level privileges, or <em>systemctl</em> may be configured with SUID permissions which provides low privileged users access to the binary. In this blog, we’re going to discuss how to do this assuming you have privileges to access <em>systemctl</em>.</p><p><strong>Creating systemd unit files</strong></p><p>First we’re going to create a systemd unit file which is where <em>systemctl</em> references when starting a service. A good reference on the structure of this file is located here: <a href="https://access.redhat.com/documentation/en-us/red_hat_enterprise_linux/7/html/system_administrators_guide/sect-managing_services_with_systemd-unit_files">https://access.redhat.com/documentation/en-us/red_hat_enterprise_linux/7/html/system_administrators_guide/sect-managing_services_with_systemd-unit_files</a>.</p><p>We first need to a find a writable directory on the target file system. In this case, I used my current user’s home directory and called the file <em>root.service</em>. The content of the file is displayed below:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*cr6cGCsiyKh6xxB7XaBYCA.png" /><figcaption>Figure 1: Content of root.service</figcaption></figure><p>It’s important to make sure that the <em>User</em> value is set to the user you want <em>systemctl</em> to execute the service as. In this case, I set this value to <em>root </em>because my goal is to obtain a root level shell. The <em>ExecStart</em> parameter is where we need to place our payload. In this case, I am using a one-line bash reverse shell.</p><p><strong>Payload Execution</strong></p><p>Before we can execute our <em>root.service</em> file, we need to place it onto the target file system if it’s not there already. Once that is done, we just need to use <em>systemctl</em> to start our custom service. To do this, we first need to set up our listener. Once we do that, we need to make sure we specify our <em>root.service</em> file location in our <em>systemctl</em> command arguments.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*rQDlk5KWmzDlbd5LPZnzUQ.png" /><figcaption>Figure 2: systemctl payload execution</figcaption></figure><p>After we start the service, we should see a root level shell in our listener.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*wsTv_UgeZdxexrz4DK9PCQ.png" /><figcaption>Figure 3: Root level shell in netcat listener</figcaption></figure><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=bc62b0b28d49" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[My OSCP Guide: A Philosophical Approach]]></title>
            <link>https://medium.com/@klockw3rk/my-oscp-guide-a-philosophical-approach-a98232bc818?source=rss-4d3cb28f02be------2</link>
            <guid isPermaLink="false">https://medium.com/p/a98232bc818</guid>
            <category><![CDATA[red-team]]></category>
            <category><![CDATA[hacking]]></category>
            <category><![CDATA[penetration-testing]]></category>
            <category><![CDATA[infosec]]></category>
            <category><![CDATA[oscp]]></category>
            <dc:creator><![CDATA[Samuel Whang]]></dc:creator>
            <pubDate>Tue, 24 Sep 2019 21:25:54 GMT</pubDate>
            <atom:updated>2019-09-30T22:01:34.544Z</atom:updated>
            <content:encoded><![CDATA[<p>About a year and a half ago from the time of writing this blog, I ventured on a journey towards achieving the coveted Offensive Security Certified Professional (OSCP) status. At this point, I had no penetration testing experience and I quickly learned that I was way in over my head after my first exam attempt. I attempted the exam a few more times with slight improvements, but OSCP still seemed like a Goliath to me and I contemplated giving up.</p><p>I took a break lasting about a month or two after which I began casually working on Hack The Box (<a href="https://www.hackthebox.eu/">https://www.hackthebox.eu</a>) since penetration testing was still a skillset I wanted to foster. It wasn’t until I adopted a switch in mindset when approaching these machines that I began to see real progress in my ability to enumerate a machine, identify vulnerabilities, and develop solutions to produce shells.</p><p>This blog is geared towards those who are struggling through their OSCP aspirations. What I intend on communicating aren’t tools or scripts I used to obtain my OSCP. Frankly, within the larger scope of things, that information is irrelevant. What I intend on communicating are philosophical changes I adopted in how I approach penetration testing that ultimately led me to developing and refining my methodology that resulted in passing my OSCP exam.</p><p><strong>Adopt the Motto: “Penetration Testing is a Lifestyle”</strong></p><p>The approach to viewing penetration testing as lifestyle originated as an inside joke among me and my coworkers. It seemed silly at the time, but there is a lot of value in approaching penetration testing as part of your lifestyle by integrating this trade into your day to day life.</p><p>To approach penetration testing as a lifestyle is to approach it as not just something you want to do, but as something you want blended into your identity. When you look at how people become experts in any field, one thing that’s common is that they have a level of obsession with the topic — it becomes part of who they are. This obsession is a driving factor that leads people to really learn the nuances of their trade, eventually leading them to become experts. Penetration testing is a self-driven research intensive field that requires a lot of dedication and time. Without a personal driving catalyst to develop fundamental penetration testing knowledge, skills, and methodology, OSCP will always be a giant.</p><p>I made penetration testing my lifestyle by not caring whether or not I achieved my OSCP. I made a decision to focus on learning the trade, dive deep into vulnerabilities, and learn to understand the exploitation process. I started focusing on becoming a solid penetration tester instead of focusing on becoming an OSCP holder. By shifting my focus, the way I approached penetration testing inherently changed because my objective was no longer to pass an exam, but to learn the penetration testing tradecraft. At the end of the day, OSCP is designed to demonstrate the necessary skills and knowledge of a penetration tester. Getting OSCP does not necessarily make someone a penetration tester; rather, becoming a penetration tester leads to a successful OSCP exam attempt.</p><p><strong>Focus on the right things</strong></p><p>Often times, I notice that people struggling along their journey towards OSCP ask the wrong types of questions. They tend to focus on the exploit proof of concept (PoC), scripts, and tools instead of focusing on learning the mechanics of vulnerabilities and thinking critically about how to leverage the vulnerability into code execution. Generally, focusing on understanding the mechanics of vulnerabilities, tools, and scripts produces a more solid foundation when approaching a machine. Tools and scripts should be viewed as a way to automate tasks that you already know how to do, not as a solution to your problem.</p><p><strong>Closing Remarks</strong></p><p>For those coming from a background with no penetration testing experience, the journey towards OSCP is a marathon. It requires diligence, dedication, and passion. I see penetration testing as a practice, not something you can learn to do by reading books or watching videos alone. I often jokingly compare it to approaching calculus problems, but I think it’s an accurate analogy. If you want to pass a calculus exam, you need to practice solving a bunch of calculus problems. Likewise, if you want to pass your OSCP exam, you need to practice working through a bunch of machines. Of course, there are a lot that is implied in the analogy such as putting in the time and effort to understand how to accurately identify vulnerabilities and develop solutions based on your data, instead of trying to root machines without learning anything from it.</p><p>My journey towards OSCP is by far among the most rewarding accomplishments that I’ve achieved in my life. For those reading this blog, please do not be discouraged if you are struggling along this journey. Approach penetration testing as a lifestyle, and OSCP will become a by-product of that.</p><p><a href="https://www.youracclaim.com/badges/8615107e-6b42-4f9f-bc36-d8317ef70091/public_url">Offensive Security Certified Professional (OSCP) was issued by Offensive Security to Samuel Whang.</a></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=a98232bc818" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Privilege Escalation: How to build RPM payloads in Kali Linux]]></title>
            <link>https://medium.com/@klockw3rk/privilege-escalation-how-to-build-rpm-payloads-in-kali-linux-3a61ef61e8b2?source=rss-4d3cb28f02be------2</link>
            <guid isPermaLink="false">https://medium.com/p/3a61ef61e8b2</guid>
            <category><![CDATA[kali-linux]]></category>
            <category><![CDATA[rpm]]></category>
            <category><![CDATA[hacking]]></category>
            <category><![CDATA[privilege-escalation]]></category>
            <category><![CDATA[penetration-testing]]></category>
            <dc:creator><![CDATA[Samuel Whang]]></dc:creator>
            <pubDate>Sun, 18 Aug 2019 23:26:16 GMT</pubDate>
            <atom:updated>2019-08-18T23:26:16.254Z</atom:updated>
            <content:encoded><![CDATA[<p>From time to time, you may come across a system that enables you to run <em>yum</em> or <em>dnf</em> as an elevated user. This scenario is quite enticing for penetration testers because it is a potential privilege escalation vector. But, what happens if we don’t have permissions to create RPM packages on the victim machine and we don’t have a CentOS or RedHat system easily available to us? The solution to this problem is to create an RPM package on our Kali Linux attacking machine and move it over to the victim machine.</p><p><strong>Prerequisites</strong></p><p>Kali Linux does not allow us to natively build RPM packages. In order to overcome this obstacle, we need to download <em>fpm. </em>You can get that here: <a href="https://github.com/jordansissel/fpm">https://github.com/jordansissel/fpm</a>.</p><p>To install <em>fpm, </em>run the following commands:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/633/1*mHnZ1747hEYH_f4hj2PMZw.jpeg" /></figure><p>You should now be able to run the <em>fpm</em> command.</p><p>We now need to make sure our Kali system has <em>rpmbuild </em>installed. To do this, run the following command:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/375/1*s25IeW6xYTGLHur2pdzH-w.jpeg" /></figure><p><strong>Creating RPM payload</strong></p><p>Our next step is to create a payload. The payload I am going to demonstrate with is a Bash Reverse Shell. In the example below, my shell is in a file called <em>root.sh</em></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/496/1*MWo7G82KQhQon0_09U8EXg.jpeg" /><figcaption>Replace ATTACKER IP and LISTENING PORT accordingly</figcaption></figure><p>Feel free to get creative with this and adapt it to your own environment and constraints.</p><p>Next, we need to convert our <em>root.sh</em> into an RPM package. To do this, run the following command:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/986/1*2mSudKzKosl-xZ9tOxeYIg.jpeg" /></figure><p>Take note that some of the values in the <em>fpm</em> command need to be altered to fit your scenario. You can run <em>fpm -h</em> to help you understand the command above.</p><p>Once you run the command, you should have a .rpm file in the directory you specified. The next step is to transfer the .rpm file to the victim machine.</p><p><strong>Payload Execution</strong></p><p>Once you manage to transfer the RPM package to the victim machine, the commands you need to run will depend on whether you are using <em>yum </em>or <em>dnf</em>.</p><p>For yum:</p><pre>sudo yum localinstall -y root-1.0-1.noarch.rpm</pre><p>For dnf:</p><pre>sudo dnf install -y root-1.0-1.noarch.rpm</pre><p>In my particular scenario, the <em>yum </em>command was deprecated and redirected the arguments attached to my original <em>yum </em>command to <em>dnf. </em>I was also experiencing issues related to repositories. My solution to this was to add a flag that disables DNF repositories. You can read more about that here: <a href="https://docs.fedoraproject.org/en-US/Fedora/23/html/System_Administrators_Guide/sec-Managing_DNF_Repositories.html">https://docs.fedoraproject.org/en-US/Fedora/23/html/System_Administrators_Guide/sec-Managing_DNF_Repositories.html</a></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*ZMp0Bs0BGC_STkGlGjLDpA.jpeg" /><figcaption>Note: The <em>yum command redirects to dnf.</em></figcaption></figure><p>The result from this should be a root shell:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/529/1*UNn8YafSvGRX5AMlrK6qhg.jpeg" /></figure><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=3a61ef61e8b2" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Privilege Escalation: Hijacking Python Library]]></title>
            <link>https://medium.com/@klockw3rk/privilege-escalation-hijacking-python-library-2a0e92a45ca7?source=rss-4d3cb28f02be------2</link>
            <guid isPermaLink="false">https://medium.com/p/2a0e92a45ca7</guid>
            <category><![CDATA[hijacking]]></category>
            <category><![CDATA[python]]></category>
            <category><![CDATA[penetration-testing]]></category>
            <category><![CDATA[reverse-shell]]></category>
            <category><![CDATA[privilege-escalation]]></category>
            <dc:creator><![CDATA[Samuel Whang]]></dc:creator>
            <pubDate>Fri, 07 Jun 2019 01:36:22 GMT</pubDate>
            <atom:updated>2020-10-02T00:07:37.989Z</atom:updated>
            <content:encoded><![CDATA[<p>From time to time, you may come across a scenario where a system has misconfigured permissions in their Python library. Generally, directories that house Python modules have permissions set so that modifications can’t be made without elevated privileges. With that, there are a number of ways that users can create this vulnerability:</p><ol><li>The user creates their own Python module and forgets to restrict write access to it.</li><li>The user decides to lessen restrictions within the Python library directory.</li><li>The PATH variable for the Python library is configured to check the current directory first.</li></ol><p>Regardless, in order to escalate privileges, we also need a way to execute a Python script with elevated privileges. This either means looking for a cronjob or scheduled task that executes Python scripts with either elevated privileges or leveraging other vulnerabilities, for example, through SUID files, to execute the script.</p><p>If we decide to explore this avenue as a potential method to escalate privileges, we first need to understand where Python looks within the file system to import its modules. We can leverage the “sys” module in Python to do this. You can read more about that here: <a href="https://docs.python.org/2/library/sys.html">https://docs.python.org/2/library/sys.html</a></p><p><strong>Enumerating Python’s Path</strong></p><p>From our terminal, we can run the following command to find the path:</p><pre>python -c &#39;import sys; print(sys.path)&#39;</pre><p>Once we do this, we get something that looks like this:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*S1y823rduVwDTQUDcAKT5g.jpeg" /></figure><p>This output shows a list of directories that Python looks in when importing modules. Python looks through this list in order. With this information, we have an idea of which directories we need to enumerate first. Once we find a directory we want to attack, we can start modifying both a target Python script or the library.</p><p><strong>Escalating Privileges</strong></p><p>As proof of concept, I am going to demonstrate how you can leverage this misconfiguration from my own Kali host.</p><p>First, you need to identify a Python script that will be executed with elevated privileges. An example of this is a Python script that is run through a cronjob with elevated privileges. In our case, I have created a file called “hello.py” to simulate a script that is executed with elevated permissions.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/201/1*cayu3Wf-s31X-T6RNQB9sg.jpeg" /></figure><p>This script does something very simple. Based on the code, we expect that the function of this script is to print the text, “hello world”. One thing to notice is that this script also appears to import a custom Python module called “evil”. Let’s find this in our Python library.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/421/1*gmRN3LpNX3YHmGb2fSBdHQ.jpeg" /></figure><p>When we inspect this module, we can see that this module is written to print the text, “This is an evil script”.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/387/1*nvf7alZ6Cwg9LLE_9j4Y4g.jpeg" /></figure><p>Let’s assume that as an attacker, we only have <strong>read permissions</strong> to “hello.py”, but we have write permissions to our “evil” module. We know that we can’t do anything with “hello.py”, but what about the “evil” module?</p><p>One method we can use to leverage this misconfiguration is to modify the “evil” module to house a Python reverse shell. In this case, I used one from <em>pentestmonkey (</em> <a href="http://pentestmonkey.net/cheat-sheet/shells/reverse-shell-cheat-sheet">http://pentestmonkey.net/cheat-sheet/shells/reverse-shell-cheat-sheet</a>) and converted it from a one-liner to a script.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/539/1*bWPiQKeCOEPh3zSKpKWKmw.jpeg" /></figure><p>Now, all we have to do is wait until an elevated user executes the Python script, “hello.py”. When the elevated user executes the script, the “evil” module will also be imported which also executes the module. In our case, since we modified the content of the module with a reverse shell, we should have a root shell!</p><p><strong>Takeaway</strong></p><p>During the course of your enumeration, when you come across Python scripts that are executed with elevated permissions and misconfigured Python libraries, you can easily leverage that misconfiguration to obtain an elevated shell. When a Python script imports a module, the script also executes that module.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=2a0e92a45ca7" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Back to Basics: DNS Enumeration]]></title>
            <link>https://medium.com/@klockw3rk/back-to-basics-dns-enumeration-446017957aa3?source=rss-4d3cb28f02be------2</link>
            <guid isPermaLink="false">https://medium.com/p/446017957aa3</guid>
            <category><![CDATA[enumeration]]></category>
            <category><![CDATA[penetration-testing]]></category>
            <category><![CDATA[kali]]></category>
            <category><![CDATA[dns]]></category>
            <category><![CDATA[hackthebox]]></category>
            <dc:creator><![CDATA[Samuel Whang]]></dc:creator>
            <pubDate>Thu, 23 May 2019 02:00:03 GMT</pubDate>
            <atom:updated>2019-05-23T23:24:34.970Z</atom:updated>
            <content:encoded><![CDATA[<p>For aspiring penetration testers who have not had much experience outside of labs such as Hack the Box or penetration testing courses, chances are that not a lot of emphasis was placed on DNS enumeration. Generally, courses cover this topic since it is important, but the lab environments that come along with the course typically do not heavily incorporate DNS enumeration as part of the intended attack path of a vulnerable machine.</p><p><strong>Why should I care about DNS as a penetration tester?</strong></p><p>There are a few reasons why DNS enumeration is important.</p><ol><li>It can reveal the size of the enterprise of the target organization which can translate to the potential size of the attack surface. Enumerating the number of domains and sub-domains can reveal how large or small the organization may be. If one was conduct DNS enumeration of a Fortune 500 company, the result would be completely different than if one was to conduct the same enumeration for a start-up.</li><li>Virtual Routing may be enabled. Virtual Routing allows a web server to serve different resources depending on the domain name. Generally, the first thing we do is attempt to navigate to a web page using the IP address of the host (e.g. http://10.10.10.112) to see what the host serves us. Let’s say that the domain name “idontexist.htb” resolves to that IP address. Some would expect that http://idontexist.htb would serve the same page as it served by requesting http://10.10.10.112. If virtual routing is enabled, this is not always the case. In fact, if virtual routing is enabled, depending on how it’s configured, http://idontexist.htb may serve a completely different page than if you were to request http://10.10.10.112.</li></ol><p>Please note that the reasons I listed above are not all-inclusive. I’ve listed a few to provide a case for why it’s important to thoroughly enumerate DNS like any other service. Now that we’ve got that out of the way, let’s break it down!</p><p><strong>Identifying DNS Server</strong></p><p>I will explain this in two different scenarios.</p><p>Scenario 1: You are attacking an enterprise environment</p><p>Within an enterprise environment, you’ll typically have dedicated servers that provide DNS service. Given this scenario, the easiest way to identify hosts provide DNS service is to search for port 53 across the subnet(s) within scope. A Nmap command similar to something below should suffice:</p><pre>nmap -sC -sV -p53 192.168.x.0/24</pre><p>Of course, replace the IP range appropriately. The host that has port 53 open will probably be the DNS server. Take note of this host.</p><p>Scenario 2: You are attacking a single machine</p><p>In this scenario, you’ll conduct your regular Nmap scan. If you find port 53 open, then chances are that the box also has DNS services running. If this is the case, take note of that.</p><p><strong>Enumerate DNS Server</strong></p><p>We will be using a retired Hack the Box machine called Cronos to explore DNS enumeration. First thing I will do is start a port scan.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/748/1*hHnAlCCNY_ERk4QcI3hMBg.jpeg" /></figure><p>We notice that port 53 is open so DNS service is likely running on this box.</p><p>First thing I am going to do is begin using a tool called <em>nslookup </em>to see if I can gather any information through reverse DNS.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/492/1*U9XQ2YGH6Xy6BxX_6yYCdw.jpeg" /></figure><p>Luckily, this query produced a sub-domain, <em>ns1.cronos.htb</em>, that appears to be the nameserver. We will confirm whether or not this is a nameserver by looking for record types later on. Based on this information we also have the domain name, <em>cronos.htb.</em></p><p>Next, we are going to dig deeper. We’re going to conduct a zone transfer using a tool called <em>dig</em>. What I am going to do is use the domain name, <em>cronos.htb</em> as the parameter instead of the suspected nameserver. So the full command looks something like this:</p><pre><em>dig axfr cronos.htb @10.10.10.13</em></pre><p>We’ve passed the domain name and the IP address of the host with DNS service running pre-pended with the “@” symbol.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/992/1*9B8K8TDcyWkVTnDtu5V5ZA.jpeg" /></figure><p>Based on this output, we can confirm that zone transfer revealed additional sub-domains. So far we have the following domain names available:</p><ol><li>cronos.htb</li><li>admin.cronos.htb</li><li>ns1.cronos.htb</li><li>www.cronos.htb</li></ol><p>We also know that <em>ns1.cronos.htb</em> is the nameserver based on the “NS” record type indicated in the output. So what do we do with this information?</p><p><strong>Modifying the hosts file</strong></p><p>There are two files on your Kali machine that you need to be concerned with. The first file is the <strong><em>/etc/hosts</em> </strong>file, which looks something like this by default:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/561/1*vl49kWZqq4ElQVWT-UdtsA.jpeg" /></figure><p>Within this file, you can map domain names and sub-domains to IP addresses. This file instructs your system to resolve to a specific IP address given the respective domain or sub-domain. Before we begin modifying this file, let’s do a quick test.</p><p>We know that a web server is running on this host, so let’s navigate to <em>http://10.10.10.13.</em></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*_mHSJ4sNuwkwxQ-JX5PO_Q.jpeg" /></figure><p>What we get is a default Apache2 page. Now since we enumerated <em>cronos.htb, </em>let’s navigate to that in our web browser.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*-XV4AZPZv8-G2aS0TPInPA.jpeg" /></figure><p>My browser can’t seem to find that resource. Now let’s add some entries into our <strong><em>/etc/hosts</em> </strong>file. We are going to add a line that maps each of the domain names we enumerated. We can do this all in one line by separating each domain name with a space.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/560/1*iXPT6c1HtVgDh6dSYaDP0Q.jpeg" /></figure><p>Now that we’ve done that, my machine should know to resolve <em>cronos.htb</em> to 10.10.10.13. Let’s try navigating to <em>cronos.htb</em> in the browser again after the hosts file modification.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*FGfUTJuFCdoLmb4ZJHyPGQ.jpeg" /></figure><p>Notice that we get a response from the server and that the page is different than when we navigated to <em>http://10.10.10.13</em>. The reason why we get different resources, even though we are resolving to the same IP address, is due to virtual routing. When the web server sees the IP address, it serves the default Apache2. When the web server sees a domain name being requested, it serves a completely different page.</p><p>We should be able to navigate to each of the enumerated sub-domains now as well.</p><p><strong>Modifying the resolv.conf file</strong></p><p>Before we go through this, let’s comment out the entry we made to our <strong>hosts</strong> file for the time being.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/553/1*vIVwyaLLs5poIMqTyTQEng.jpeg" /></figure><p>The <strong><em>resolve.conf</em></strong> file, also located in the <em>/etc</em> directory, is a file that tells your machine which DNS server to use to resolve domain names. By default, your file should look something like this:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/306/1*qm9g52n3Bo2v5q6sCbSqgw.jpeg" /></figure><p>Before we add any entries, in a new browser (to prevent cached content from populating), navigate to <em>cronos.htb</em>. We shouldn’t get a connection since our machine does not know how to resolve that domain name.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*-XV4AZPZv8-G2aS0TPInPA.jpeg" /></figure><p>Now, let’s specify the nameserver as the 10.10.10.13. This should work because we know that DNS service is running on the host and we enumerated that the host has a nameserver, <em>ns1.cronos.htb</em>.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/292/1*mGA5weKJi9JokWDc4LrBqQ.jpeg" /></figure><p>I placed this entry above the default nameserver because I want my machine to use the one on the target host first, and then if that fails, use the default nameserver. Let’s save this file and navigate to <em>cronos.htb </em>again.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*FGfUTJuFCdoLmb4ZJHyPGQ.jpeg" /></figure><p>Again, we see that modifying the <strong><em>resolv.conf</em></strong> file worked as well.</p><p><strong>Last Thoughts…</strong></p><p>Without DNS enumeration, there may be information that you are missing out on. In this example, we modified both <strong><em>hosts</em></strong> and <strong><em>resolv.conf</em></strong> files to get our machines to resolve domain names specific to the target host. Depending on the machine you are attacking, one method may work while the other does not, so it is imperative to test the machine. Please note that if you opt to use the <strong><em>hosts</em></strong> file instead of the <strong><em>resolv.conf</em></strong> file, each domain and sub-domain must be explicitly defined in the file for your machine to resolve the domain names.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=446017957aa3" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>