Unauthorized Access to OData Entities + $2K Bounty From Microsoft
The OData endpoint for Microsoft Forms allowed access to the metadata and to an entity called runtimeForms that exposed the createdBy property (the user's email) using only the formID from a shared form. An attacker could retrieve the email address of any user who shared a form, without any user interaction.
Published on medium.com
{{media:0}}
The full write-up lives on its author's site
It belongs to its author, so we link to it rather than copy it. The other two tabs are our own rewrites, checked against it.
Context
Microsoft Forms is an online survey creator that is part of Office 365. A user creates a form and can share it with other users, who then submit responses. The service uses OData to interact with its data, and the target of this research was the Forms API at forms.office.com.
OData is an application-level protocol for interacting with data through RESTful interfaces. It supports describing data models and editing and querying data according to those models. The researcher frames it in SQL terms: the client sends a request, the server performs CRUD operations on the data and returns the result, regardless of the client technology or the underlying data source.
A few OData concepts matter for the rest of the write-up:
- Metadata is the data model of the system, comparable to
information_schemain a relational database. - Entities are comparable to tables, and properties to columns.
- Each entity type has an entity key, comparable to a key in a relational database.
- Query options allow shaping the result.
$selectrequests a limited set of properties, and$formatchooses JSON or XML output.

For example, given an entity type Customers with an entity key ID, the following request returns the individual record with ID 2:
customerApi/Customers(2)
And the following query fetches only the email of that customer:
customerApi/Customers(2)?$select=email
which is equivalent to:
SELECT email FROM Customers WHERE ID=2;
Setup
The researcher worked against the Microsoft Forms API. No special accounts, roles or tool versions are described beyond a normal user who can create and share a form, and a second user who receives the shared link and submits the form. The only tool mentioned is the XOData visualiser at pragmatiqa.com/xodata, a generic OData API/service visualiser and explorer that takes the link of an OData metadata document and shows the connections between different entity types.
The researcher's stated approach is to get an overview of the system first and then test each component.
Finding it
Because the target was known to use OData, the first step was to fetch the metadata to learn the structure of the service. The following URL returned the target's metadata:
http://forms.office.com/formapi/api/$metadata

The document is XML and was not interesting on its own, so it was loaded into XOData to see the relationships between entity types more clearly.

With the overview in hand, the researcher looked for entities that could hold sensitive information. One entity type, forms, contained user-generated form data as well as the user's email.

The email raised the question of how to reach other users' email addresses. IDOR and CORS were tested and were not possible here. A first attack scenario did allow access to another user's email, but it required user interaction: the victim had to visit an attacker site and more. That requirement reduced the impact, and the report submitted to MSRC received only a Microsoft Hall of Fame entry, with no bounty.
Exploitation
After the first report produced no bounty, the researcher looked at the target differently. The goal was now to reach the email with no user interaction at all.
Step 1: Understand the sharing flow
In Microsoft Forms, a user can share a form with others. If User A wants to share a form with User B, the flow is:
- User A selects a form to share. The server generates a shareable link for User A.
- User A sends the generated link to User B.
- When User B submits the form, the submitted data is sent to the server. User A can view the submitted data in their account.
In the third step, the following request is sent:
The request has the following structure:
formapi/api/<ownerTenantID>/users/<ownerID>/forms(<formID>)/responses
All three parameters, ownerTenantID, ownerID and formID, belong to the user who shared the form. When submitting that user's form, the submitter has access to all of them, so none of them has to be discovered separately.
Step 2: Try $select on the forms entity
The idea was straightforward: all the parameters needed to address the victim's form are already known, so why not add the $select query option and ask the server for the victim's email as well? The following request was sent:
The server returned 404. It did not allow access to the createdBy property, or the user's email, on the forms entity.
Step 3: Look for another entity with the same key
The next idea was to find another entity that also has a createdBy property and, crucially, the same entity key (formID) as the forms entity.
The reason the key has to match is explained with a hypothetical entity X. X has the createdBy property, whose value is the user's email, which is the goal. If X had an entity key called accountID, a random string, the request would be:
formapi/api/<ownerTenantID>/users/<ownerID>/X(<accountID>)$select=createdBy
The problem is accountID: the victim's value is unknown. The formID, by contrast, is known from the victim's shared form.
Step 4: Find runtimeForms
Reviewing the relationships between entity types produced an entity called runtimeForms. It had the createdBy property and the same entity key as forms, which met all the conditions.

Step 5: Swap the entity and select the email
Using runtimeForms instead of forms, together with the $select query option, the following request finally returned the victim's email:
With this scenario, users' email addresses could be accessed without any user interaction. MSRC awarded a $2,000 bounty.

Root cause
The forms entity exposes a createdBy property that resolves to the owner's email, and the server correctly refused to return it through $select on that entity. The same property, however, is also reachable through the runtimeForms entity, which shares the formID entity key. Because the submitter of a shared form legitimately knows ownerTenantID, ownerID and formID, the runtimeForms route needs no additional identifier and no interaction from the victim. The authorisation check that protected the property on forms was evidently not applied consistently to the other entity that carries the same property, so the restriction could be bypassed by addressing the same record through a different entity type. The report does not describe the server-side implementation, so this is the likely mechanism rather than a confirmed one.
Impact
An attacker who has been given a shared form knows the owner's ownerTenantID, ownerID and formID, and can retrieve the owner's email address without any action by the victim. The first scenario the researcher found also exposed email addresses but required the victim to visit an attacker site and more, which reduced its impact and earned only a Hall of Fame entry. The final scenario removes that requirement. The report describes access to users' email addresses; it does not describe access to other properties or to form response data through this route.
Fix
MSRC paid a $2,000 bounty for the issue. The fix implied by the root cause is to apply the same property-level authorisation to every entity that exposes createdBy, so that a property blocked on forms is also blocked on runtimeForms and any other entity sharing the same key.
Variants to test
- Enumerate the metadata for duplicate keys. Fetch
$metadataand look for entity types that share an entity key with an entity that holds sensitive properties. A positive result is a second entity whose key you already know from a legitimate request, such as a shared link or a submission. - Try
$selecton each sibling entity. For every entity sharing the key, request the sensitive property with$select. A positive result is a 200 response containing the property that another entity refused with 404. - Compare property-level responses across entities. Send the same
$selectagainst the protected entity and its siblings and diff the status codes and bodies. A positive result is inconsistent authorisation for the same underlying record. - Check other query options. The report mentions
$formatalongside$select; try shaping the response of a blocked property through other query options. A positive result is the property appearing in a format or projection that the direct request denied. - Re-test the interaction-based path. The researcher's first scenario reached the email with user interaction. If a no-interaction variant exists on another target, compare both to judge impact before reporting.
What happened, in plain words
A security researcher found a way to read the email address of a user who had shared a Microsoft Forms survey, without that user having to do anything at all. Microsoft Forms is the part of Office 365 that lets you build online questionnaires and share them with other people. The researcher was paid a $2,000 bounty by Microsoft's bug bounty programme (MSRC, the Microsoft Security Response Center) for reporting it.
The trick was not a password guess or a break-in. It was a matter of asking the same question in a slightly different way. The service that stores Forms data speaks a language called OData, and OData lets a client ask for specific pieces of a record. One piece of a form record is the email address of the person who created it. The server refused that piece when it was requested through one kind of record, but the same piece was reachable through a second kind of record that shared the same entity key. By switching from the first kind to the second, the researcher got the email.
This write-up walks through the whole story from zero: what OData is, what a metadata document is, how sharing a form works, why the first attempt failed, and how the second attempt succeeded. You only need to be comfortable using a browser.
The product: Microsoft Forms
Microsoft Forms is an online survey creator. You sign in, create a form (a set of questions), and then share it. Sharing produces a link. Anyone with that link can open the form and submit answers. The person who created the form can then open their account and read the submitted answers.
Behind the web page there is a server that stores all of this: the forms, the questions, the answers, and information about who owns what. The web page in your browser talks to that server by sending requests over the internet. Each request is a small message asking the server to do something, such as "give me the answers to this form". The server replies with data, usually in a structured text format.
A service like this, designed to be called by software rather than read by a human, is often called an API (Application Programming Interface). A useful everyday comparison: a restaurant menu. You do not walk into the kitchen and cook; you pick an item from the menu, the kitchen prepares it, and a waiter brings it back. The menu is the API: a fixed list of things you are allowed to ask for, and the kitchen is the server that does the work.
OData in plain terms
Microsoft Forms uses a protocol called OData to talk to its data. The researcher quotes the official definition:
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]
That sentence is dense, so let us unpack it. A protocol is simply an agreed set of rules for how two programs exchange messages, like the rules of a card game: everyone knows what a valid move looks like. RESTful means the requests are ordinary web requests, the same kind your browser makes when it loads a page, each one naming a thing (a record, a collection of records) and an action (read it, change it, delete it).

The researcher explains OData by comparing it to SQL, the language used to query relational databases (the classic systems that store data in tables). The idea is that the server does not care whether the client is a .NET program, a Java program or a browser. It receives a request, works out what the client wants, performs the corresponding create, read, update or delete operation on the data, and returns the result. CRUD stands for Create, Read, Update, Delete: the four basic things you can do to stored data.
To follow the rest of the story you need four OData ideas. The researcher gives each one a database equivalent, which is the easiest way to learn them:
| OData term | What it means | Database equivalent |
|---|---|---|
| Metadata | The description of the whole data model: what kinds of records exist and what fields they have | information_schema |
| Entity | A kind of record, for example all customers | A table |
| Property | One field of a record, for example the email | A column |
| Entity key | The field that uniquely identifies one record | A primary key |
Metadata deserves a moment. Think of a library. The books are the data; the catalogue that describes which shelves exist and what each shelf holds is the metadata. In a database, information_schema is a built-in catalogue that tells you the names of all tables and columns without showing you the rows themselves. OData metadata does the same job for an OData service: it is a map of the system.
An entity key is what makes one record distinguishable from another. If two customers are both called "Alex", the name does not identify them, but an ID number does. The key is that ID number.
Reading one record, and choosing fields
Suppose there is an entity type called Customers with a key called ID, and it holds three records. The researcher shows this example:
To fetch the single record whose ID is 2, you put the key value in brackets after the entity name:
customerApi/Customers(2)
Line by line, in plain words:
customerApi/is the base address of the service, the part of the URL that says which API you are talking to.Customersnames the kind of record you want, the equivalent of a table name.(2)selects one specific record by its key value, here the customer with ID 2.
The server replies with that customer's information.
OData also lets you ask for only some of the fields, using query options. A query option is an extra instruction appended to the request, starting with a dollar sign. The one used throughout this story is $select, which names the properties you want back. The following request fetches only the email of customer 2:
customerApi/Customers(2)?$select=email
Line by line:
customerApi/Customers(2)is the same record as before.?marks the start of the query options, exactly as in an ordinary web address.$select=emailtells the server: of all the fields this record has, send me back onlyemail.
The researcher then shows the SQL equivalent, to make the idea concrete for anyone who has seen a database query:
SELECT email FROM Customers WHERE ID=2;
In words: from the Customers table, take the email column, for the row where ID equals 2. The OData request and the SQL statement ask for the same thing in two different languages.
There is one more query option worth knowing: $format chooses whether the answer comes back as JSON or XML. JSON and XML are two common ways of writing structured data as text, so that a program can read it back reliably. JSON looks a bit like a shopping list with labels; XML looks like nested tags, similar to HTML. The researcher points to odata.org as the main reference for the full list of query options.
The researcher's approach
The researcher states a principle that shapes everything that follows:
"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."
This is worth internalising. Before poking at individual features, get the map. In a building, you would first look at the floor plan before trying doors. The floor plan here is the OData metadata.
Step 1: Fetch the metadata
Because the researcher knew the target used OData, the first move was to ask the service for its metadata, to learn what kinds of records exist. The following URL returned it:
http://forms.office.com/formapi/api/$metadata
Line by line:
http://is the scheme, meaning an ordinary unencrypted web request.forms.office.comis the server that hosts the Forms service./formapi/api/is the path to the Forms API on that server.$metadatais the special OData address that returns the description of the data model rather than any actual records.

The answer was an XML document describing the whole service. On its own it was not interesting to the researcher: it is a long list of definitions, not data. Reading raw XML to understand relationships between record types is like reading a phone book to understand a family tree. So the researcher used a tool to draw it instead.
Step 2: Visualise the model with XOData
The tool is XOData, at pragmatiqa.com/xodata. The researcher describes it as a generic OData API/service visualiser and explorer. You give it the link of an OData metadata document, and it draws the connections between the different entity types.

Why bother? Because the relationships between record types are exactly where this vulnerability lives. A diagram makes it easy to spot that two different record types are connected, or that they share the same key. In a spreadsheet of definitions you would miss it; in a diagram it stands out.
Step 3: Find a record type holding sensitive data
With the overview in hand, the researcher looked for entity types that might contain sensitive information. One entity type, called forms, held the data users had entered into their forms, and also the user's email address.

An email address is personal data. If you can read someone else's, you have learned something about them that they did not choose to publish, and email addresses are also the starting point for phishing and for account discovery on other services. That is why the researcher treated this field as the prize.
Step 4: The first attempt, and why it was not enough
The natural next question: how do I reach other users' email addresses? The researcher tested two well-known classes of bug and found neither worked here.
- IDOR (Insecure Direct Object Reference) is when a server hands out a record based only on an identifier you supply, without checking that the record is yours. The everyday comparison is a hotel: if room numbers are the only thing the reception desk checks, saying "room 214" might get you a key to someone else's room. Here, IDOR was not possible.
- CORS (Cross-Origin Resource Sharing) is the browser rule that decides whether a page from one website may read responses from another website. It exists to stop a malicious site from quietly reading your data from a site you are logged into. Here, CORS was not exploitable either.
A first attack scenario did work: it allowed access to another user's email. But it required user interaction: the victim had to visit an attacker's website, and more. User interaction matters because it makes an attack much less reliable. You have to convince a specific person to click a specific link, and if they do not, nothing happens. The researcher reported this version to MSRC and received only a Microsoft Hall of Fame entry, a public thank-you, with no money. The lower impact is the reason.
Step 5: Start again with a stricter goal
After the first report produced no bounty, the researcher looked at the target differently. The new goal was precise: reach the email with no user interaction at all. If the victim does not have to do anything, the attack is far more serious, because it can be repeated quietly against many people.
Understanding the sharing flow
To get there, the researcher studied how sharing actually works. In Microsoft Forms, if User A wants to share a form with User B, the flow is:
- User A selects a form to share. The server generates a shareable link for User A.
- User A sends the generated link to User B.
- When User B submits the form, the submitted data is sent to the server. User A can view the submitted data in their account.
Step 3 is the interesting one, because it is the moment when someone who is not the owner sends data to the server. In that step, the following request is sent:
The request has this structure:
formapi/api/<ownerTenantID>/users/<ownerID>/forms(<formID>)/responses
Line by line, in plain words:
formapi/api/is the base address of the Forms API, as before.<ownerTenantID>identifies the organisation (the tenant) that the form's owner belongs to. A tenant is the company or account space a user sits in; think of it as the building, and the user as an office inside it.users/<ownerID>identifies the specific owner inside that tenant. The ownerID is the owner's identifier.forms(<formID>)selects one specific form by its key, the formID, exactly likeCustomers(2)selected one customer./responsesasks for the answers submitted to that form.
All three values, ownerTenantID, ownerID and formID, belong to the person who shared the form. And here is the key observation: when you submit someone's shared form, your browser is given all three of them in order to send your answers. You do not have to discover them; they arrive with the shared link. The researcher puts it plainly: there is no need to find any of them.
Trying $select on the forms entity
The idea was simple. All the parameters needed to address the victim's form are already known. So why not add the $select query option and ask the server for the victim's email as well? The following request was sent:
The server returned 404. A 404 is the standard web response meaning "not found". In this context it means the server refused: it did not allow access to the createdBy property, the field that holds the user's email, on the forms entity. The door was locked.
Looking for another entity with the same key
The next idea was to find another entity that also has a createdBy property and, crucially, the same entity key (formID) as the forms entity. The researcher explains why the key has to match, using a hypothetical entity called X.
X has the createdBy property, whose value is the user's email, which is the goal. But suppose X's entity key is called accountID, a random string. To reach the email you would have to send:
formapi/api/<ownerTenantID>/users/<ownerID>/X(<accountID>)$select=createdBy
Line by line:
formapi/api/<ownerTenantID>/users/<ownerID>/is the same address as before, pointing at the victim's space.X(<accountID>)selects a record of type X by its key,accountID.$select=createdByasks for only thecreatedByproperty, which holds the email.
The problem is accountID. It is a random string, and the victim's value is unknown. You cannot ask for a record if you cannot name it. The formID, by contrast, is known, because it came with the shared form. So the entity we want must be keyed by formID, not by some other identifier. This is the whole insight: find a second door into the same room, one whose key you already hold.
Finding runtimeForms
Reviewing the relationships between entity types, the researcher found an entity called runtimeForms. It had the createdBy property and the same entity key as forms. It met all the conditions.

In plain terms: forms and runtimeForms are two different record types that share the same entity key, formID. One of them was protected against returning createdBy; the other was the sibling that had been overlooked.
Swapping the entity and selecting the email
Using runtimeForms instead of forms, together with the $select query option, the following request finally returned the victim's email:
With this scenario, users' email addresses could be accessed without any user interaction. MSRC awarded a $2,000 bounty.

Why it worked
The forms entity exposes a createdBy property that resolves to the owner's email, and the server correctly refused to return it through $select on that entity. The same property, however, is also reachable through the runtimeForms entity, which shares the formID entity key. Because the submitter of a shared form legitimately knows ownerTenantID, ownerID and formID, the runtimeForms route needs no additional identifier and no interaction from the victim.
The authorisation check that protected the property on forms was evidently not applied consistently to the other entity carrying the same property, so the restriction could be bypassed by addressing the same record through a different entity type. Authorisation is the server deciding whether you are allowed to do what you are asking; authentication is the server deciding who you are. Here, the server knew perfectly well who was asking, it just failed to apply the same permission rule on both routes to the same data. The report does not describe the server-side implementation, so this is the likely mechanism rather than a confirmed one.
What the impact was
An attacker who has been given a shared form knows the owner's ownerTenantID, ownerID and formID, and can retrieve the owner's email address without any action by the victim. The first scenario the researcher found also exposed email addresses but required the victim to visit an attacker site and more, which reduced its impact and earned only a Hall of Fame entry. The final scenario removes that requirement. The report describes access to users' email addresses; it does not describe access to other properties or to form response data through this route.
How it should be fixed
MSRC paid a $2,000 bounty for the issue. The fix implied by the root cause is to apply the same property-level authorisation to every entity that exposes createdBy, so that a property blocked on forms is also blocked on runtimeForms and any other entity sharing the same key. In everyday terms: if one door to a room is locked, every door to that room must be locked, not just the one you happened to try first.
Variants worth testing
These are generalisations of the same idea, useful if you want to look for similar bugs on other targets.
- Enumerate the metadata for duplicate keys. Fetch
$metadataand look for entity types that share an entity key with an entity that holds sensitive properties. A positive result is a second entity whose key you already know from a legitimate request, such as a shared link or a submission. - Try
$selecton each sibling entity. For every entity sharing the key, request the sensitive property with$select. A positive result is a 200 response containing the property that another entity refused with 404. - Compare property-level responses across entities. Send the same
$selectagainst the protected entity and its siblings and diff the status codes and bodies. A positive result is inconsistent authorisation for the same underlying record. - Check other query options. The report mentions
$formatalongside$select; try shaping the response of a blocked property through other query options. A positive result is the property appearing in a format or projection that the direct request denied. - Re-test the interaction-based path. The researcher's first scenario reached the email with user interaction. If a no-interaction variant exists on another target, compare both to judge impact before reporting.
Glossary
- API (Application Programming Interface): a fixed set of requests a program is allowed to make to a service, like a menu you order from.
- Authentication: the server working out who you are.
- Authorisation: the server deciding whether you are allowed to do what you are asking.
- Bounty: a payment made by a company to a researcher who reports a security bug responsibly.
- CORS (Cross-Origin Resource Sharing): the browser rule that decides whether a page from one website may read responses from another website.
- CRUD: Create, Read, Update, Delete, the four basic operations on stored data.
- Entity: in OData, a kind of record, comparable to a table in a database.
- Entity key: the field that uniquely identifies one record, comparable to a primary key.
- Hall of Fame: a public acknowledgement page listing researchers who reported issues, given here instead of a bounty.
- IDOR (Insecure Direct Object Reference): a bug where a server returns a record based only on an identifier you supply, without checking that the record is yours.
- information_schema: a built-in catalogue in a relational database that lists its tables and columns.
- JSON: a text format for structured data, made of labelled values and lists.
- Metadata (OData): the description of the whole data model: which entity types exist, which properties they have, and how they relate.
- MSRC (Microsoft Security Response Center): Microsoft's team that receives and handles security reports.
- OData: an application-level protocol for interacting with data through RESTful interfaces, supporting a described data model and querying of that data.
- Owner (of a form): the user who created and shared the form.
- Property: in OData, one field of a record, comparable to a column in a database.
- Protocol: an agreed set of rules for how two programs exchange messages.
- Query option: an extra instruction appended to an OData request, starting with
$, that shapes the result, such as$selector$format. - RESTful: using ordinary web requests, each naming a thing and an action.
- Root cause: the underlying reason a vulnerability exists, as opposed to its visible symptom.
$format: an OData query option that chooses the output format, JSON or XML.$select: an OData query option that requests only a named set of properties.- SQL: the language used to query relational databases.
- Tenant: the organisation or account space a user belongs to.
- User interaction: a step the victim must perform, such as visiting a link, for an attack to work.
- XML: a text format for structured data, made of nested tags.
- 404: the standard web response meaning "not found", used here to signal that the server refused the request.