<?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 Borna Nematzadeh on Medium]]></title>
        <description><![CDATA[Stories by Borna Nematzadeh on Medium]]></description>
        <link>https://medium.com/@LogicalHunter?source=rss-bb4e085fcac2------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/1*shU3C4zVNdYRz9ww5hRq5Q.jpeg</url>
            <title>Stories by Borna Nematzadeh on Medium</title>
            <link>https://medium.com/@LogicalHunter?source=rss-bb4e085fcac2------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Sun, 22 Nov 2026 09:47:36 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@LogicalHunter/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[tRPC Security Research: Hunting for Vulnerabilities in Modern APIs]]></title>
            <link>https://medium.com/@LogicalHunter/trpc-security-research-hunting-for-vulnerabilities-in-modern-apis-b0d38e06fa71?source=rss-bb4e085fcac2------2</link>
            <guid isPermaLink="false">https://medium.com/p/b0d38e06fa71</guid>
            <category><![CDATA[bug-bounty-writeup]]></category>
            <category><![CDATA[bug-bounty]]></category>
            <category><![CDATA[web-security]]></category>
            <category><![CDATA[security-research]]></category>
            <category><![CDATA[api-security]]></category>
            <dc:creator><![CDATA[Borna Nematzadeh]]></dc:creator>
            <pubDate>Fri, 12 Jan 2024 14:41:00 GMT</pubDate>
            <atom:updated>2024-01-12T15:47:03.030Z</atom:updated>
            <content:encoded><![CDATA[<p>In this write-up, I want to discuss my research on tRPC. Initially, we will review the concepts of tRPC before proceeding to analyse the attack surface of a tRPC application.</p><figure><img alt="https://media.sitepen.com/blog-images/2022/12/Intro-to-tRPC-1024x538.jpg" src="https://cdn-images-1.medium.com/max/1024/1*8wvF7dZkcTr-HoCF52gN5A.jpeg" /></figure><h3><strong>tRPC from a Developer’s Perspective</strong></h3><p><strong>tRPC </strong>stands for “<strong>TypeScript Remote Procedure Call”</strong>, and it leverages the capabilities of TypeScript to ensure type safety across client-server boundaries. This means that tRPC enables developers to create APIs where the inputs and outputs are automatically type-checked, significantly reducing the risk of runtime errors due to mismatched data types or unexpected data structures. Let’s learn how it works:</p><p><strong>1.API Definition</strong></p><p>As a developer, you must define the API on the server using TypeScript, specifying the types of input and output for functions that represent the API’s endpoints. These functions, known in tRPC as procedures, can perform various operations such as fetching data (<strong>Queries</strong>), as well as creating, deleting, and updating data (<strong>Mutations</strong>).</p><p><strong>2.Define Routers</strong></p><p>On the server, procedures are organized into routers. Routers manage different API paths and operations and can be nested to handle more complex APIs, creating a structured approach akin to controllers in a traditional API. Here is an example:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*-Qwf0iOfwn2Yvo06RPOKlw.png" /></figure><p>In this example, two procedures have been defined: one for reading data and another for modifying data. It is possible that certain procedures may receive input from the client.</p><p><strong>3.Client-Side Integration</strong></p><p>tRPC auto-generates a client-side library based on your API’s types. This client library enables front-end application to call server procedures directly, like local functions, without needing to worry about HTTP methods, headers, or paths. When you call a server procedure, the types are inferred directly from the server’s TypeScript definitions. This means a developer gets autocomplete suggestions in their editor and compile-time type checking, helping prevent issues related to providing the wrong data type or structure in API requests or responses. Here’s an example:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*JbeWwmUskHbUM1nNDxKXLA.png" /></figure><p>The client invokes the ‘<strong>addUser</strong>’ method; the result of this method is then read from the response and rendered in the DOM. The <strong>httpBatchLink </strong>is particularly useful in scenarios where the client needs to send several requests to the server simultaneously. Alternatively, the <strong>httpLink </strong>can be used for making standard individual HTTP requests from the client to a tRPC server.</p><p><strong>4.ِData Exchange between Client and Server (Transport Layer)</strong></p><p>tRPC uses transportation mechanisms (usually HTTP/HTTPS) under the hood.</p><p>So far, we have learned the concepts of tRPC. Next, we will explore tRPC from a researcher’s perspective.</p><h3>tRPC from a Researcher’s Perspective</h3><p>To identify vulnerabilities in tRPC, we must take the following steps into consideration:</p><ol><li><strong>Identifying the tRPC Style</strong></li><li><strong>tRPC Recon</strong></li><li><strong>Attack Surface Analysis</strong></li></ol><h3>Step 1: Identifying the tRPC Style</h3><p>The most critical question we need to address in API testing is: <strong>What style is used? </strong>Each API has a distinct style. By understanding the style, we can more easily perform reconnaissance and discover vulnerabilities. How can we determine that the target’s API style is tRPC?</p><p>As we saw in the previous section, procedures in tRPC come in two forms: <strong>Query </strong>and <strong>Mutation</strong>. The GET method is used for Queries, which involves reading data, while the POST method is used for Mutations, to change data. We have the following general patterns:</p><pre>GET  /ProcedureName<br>POST /ProcedureName<br><br>GET  /getUsers<br>POST /addUser</pre><p>Sometimes, the application uses <strong>httpBatchLink </strong>to send all the requests together. In this scenario, the ‘batch’ parameter is included in the query string:</p><pre>GET  /getUsers?batch=1</pre><p><strong>Error Formatting</strong></p><p>Another way to identify the style of tRPC is to observe which error the server returns for various states. If a procedure has not been defined for an endpoint on the server side, changing the HTTP method will result in an error from the server:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*DxaQu1noGF9VY2oWSqO58Q.png" /></figure><p><strong>Changing the Parameter’s Type</strong></p><p>Changing the types of parameters in a request and generating an error can help us in identifying the tRPC:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*HQG0jOgf9tsbkjn3AiezFQ.png" /></figure><p><strong>Request/Response Data Format</strong></p><p>The data format that we can use in tRPC is <strong>JSON</strong>. The example below shows the data structure in two scenarios: httpLink and httpBatchLink:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/890/1*KSF0RwBmIL3kuO2nJV9GFQ.png" /></figure><p>By combining the above techniques, we can determine the tRPC style in our target.</p><h3>Step 2: tRPC Recon</h3><p>During API reconnaissance, accessing documentation can aid us in analyzing the target. Our target may have made its API publicly available, which we can access using a variety of techniques. The target may use the <a href="https://github.com/iway1/trpc-panel"><strong>trpc-panel </strong></a>for documentation. This tool is specifically for documenting tRPC endpoints.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*m94Pz86Iz0ca3mE0JBneUA.png" /><figcaption><a href="https://app.trpcpanel.io/">https://app.trpcpanel.io/</a></figcaption></figure><p>Here’s a simple implementation:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*qy3cH9pTHfcTxq-ZgbGXKg.png" /></figure><p>A developer can define middleware for the trpc-panel and specify an endpoint to access the panel, as demonstrated in the example below:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*9cnA7Dum0q3j2n8-TlMBpw.png" /></figure><p>If we send a request to the “<strong>/panel”</strong>, we can view a list of all the procedures and obtain full access to the documentation, which simplifies the process of vulnerability hunting for us. This endpoint may vary in different targets. The best way for finding this endpoint is to use <strong>fuzzing </strong>and the methods outlined below:</p><ol><li><strong>Google Dorking</strong></li></ol><pre>site:TARGET.tld intitle:&quot;tRPC.panel()&quot; inurl:/panel<br>site:TARGET.tld intitle:&quot;tRPC.panel()&quot;</pre><p>2. <strong>API Fuzzing</strong></p><pre>id: trpc-panel<br><br>info:<br>  name: Public trpc-panel<br>  author: LogicalHunter<br>  severity: info<br>  tags: exposure,trpc<br><br>http:<br>  - method: GET<br>    path:<br>      - &quot;{{BaseURL}}/panel&quot;<br>      - &quot;{{BaseURL}}/trpc-panel&quot;<br>      - &quot;{{BaseURL}}/trpc&quot;<br>      - &quot;{{BaseURL}}/trpc/panel&quot;<br>      - &quot;{{BaseURL}}/api/panel&quot;<br>      - &quot;{{BaseURL}}/api/trpc-panel&quot;<br>      - &quot;{{BaseURL}}/docs&quot;<br>      - &quot;{{BaseURL}}/doc&quot;<br>      - &quot;{{BaseURL}}/api/docs&quot;<br>      - &quot;{{BaseURL}}/api/doc&quot;<br>      - &quot;{{BaseURL}}/api/trpc/panel&quot;<br>  <br>    headers:<br>      Accept: text/html<br>    stop-at-first-match: true<br><br>    matchers-condition: and<br>    matchers:<br>      - type: word<br>        part: body<br>        words:<br>          - &quot;tRPC.panel()&quot;<br><br>      - type: status<br>        status:<br>          - 200</pre><p>3. <strong>Third-Party Sources</strong></p><p>Sometimes, the website’s API may be available for public access for other developers. In such cases, we are able to seek assistance from the below-mentioned websites. The following websites may be able to assist us in this case:</p><pre>https://www.postman.com/explore<br>https://apis.guru/<br>https://github.com/public-apis/public-apis<br>https://rapidapi.com/search/</pre><h3>Step 3: Attack Surface Analysis</h3><p>We need to consider two general scenarios:</p><ol><li>Documentation is available.</li><li>Documentation is not available.</li><li><strong>Target’s documentation is available</strong></li></ol><p>In this case, with access to the documentation, we can review all procedures and the structure of requests and responses. At this stage, it is sufficient to examine the different vulnerabilities through the documentation. The first question we need to ask is: <strong>How does the authentication process in the API work, and which endpoint is used?</strong> To access different endpoints, we must be logged into the system. In such a case, we need to identify a procedure that enables us to log in:</p><pre>POST /AuthProcedure<br>POST /authUser </pre><p>When reviewing the documentation, we should examine various components, each of which may reveal different vulnerabilities:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*h8THrIuHQuXwvEyETI1rNQ.png" /></figure><p>We must then consider the next question: <strong>What vulnerabilities exist in different procedures? </strong>At this stage, depending on whether the operation is a Query or a Mutation, we try to identify the various vulnerabilities. For Queries and Mutations, we should examine the following classes of vulnerabilities:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*tthGHhYQCxiSP6GrJT5yUg.png" /></figure><p>2. <strong>Target’s documentation is not available</strong></p><p>In the second scenario, without access to the documentation, we need to map the target API. For this task, tools like <strong>Logger++</strong> can be utilized. Typically, we browse the application and filter out the tRPC logged requests using Logger++. We can then export the endpoints and begin investigating various vulnerabilities.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*Sg88RsiHJ6v0KpvUKjWMOQ.png" /><figcaption>Request.Path CONTAINS “API Endpoint” AND !(Request.Method == “OPTIONS”)</figcaption></figure><p>After mapping the public endpoints of the target, our objective should be to identify the <strong>application’s hidden endpoints</strong>. Fuzzing the known endpoint is essential for this purpose. Discovering hidden endpoints can aid us in finding various vulnerabilities, such as those related to access control. The general pattern is as follows:</p><pre>Fuzz(METHOD) /FUZZ(ProcedureName)<br><br>POST /addUsers<br><br>Possible Endpoints: <br>METHOD /getUsers<br>METHOD /deleteUsers<br>METHOD /updateUsers<br>...</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*1vms47lAAj1A-jSMkd4UWQ.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*z56nfecqXPlIfShvWxQXsQ.png" /><figcaption>Broken Function Level</figcaption></figure><p>Moreover, for practical experience, I have created a vulnerable tRPC application that can be accessed through my <a href="https://github.com/bnematzadeh">GitHub</a>.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*rNMgoKhI-jEG7T7fPVYkBw.png" /><figcaption><a href="https://github.com/bnematzadeh/trpc-playground/">https://github.com/bnematzadeh/trpc-playground</a></figcaption></figure><p>I hope you enjoyed reading this write-up. Make sure to follow me on Twitter and LinkedIn:</p><p><a href="https://x.com/LogicalHunter">https://twitter.com/LogicalHunter</a></p><p><a href="https://www.linkedin.com/in/borna-nematzadeh/">https://www.linkedin.com/in/borna-nematzadeh/</a></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=b0d38e06fa71" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Identity-Aware Proxy Misconfiguration- Google Cloud Vulnerability]]></title>
            <link>https://medium.com/@LogicalHunter/identity-aware-proxy-misconfiguration-google-cloud-vulnerability-813d2a07a4ed?source=rss-bb4e085fcac2------2</link>
            <guid isPermaLink="false">https://medium.com/p/813d2a07a4ed</guid>
            <category><![CDATA[security]]></category>
            <category><![CDATA[google-vrp]]></category>
            <category><![CDATA[google]]></category>
            <category><![CDATA[bug-bounty]]></category>
            <dc:creator><![CDATA[Borna Nematzadeh]]></dc:creator>
            <pubDate>Fri, 06 Jan 2023 11:12:28 GMT</pubDate>
            <atom:updated>2023-01-16T08:48:25.430Z</atom:updated>
            <content:encoded><![CDATA[<h4>Summary</h4><p>I found a way to disclose any user email address via CORS misconfiguration in IAP by opening a malicious domain. I implemented two different attack scenarios to read the email address of an authenticated or unauthenticated user.</p><h4><strong>Introduction to IAP</strong></h4><p>First, we need to know what Identity-Aware Proxy (IAP) is and how it works. IAP is a Google Cloud Platform service which helps to control access to apps deployed on cloud and only lets the requests through if they come from a user you authorize.</p><p>With IAP, you can enforce access control policies for applications and different resources. You can also get more information about this service from <a href="https://cloud.google.com/iap/docs/concepts-overview">here</a>.</p><h4><strong>IAP Workflow</strong></h4><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*5o0rwg9WK5l4eX7Tay9CqA.png" /><figcaption><a href="https://codelabs.developers.google.com/codelabs/user-auth-with-iap">https://codelabs.developers.google.com/codelabs/user-auth-with-iap</a></figcaption></figure><p>If IAP is enabled, the user is redirected to the Google Account Sign-In page. If the credentials are valid, IAP checks if the user is authorized to access the resource.</p><p>At step 4, if the user has appropriate permissions, the request is forwarded to the protected resource (4.2). <br>For an unauthorized user, it results in “You don’t have access” and sends it back to the user. The error page includes both the email addresses of the logged-in user (which is not public) and the owner of the application (4.1).</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*w5C5qQ36X77JdcGwa2MBPA.png" /></figure><h4>The Attack Scenarios</h4><p>I thought maybe I could read the email address of other users. After some recon, I found different domains which were protected by IAP. I had the following attack scenarios in my mind:</p><ul><li><strong>Finding a CORS vulnerability in IAP to read the email address by opening a malicious domain</strong></li><li><strong>Finding an Insecure postMessage channel to disclose the email address</strong></li></ul><p>The second scenario did not work for me so I tried the first one. Many servers read the Origin header from the client and write it to the Access-Control-Allow-Origin header, thus giving access to all domains, including malicious ones.</p><p>I sent an HTTP request with an arbitrary origin to check if both headers ”ACAC: true” and “ACAO” are reflected and bingo! The IAP was vulnerable to CORS misconfiguration. Allowing arbitrary origins with the ability to request credentials effectively disables the SOP and allows a malicious domain to issue authenticated requests to the IAP:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*lun4kCbI2Af-IUYzyJBcNA.png" /></figure><h4>The Exploitation</h4><p><strong>Authenticated User</strong></p><p>It was easy to make a proof of concept exploit to steal a user’s email. We only need to send a malicious CORS request to read the email address.</p><p>How about an unauthenticated user? We know that it doesn’t work because we need to send the request along with the user’s credentials. We need another attack scenario.</p><p><strong>Unauthenticated User</strong></p><p>The first idea which came to my mind was to force the victim to login into the app via the Google SSO and then send XHR requests repeatedly to steal the email address. How to force the victim to login into the app?</p><p>I tried to frame the Google Account Sign-In page in my domain but it didn’t work because of the protection. How about “<strong>window.open</strong>”? It worked fine! The opened window allows us to choose between different accounts:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*2dhH8wG2vIql2tzTMBJXSA.png" /></figure><h4>POC</h4><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*gBkHvdnwjPHfF5tF3rPBcQ.png" /></figure><p><strong>The Attack Scenario</strong></p><ul><li>An attacker could configure a malicious domain and host the above script. How does the above exploit work? It first redirects the user to Google Login. Then it sends XHR requests to IAP every second. After a successful login from the user, we access the email address.</li></ul><h3>Finding Vulnerable Domains</h3><p>I used different approaches to find vulnerable domains which were protected by IAP. Here’s a simple workflow of my recon phase:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*VWp7y5bBaAeNvMU_jVuwjA.png" /></figure><h4>Timeline</h4><p>May 3, 2022: Report Sent</p><p>May 6, 2022: Report Accepted &amp; Nice catch!</p><p>May 31, 2022: The VRP panel has decided to issue a reward of 1337$</p><p>May 31, 2022: The VRP panel has decided to issue a bonus of 1000$.</p><p>“We’re issuing a $1000 bonus for highlighting the systemic pattern of this bug. Thanks!”</p><p>The issue has been fixed by Google in July 2022.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=813d2a07a4ed" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Unauthorized Access to OData Entities + $2K Bounty From Microsoft]]></title>
            <link>https://infosecwriteups.com/unauthorized-access-to-odata-entities-2k-bounty-from-microsoft-e070b2ef88c2?source=rss-bb4e085fcac2------2</link>
            <guid isPermaLink="false">https://medium.com/p/e070b2ef88c2</guid>
            <dc:creator><![CDATA[Borna Nematzadeh]]></dc:creator>
            <pubDate>Sun, 10 Jan 2021 15:37:35 GMT</pubDate>
            <atom:updated>2021-01-10T15:37:35.064Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/640/1*lmTFDSNss95PS5s8SHdwXQ.png" /></figure><p>Hi, this post is about one of the vulnerabilities I found from Microsoft.</p><p>As you know, Office365 has various services. One service that drew my attention was <strong>Microsoft Forms.</strong> It’s an online survey creator, part of Office 365. You can create your form and share it with other users. This service uses OData for interacting with data. But what is OData?</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/597/1*4_--l2dINZqHF0BXZlFEtQ.png" /></figure><h3>OData Basics</h3><blockquote>The OData Protocol is an application-level protocol for interacting with data via RESTful interfaces. It supports the description of data models, editing and querying of data according to those models. [docs.microsoft.com]</blockquote><p><strong>OData</strong> uses the SQL idea. By saying that I don’t mind what type of client (such as .NET, Java) sent me a request or what the site’s data source is, I receive the request from the client, based on the type of work that client wants, I perform CRUD operations on the data and return the result to the client.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/768/1*IK_ZqSEn6C88pXk5Z3qnEw.png" /><figcaption><a href="https://www.progress.com/blogs/what-is-odata-rest-easy-with-our-quick-guide">https://www.progress.com/blogs/what-is-odata-rest-easy-with-our-quick-guide</a></figcaption></figure><p>For simplicity, I explain some concepts of this protocol and do some equivalences. The <strong>OData metadata</strong> is a data model of the system(consider it as <strong>information_schema</strong> in relational databases). For each metadata, we have <strong>entities</strong>(similar to <strong>tables</strong> in relational databases) and <strong>properties</strong> (similar to <strong>columns</strong>) as well as the relationship between different entity types. Each entity type has an <strong>entity key</strong> that is similar to the key in relational databases. Suppose we have an entity type called Customers, which includes three properties. This entity type has the following records:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/426/1*0cEhmzF6bhKX1ibnj-uGeQ.png" /></figure><p>In the above example, <strong>ID</strong> is an entity key. The request below returns an individual record of type Customers by the given ID “2”:</p><pre>customerApi/Customers(2)</pre><p>The above request returns the customer information with ID=2. Similar to SQL, we can use query options for querying data. OData supports various kinds of <strong>query options</strong> for querying data. We can use the <strong>$select</strong> query option to request a limited set of properties for each entity. The following query is an example, which would fetch the email from the Customers entity for a customer with the ID 2:</p><pre>customerApi/Customers(2)?<strong>$select=email</strong></pre><p>In SQL, The above example is as follows:</p><pre>SELECT email FROM Customers WHERE ID=2;</pre><p>The concepts I have explained so far are enough to understand the continuation of this write-up. Apart from <strong>$select</strong>, you can use different query options. You can choose the output of data using the <strong>$format</strong>, whether it is JSON or XML. For further details and getting familiar with other query options, I suggest you <a href="http://odata.org/">this </a>link, which is the main reference for OData.</p><h3>Attack Scenarios</h3><blockquote><strong><em>“One thing I always bear in mind is that I try to get an overview of the system first, and then I start testing each of the components.”</em></strong></blockquote><p>In this target, I first tried to access the OData metadata because I knew the target was using OData, and I’d better get to know the structure of metadata. By sending a request to the following URL, I was able to access the target’s metadata:</p><pre>http://forms.office.com/formapi/api/$metadata</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*4U27nEcwY-pnBJ1_clwCDQ.png" /></figure><p>The above document, which is an XML, was not interesting to me. So I used the following website to see the connections between different entity types better:</p><p><a href="http://pragmatiqa.com/xodata">XOData - Visualize and Explore OData Services Online</a></p><p>This website is a generic OData API/Service visualizer and explorer. It has a cool feature that you can give the link of OData metadata, and it shows you the connection between different entity types:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*T4wsCqwr8prWxSMxS_gc5w.png" /></figure><p>After getting an overview of metadata, I tried to look for entities that could have sensitive information. I found an entity type called <strong>forms</strong>. This entity had user-generated form’s data as well as the <strong>user’s email</strong>: ‌</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*Nl8EjxmPGYUKEponLV3cwQ.png" /></figure><p>The email made me think about how I can access other users’ email? IDOR and CORS were not possible here. After testing different attack scenarios, I found a way to access another user’s email. But The problem was that my attack scenario required user interaction(the victim visits the attacker site and more). The user interaction reduced the impact of my attack scenario. After sending my report to MSRC, I only got the Microsoft <a href="https://msrc.microsoft.com/update-guide/en-us/acknowledgement/online">Hall of Fame</a>.</p><h3><strong>Unauthorized Access to OData Entities</strong></h3><p>After I didn’t get any bounty, I tried to look at the target differently. My previous attack scenario required user interaction, So I had to find a way to access the email without any user interaction.<br>In Microsoft Forms, a user can share a form with others. I tried to test the file-sharing functionality. If <strong>User A</strong> wants to share a form with <strong>User B</strong>, the following steps are required:</p><ol><li>User A selects a form to share. The server generates a shareable link for User A.</li><li>User A sends the generated link from the previous step to User B.</li><li>When User B submits the form, the submitted data send to the server. User A can view the submitted data in his/her account.</li></ol><p>In the third step, the following request sends:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/542/1*DAMRZnrRFxEesEtPs_hAWw.png" /></figure><p>The above request has the following structure:</p><pre>formapi/api/<strong>&lt;ownerTenantID&gt;</strong>/users/<strong>&lt;ownerID&gt;</strong>/forms(<strong>&lt;formID&gt;</strong>)/responses</pre><p>All the parameters <strong>ownerTenantID</strong>, <strong>ownerID, </strong>and <strong>‌formID </strong>are related to the user<strong> who shared the form with us</strong>. When we submit the user’s form, we have access to all these parameters, So there is no need to find any of them.</p><p>The scenario which came to my mind was that I had all the necessary parameters from the victim. <strong>Why not use the $select query option and get the victim’s email from the server too?</strong> To do that, I used the $select query option and sent the following request:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/561/1*EPk23qA_mxQwmHYrfkIYeQ.png" /></figure><p>After I sent the above request, I got 404. The server did not allow me to access the <strong>createdBy</strong> property or the user’s email on <strong>forms</strong> entity, So I tried to find another way to access the value of the <strong>createdBy </strong>property, and an idea came to my mind:</p><p><strong><em>“Is there another entity that has a createdBy property? And also has the same entity key (formID) as forms entity?”</em></strong></p><p>The question that may arise is why the entity key should be the same as the forms entity key?</p><p>Suppose the entity that we are looking for is called X.</p><p>X has the <strong>createdBy</strong> property, and our point is to access the value of this property because the value of this property is the user’s email. On the other hand, imagine X has an entity key called <strong>accountID</strong>, which is a random string. To access the email, we have to send the following request:</p><pre>formapi/api/&lt;ownerTenantID&gt;/users/&lt;ownerID&gt;/X(<strong>&lt;accountID&gt;</strong>)<strong>$select=createdBy</strong></pre><p>The problem here is the <strong>accountID</strong> because we don’t know what the <strong>accountID</strong> of the victim is, But we saw earlier that we have access to <strong>formID </strong>using the victim’s shared form.</p><p>I tried to look for an entity type with the mentioned conditions. After reviewing the relationship between different entity types, I was able to find an entity called <strong>runtimeForms </strong>that had the <strong>createdBy</strong> property and even had the same entity key as <strong>forms</strong>! , which had all the conditions I wanted:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/711/1*63K48uPocSA5ij3vDKxPbA.png" /></figure><p>I used <strong>runtimeForms </strong>instead of <strong>forms </strong>then I used the <strong>$select</strong> query option to access the email. By sending the following request, I finally managed to access the victim’s email:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/569/1*Cp55rTwB4DtSzp7crHU9KQ.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/259/1*u_fzGH5jqkYOJEEZkv5tsw.png" /></figure><iframe src="https://cdn.embedly.com/widgets/media.html?src=https%3A%2F%2Fwww.youtube.com%2Fembed%2FhrBi-VzK3SQ%3Ffeature%3Doembed&amp;display_name=YouTube&amp;url=https%3A%2F%2Fwww.youtube.com%2Fwatch%3Fv%3DhrBi-VzK3SQ&amp;image=https%3A%2F%2Fi.ytimg.com%2Fvi%2FhrBi-VzK3SQ%2Fhqdefault.jpg&amp;key=a19fcc184b9711e1b4764040d3dc5c07&amp;type=text%2Fhtml&amp;schema=youtube" width="854" height="480" frameborder="0" scrolling="no"><a href="https://medium.com/media/b6910e237410050b747b338905238653/href">https://medium.com/media/b6910e237410050b747b338905238653/href</a></iframe><p>With this attack scenario, I could access users’ email without any user interaction. Finally, I got a $2k bounty from MSRC ;)</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/535/1*8EHlKXIlQZlju2sl4C9k5g.png" /></figure><p>I hope you enjoyed this write-up. Always look for edge cases in your target to find more interesting vulnerabilities! If you liked this write-up, make sure to follow me on Twitter:</p><p>Twitter: <a href="https://twitter.com/LogicalHunter">@LogicalHunter</a></p><p>LinkedIn: <a href="https://www.linkedin.com/in/borna-nematzadeh/">https://www.linkedin.com/in/borna-nematzadeh/</a></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=e070b2ef88c2" width="1" height="1" alt=""><hr><p><a href="https://infosecwriteups.com/unauthorized-access-to-odata-entities-2k-bounty-from-microsoft-e070b2ef88c2">Unauthorized Access to OData Entities + $2K Bounty From Microsoft</a> was originally published in <a href="https://infosecwriteups.com/">InfoSec Write-ups</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
    </channel>
</rss>