<?xml version="1.0" encoding="utf-8" standalone="yes"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom">
  <channel>
    <title>#cybersecurity on Sagar Chamling&#39;s Blogging Site</title>
    <link>https://sagarchamling.com/blogs/cybersecurity/</link>
    <description>Recent content in #cybersecurity on Sagar Chamling&#39;s Blogging Site</description>
    <image>
      <title>Sagar Chamling&#39;s Blogging Site</title>
      <url>https://sagarchamling.com/logo.svg</url>
      <link>https://sagarchamling.com/logo.svg</link>
    </image>
    <generator>Hugo -- gohugo.io</generator>
    <language>en</language>
    <lastBuildDate>Sat, 04 Nov 2023 00:00:00 +0000</lastBuildDate>
    <atom:link href="https://sagarchamling.com/blogs/cybersecurity/index.xml" rel="self" type="application/rss+xml" />
    <item>
      <title>Cloud Security Assessment using ScoutSuite, Pacu, and Prowler</title>
      <link>https://sagarchamling.com/blogs/cybersecurity/cloud-security-assessment-using-scoutsuite-pacu-prowler/</link>
      <pubDate>Sat, 04 Nov 2023 00:00:00 +0000</pubDate>
      <guid>https://sagarchamling.com/blogs/cybersecurity/cloud-security-assessment-using-scoutsuite-pacu-prowler/</guid>
      <description>Perform Cloud Security Assessment, analyzing the report and providing recommendation.</description>
      <content:encoded><![CDATA[<h2 id="introduction">Introduction</h2>
<p>In this blog, I&rsquo;ll be showing how we can perform cloud security auditing and assessment using ScoutSuite, Pacu and Prowler, and analyzing the report generated by these tools. I will demonstrate the privilege escalation attack on misconfigured policy of AWS.</p>
<blockquote>
<p>Note: The AWS <code>access_key_id</code>, <code>access_secret_key</code> used in the screenshot will not work and was only created for this writing this blog. If you want to test it, please make sure you are authorized to perform the assessment in targeted cloud.</p>
</blockquote>
<h2 id="prerequisites">Prerequisites</h2>
<h3 id="configure-aws">Configure AWS</h3>
<p>Amazon Web Services (AWS) is cloud computing services which will be a target cloud infrastructure for the assessment. To perform this activity, I created AWS account from my own account. To continue follow the given instructions:</p>
<ul>
<li>
<p>Navigate to Identity Access Management (<code>IAM</code>) Service</p>
</li>
<li>
<p>Go to <strong>Users</strong> &gt; <strong>Create user</strong> to create a user named <code>kaliuser</code></p>
</li>
<li>
<p>Next, Go to <strong>User groups</strong> &gt; <strong>Create group</strong> to create a user group <code>testing</code>.</p>
<ul>
<li>Add the <code>kaliuser</code> in a group while creating.</li>
<li>Attach Policy <strong>SecurityAudit</strong> and <strong>SecurityAudit</strong> to providing permissions.</li>
</ul>
</li>
<li>
<p>Then, navigate to <strong>User</strong> &gt; <strong>kaliuser</strong> &gt; <strong>Security credentials</strong> &gt; <strong>Access keys</strong> &gt; <strong>Create access key</strong> &gt; Select <strong>Command Line Interface (CLI)</strong> &gt; <strong>Next</strong> &gt; <strong>Create access key</strong>. This will generate programmatic access key and secret key.</p>
</li>
<li>
<p>Finally, configure your shell running <code>aws configure</code>, enter the <code>access_key_id</code> and <code>access_secret_key</code> in the terminal.</p>
<div class="highlight"><pre tabindex="0" class="chroma"><code class="language-bash" data-lang="bash"><span class="line"><span class="cl">$ aws configure
</span></span><span class="line"><span class="cl">AWS Access Key ID <span class="o">[</span>****************TKIZ<span class="o">]</span>:
</span></span><span class="line"><span class="cl">AWS Secret Access Key <span class="o">[</span>****************/G0w<span class="o">]</span>:
</span></span><span class="line"><span class="cl">Default region name <span class="o">[</span>us-east-2<span class="o">]</span>:
</span></span><span class="line"><span class="cl">Default output format <span class="o">[</span>None<span class="o">]</span>:
</span></span></code></pre></div></li>
</ul>
<blockquote>
<p>Note: I will further configure additional Policy for <code>Pacu</code> in next section.</p>
</blockquote>
<p>
  
  <input type="checkbox" id="zoomCheck-26bc4" hidden />
  <label for="zoomCheck-26bc4">
    <img
      class="zoomCheck"
      loading="lazy"
      decoding="async"
      src="img/aws-setup.webp"
      alt="AWS Console Setup"
       />
  </label>
</p>
<h3 id="scoutsuite">ScoutSuite</h3>
<p><code>Scout Suite</code> is an open source multi-cloud security-auditing tool, which enables security posture assessment of cloud environments.</p>
<div class="highlight"><pre tabindex="0" class="chroma"><code class="language-bash" data-lang="bash"><span class="line"><span class="cl">git clone git@github.com:nccgroup/ScoutSuite.git
</span></span><span class="line"><span class="cl">
</span></span><span class="line"><span class="cl">virtualenv -p python3 venv <span class="c1"># Create virtual environment</span>
</span></span><span class="line"><span class="cl"><span class="nb">source</span> venv/bin/activate   <span class="c1"># Activate virtual environment in shell</span>
</span></span><span class="line"><span class="cl">
</span></span><span class="line"><span class="cl"><span class="nb">cd</span> ScoutSuite
</span></span><span class="line"><span class="cl">pip install                <span class="c1"># Install dependencies</span>
</span></span></code></pre></div><h3 id="setup-pacu">Setup Pacu</h3>
<p><code>Pacu</code> is an open-source AWS exploitation framework, designed for offensive security testing against cloud environments</p>
<div class="highlight"><pre tabindex="0" class="chroma"><code class="language-bash" data-lang="bash"><span class="line"><span class="cl">git clone git@github.com:RhinoSecurityLabs/pacu.git
</span></span><span class="line"><span class="cl"><span class="nb">source</span> venv/bin/activate   <span class="c1"># Activate virtual environment in shell</span>
</span></span><span class="line"><span class="cl">
</span></span><span class="line"><span class="cl"><span class="nb">cd</span> pacu
</span></span><span class="line"><span class="cl">./install.sh               <span class="c1"># Install Dependencies</span>
</span></span></code></pre></div><h3 id="setup-prowler">Setup Prowler</h3>
<p><code>Prowler</code> is an Open Source security tool to perform AWS, GCP and Azure security best practices assessments, audits, incident response, continuous monitoring, hardening and forensics readiness.</p>
<div class="highlight"><pre tabindex="0" class="chroma"><code class="language-bash" data-lang="bash"><span class="line"><span class="cl">git clone git@github.com:prowler-cloud/prowler.git
</span></span><span class="line"><span class="cl"><span class="nb">source</span> venv/bin/activate   <span class="c1"># Activate virtual environment in shell</span>
</span></span><span class="line"><span class="cl">
</span></span><span class="line"><span class="cl"><span class="nb">cd</span> prowler
</span></span><span class="line"><span class="cl">pip install prowler <span class="c1"># Install prowler and its dependencies</span>
</span></span><span class="line"><span class="cl">
</span></span><span class="line"><span class="cl">./prowler.py aws -f us-east-2 -s <span class="o">{</span>s3,iam,cloudtrail,cloudwatch<span class="o">}</span> <span class="c1"># Running</span>
</span></span></code></pre></div><h2 id="scoutsuite-assessment">ScoutSuite Assessment</h2>
<p>Navigate to cloned folder, activate the environment and run the scout suite.</p>
<div class="highlight"><pre tabindex="0" class="chroma"><code class="language-bash" data-lang="bash"><span class="line"><span class="cl"><span class="nb">cd</span> ScoutSuite
</span></span><span class="line"><span class="cl">
</span></span><span class="line"><span class="cl">python3 scout.py           <span class="c1"># Start auditing using scout.py</span>
</span></span></code></pre></div><p>Running Scout Suite will take some minutes to complete.</p>
<p>
  
  <input type="checkbox" id="zoomCheck-b5cf2" hidden />
  <label for="zoomCheck-b5cf2">
    <img
      class="zoomCheck"
      loading="lazy"
      decoding="async"
      src="img/scout-suite-cli.webp"
      alt="CLI Output of Scout Suite"
       />
  </label>

After completion, you&rsquo;ll see html file as an output stored inside <strong>scoutsuite-report</strong> folder. Go to the folder and open it in your browser.</p>
<p>
  
  <input type="checkbox" id="zoomCheck-3aef8" hidden />
  <label for="zoomCheck-3aef8">
    <img
      class="zoomCheck"
      loading="lazy"
      decoding="async"
      src="img/scout-suite-output.webp"
      alt="HTML file generated by Scout Suite"
       />
  </label>
</p>
<h3 id="cloudwatch-recommendation">Cloudwatch Recommendation</h3>
<p>
  
  <input type="checkbox" id="zoomCheck-0a1b8" hidden />
  <label for="zoomCheck-0a1b8">
    <img
      class="zoomCheck"
      loading="lazy"
      decoding="async"
      src="img/cloud-watch-dashboard.webp"
      alt="Cloud Watch Dashboard Critical Configuration"
       />
  </label>
</p>
<p>Here, <code>CloudTrail is not configured</code> in dashboard signifies it is a crucial issue and vulnerability as AWS CloudTrail plays a critical role in monitoring and auditing AWS resources and API activities. Without it being configured, we will lack visibility into actions taken within AWS environment, making it difficult to detect and investigate security incidents.</p>
<p>To address this, we should create a CloudTrail trail to log events in all AWS Regions. This trail should deliver log files to an <code>Amazon S3</code> bucket which is storage service of AWS. As per the best practices documentation, we also need to enable CloudTrail log file integrity and integrate it with <code>Amazon CloudWatch</code> Logs for monitoring to make sure the file is not changed. Additionally, it is considered good practice to use AWS Security Hub to monitor CloudTrail resources.</p>
<h3 id="iam-recommendation">IAM Recommendation</h3>
<p>
  
  <input type="checkbox" id="zoomCheck-f5fdb" hidden />
  <label for="zoomCheck-f5fdb">
    <img
      class="zoomCheck"
      loading="lazy"
      decoding="async"
      src="img/iam-dashboard.webp"
      alt="Cloud Watch Dashboard Critical Configuration"
       />
  </label>
</p>
<p>In general, it shows two different types of vulnerabilities:</p>
<ul>
<li>
<p><strong>Password Policies</strong>: The vulnerabilities related to inadequate password length, expiration, and reuse signify a weak password policy in your AWS environment.</p>
<p><strong><em>To remediate these issues</em></strong>, we need to enforce stronger password policies that require longer passwords, implement regular password expiration intervals (e.g., 90 days), and disallow password reuse to enhance security.</p>
</li>
<li>
<p><strong>Root Account Security</strong>: The vulnerabilities regarding root account usage and the absence of <code>Multi-Factor Authentication (MFA)</code> highlight the need for securing the root AWS account.</p>
<p><strong><em>To address these issues</em></strong>, we need to ensure that IAM policies are attach only the users and groups, enable hardware-based MFA for the root account, and enforce MFA for all users accessing the AWS environment. Additionally, limit the use of the root account and establish individual IAM user accounts with appropriate permissions to reduce security risks associated with the root account.</p>
</li>
</ul>
<h2 id="pacu-exploitation">Pacu Exploitation</h2>
<p>In Pacu, I will try to escalate the privilege by using the tool command. To do this, I have to add custom policy referred as misconfigured customer managed policy. Practically, it is possible someone can add hazardous policy without knowing the consequences and human error or misconfiguration can happen. To do this follow these steps:</p>
<h3 id="adding-custom-policy">Adding custom policy</h3>
<ul>
<li>
<p>Navigate to Identity Access Management (<code>IAM</code>) Service</p>
</li>
<li>
<p>Go to <strong>Policies</strong> &gt; <strong>Create policy</strong> &gt; <strong>JSON</strong> to create new policy <code>PacuExploitPolicy</code>.</p>
</li>
<li>
<p>Copy and paste following lines in <strong>Policy Editor</strong> &gt; <strong>Next</strong> &gt; <strong>Create Policy</strong>.</p>
<div class="highlight"><pre tabindex="0" class="chroma"><code class="language-json" data-lang="json"><span class="line"><span class="cl"><span class="p">{</span>
</span></span><span class="line"><span class="cl">  <span class="nt">&#34;Version&#34;</span><span class="p">:</span> <span class="s2">&#34;2012-10-17&#34;</span><span class="p">,</span>
</span></span><span class="line"><span class="cl">  <span class="nt">&#34;Statement&#34;</span><span class="p">:</span> <span class="p">[</span>
</span></span><span class="line"><span class="cl">    <span class="p">{</span>
</span></span><span class="line"><span class="cl">      <span class="nt">&#34;Sid&#34;</span><span class="p">:</span> <span class="s2">&#34;VisualEditor1&#34;</span><span class="p">,</span>
</span></span><span class="line"><span class="cl">      <span class="nt">&#34;Effect&#34;</span><span class="p">:</span> <span class="s2">&#34;Allow&#34;</span><span class="p">,</span>
</span></span><span class="line"><span class="cl">      <span class="nt">&#34;Action&#34;</span><span class="p">:</span> <span class="s2">&#34;s3:*&#34;</span><span class="p">,</span>
</span></span><span class="line"><span class="cl">      <span class="nt">&#34;Resource&#34;</span><span class="p">:</span> <span class="s2">&#34;arn:aws:s3:::cybr-pacu-lab-example&#34;</span>
</span></span><span class="line"><span class="cl">    <span class="p">},</span>
</span></span><span class="line"><span class="cl">    <span class="p">{</span>
</span></span><span class="line"><span class="cl">      <span class="nt">&#34;Sid&#34;</span><span class="p">:</span> <span class="s2">&#34;Statement1&#34;</span><span class="p">,</span>
</span></span><span class="line"><span class="cl">      <span class="nt">&#34;Effect&#34;</span><span class="p">:</span> <span class="s2">&#34;Allow&#34;</span><span class="p">,</span>
</span></span><span class="line"><span class="cl">      <span class="nt">&#34;Action&#34;</span><span class="p">:</span> <span class="p">[</span>
</span></span><span class="line"><span class="cl">        <span class="s2">&#34;iam:Get*&#34;</span><span class="p">,</span>
</span></span><span class="line"><span class="cl">        <span class="s2">&#34;iam:List*&#34;</span><span class="p">,</span>
</span></span><span class="line"><span class="cl">        <span class="s2">&#34;iam:Put*&#34;</span><span class="p">,</span>
</span></span><span class="line"><span class="cl">        <span class="s2">&#34;iam:AttachRolePolicy&#34;</span><span class="p">,</span>
</span></span><span class="line"><span class="cl">        <span class="s2">&#34;iam:SimulateCustomPolicy&#34;</span><span class="p">,</span>
</span></span><span class="line"><span class="cl">        <span class="s2">&#34;iam:SimulatePrincipalPolicy&#34;</span>
</span></span><span class="line"><span class="cl">      <span class="p">],</span>
</span></span><span class="line"><span class="cl">      <span class="nt">&#34;Resource&#34;</span><span class="p">:</span> <span class="s2">&#34;*&#34;</span>
</span></span><span class="line"><span class="cl">    <span class="p">}</span>
</span></span><span class="line"><span class="cl">  <span class="p">]</span>
</span></span><span class="line"><span class="cl"><span class="p">}</span>
</span></span></code></pre></div><p>Source: <a href="https://www.youtube.com/watch?v=IbqjtqTeyr0">intro to AWS PENTESTING (with Pacu)</a></p>
</li>
<li>
<p>Next, attach the custom policy to the <code>testing</code> group or <code>kaliuser</code> user directly. I attached for user group.</p>
</li>
</ul>
<blockquote>
<p>Note: In the custom policy, <code>iam:Put*</code> is risky attribute which allow to add new Policies leading to escalate the policy. You&rsquo;ll see how that can be achieved in the next section.</p>
</blockquote>
<h3 id="running-pacu">Running Pacu</h3>
<div class="highlight"><pre tabindex="0" class="chroma"><code class="language-bash" data-lang="bash"><span class="line"><span class="cl"><span class="nb">cd</span> pacu
</span></span><span class="line"><span class="cl">
</span></span><span class="line"><span class="cl">./cli.sh                   <span class="c1"># Start Pacu.</span>
</span></span></code></pre></div><h3 id="setting-up-aws-credentials">Setting up AWS credentials</h3>
<p>First, we need to setup the AWS keys using <code>set_keys</code> and <code>set_regions</code> command.</p>
<p>
  
  <input type="checkbox" id="zoomCheck-81ffa" hidden />
  <label for="zoomCheck-81ffa">
    <img
      class="zoomCheck"
      loading="lazy"
      decoding="async"
      src="img/pacu-aws-setup.webp"
      alt="Setting AWS keys in Pacu"
       />
  </label>
</p>
<h3 id="begin-exploitation">Begin Exploitation</h3>
<p>Before beginning exploitation, you can enumerate the IAM permissions using command <code>run iam__enum_permissions</code>. Now, I run command <code>run iam__privesc_scan</code>, you&rsquo;ll see output something like this:</p>
<p>
  
  <input type="checkbox" id="zoomCheck-cae88" hidden />
  <label for="zoomCheck-cae88">
    <img
      class="zoomCheck"
      loading="lazy"
      decoding="async"
      src="img/pacu-exploitation.webp"
      alt="Running privilege escalation in Pacu"
       />
  </label>
</p>
<p>You can see escalation method <code>PutGroupPolicy</code> and <code>PutUserPolicy</code> is used to attempt the privilege escalation. In the highlighted section, new administrator policy to the current user has been added with policy named <code>o7go7jwhnq</code>.</p>
<p>
  
  <input type="checkbox" id="zoomCheck-754c3" hidden />
  <label for="zoomCheck-754c3">
    <img
      class="zoomCheck"
      loading="lazy"
      decoding="async"
      src="img/pacu-aws-modified.webp"
      alt="AWS Permissions modified by pacu"
       />
  </label>
</p>
<blockquote>
<p>You can verify by running <code>run iam__enum_permissions</code> command in <code>pacu</code> terminal where you&rsquo;ll notice, objects with escalated admin permissions.</p>
</blockquote>
<h3 id="takeaways">Takeaways</h3>
<p>Pacu provides several commands for pen testers to enumerate, privilege escalate, reconnaissance, exfiltration, exploitation, and persistence on the given AWS account. In this activity, I used <code>iam__privesc_scan</code> which is a command designed to scan for and exploit privilege escalation vulnerabilities in AWS Identity and Access Management (IAM) policies. If the policy is weak or vulnerable, this command can look for multiple approach to escalate privilege to a current AWS user. This command can be used in penetration testing for following purposes:</p>
<ul>
<li>Identify Weak IAM Policies that can be potentially exploited for privilege escalation.</li>
<li>Demonstrate impact of weak policies by creating, modifying, and deleting AWS resources.</li>
<li>Assessing the Security Posture is a great advantage as it can help identify and highlight areas where IAM policies need to be improved.</li>
</ul>
<h2 id="prowler-assessment">Prowler Assessment</h2>
<div class="highlight"><pre tabindex="0" class="chroma"><code class="language-bash" data-lang="bash"><span class="line"><span class="cl"><span class="nb">cd</span> prowler
</span></span><span class="line"><span class="cl">
</span></span><span class="line"><span class="cl">./prowler.py aws -f us-east-2 -s <span class="o">{</span>s3,iam,cloudtrail,cloudwatch<span class="o">}</span> <span class="c1"># Run Prowler</span>
</span></span></code></pre></div><p>Here, I used <code>prowler</code> to scan for specific services like <code>S3</code>, <code>IAM</code>, <code>Cloudtrail</code>, <code>Cloudwatch</code>.</p>
<p>
  
  <input type="checkbox" id="zoomCheck-3245b" hidden />
  <label for="zoomCheck-3245b">
    <img
      class="zoomCheck"
      loading="lazy"
      decoding="async"
      src="img/prowler-output.webp"
      alt="Running Prowler"
       />
  </label>
</p>
<p>The output is summarized in the terminal or we can open the html file for detailed results in browser.</p>
<p>
  
  <input type="checkbox" id="zoomCheck-04c37" hidden />
  <label for="zoomCheck-04c37">
    <img
      class="zoomCheck"
      loading="lazy"
      decoding="async"
      src="img/prowler-detailed-output.webp"
      alt="Prowler scan, detailed output"
       />
  </label>
</p>
<p>
  
  <input type="checkbox" id="zoomCheck-596e6" hidden />
  <label for="zoomCheck-596e6">
    <img
      class="zoomCheck"
      loading="lazy"
      decoding="async"
      src="img/prowler-filtered-output.webp"
      alt="Prowler resulting custom policy as severity level of high"
       />
  </label>
</p>
<p>From the Prowler result the custom policy that we created is identified as vulnerable with high severity:</p>
<ul>
<li><em>Severity:</em> <strong>High</strong></li>
<li><em>Service Name:</em> <strong>IAM</strong> (Identity and Access Management)</li>
<li><em>Region:</em> <strong>us-east-2</strong></li>
<li><em>Check ID:</em> <strong>iam_policy_allows_privilege_escalation</strong></li>
<li><em>Check Title:</em> Ensure no Customer Managed IAM policies allow actions that may lead to Privilege Escalation</li>
<li><em>Resource ID:</em> Custom Policy arn:aws:iam::201368012826:policy/PacuExploitPolicy allows privilege escalation using the following actions: {&lsquo;iam:AttachRolePolicy&rsquo;}.</li>
<li><em>Status:</em> <strong>FAIL</strong></li>
<li><em>Risk:</em> Users with some IAM permissions are allowed to elevate their privileges up to administrator rights.</li>
<li><em>Associated with:</em> MITRE ATT&amp;CK and AWS Well-Architected Framework (Security Pillar)</li>
<li><em>Recommendations:</em>
<ul>
<li>Granting usage permission on a per-resource basis</li>
<li>Applying the least privilege principle.</li>
<li>The best practice is to review and adjust the polices to remove the risky permissions.</li>
<li>Regular auditing and assessment of IAM policies is also important to figure out the security posture.</li>
</ul>
</li>
</ul>
<h2 id="conclusion">Conclusion</h2>
<p>We covered three powerful open-source cloud assessment tools - ScoutSuite, Pacu and Prowler.</p>
<ul>
<li><strong>Scoutsuite</strong> allowed us to perform a comprehensive scan of AWS, identifying vulnerabilities, misconfigurations, and potential security risks.</li>
<li><strong>Pacu</strong> enabling us to simulate attacks and assess the security of our AWS environment from an attacker&rsquo;s perspective</li>
<li><strong>Prowler</strong> with more robust assessment by conducting security best practice checks and compliance checks based on industry standards.</li>
</ul>
<p>Furthermore, I demonstrated how a simple misconfiguration could be exploited using these Pacu to gain higher privilege access. By regularly conducting assessments and adhering to best practices when creating policies and configurations, we can improve our defenses and minimize the potential for such cloud security breaches.</p>
<h2 id="resources">Resources</h2>
<ul>
<li><a href="https://www.youtube.com/watch?v=IbqjtqTeyr0">AWS Pentesting (with pacu) by Cybr</a></li>
</ul>
]]></content:encoded>
    </item>
    <item>
      <title>Capture The Flag Competition Preparation Journey</title>
      <link>https://sagarchamling.com/blogs/cybersecurity/ctf-competition-preparation-journey/</link>
      <pubDate>Thu, 19 Oct 2023 00:00:00 +0000</pubDate>
      <guid>https://sagarchamling.com/blogs/cybersecurity/ctf-competition-preparation-journey/</guid>
      <description>Experience sharing, Cracking CTF preparation for competition</description>
      <content:encoded><![CDATA[<blockquote>
<p><strong>Important Note</strong>: Always follow ethical guidelines. Never use these skills for illegal activities.</p>
</blockquote>
<blockquote>
<p>You can find competition galleries <a href="/honors/winner-of-capture-the-flag-competition/">here</a> 👈.</p>
</blockquote>
<h2 id="familiarization">Familiarization</h2>
<p>The preparation journey led me to platforms like <strong>Hack The Box</strong>, <strong>TryHackMe</strong>, and <strong>CyberQ</strong>, all of which offered a free tier Capture the Flag resources and challenges, it helped me get started.</p>
<p>I began solving basic challenges and gradually familiarized with the platforms, gaining fundamental skills in <em>port scanning</em> and <em>network discovery</em> done for <strong>enumeration</strong> as part of the <strong>reconnaissance</strong> process. As I progressed, I gained knowledge about potential network port specific <em>misconfigurations</em> that could potentially <em>bypass authentication</em>. In most challenges, <em>password cracking</em>, <em>directory traversal</em>, <em>reverse shell</em> and <em>achieving privilege escalation</em> were intermediate steps crucial for capturing the flags. I realized the importance of becoming proficient in these concepts in ethical hacking.</p>
<blockquote>
<p>Understanding all the concepts and tools was challenging, so I began to compile reference notes. This not only helped me memorize but also served as a handy guide. You can refer <a href="/categories/ethical-hacking/">here</a> 👈.</p>
</blockquote>
<h2 id="building-mindset">Building Mindset</h2>
<p>CTF challenges and competitions can vary based on different cloud platforms. Here are the basic strategy to help you start building a mindset for cracking CTFs:</p>
<h3 id="enumeration">Enumeration</h3>
<ul>
<li>Discover networks to find the IP address of active hosts in the given network.</li>
<li>Scan for operating system, open service ports with versions and look for common misconfigurations that could lead to bypass the authentication process.</li>
<li>Use a browser to explore the application or perform directory traversal to find unsecured hidden paths.</li>
</ul>
<h3 id="exploitation">Exploitation</h3>
<ul>
<li>If password locking is an issue, there are many ways to crack passwords using dictionary or brute force attacks. Depending on the situation and target platform, decide which tools will be most effective for cracking password.</li>
<li>Familiarize with the concept of reverse shell and tools that can generate the reverse shell file. This file will help us redirect to the target computer&rsquo;s shell, granting remote access.</li>
<li>This file can be injected either after connecting through open ports or from cracked password.</li>
<li>Once attacker get into the target system, there&rsquo;s a likelihood of further more misconfigurations. These can allow attacker to perform privilege escalation, potentially granting elevated access to resources.</li>
</ul>
<h2 id="competition">Competition</h2>
<h3 id="context">Context</h3>
<p>We were given a scenario with instructions and vulnerable cloud system in EC-Council&rsquo;s CyberQ platform. There were seven flags in total to capture, with the final one being the most challenging. Each flag was linked to the previous one, either directly or indirectly, and the seventh flag couldn’t be captured without finding the first six. In this challenge, we had to demonstrate scanning network skills, password cracking skills, reverse shell and privilege escalation in a Linux based target system.</p>
<h3 id="the-pain">The Pain</h3>
<p>Unfortunately, many of us faced difficulties as the virtual machine (VM) provided for the competition was hosted on a server in <strong>Singapore</strong>. Accessing it from <strong>North America</strong> resulted in a slow server response, <em>keyboard input lag</em>, and <em>key bouncing</em>. Despite the intense competitive environment and the server frustration, I successfully captured all the flags in just 38 minutes.</p>
<p>
  
  <input type="checkbox" id="zoomCheck-22a7b" hidden />
  <label for="zoomCheck-22a7b">
    <img
      class="zoomCheck"
      loading="lazy"
      decoding="async"
      src="img/result.webp"
      alt="CyberQ Result"
       />
  </label>
</p>
<h3 id="answer-hint">Answer Hint</h3>
<table>
<thead>
<tr>
<th>Pattern</th>
<th>Description</th>
<th>Example</th>
</tr>
</thead>
<tbody>
<tr>
<td>N, NN</td>
<td>Represents single or two digit numeric</td>
<td>6, 22</td>
</tr>
<tr>
<td>aaaaaa</td>
<td>Represents all small alphabet of length 6</td>
<td>hannaa</td>
</tr>
<tr>
<td>aaaaaaaaaa-aaaaa-aaaaaa</td>
<td>Represents small alphabets with exact length and hyphen in between</td>
<td>gracemedia-media-player</td>
</tr>
<tr>
<td>NANNNNaaN.NaaNNaN-NNaNaNaNNNNNNNAN</td>
<td>Represents combination of alphabets and numbers</td>
<td>1F6154fc2.7fa29a5-48c6a7b6902590E7</td>
</tr>
</tbody>
</table>
<h3 id="tips">Tips</h3>
<ul>
<li>
<p><strong>CyberQ Tip</strong>: To overcome the key bouncing issue, I typed commands in my system’s notepad and then copied them to the CyberQ VM using the <strong>Paste Clipboard Text</strong> button.</p>
</li>
<li>
<p><strong>Troubleshooting Tip</strong>: <strong>Reset</strong> your VM, if you face black screen of death or any OS issue.</p>
</li>
<li>
<p><strong>Submission Tip</strong>: It is specific to CyberQ, even if you submit all your flags correctly, the time doesn&rsquo;t stop unless you <strong>Ends/Terminates the running</strong> by the VM using the <strong>red power</strong> button. Then, finish lab by clicking <strong>Finish</strong> button.</p>
</li>
</ul>
]]></content:encoded>
    </item>
  </channel>
</rss>
