I Found a Hidden GraphQL Search That Exposed Employee Emails And Earned $1200 for It
A hidden GraphQL query allowed an ordinary employee to retrieve the organisation's user directory, and a search argument that matched against the hidden email column acted as an oracle to recover email addresses. An attacker could use this to obtain employee emails for phishing.
Published on medium.com
Bug Bounty
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
The target was an employee security-awareness platform, tested through a HackerOne program. The researcher held a completely ordinary employee account with no administrative privileges. The feature at the centre of the report is the organisation's user directory: a settings sidebar section called Users that lists the organisation's accounts. On the researcher's account that section was not available.
The application's frontend is a GraphQL client, and the directory is loaded by a GraphQL connection. The report describes three separate weaknesses that combined: a directory query the backend would execute for a user who was not allowed to see it, a client-side permission check that was the only thing stopping the query, and a search argument that evaluated the hidden email column using SQL LIKE semantics, turning result counts into an oracle for email addresses.
Setup
- One ordinary employee account on the target, no administrative role.
- The application's minified JavaScript bundle, downloaded and read offline.
- An authenticated GraphQL session using that account.
- Additional accounts controlled by the researcher, used to validate the search behaviour and the recovery process.
- Testing stayed within the scope of the authorised bug bounty engagement, and the automated probing was deliberately kept to around eight requests per second to respect the program's rate restrictions.
No specific endpoint paths, hostnames, versions or tool names are given in the report.
Finding it
While reading the minified bundle, the researcher found the GraphQL operation that loads the administrative Users page. The frontend guarded it with an authorisation-dependent skip condition:
skipAccounts: !canViewUsers.value
In practice this means the query is only sent when the user has permission to view the directory, and is skipped entirely otherwise. The application was relying on frontend logic to keep unauthorised users away from the functionality.
The question worth asking was whether the backend enforced the same restriction independently. The researcher reproduced the underlying GraphQL request with their own authenticated session, and the server answered with the directory anyway:
- 648 organisation accounts.
- Employee names.
- Account creation dates.
- Last-active timestamps.
- Internal account identifiers.
The same response also contained the permission flag itself:
{ "canViewUsers": { "value": false }}
So the backend returned the directory while explicitly stating that the account could not view users. That was the first finding: an authorisation enforcement issue on a GraphQL connection.
One detail stood out: the email field was consistently returned as null. The directory was accessible, but not the field the researcher most wanted.
Exploitation
Step 1: Confirm the directory is reachable without permission
Replaying the directory query from the bundle with the ordinary session returned the 648-account listing described above, together with canViewUsers.value: false. The important parts are the connection itself (which the frontend only sends when canViewUsers is true) and the fact that the server did not reject it. The response confirmed that the backend did not enforce the same restriction the frontend applied.
Step 2: Try to get the email field directly
The application exposed an account lookup through a profile slug, so the researcher queried individual profiles and examined the available fields: email, roles, points, real IDs, profile information and other account-related properties. The email field consistently returned null for other users, which suggested some form of field-level privacy enforcement at the resolver.
Step 3: Try introspection
Standard GraphQL introspection was attempted. Both __schema and __type were unavailable, and field suggestions were disabled, so invalid field names returned no useful schema information. Discovering additional functionality this way was not possible.
Step 4: Try the password reset endpoint
The password reset flow could in principle distinguish valid addresses from invalid ones. It did not: the application had CAPTCHA protection and returned identical HTTP 422 responses for both valid-looking and nonexistent addresses, so there was no useful distinction to exploit.
Step 5: Try the email confirmation resend endpoint
The email confirmation resend functionality behaved differently for a limited category of accounts that had started registration but never completed it. That was interesting but did not help retrieve existing employee email addresses.
Step 6: Notice that the directory can be sorted by email
While experimenting with the directory query, the researcher noticed that its sorting functionality accepted an EMAIL enum value. The application allowed sorting accounts by a value it would not allow reading. Sorting revealed relative ordering, but that was not enough to reconstruct individual addresses.
Step 7: Look at arguments instead of returned fields
Up to this point the investigation had focused on what the query returns. The researcher changed the question to what the query accepts. Reading another part of the bundle, the team invitation functionality, revealed a related GraphQL connection whose generated query structure exposed additional arguments:
firstafterbeforelastsearchTermfilters
The searchTerm argument was the interesting one: the directory query supported searching, but the application did not expose that search through the normal user interface.
Step 8: Establish that search matches hidden data
Using an account the researcher controlled, the search was probed with known values and the result count was observed. Certain fragments produced matches even when they were not present in the account's username or display name. That meant the search was matching information beyond the fields visible in the directory response.
Step 9: Identify the matching mechanism
Controlled experiments showed SQL LIKE semantics:
%matches any sequence of characters. A standalone%matched the entire directory._matches exactly one character. A pattern containing_matched accounts where a single character differed.- Regular expression syntax did not produce equivalent results.
This indicated SQL-style pattern matching rather than regular expressions, and that user-controlled input was being interpreted as a pattern rather than as literal text. Wildcard characters were not escaped before the search evaluated them.
Step 10: Confirm the email column is searched
A successful search alone does not prove which column matched, since usernames, display names and other profile attributes could be responsible. To eliminate those possibilities the researcher pinned the query to a specific account using the directory connection's ids argument, so that one account could be investigated without interference from other directory entries. Search results were then compared against information already visible in that account's profile.
Some fragments matched even though they were absent from the account's username and display name. Domain-anchored patterns were also used: searching for patterns associated with a known email domain distinguished email-based matches from username or display-name matches, because the @domain portion was not present in those other fields. This was strong evidence that the email column was included in the backend search despite being unavailable through direct field selection.
Step 11: Turn totalCount into an oracle
With two facts established, that the search evaluates the hidden email column and that the API exposes whether a search matched through totalCount, the combination became an information disclosure oracle. The report's simplified illustration: an account whose email is
[redacted]
but whose GraphQL profile looks like
{ "username": "employee", "email": null}
cannot be read directly. The search operation, however, evaluates patterns against the underlying email value, and observing whether a carefully constructed pattern produces a match lets an attacker determine unknown characters one at a time. The known domain served as an anchor, and the unknown local part was resolved through successive matching decisions: establish a known prefix, then use the search response to determine which character extensions still match, narrowing the possibilities with each successful match until the complete address could be confirmed. The researcher also accounted for ambiguity and verified that the recovered prefix was complete rather than assuming the first successful match represented the whole address.
Step 12: Automate and measure
An automated approach was built to validate the recovery process against accounts the researcher was authorised to test. It used controlled, domain-anchored search probes, parallelised requests in small batches, and handled ambiguous matches through backtracking, at roughly eight requests per second. In testing, recovering a complete address took approximately 16 requests and around 20 seconds for a known-prefix example; the automated approach could recover an address in approximately 2 to 3 minutes depending on the search space and matching behaviour. The application never returned the protected address directly. It only answered whether a pattern matched the account.
Step 13: Assess the scope
Aggregate search results and the organisation directory were examined to see whether the issue was limited to one account or affected the wider organisation:
| Observation | Result |
|---|---|
| Total organisation accounts | 648 |
| Accounts associated with one observed domain | 314 |
| Accounts associated with another observed domain | 162 |
| Sampled accounts where email local-part matched username | 3 out of 8 |
These observations suggested that a substantial portion of the organisation used predictable email domains and naming conventions, so the impact was not limited to confirming whether an arbitrary string existed.
Root cause
The report identifies three security boundaries that were not working as expected.
- Frontend authorisation was treated as a security boundary. The frontend prevented the directory query from executing via
skipAccounts: !canViewUsers.value, but the backend did not consistently enforce the same restriction. The server returned the directory while reportingcanViewUsers.value: false. - Field-level privacy did not account for indirect disclosure. The email field returned
null, but another operation, the search, still evaluated the underlying email value and exposed the result of that evaluation throughtotalCount. - Search input was not handled as literal input. Wildcard characters in
searchTermwere not escaped before the search pattern was evaluated, so%and_influenced matching and the search became an information oracle.
Sorting by the EMAIL enum was another observation: ordering by a column the user cannot read revealed relative ordering, though not enough to reconstruct addresses.
Impact
An ordinary employee account, without administrative privileges, could retrieve an organisation-wide directory of 648 accounts including names, creation dates, last-active timestamps and internal identifiers, and could then recover employee email addresses that the profile API explicitly returned as null. The report notes that a substantial portion of the organisation appeared to use predictable email domains and naming conventions, so the exposure was not limited to confirming whether an arbitrary string existed.
For a security-awareness platform this matters: an attacker with verified employee email addresses could construct more convincing phishing campaigns. The report also lists employee impersonation, targeted social engineering, account discovery, spear-phishing preparation and mapping organisational identities as uses for the same data. The report does not state a CVSS score or a formal severity rating.
Fix
The report recommends the following, and states that the vendor has since changed the email-search behaviour, so the specific matching behaviour described no longer reproduces against the current build. The vendor's name is withheld while the remaining issue is being addressed.
- Enforce authorisation on the backend. Frontend visibility checks are never sufficient authorisation. The backend must verify whether the authenticated user may access organisation-wide account information, and the directory connection must enforce this independently of the frontend.
- Escape SQL
LIKEwildcards. If the intended behaviour is literal text search, wildcard characters must be escaped before the pattern is constructed, and the backend should distinguish literal user input from intentional search operators. Parameterised queries prevent SQL injection, but parameterisation alone does not make wildcard characters literal in aLIKEexpression; both concerns need addressing. - Restrict searchable columns. Only columns the current user is authorised to access should be searched. Private email addresses should not be in the searchable column set for ordinary employees.
- Review sorting and filtering permissions. Sorting and filtering should follow the same authorisation rules as direct field access, so sensitive columns do not become indirect information sources through ordering, filtering or aggregate counts.
- Review organisation-level access controls. Every organisation-level GraphQL connection should independently enforce authorisation; a user should not reach administrative functionality just because the operation exists in the frontend bundle.
Variants to test
- Replay every skipped operation from the bundle. Look for frontend guards such as
skip: !permission.valueand send the underlying request with a low-privilege session. A positive result is a response containing data the UI never shows, especially when the response also carries the permission flag set to false. - Enumerate arguments on connections you can reach. Compare the generated query structure of related features (the report found
searchTermandfilterson a team invitation connection) against the directory connection. A positive result is an argument the UI never exposes that changes the response. - Probe search arguments with
%and_. A standalone%matching every record, or_matching records that differ by one character, indicates unescapedLIKEwildcards. Regex syntax producing no equivalent matches supports the same conclusion. - Pin to a single record with an
ids-style argument and test fragments absent from visible fields. A positive result is a match for a fragment that appears in no field the response returns, which points at a hidden column. - Use domain anchors. Search for
@known-domainfragments that cannot appear in usernames or display names. A match confirms the email column is in the searchable set. - Watch
totalCountwhile varying a pattern one character at a time. A count that changes predictably as you extend a known prefix is an oracle; automate with small batches, respect rate limits, and handle ambiguous matches with backtracking. - Sort by fields you cannot read. If an enum such as
EMAILis accepted for sorting while the field returnsnull, the ordering leaks relative information about the hidden values. - Check error and response differences on reset and resend flows. Identical status codes and bodies for valid and invalid addresses mean no oracle there; differing behaviour for partially registered accounts is worth noting even when it does not expose existing addresses.
What happened, in plain words
A security researcher was testing a website that companies use to train their staff about phishing and other security risks. Think of it as a company intranet with lessons and quizzes. He had a normal employee login, the kind any worker would get, with no special admin powers.
While poking around, he noticed that the settings menu had a section called Users, but his account could not open it. That is where most people would stop. Instead he downloaded the website's JavaScript files, the code that runs inside your browser, and read them. In those files he found a hidden request that the site uses to fetch the list of everyone in the organisation. The site simply chose not to send that request for his account. He sent it himself, and the server answered with the whole employee directory anyway: 648 accounts, with names, creation dates, last-active times and internal IDs.
The email addresses in that list came back as null, which is computer-speak for "nothing here". So he could see who worked there but not how to contact them. He then tried several other ways to get the emails and all of them failed. The breakthrough came when he looked not at what the request returns but at what it accepts. A related feature, team invitations, revealed that the directory request also accepts a search term. The site never showed a search box for this list, but the server supported searching. And that search was quietly looking inside the hidden email column too.
Because the search used a database pattern language called SQL LIKE, where % means "anything" and _ means "any single character", the researcher could ask the server yes/no questions: does any account's email start with these letters? Each answer narrowed the possibilities until a full email address could be reconstructed, even though the site never displayed it. He automated this, kept the request rate low, and measured how many accounts were affected. He reported it through HackerOne, the platform where companies offer rewards for security findings, and the vendor has since changed the search behaviour.
This article walks through the same investigation step by step, explaining every term as it comes up.
Background: what the product and the pieces are
The product
The target is an employee security-awareness platform. Companies buy it so their staff can take short training courses and simulated phishing tests. Because it is used by whole organisations, it holds a directory of employee accounts: names, creation dates, last-active times and internal identifiers.
Accounts and roles
An account is your login on a website. A role is the set of things your account is allowed to do. An ordinary employee account can see its own training and maybe some team information. An administrator account can manage everyone. The researcher had an ordinary account, with no administrative privileges.
The Users section
In the settings sidebar there was a section called Users. A sidebar is the vertical menu on the left of many web apps. The Users section is meant to list everyone in the organisation. On the researcher's account it was not available. That is a normal design decision: only admins should see the full staff list.
What an API is
An API (Application Programming Interface) is the set of doors a website's frontend uses to talk to its backend. The frontend is what runs in your browser: buttons, pages, menus. The backend is the server in a data centre that holds the database and decides what to return. When you click something, your browser sends a request to the backend and the backend sends back data. A useful comparison: the frontend is the waiter in a restaurant, the backend is the kitchen. You tell the waiter what you want; the waiter carries the order to the kitchen and brings back the plate. If the waiter decides not to pass your order on, the kitchen never knows you asked. That detail matters later.
What GraphQL is
GraphQL is a way of designing an API. Instead of many separate addresses (like /users or /orders), there is usually one address, and the client sends a query describing exactly which fields it wants. A field is one piece of data, such as name or email. The server answers with a JSON document, which is a text format for structured data using curly braces, quotes and colons.
A connection in GraphQL is a standard pattern for returning a list of things with paging information. It typically includes the items themselves and a totalCount, the number of items that match. Paging arguments like first and after let you ask for the first N items, then the next N.
What JavaScript bundles are
When you load a modern web app, your browser downloads one or more JavaScript files. JavaScript is the programming language that runs in the browser. These files are often minified: all the spaces and readable names are stripped out to make the file smaller, so it looks like a wall of gibberish. But the structure is still there, and so are the GraphQL queries the app can send. Reading these files is a common first step in security testing, because the browser must contain every request the app is capable of making, including ones the interface hides from you.
What a cookie or token is
When you log in, the server gives your browser a session cookie or token: a long random string that your browser sends with every request so the server knows who you are. Think of it as a wristband at an event. You show it at the door and staff let you in without asking for your ID again. In this report the researcher used his own authenticated session, meaning his own wristband, to send requests. He did not steal anyone else's.
What the vulnerability class means
This report is about information disclosure: a system reveals data to someone who should not have it. It is also about a broken access control or authorisation problem. Authentication asks "who are you?" (your login). Authorisation asks "are you allowed to do this?" (your permissions). A site can authenticate you perfectly and still fail to authorise you properly.
A related idea is an oracle. In security, an oracle is any behaviour that answers a yes/no question about secret data. You cannot read the secret, but you can keep asking questions and learn from the answers. A common comparison is the game where someone thinks of a word and you guess letters: they only say yes or no, but eventually you know the word.
1. The first discovery: a hidden GraphQL query
The researcher was reading the minified JavaScript bundle offline. Inside it he found the GraphQL operation that loads the administrative Users page. The frontend guarded it with a condition that depends on the user's permission:
skipAccounts: !canViewUsers.value
Line by line, in plain words:
skipAccountsis the name of a setting that tells the GraphQL client whether to skip this request. If it is true, the request is not sent at all.!means "not". It flips true to false and false to true.canViewUsers.valueis a value the frontend has stored about the current user. If the user is allowed to view the directory, it is true; otherwise false.- So the whole line reads: skip the request when the user cannot view users. In other words, send the request only when the user is allowed to.
The important point is where this decision is made: in the browser. The browser is under the user's control. Anyone can open developer tools, change variables, or simply send the request by hand. A lock that lives in the browser is like a sign on a door saying "staff only": it works for polite visitors and does nothing against anyone else.
The researcher wanted to know whether the backend enforced the same rule independently. So he reproduced the underlying GraphQL request using his own authenticated session. The server answered with the directory anyway:
- 648 organisation accounts.
- Employee names.
- Account creation dates.
- Last-active timestamps.
- Internal account identifiers.
And the same response also contained the permission flag itself:
{ "canViewUsers": { "value": false }}
Line by line:
- The outer
{ ... }is a JSON object, a collection of named values. "canViewUsers"is the name of a field in the response.- Its value is another object,
{ "value": false }. "value": falsemeans the server itself is saying: this account is not allowed to view users.
So the server returned the directory while explicitly stating that the account could not view users. That contradiction is the first finding: an authorisation enforcement issue on a GraphQL connection. The frontend was the only thing stopping the request, and the frontend is not a security boundary.
One detail stood out: the email field was consistently returned as null. The directory was accessible, but not the field the researcher most wanted.
2. Trying to retrieve the missing information
He now had names and IDs but no email addresses. He tried several routes, each for a specific reason.
Direct GraphQL field queries
The application exposed an account lookup through a profile slug. A slug is the readable part of a web address that identifies a page. He queried individual profiles and examined the available fields: email, roles, points, real IDs, profile information and other account-related properties. The email field consistently returned null for other users. That suggested some form of field-level privacy enforcement: the server checks each field and blanks out the ones you are not allowed to see. This is a sensible defence, and it worked for direct reads.
GraphQL introspection
Introspection is a built-in GraphQL feature that lets a client ask the server to describe its own schema, meaning the full list of types, fields and arguments it supports. It is like asking a restaurant for the full menu. He tried the standard introspection queries, __schema and __type. Both were unavailable. Field suggestions were disabled too: normally, if you misspell a field name, GraphQL helpfully replies "did you mean ...?". With suggestions off, invalid field names returned no useful schema information. Discovering additional functionality this way was not possible.
Password reset endpoint
An endpoint is one specific address on a server that accepts requests, for example the one that handles password resets. The idea here was a classic trick: if the reset form says "we sent an email" for real addresses and "no such account" for fake ones, you can use it to test whether an address exists. It did not work. The application had CAPTCHA protection (the puzzle that proves you are human) and returned identical HTTP 422 responses for both valid-looking and nonexistent addresses. HTTP 422 is a status code meaning the server understood the request but could not process it, usually because the data was invalid. Identical answers for both cases mean no useful distinction to exploit.
Email confirmation resend endpoint
He also examined the email confirmation resend functionality. It behaved differently for a limited category of accounts that had started registration but never completed it. That was interesting but did not help retrieve existing employee email addresses.
An unexpected observation: email sorting
While experimenting with the directory query, he noticed that its sorting functionality accepted an EMAIL enum value. An enum is a fixed list of allowed values, like a dropdown. The application allowed sorting accounts by a value it would not allow reading. Sorting revealed relative ordering, meaning you could learn that one person's email comes alphabetically before another's, but that was not enough to reconstruct individual addresses.
At this point he had explored several possibilities without recovering a single address. Then he changed his question.
3. The breakthrough: inspecting GraphQL arguments
Until this point, most of the investigation had focused on the fields returned by GraphQL. He was asking: what information can this query return?
He changed his approach and started investigating: what functionality does this query accept?
An argument is an input you attach to a query, the way you fill in a form field before submitting. A query can accept arguments that the interface never shows you. While examining another part of the JavaScript bundle, specifically the team invitation functionality, he found a related GraphQL connection. Its generated query structure exposed additional arguments:
firstafterbeforelastsearchTermfilters
What each one is for:
firstandlastask for a number of items from the start or the end of a list. They are paging controls.afterandbeforeare cursors: markers that say "continue from here". Together withfirstthey let a client walk through a long list page by page.searchTermis the text to search for.filtersnarrow the list by conditions, for example only active accounts.
The searchTerm argument was the interesting one: the directory query supported searching, but the application did not expose that search through the normal user interface. A hidden search box on the server side is a very different thing from a hidden button in the browser, because the server actually does the work.
He decided to investigate its behaviour using an account he controlled. The important discovery was that the search operation appeared to match information beyond the fields visible in the directory. He began with a known account and observed how the result count changed when different search terms were supplied. Certain fragments produced matches even when they were not present in the account's username or display name. A fragment here just means a piece of text. That was the turning point: the search was revealing information through its matching behaviour, even though the corresponding field was hidden from the response.
4. Understanding the root cause: SQL LIKE wildcards
He wanted to determine what kind of matching mechanism was being used. A few controlled experiments revealed some interesting behaviour. The search functionality appeared to follow SQL LIKE semantics.
SQL is the standard language for talking to relational databases, the software that stores rows and columns of data. LIKE is the SQL operator for pattern matching on text. Two characters are particularly important:
%matches any sequence of characters, including none at all._matches exactly one character.
For example, a search pattern using % matched the entire directory. A pattern containing _ also matched accounts where a single character differed. Meanwhile, regular expression syntax did not produce equivalent results. Regular expressions are a different, more powerful pattern language; if the backend had used them, the results would have looked different. This strongly indicated SQL-style pattern matching rather than regular expressions.
The underlying problem was that user-controlled search input was being interpreted as a pattern rather than treated as literal text. If you type 50% into a search box expecting to find the text "50%", a well-built system treats the percent sign as an ordinary character. A system that passes it straight into a LIKE expression treats it as "anything", which is not what you meant. The wildcard characters were not escaped, meaning they were not marked as ordinary text before the search evaluated them.
More importantly, the search appeared to include the email column. He verified this using controlled test accounts and domain-anchored matching behaviour. The application had effectively created an information disclosure oracle. Even though the email field was hidden, the search functionality could reveal whether a guessed fragment matched the underlying email address.
5. Recovering an email address without ever reading the email field
This is where things became interesting. He had already established that the application was returning the organisation's directory, but direct access to employee email addresses was blocked. Regardless of which profile fields he queried, the email property consistently returned null. He initially assumed that email addresses were properly protected at the resolver level. A resolver is the small piece of server code that produces the value for one field; if the resolver returns null, the field is blank.
But he had not considered whether another functionality could indirectly expose the same information. Remember the searchTerm argument? He started experimenting with it using an account he controlled. Instead of relying on the returned fields, he focused on how the totalCount value changed when different search terms were supplied. That small change in approach made all the difference.
Discovering the matching behaviour
His first experiments involved checking how the search functionality handled special characters. He observed three particularly interesting behaviours:
- A standalone
%matched the entire directory. - The
_character behaved like a single-character wildcard. - Regular expression syntax did not produce equivalent matches.
These observations strongly suggested that the backend was using SQL LIKE-style pattern matching. The important detail was that wildcard characters were not being escaped before the search operation evaluated them. This meant the search argument was not necessarily being interpreted as literal text.
Identifying the email column
The next challenge was figuring out which database column was actually being searched. A column is one named field in a database table, like a column in a spreadsheet. A successful search alone was not enough: the application could have been matching usernames, display names, or other profile attributes. He needed to eliminate those possibilities.
He pinned the query to a specific account ID using the directory connection's ids argument. This allowed him to investigate one account without interference from other directory entries. He then compared search results against information already visible in that account's profile.
Some search fragments matched even though they were not present in the account's username or display name. He also used domain-anchored patterns. For example, searching for patterns associated with a known email domain allowed him to distinguish email-based matches from username or display-name matches. The @domain portion was particularly useful because it was not present in those other fields. This provided strong evidence that the email column was included in the backend search operation, despite being unavailable through direct GraphQL field selection.
Turning search results into an information oracle
Now he had two important pieces of information:
- The search functionality evaluated the hidden email column.
- The API exposed whether a search matched through
totalCount.
The combination created an information disclosure oracle. Consider a simplified example. Suppose the target account has the following email:
[redacted]
But its GraphQL profile looks like this:
{ "username": "employee", "email": null}
Line by line:
"username": "employee"is the visible name for the account."email": nullmeans the email field is deliberately blank in the response.
A direct query cannot retrieve the email address. However, the search operation can evaluate patterns against the underlying email value. By observing whether a carefully constructed search pattern produces a match, it becomes possible to progressively determine the unknown characters. The key was to use a known domain as an anchor and investigate the unknown local part through successive matching decisions. The local part is the bit before the @; the domain is the bit after it.
In his testing, he first established a known prefix and then used the search response to determine which character extensions continued to match. Each successful match narrowed down the possibilities. The process was repeated until the complete address could be confirmed. He also accounted for ambiguity and verified that the recovered prefix was complete rather than assuming that the first successful match represented the entire address. Ambiguity matters because a pattern can match more than one account, and a careless guess can lead you down the wrong path.
The failed approaches
Getting to this point was not straightforward. He had already tried direct profile queries, GraphQL introspection, password-reset behaviour, email-confirmation endpoints, and even sorting by the hidden email field. None of those approaches recovered an existing employee's email address. The breakthrough came from realising that he did not need the application to return the email field. He only needed to know whether a particular pattern matched it. That distinction changed the entire investigation.
How quickly could it be done?
After understanding the matching behaviour, he developed an automated approach to validate the recovery process against accounts he was authorised to test. The implementation used controlled, domain-anchored search probes, parallelised requests in small batches, and handled ambiguous matches through backtracking. Backtracking means going back to an earlier point when a guess turns out to be wrong and trying a different option, like retracing your steps in a maze. He deliberately kept the request rate around eight requests per second to respect the program's rate restrictions. Rate limiting is a server-side rule that caps how many requests you can send in a period; staying under it is both polite and required by most bug bounty programs.
In his testing, recovering a complete address took approximately 16 requests and around 20 seconds for a known-prefix example. The automated approach could recover an address in approximately 2 to 3 minutes, depending on the search space and matching behaviour. The important point is that the application never returned the protected email address directly. It repeatedly answered a much simpler question: does this search pattern match the account? And those answers were enough to reconstruct information that the profile API explicitly refused to disclose.
This is an example of inference-based information disclosure through an application-level search oracle. It demonstrates why protecting a sensitive field at the response layer is not sufficient when other operations can still evaluate that field and expose the result of those evaluations. A field returning null does not necessarily mean its underlying data is inaccessible. Sometimes, the application leaks the information through the questions it allows you to ask.
6. Measuring the impact
Once he understood the behaviour, he wanted to determine whether this was limited to an individual account or affected the wider organisation. He examined aggregate search results and the organisation directory. Aggregate means a summary number, such as a count, rather than the individual records.
| Observation | Result |
|---|---|
| Total organisation accounts | 648 |
| Accounts associated with one observed domain | 314 |
| Accounts associated with another observed domain | 162 |
| Sampled accounts where email local-part matched username | 3 out of 8 |
These observations suggested that a substantial portion of the organisation used predictable email domains and naming conventions. The impact was therefore not limited to discovering whether an arbitrary string existed. It involved the possibility of recovering employee contact information from an organisation-wide directory.
For a security-awareness platform, this is particularly relevant. An attacker with access to verified employee email addresses could use that information to construct more convincing phishing campaigns. Phishing is a fake message designed to trick someone into clicking a link or giving away a password. Knowing a real colleague's address makes a fake message far more believable. The same data could also be useful for:
- Employee impersonation.
- Targeted social engineering.
- Account discovery.
- Spear-phishing preparation.
- Mapping organisational identities.
Social engineering is manipulating people rather than machines. Spear-phishing is phishing aimed at one specific person, using details about them. The vulnerability combined two separate security problems:
- Unauthorised access to an organisation directory.
- Information disclosure through a search functionality that matched protected email data.
Together, these issues significantly increased the exposure.
7. Why this was not just a GraphQL authorisation bug
Initially, this investigation looked like a fairly standard authorisation issue. A user without administrative permissions could execute a query intended for a different role. But the deeper issue was more interesting. There were multiple security boundaries that were not working as expected.
First: frontend authorisation was treated as a security boundary. The frontend prevented the query from executing, but the backend did not consistently enforce the same restriction. A boundary is a line the system promises not to let you cross; here the line was drawn in the browser, where the user can rub it out.
Second: field-level privacy did not account for indirect information disclosure. The email field returned null, but another operation could still evaluate the underlying email value. Direct reads were blocked; indirect questions were not.
Third: search input was not handled as literal input. Wildcard characters influenced the matching behaviour, allowing the search operation to act as an information oracle.
This is an important lesson when assessing GraphQL applications. Authorisation is not just about checking whether someone can retrieve a particular field. It is also about checking whether they can infer that field through:
- Search operations.
- Sorting.
- Filtering.
- Aggregation.
- Pagination.
- Result counts.
- Error differences.
A field can be hidden in one resolver and still leak through another.
8. Recommended remediation
There are several changes that would address the underlying issues. Remediation means the fix.
1. Enforce authorisation on the backend
Frontend visibility checks should never be considered sufficient authorisation. The backend must verify whether the authenticated user is permitted to access organisation-wide account information. The directory connection should enforce this restriction independently of the frontend. In plain terms: the kitchen should check the order itself, not trust the waiter to filter it.
2. Escape SQL LIKE wildcards
If the intended behaviour is literal text searching, special wildcard characters must be escaped before constructing the search pattern. The backend should distinguish between literal user input and intentional search operators. Parameterised queries should be used to prevent SQL injection, but parameterisation alone does not make wildcard characters literal in a LIKE expression. Both concerns need to be addressed. SQL injection is a separate attack where user input changes the structure of a database query; parameterisation stops that, but it does not stop % from acting as a wildcard.
3. Restrict searchable columns
The backend should only search columns that the current user is authorised to access. If email addresses are private, they should not be included in the searchable column set for ordinary employees. Hiding a field in GraphQL responses is insufficient if another resolver can still query it indirectly.
4. Review sorting and filtering permissions
Sorting and filtering should follow the same authorisation rules as direct field access. Sensitive columns should not become indirect information sources through ordering, filtering, or aggregate counts.
5. Review organisation-level access controls
Every organisation-level GraphQL connection should independently enforce authorisation. A user should not be able to access administrative functionality simply because the corresponding operation exists in the frontend bundle.
9. Lessons for bug bounty hunters
This investigation reinforced a few techniques worth incorporating into regular web application testing.
Do not stop at the visible interface. Frontend JavaScript bundles often contain GraphQL operations, feature flags, hidden queries, and functionality that is not available to every user. These can provide valuable leads during an assessment.
Look at arguments, not just returned fields. A GraphQL operation's arguments can reveal functionality that is not exposed through the normal UI. Search, filters, sorting, and pagination deserve particular attention.
Think about indirect information disclosure. A sensitive field returning null does not necessarily mean the information is protected. Ask whether the application can still search, filter, sort, count, or otherwise evaluate that field.
Investigate result counts. Developers sometimes underestimate the information exposed by aggregate counts. A response that only returns totalCount can still reveal whether a particular condition matches an underlying record.
Treat client-side authorisation as a lead, not a security control. Whenever frontend code skips a request based on a permission flag, investigate whether the backend independently validates that permission.
Responsible disclosure
The vulnerability was reported through HackerOne. The vendor has since changed the email-search behaviour, and the specific matching behaviour described in this article no longer reproduces against the current build. The vendor's name is intentionally withheld while the remaining issue is being addressed. All testing was performed within the scope of the authorised bug bounty engagement.
Responsible disclosure means telling the vendor privately, giving them time to fix the issue, and not publishing details that would let others abuse it before a fix exists.
Final thoughts
One of the interesting things about application security research is that vulnerabilities do not always come from complicated exploitation chains. Sometimes, they come from two individually ordinary features interacting in an unexpected way. In this case:
- A hidden GraphQL query exposed an organisation directory.
- A privacy restriction prevented direct email retrieval.
- A search operation evaluated the protected email column.
- SQL wildcard behaviour made that search operation an information oracle.
The application never directly returned the sensitive information. It simply answered enough questions to make that information recoverable. And that is something worth remembering when testing modern applications: do not just investigate what an application tells you. Investigate what its behaviour allows you to figure out.
Glossary
- Account: a login on a website, with a username and password.
- Administrator: an account with extra powers to manage other users and settings.
- Aggregate: a summary value such as a count, rather than the individual records.
- API (Application Programming Interface): the set of requests a frontend can send to a backend to read or change data.
- Argument: an input attached to a query, like a form field, that changes what the query does.
- Authentication: proving who you are, usually by logging in.
- Authorisation: deciding whether an authenticated user is allowed to do a particular thing.
- Backend: the server and database that hold the data and decide what to return.
- Backtracking: going back to an earlier step when a guess turns out wrong and trying another option.
- Bug bounty program: a scheme where a company pays researchers for reporting security problems in its systems.
- CAPTCHA: a puzzle designed to prove a human is making the request, not a script.
- Column: one named field in a database table, like a column in a spreadsheet.
- Connection: a GraphQL pattern for returning a list of items together with paging information and a total count.
- Cookie / token: a random string your browser stores after login and sends with each request so the server knows who you are.
- Cursor: a marker in a list that says where to continue paging from.
- Domain: the part of an email address after the
@, such asexample.com. - Endpoint: one specific address on a server that accepts requests.
- Enum: a fixed list of allowed values, like a dropdown menu.
- Escaping: marking special characters so they are treated as ordinary text instead of having their special meaning.
- Field: one piece of data in a GraphQL response, such as
nameoremail. - Field-level privacy: a server rule that blanks out individual fields the user is not allowed to see.
- Fragment: a piece of text used in a search.
- Frontend: the part of a web app that runs in your browser: pages, buttons, menus.
- GraphQL: an API style where the client sends a query describing exactly which fields it wants.
- HackerOne: a platform where companies run bug bounty programs and researchers submit reports.
- HTTP 422: a status code meaning the server understood the request but could not process it, usually because the data was invalid.
- Information disclosure: a system revealing data to someone who should not have it.
- Introspection: a GraphQL feature that lets a client ask the server to describe its own schema.
- JavaScript: the programming language that runs in web browsers.
- JSON: a text format for structured data using curly braces, quotes and colons.
- LIKE: the SQL operator for pattern matching on text, where
%and_have special meanings. - Local part: the part of an email address before the
@. - Minified: JavaScript with spaces and readable names stripped out to make the file smaller.
- Oracle: any behaviour that answers a yes/no question about secret data, letting you learn the secret indirectly.
- Parameterised query: a database query where user input is passed separately from the query structure, preventing SQL injection.
- Phishing: a fake message designed to trick someone into clicking a link or giving away a password.
- Rate limiting: a server rule capping how many requests you can send in a period.
- Regular expression: a powerful pattern language for matching text, different from SQL
LIKE. - Remediation: the fix for a vulnerability.
- Resolver: the small piece of server code that produces the value for one GraphQL field.
- Responsible disclosure: telling a vendor privately about a vulnerability and giving them time to fix it before details are published.
- Role: the set of things an account is allowed to do.
- Schema: the full description of a GraphQL API's types, fields and arguments.
- Session: the period during which your browser is logged in, identified by a cookie or token.
- Slug: the readable part of a web address that identifies a page.
- Social engineering: manipulating people rather than machines to get access or information.
- Spear-phishing: phishing aimed at one specific person, using details about them.
- SQL: the standard language for talking to relational databases.
- SQL injection: an attack where user input changes the structure of a database query.
- Timestamp: a date and time recorded by the system, such as when an account was created or last used.
- Wildcard: a character that stands for other characters in a pattern, such as
%or_in SQLLIKE.