<?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 Sam Mirov on Medium]]></title>
        <description><![CDATA[Stories by Sam Mirov on Medium]]></description>
        <link>https://medium.com/@melodicbook?source=rss-f27a4e86b3c4------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/1*InB11x2xvQmfr6mAh6ECRQ.jpeg</url>
            <title>Stories by Sam Mirov on Medium</title>
            <link>https://medium.com/@melodicbook?source=rss-f27a4e86b3c4------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Thu, 03 Dec 2026 15:15:04 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@melodicbook/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[Indirect Prompt Injection in Preplexity Comet AI]]></title>
            <description><![CDATA[<div class="medium-feed-item"><p class="medium-feed-image"><a href="https://medium.com/@melodicbook/indirect-prompt-injection-in-preplexity-comet-ai-03a383d971c6?source=rss-f27a4e86b3c4------2"><img src="https://cdn-images-1.medium.com/max/2100/0*zfKArPORT1_UQ_0g.png" width="2100"></a></p><p class="medium-feed-snippet">LLM&#x2011;powered &#x201C;email butlers&#x201D; can now read, summarize, and reply to emails on your behalf, once you connect them to Gmail or other providers&#x2026;</p><p class="medium-feed-link"><a href="https://medium.com/@melodicbook/indirect-prompt-injection-in-preplexity-comet-ai-03a383d971c6?source=rss-f27a4e86b3c4------2">Continue reading on Medium »</a></p></div>]]></description>
            <link>https://medium.com/@melodicbook/indirect-prompt-injection-in-preplexity-comet-ai-03a383d971c6?source=rss-f27a4e86b3c4------2</link>
            <guid isPermaLink="false">https://medium.com/p/03a383d971c6</guid>
            <category><![CDATA[prompt-injection-attack]]></category>
            <category><![CDATA[ai-security]]></category>
            <category><![CDATA[bug-bounty]]></category>
            <category><![CDATA[indirect-prompt-injection]]></category>
            <category><![CDATA[ai]]></category>
            <dc:creator><![CDATA[Sam Mirov]]></dc:creator>
            <pubDate>Thu, 22 Jan 2026 12:53:22 GMT</pubDate>
            <atom:updated>2026-01-22T12:53:22.570Z</atom:updated>
        </item>
        <item>
            <title><![CDATA[Web Services SOAP Based Attack Vectors]]></title>
            <description><![CDATA[<div class="medium-feed-item"><p class="medium-feed-image"><a href="https://medium.com/@melodicbook/web-services-soap-based-attack-vectors-a3a2672425ed?source=rss-f27a4e86b3c4------2"><img src="https://cdn-images-1.medium.com/max/631/1*w47Z62CtMPD0z2hOO0ecuw.png" width="631"></a></p><p class="medium-feed-snippet">Web Service Definition Language Disclosure &amp; Method Enumeration:</p><p class="medium-feed-link"><a href="https://medium.com/@melodicbook/web-services-soap-based-attack-vectors-a3a2672425ed?source=rss-f27a4e86b3c4------2">Continue reading on Medium »</a></p></div>]]></description>
            <link>https://medium.com/@melodicbook/web-services-soap-based-attack-vectors-a3a2672425ed?source=rss-f27a4e86b3c4------2</link>
            <guid isPermaLink="false">https://medium.com/p/a3a2672425ed</guid>
            <category><![CDATA[bug-bounty-writeup]]></category>
            <category><![CDATA[web-services]]></category>
            <category><![CDATA[bug-bounty]]></category>
            <category><![CDATA[penetration-testing]]></category>
            <category><![CDATA[bug-bounty-tips]]></category>
            <dc:creator><![CDATA[Sam Mirov]]></dc:creator>
            <pubDate>Tue, 21 Oct 2025 06:49:52 GMT</pubDate>
            <atom:updated>2025-10-21T06:49:52.434Z</atom:updated>
        </item>
        <item>
            <title><![CDATA[How mass-assignment led to stored-XSS and a CSP bypass in a major chatbot platform]]></title>
            <description><![CDATA[<div class="medium-feed-item"><p class="medium-feed-image"><a href="https://medium.com/@melodicbook/how-mass-assignment-led-to-stored-xss-and-a-csp-bypass-in-a-major-chatbot-platform-3c6569d7c9e9?source=rss-f27a4e86b3c4------2"><img src="https://cdn-images-1.medium.com/max/1667/1*loUwVqIvGd64cos0Km9xrA.png" width="1667"></a></p><p class="medium-feed-snippet">By Sami Mirov&#x200A;&#x2014;&#x200A;Security Researcher</p><p class="medium-feed-link"><a href="https://medium.com/@melodicbook/how-mass-assignment-led-to-stored-xss-and-a-csp-bypass-in-a-major-chatbot-platform-3c6569d7c9e9?source=rss-f27a4e86b3c4------2">Continue reading on Medium »</a></p></div>]]></description>
            <link>https://medium.com/@melodicbook/how-mass-assignment-led-to-stored-xss-and-a-csp-bypass-in-a-major-chatbot-platform-3c6569d7c9e9?source=rss-f27a4e86b3c4------2</link>
            <guid isPermaLink="false">https://medium.com/p/3c6569d7c9e9</guid>
            <category><![CDATA[cybersecurity]]></category>
            <category><![CDATA[web-applications]]></category>
            <category><![CDATA[bug-bounty]]></category>
            <category><![CDATA[research]]></category>
            <dc:creator><![CDATA[Sam Mirov]]></dc:creator>
            <pubDate>Mon, 13 Oct 2025 17:46:21 GMT</pubDate>
            <atom:updated>2025-10-13T17:46:21.746Z</atom:updated>
        </item>
        <item>
            <title><![CDATA[Mastering SSTI Exploitation: Executing Commands in Popular Templating Engines]]></title>
            <link>https://medium.com/@melodicbook/mastering-ssti-exploitation-executing-commands-in-popular-templating-engines-fce0444cd7a7?source=rss-f27a4e86b3c4------2</link>
            <guid isPermaLink="false">https://medium.com/p/fce0444cd7a7</guid>
            <category><![CDATA[owasp-top-10]]></category>
            <category><![CDATA[ssti]]></category>
            <category><![CDATA[server-side-rendering]]></category>
            <category><![CDATA[web-app-pentesting]]></category>
            <category><![CDATA[template-engine]]></category>
            <dc:creator><![CDATA[Sam Mirov]]></dc:creator>
            <pubDate>Tue, 15 Apr 2025 13:22:22 GMT</pubDate>
            <atom:updated>2025-04-15T13:22:22.727Z</atom:updated>
            <content:encoded><![CDATA[<h3>Mastering SSTI Exploitation: Executing Commands in Popular Templating Engines</h3><p>Server-Side Template Injection (SSTI) remains one of the more underestimated attack vectors in modern web applications. By abusing how server-side template engines render dynamic content, an attacker may gain access to internal objects, functions, and—under the right circumstances—achieve remote code execution (RCE).</p><p>The ability to exploit SSTI depends heavily on the specific templating engine used, its underlying language, and whether sandboxing or filtering mechanisms are in place. Below is a curated breakdown of how various popular template engines can be abused for command execution, along with real-world examples and deeper technical reasoning.</p><h3>Popular Templating Engines and Their Exploitation Techniques</h3><h3>Jinja2 (Python)</h3><ul><li><strong>Execution Functions</strong>: os.system(), os.popen(), __import__()</li><li><strong>Why it works</strong>: Jinja2 templates can expose internal Python objects. If attackers can reach __globals__, they may traverse through the object graph to the standard library and use dangerous modules like os.</li><li><strong>Payload Example</strong>:</li><li>{{ self._TemplateReference__context.cycler.__init__.__globals__.os.popen(&#39;id&#39;).read() }}</li><li><strong>Explanation</strong>: This payload relies on accessing the template context, following a chain of attributes to reach os.popen(), and executing a shell command.</li></ul><h3>Twig (PHP)</h3><ul><li><strong>Execution Mechanism</strong>: registerUndefinedFilterCallback(&quot;system&quot;) combined with getFilter()</li><li><strong>Why it works</strong>: Twig is designed to restrict access to dangerous PHP functions. However, if the sandbox is not enabled or internal objects are exposed, attackers can redefine how the engine behaves when encountering undefined filters. This allows hijacking undefined filters and binding them to functions like system().</li><li><strong>Payload Example</strong>:</li><li>{{ _self.env.registerUndefinedFilterCallback(&quot;system&quot;) }} {{ _self.env.getFilter(&quot;id&quot;) }}</li><li><strong>Explanation</strong>: The first line registers system as the callback for any undefined filter. The second line invokes the undefined id filter, effectively triggering system(&#39;id&#39;) and executing the command on the server.</li></ul><h3>Smarty (PHP)</h3><ul><li><strong>Execution Functions</strong>: system(), exec(), shell_exec()</li><li><strong>Why it works</strong>: Legacy versions of Smarty, or poorly configured ones, allow embedding raw PHP using {php} blocks.</li><li><strong>Payload Example</strong>:</li><li>{php}echo system(&#39;id&#39;);{/php}</li><li><strong>Explanation</strong>: Directly executes arbitrary system commands via raw PHP code. Newer Smarty versions disable {php} blocks by default.</li></ul><h3>Velocity (Java)</h3><ul><li><strong>Execution Function</strong>: Runtime.getRuntime().exec()</li><li><strong>Why it works</strong>: Velocity templates run in the Java Virtual Machine. If the attacker can access class metadata or Java reflection APIs, it’s possible to call dangerous methods like exec().</li><li><strong>Payload Example</strong>:</li><li>#set($e=&quot;&quot;)$e.class.forName(&quot;java.lang.Runtime&quot;).getRuntime().exec(&quot;id&quot;)</li><li><strong>Explanation</strong>: Dynamically accesses java.lang.Runtime, obtains a runtime instance, and invokes exec().</li></ul><h3>Freemarker (Java)</h3><ul><li><strong>Execution Function</strong>: freemarker.template.utility.Execute (when enabled)</li><li><strong>Why it works</strong>: Freemarker allows dynamic instantiation of classes. If not configured securely, an attacker may use ?new to create and call the Execute utility.</li><li><strong>Payload Example</strong>:</li></ul><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=fce0444cd7a7" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Exploiting Security Misconfigurations in AWS Cognito AuthFlow Types]]></title>
            <link>https://medium.com/@melodicbook/exploiting-security-misconfigurations-in-aws-cognito-authflow-types-bc693260b8b8?source=rss-f27a4e86b3c4------2</link>
            <guid isPermaLink="false">https://medium.com/p/bc693260b8b8</guid>
            <category><![CDATA[cognito]]></category>
            <category><![CDATA[cognito-user-pools]]></category>
            <category><![CDATA[aws]]></category>
            <category><![CDATA[cybersecurity]]></category>
            <category><![CDATA[cognito-identity-pool]]></category>
            <dc:creator><![CDATA[Sam Mirov]]></dc:creator>
            <pubDate>Thu, 13 Feb 2025 15:33:01 GMT</pubDate>
            <atom:updated>2025-05-13T20:02:34.305Z</atom:updated>
            <content:encoded><![CDATA[<h3>Pentesting AWS Cognito: Exploiting AuthFlow Misconfigurations for Bug Bounties</h3><blockquote>Bug bounty hunters, uncover security gaps in AWS Cognito AuthFlow! Learn how misconfigurations expose vulnerabilities in authentication flows</blockquote><p>Let’s talk about Cognito AuthFlow Types</p><p><strong>Author: Sami Mirov</strong></p><blockquote><em>“</em><strong><em>A</em></strong><em> world of vulnerabilities awaits those audacious enough to seek them, and skilled enough to mend them.”</em></blockquote><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*_rwmtR21F4KbOV-s809R_A.png" /></figure><p>Based on the context, there are several key misconfigurations and attack vectors in Cognito AuthFlows:</p><p>Here are the main types of AuthFlow in Amazon Cognito:</p><ul><li><strong>USER_PASSWORD_AUTH</strong>: Traditional password-based authentication where users submit username and password directly. <strong>USER_SRP_AUTH</strong> is a more secure alternative that prevents direct password transmission.</li><li><strong>CUSTOM_AUTH &amp; CUSTOM_CHALLENGE</strong>: Enables custom authentication flows through AWS Lambda, supporting features like one-time passwords (OTP) or CAPTCHA.</li><li><strong>ADMIN_NO_SRP_AUTH &amp; ALLOW_ADMIN_USER_PASSWORD_AUTH</strong>: Used by backend services or administrators for user authentication.</li><li><strong>REFRESH_TOKEN_AUTH &amp; REFRESH_TOKEN</strong>: Maintains persistent sessions by allowing users to get new access tokens without re-entering credentials.</li><li><strong>SMS_MFA_AUTH</strong>: Provides Multi-Factor Authentication security, while <strong>NEW_PASSWORD_REQUIRED</strong> handles forced password resets.</li></ul><p>Each of these flows is designed for specific use cases and security requirements, balancing usability and security needs for the applications we test daily, but most of the administrators leave the types checked and using only SRP as “SECURED” One.</p><p>Let’s dive in the types</p><p><strong>1. AuthFlow Parameter Manipulation</strong></p><ul><li>Attackers can modify the AuthFlow parameter from secure flows (like USER_SRP_AUTH) to less secure ones (like USER_PASSWORD_AUTH), enabling plaintext password transmission</li></ul><p><strong>2. Custom Authentication Vulnerabilities</strong></p><ul><li>Weak Lambda implementations can lead to authentication bypass if challenges aren’t properly validated</li><li>Custom challenge manipulation and forced challenge injection by altering the ChallengeName parameter</li></ul><p><strong>3. USER_PASSWORD_AUTH Risks</strong></p><ul><li>Vulnerable to credential stuffing, brute-force attacks, and password spraying</li><li>Weak password policies can lead to account takeover</li></ul><p><strong>4. SRP Implementation Issues</strong></p><ul><li>Weak password entropy can enable offline brute-force attempts</li><li>Misconfigurations in SRP parameters or improper secret hash implementation could lead to authentication bypass</li></ul><p><strong>Mitigation Strategies:</strong></p><ul><li>Enforce strong password policies and implement MFA</li><li>Implement proper server-side validation of AuthFlow parameters by ensuring propper secured configurations.</li><li>Ensure strict validation in Lambda functions and proper logging of authentication attempts</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*xlX4BaMeCSAmwjZ8HZ_4-Q.png" /><figcaption>AuthFlow Types</figcaption></figure><p>Amazon Cognito authentication flows, or AuthFlows, define how users authenticate within an application using AWS Cognito. These flows ensure secure access management by leveraging different authentication mechanisms based on user needs and security policies.</p><p>Each AuthFlow is designed for specific use cases, balancing usability and security. Standard password-based authentication is common, but for added security, AWS provides options like Secure Remote Password (SRP) authentication, multi-factor authentication (MFA), and custom authentication using AWS Lambda functions.</p><p>Understanding how each AuthFlow operates helps developers and security researchers identify potential misconfigurations and security vulnerabilities. By breaking down each flow’s API interactions and token management, we can analyze how authentication is enforced within an application.</p><p>Amazon Cognito provides various authentication flows, each designed for different use cases and security requirements.</p><ul><li><strong>USER_PASSWORD_AUTH</strong> allows traditional password-based authentication, but <strong>USER_SRP_AUTH</strong> improves security by preventing password transmission.</li><li><strong>CUSTOM_AUTH &amp; CUSTOM_CHALLENGE</strong> enable custom authentication flows via AWS Lambda, allowing flexible security policies such as one-time passwords (OTP) or CAPTCHA-based authentication.</li><li><strong>ADMIN_NO_SRP_AUTH &amp; ALLOW_ADMIN_USER_PASSWORD_AUTH</strong> are used by backend services or administrators for user authentication, with or without SRP.</li><li><strong>REFRESH_TOKEN_AUTH &amp; REFRESH_TOKEN</strong> ensure persistent sessions by allowing users to get new access tokens without re-entering credentials.</li><li><strong>SMS_MFA_AUTH</strong> secures accounts with Multi-Factor Authentication (MFA), while <strong>NEW_PASSWORD_REQUIRED</strong> handles forced password resets.</li></ul><p>Each flow has distinct security properties and potential attack vectors, which we will explore in detail.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*ARfUoySC7dvAOZ4bFqApPw.png" /><figcaption>USER_PASSWORD_AUTH RISKS</figcaption></figure><p>The USER_PASSWORD_AUTH flow is a common authentication method where the client submits a username and password directly to Cognito for validation. If the credentials are correct, Cognito returns authentication tokens for the user session.</p><p>However, this flow has security risks. Attackers can attempt credential stuffing using breached credentials, perform brute-force attacks, or use password spraying techniques to guess weak passwords. Additionally, weak password policies make accounts vulnerable to takeover.</p><p>Another major attack vector is <strong>manipulating the AuthFlow parameter</strong>. An attacker may change the authentication request to use USER_PASSWORD_AUTH instead of a more secure flow like USER_SRP_AUTH, allowing plaintext password transmission and bypassing security measures.</p><p>Mitigation strategies include enforcing strong password policies, requiring Multi-Factor Authentication (MFA), limiting login attempts, and continuously monitoring authentication logs for suspicious activity.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*otWssvEDN9cCErA7m2-ffg.png" /><figcaption>USER_SRP_AUTH Security Risks</figcaption></figure><p>USER_SRP_AUTH is one of the most secure authentication methods in Amazon Cognito, leveraging the Secure Remote Password (SRP) protocol. Unlike traditional password-based authentication, SRP avoids transmitting plaintext passwords over the network, mitigating risks from eavesdropping and man-in-the-middle (MITM) attacks.</p><p>However, while SRP enhances security, it is not immune to threats. If implemented incorrectly, vulnerabilities may arise, such as weak password entropy allowing offline brute-force attempts. Additionally, misconfigurations in SRP parameters or an improper secret hash implementation could introduce authentication bypass risks.</p><p>One critical attack vector involves altering the <strong>AuthFlow</strong> value in API requests. An attacker may modify the <strong>AuthFlow</strong> parameter from USER_SRP_AUTH to USER_PASSWORD_AUTH, allowing them to authenticate using plaintext passwords instead of SRP-secured authentication. This bypasses the intended security controls and exposes credentials to potential interception.</p><p>To mitigate these risks, developers should ensure SRP is correctly implemented, enforce strong password policies, validate the AuthFlow parameter server-side, and consider additional layers of security like multi-factor authentication (MFA). Security researchers should test for implementation flaws, monitor for weak password choices, and verify the integrity of the authentication process.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*7aXPeWgaaDQKq2m2fmxJ_g.png" /></figure><p>CUSTOM_AUTH is one of the most flexible authentication flows in Amazon Cognito, allowing developers to implement custom authentication logic using AWS Lambda functions. This flow is useful when standard authentication methods do not meet application-specific security requirements, such as integrating biometric authentication, CAPTCHA challenges, or additional risk-based validation steps.</p><p>Despite its flexibility, CUSTOM_AUTH introduces several attack vectors. <strong>Weak or insecure Lambda implementations</strong> may allow authentication bypass if developers do not properly validate authentication challenges. Attackers can attempt to manipulate responses or find ways to skip required authentication steps. <strong>Logic flaws in the custom challenge-response handling</strong> could lead to unauthorized access.</p><p>To mitigate these risks, developers should ensure that Lambda functions strictly validate authentication challenges, restrict IAM permissions to prevent privilege escalation, and log authentication attempts for anomaly detection. Security researchers should focus on testing the integrity of custom authentication logic, checking for ways to bypass authentication steps, and ensuring proper challenge-response validation.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*CKR2Ke1HlEH8eW8XUtMWmA.png" /><figcaption>CUSTOM_AUTH Rissk</figcaption></figure><p>While CUSTOM_AUTH offers flexibility in authentication, improper Lambda implementations can introduce security risks.</p><p>One of the most dangerous vulnerabilities is <strong>Weak Lambda Validation</strong> — if a developer fails to enforce strict authentication checks, an attacker can send an empty or arbitrary response to bypass authentication.</p><p>The <strong>Forced Challenge Injection</strong> exploit occurs when an attacker manipulates the ChallengeName parameter in an API request to trick Cognito into accepting unintended authentication challenges, potentially bypassing required steps.</p><p>To mitigate these risks, developers should ensure strict validation inside AWS Lambda, enforce strong challenge mechanisms, and log authentication attempts to detect anomalies.</p><p>Some edge cases when Cognito configurations allows all the AuthFlows:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/720/1*sM-grD2OqScOL2LThbV7RA.png" /></figure><p><strong>A</strong>fter we talked much, first how did I find the flaw? well while exploring technologies and products implementation first key role study the product’s capabilities and assume what edge cases could potentially risk the application through these services, so the very first ones are Security Misconfigurations, observe and explore the parameters sent towards the service provided and analyze each parameter check it’s essence and influence on technical logic.</p><p><strong>Proof Of Concept:</strong></p><p><strong>Legitimate Request towards the Cognito service:</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*A3VMYnYAghdJfGJgrhzfJA.png" /></figure><p>After I’ve spotted some capabilities in the IDP capabilities and studied carefully each of the parameters, I decided to replace the value of “AuthFlow” Parameter into USER_PASSWORD_AUTH and appened new paraemeter into the json based request “PASSWORD” (Based on Cognito’s USER_PASSWORD_AUTH documentation) as plaintext in order to brute force the password:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/696/1*XWEV0dQ3rKtfczgq5w-PDw.png" /></figure><p>I assume you’re asking how you know the usernames, then I will leave the username enumeration to the next topic, I hope you enjoyed the content so clap for me once ? :)</p><p><strong>Recommended For You:</strong></p><p><a href="https://medium.com/@melodicbook/exploiting-security-misconfiguration-in-auth0-by-okta-061da9330320">Exploiting Security Misconfiguration In Auth0 By Okta</a></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=bc693260b8b8" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Reflected XSS in JavaScript URL with some characters blocked (PortSwigger)]]></title>
            <link>https://medium.com/@melodicbook/reflected-xss-in-javascript-url-with-some-characters-blocked-portswigger-97e2531eed04?source=rss-f27a4e86b3c4------2</link>
            <guid isPermaLink="false">https://medium.com/p/97e2531eed04</guid>
            <category><![CDATA[xss-bypass]]></category>
            <category><![CDATA[portswigger]]></category>
            <category><![CDATA[offensive-security]]></category>
            <category><![CDATA[web-application-security]]></category>
            <category><![CDATA[xss-attack]]></category>
            <dc:creator><![CDATA[Sam Mirov]]></dc:creator>
            <pubDate>Fri, 12 Jul 2024 13:43:59 GMT</pubDate>
            <atom:updated>2024-07-12T13:43:59.625Z</atom:updated>
            <content:encoded><![CDATA[<p>H3llo, my name is Sami a web application penetration tester , today we’ll discuss about interesting topic that is focusing on JavaScript functions manipulation.</p><p>We’ll solve the following lab which is tagged as <strong>expert level.</strong></p><p><a href="https://portswigger.net/web-security/cross-site-scripting/contexts/lab-javascript-url-some-characters-blocked">Lab: Reflected XSS in a JavaScript URL with some characters blocked | Web Security Academy</a></p><p><strong>A quick summary about the lab :</strong></p><p>This lab uses some JavaScript API functionality that is abusable to append more data in it. But before we do so it’s important to understand that there are several characters that are being blocked by the application.</p><p><strong>Let’s First Understand Our Main Goal:</strong></p><blockquote>To solve the lab, perform a <a href="https://portswigger.net/web-security/cross-site-scripting">cross-site scripting</a> attack that calls the alert function with the string 1337 contained somewhere in the alert message.</blockquote><p><strong>Identification Phase</strong></p><p><strong>I</strong>n this step we’ll map all the injection points and check in the Document Object Module (or the document if you want) how the data reflects, are there any encodings? or the input data is being reflected in some JavaScript function?</p><p><strong>Let’s map out the controlable parameters:</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/848/1*iHr7ePuKdrdfQ7Xz3I-e-g.png" /></figure><blockquote><strong>Clicking “View Post” changes our URI to /post/postId=4</strong></blockquote><figure><img alt="Injection Point" src="https://cdn-images-1.medium.com/max/858/1*qVMS9-lubPt7qvUIe7r0ug.png" /></figure><p><strong>Reflection Analysis Step</strong></p><p>After we found the potential injection point, the very first step is to ensure we’re able to manipulate it and build payload to inject XSS.</p><p>Searching for “postId” in the Elements tab of DevTools results the following screenshot that is demonstrated below:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*fazxbFB7itaSNswAGsXewg.png" /></figure><p>We understand that javascript:fetch() functionality is an API function in JavaScript, if you are not familliar with the API functionality it is recommended to read more about it before advancing furthermore</p><p><a href="https://www.w3schools.com/js/js_api_fetch.asp">W3Schools.com</a></p><p>So how can we build our payload? regarding this interesting reflection inside fetch functionality.</p><p>First of all we must understand that we have the ability to pass more arguments inside Fetch() functionality but the question is if it will be executed?</p><p>As JS if the number of arguments is reaching to the limit the rest of the arguments won’t be considered as data or anything.</p><p>So we’ll first of all try to undestand how it is possible to chain our payload and trigger some event to popup an alert.</p><p>As we’ve noticed earlier the fetch() additional arguments are passed in curly brackets, so we’ll need to append “and” or ampersand operator and single quote then close the first argument with curly brackets in order to close the fetch() functionality.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*tzzXE98KH9b-jUDCQj31Zg.png" /></figure><p><strong>Matching Payload To The Context</strong></p><p>The following screen capture demonstrates usage of exception errors functionality in JavaScript. We’ve created new function with no arguments that throws an error.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/775/1*0RsIIBCcEvbtmEnZjMGv1w.png" /></figure><p>The following screen capture exposes the uncaught exception error that we’ve chained into alert and the payload with passing more variables with comma separated value data.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/908/1*ay9_ZMkJrz-Vh7z6_neDlw.png" /></figure><p>Using the same technique in order to append more data we’ll add comma inside the fetch() API functionality starting with our malicious payload that bypassed spaces with comment like syntax /**/:</p><pre>post?postId=4&amp;&#39;},x=x=&gt;{throw/**/onerror=alert,1337}&#39;</pre><p>So how do we keep our from here? nothing executes the function x to imitate the payload.</p><p><strong>Let’s dive deep to JS functionalities overwrites:</strong></p><pre>post?postId=4&amp;&#39;},x=x=&gt;{throw/**/onerror=alert,1337},toString=x,window+&#39;&#39;</pre><p>What happens in the payload above? we are overwriting the function toString() to x as variable which is a function that contains our payload, right?</p><p>Why we need the use of another argument inside the statement? how window+’’ (empty string), is apart of the payload?</p><p><strong><em>The answer is:</em></strong></p><p>We’re concatenating the payload together with window() empty string functionality that will try to call the default toString() JavaScript we all know instead of calling the real toString() function it will execute our mutated function with x(); That we have overwritted in order to force the payload to run.</p><p><strong>Final Payload:</strong></p><p><strong>So how the final payload works under the hood?</strong></p><p>After we found an injection point, manipulated it’s reflaction and created function, also we’ve overwitted a legitimate function and then forced this overwritted function to execute our payload, it is always curical to close our XSS payload without any errors, since we’re operating at curly barckets in fetch() API method of JavaScript, our payload must have additional parameter ,{x:’ as argument for the fetch() method.</p><pre>post?postId=4&amp;&#39;},x=x=&gt;{throw/**/onerror=alert,1337},toString=x,window+&#39;&#39;,{x:&#39;</pre><p>Congratulations you’ve solved the lab <strong>AND understood the attack logic</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*1WSKHOGHvMtMjH7JgPDHqw.png" /></figure><p>It is critical to understand what you’re exploiting and how, when it comes to labs do not use the walkthroughs without understanding the attack logic.</p><p>Hope you’ve learnt something new from this walkthrough, I would like to thank <strong>z3nsh3ll for demonstrating and explaining in a video about this lab and the logic behind this lab.</strong></p><p><a href="https://www.youtube.com/channel/UCnWAPVvXxivIo40QpjEMU1w">z3nsh3ll</a></p><p><a href="https://www.youtube.com/watch?v=bCpBD--GCtQ&amp;t=1264s">https://www.youtube.com/watch?v=bCpBD--GCtQ&amp;t=1264s</a></p><p>Thank you for reading.</p><p>Best Regards,</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=97e2531eed04" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Exploiting Security Misconfiguration In Auth0 By Okta]]></title>
            <link>https://medium.com/@melodicbook/exploiting-security-misconfiguration-in-auth0-by-okta-061da9330320?source=rss-f27a4e86b3c4------2</link>
            <guid isPermaLink="false">https://medium.com/p/061da9330320</guid>
            <category><![CDATA[penetration-tester]]></category>
            <category><![CDATA[appsec]]></category>
            <category><![CDATA[auth0]]></category>
            <category><![CDATA[web-application-security]]></category>
            <category><![CDATA[security-misconfiguration]]></category>
            <dc:creator><![CDATA[Sam Mirov]]></dc:creator>
            <pubDate>Sun, 23 Jun 2024 17:59:08 GMT</pubDate>
            <atom:updated>2025-05-13T20:02:58.746Z</atom:updated>
            <content:encoded><![CDATA[<p>This writeup focuses on security misconfigurations and default endpoints left open to the wild.</p><blockquote><strong>My name is Sam</strong> an AppSec penetration tester, we’ll explore about Auth0 endpoints and even speak much more about security misconfigurations that could grant you pretty handful bounty at your bug bounty hunting progress.</blockquote><figure><img alt="" src="https://cdn-images-1.medium.com/max/484/0*2_7W1uws51HC0nF8" /></figure><p><strong>Auth0 by Okta</strong> is a prominent identity management platform that offers comprehensive solutions for authentication, authorization, and secure identity management across various applications and APIs. Acquired by Okta in 2021, Auth0 continues to operate as a distinct offering, leveraging Okta’s robust infrastructure and expertise in identity management.</p><p>Auth0 simplifies the complex task of integrating authentication and authorization features into applications, allowing developers to focus more on core functionalities rather than reinventing secure user management systems. Here’s how it works:</p><p>So After we spoke a little bit about Auth0, let’s understand it’s default endpoints for logging in/ resetting passwords / registration functionalities.</p><h3>Auth0 Endpoints</h3><p><strong>Auth0</strong> provides default endpoints for various authentication and user management functionalities under the <strong>/dbconnections/</strong> path. These endpoints are typically used when integrating Auth0 with applications that require database connections for user authentication and management. Here&#39;s a list of some common endpoints and their purposes:</p><blockquote><strong>Login Endpoint (</strong><strong>/dbconnections/login)</strong>:</blockquote><ul><li><strong>Purpose</strong>: This endpoint is used for user authentication. It allows users to log in using their credentials stored in the Auth0 database connection.</li><li><strong>Usage</strong>: Developers can integrate this endpoint into their application’s login flow to authenticate users securely.</li></ul><blockquote><strong>Signup Endpoint (</strong><strong>/dbconnections/signup)</strong>:</blockquote><ul><li><strong>Purpose</strong>: Allows new users to register or sign up for an account in the application.</li><li><strong>Usage</strong>: Developers can use this endpoint to provide a user registration form where users can create new accounts using their chosen credentials.</li></ul><blockquote><strong>Change Password Endpoint (</strong><strong>/dbconnections/change_password)</strong>:</blockquote><ul><li><strong>Purpose</strong>: Provides functionality for users to change their passwords.</li><li><strong>Usage</strong>: Users typically access this endpoint through a password change form in the application. It ensures that users can update their passwords securely without exposing sensitive information.</li></ul><blockquote><strong>Forgot Password Endpoint (</strong><strong>/dbconnections/change_password)</strong>:</blockquote><ul><li><strong>Purpose</strong>: Enables users to reset their forgotten passwords.</li><li><strong>Usage</strong>: This endpoint is used in conjunction with a “Forgot Password” flow in the application. Users can initiate a password reset request by providing their email address or username, and Auth0 sends them instructions for resetting their password securely.</li></ul><blockquote><strong>Verify Email Endpoint (</strong><strong>/dbconnections/change_password)</strong>:</blockquote><ul><li><strong>Purpose</strong>: Verifies a user’s email address.</li><li><strong>Usage</strong>: This endpoint is typically used in scenarios where email verification is required before users can fully activate their accounts or access certain features within the application.</li></ul><p>Before we delve into saved parameters in these requests, let’s consider the risk of leaving the signup endpoint to an application that redirects anonymous users to the login page without a signup button or functionalities. This security risk could potentially harm the company that uses default Auth0 endpoints when the application logic doesn’t support a signup form.</p><p>The risks for default endpoints at Authentication mechanisim leaves the application vulnerable when there is no signup functionality shown in the UI, who said we cannot register users with the default endpoint and the right client-id of Auth0 tenant.</p><h3><strong>Time To Analyze The Authentication Request.</strong></h3><p>Analyze legitimate request for login, check what parameters are used to sent for authentication mechanism and check for the following parameters:</p><blockquote><strong>client_id:</strong> The client_id parameter serves as a unique identifier for an application seeking access to Auth0 services.</blockquote><blockquote><strong>connection:</strong> The connection parameter plays a crucial role in Auth0’s authentication API. It specifies which identity provider Auth0 should use to authenticate a user when they log into an application. Additionally, it determines the identity provider through which the user will be authenticated during the signup process for the application.</blockquote><blockquote><strong>email:</strong> This parameter refers to the email address of the user.</blockquote><blockquote><strong>password:</strong> The password parameter represents the user’s chosen password. It must comply with the password policy defined by the developer within the Auth0 dashboard.</blockquote><p><strong>The</strong> <strong>client_id </strong>and <strong>connection </strong>parameters, crucial to the system’s environment, can be obtained through various methods. One approach involves intentionally attempting to authenticate with invalid credentials as we metioned previously, which automatically includes these parameters in the POST method request. This method allows for the retrieval of the client_id and connection parameter values relevant to the system’s configuration.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/470/1*Xqz0D0S96afPLabzwg-IGw.png" /><figcaption>Authentication Post Request</figcaption></figure><p><strong>A</strong>fter acquiring the client_id and connection parameters, the next step involves verifying if the system supports registration through the Auth0 API. To do this, we initiate a POST request to “<strong>/dbconnections/signup</strong>” which could stay open due to security misconfiguration during the product implementation, including the appropriate parameters mentioned earlier. This action aims to confirm their functionality based on our successful scenario.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/466/1*X8DGx4gh1QlnaI1LBtFJUA.png" /><figcaption>Default Auth0 Endoint Authentication Bypass</figcaption></figure><p><strong>A</strong>t this stage, we can proceed to the login page and attempt to authenticate to the system using the newly created user account. This approach allows us to bypass the restrictions imposed by the application’s standard registration mechanism or even the application logic to forbbid the registration progress.</p><blockquote><strong>Mitigation:</strong></blockquote><p>To prevent this behavior, enable the “Disable Sign Ups” feature in the application database. This can be done by navigating to the following path:</p><ol><li>Go to the <strong>Authentication</strong> tab.</li><li>Select <strong>Database Connections</strong>.</li><li>Choose your specific application database.</li><li>Enable <strong>Disable Sign-Ups</strong>.</li></ol><p>This action will help secure your system against unauthorized access.</p><p><strong>I hope you found this writeup helpful.</strong></p><p><strong>More Recommended For You</strong></p><p><a href="https://medium.com/@melodicbook/exploiting-security-misconfigurations-in-aws-cognito-authflow-types-bc693260b8b8">https://medium.com/@melodicbook/exploiting-security-misconfigurations-in-aws-cognito-authflow-types-bc693260b8b8</a></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=061da9330320" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>