XSLeaking with my best bud SOP
A cross-site leak technique using the browser's HTTP/1 connection limit allowed an attacker to detect when a cross-domain request was running, and this was applied to Microsoft Dynamics CRM to leak field-level-secured data via a report filter. An attacker could infer redacted information such as phone numbers by timing requests.
Published on blog.viettelcybersecurity.com
During any bug hunting journey, there's bound to be something special. I dedicate this blog post to the most fun CTF-like challenge I encountered working on the Microsoft Dynamics platform.
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 Dynamics CRM on-premise ships a report generation feature built on SQL Server Reporting Service (SSRS). Normal users cannot upload a complete report definition (.rdl); they go through the Report Wizard, which accepts a custom sandboxed format and validates the user's permissions before generating the definition via XSLT. Reports are opened through a POST request that takes a report id and a CRM_filter parameter, and the report viewer fetches its data later, at document.load, through an AJAX request protected by a token.
The write-up is about leaking data across origins from that deferred fetch, using a timing oracle built on the browser's per-host connection limit rather than on any flaw in the report query itself.
Setup
The work was done against Dynamics CRM on-premise, deployed in an Active Directory environment, so authentication is NTLM/Kerberos rather than cookies. The researcher's own miniature lab (PHP calling sleep to simulate database activity, plus some JavaScript) was used earlier to study the XSLeaks Wiki techniques. The report does not list browser versions or CRM build numbers.
Two properties of the deployment matter for the attack:
- NTLM/Kerberos puts the token in an
Authenticate: NTLMheader instead of a cookie, so SameSite does nothing to stop cross-site requests. - NTLM authentication is incompatible with HTTP/2, at least on IIS, so the target speaks HTTP/1 and the per-host connection limit applies.
Finding it
The starting point was the XSLeaks Wiki's Connection Pool section, which links to a Chromium issue marked won't fix and containing a PoC. The idea there is a global pool of connection sockets:
- A user opens a page on an attacker-controlled domain.
- The attacker issues an AJAX request to the victim domain with some control over how the data is loaded.
- If the global pool limit is 256 connections, the attacker fetches resources from 256 other domains he controls while the XHR runs.
- The timing of the 256th connection tells the attacker whether the XHR to the victim took a long or short time.
The researcher fixed up the PoC and ran it against the miniature lab but got no meaningful results. The Wiki notes that Mozilla confirmed mitigations on Firefox. Even if it had worked, he would not have submitted it: the exploit only works if the victim does nothing (does not navigate in another tab) and watches it run for the whole duration.
Looking further into connection pools turned up Domain Sharding, a technique from the HTTP/1.x era used to bypass the browser's active connection limit to a single domain. It is obsolete under HTTP/2, which multiplexes on a single connection. On Chrome the HTTP/1 limit is 6 connections, and that can be exploited to leak request timing cross-domain.
Exploitation
Step 1: the HTTP/1 connection-limit oracle
The goal is to determine whether an XHR to victim.domain/resource has completed, given some knowledge of when the request started, here at iframe.load, which can be captured cross-domain.
Suppose the target request takes about 1.5 seconds. The attacker tricks the victim into visiting a page he controls and asynchronously requests a static resource such as victim.domain/static.png in blocks of 6. Cache busting elements must be included so caching does not interfere with the measurements. An iframe or any element that loads resources asynchronously, such as script, works, so frame options are not an issue.
Because the size of the static resource does not vary, six parallel requests for it should take about the same time, as long as no other requests are running. When victim.domain/resource is running, the waterfall in Chrome DevTools looks like this, assuming the static resource requests take about 1 second:
- The first 5 requests for
victim.domain/static.pngcomplete in about 1 second as expected. - The 6th request is stalled by about 1 second: the browser must wait for one of the first 5 to finish, because the request to
victim.domain/resourcewill run for another 0.5 seconds. - Since the first 5 all finish after about 1 second, requests 6 to 10 for
victim.domain/static.pngall take about 2 seconds. - At the 1.5 second mark the target request finishes, unblocking the 11th request, which completes 2.5 seconds after the initial
iframe.loadevent.
So, given that the target host runs HTTP/1 and the static resource timing stays roughly constant during the attack, an attacker can tell at any single point in time whether cross-domain requests are running.
Step 2: dealing with jitter
In a real environment jitter creates false results. The researcher's exploit hit this:
Chrome DevTools showed the 6th request in the block stalling, the sign that an XHR is running cross-domain, but the fetch then sped up dramatically on that request, so its total time was about the same as the previous five. Without the Timing-Allow-Origin header there is no way to distinguish the stall time of a cross-domain request, and the attacker wrongly concludes that no XHR is running.
Two mitigations are used:
- Decrease sensitivity: the 6th request taking 133% longer than the average of the last 5 was good enough both on the LAN and over the internet (a VPN connection from Vietnam to India and back) to conclude an XHR is running.
- Perform multiple sanity checks: several test instances must yield the same result before drawing a conclusion.
Step 3: the report POST without a CSRF token
Around December 2020, while combing through report generation in Dynamics CRM on-premise, the researcher found a POST request that returned 200 without a CSRF token.
The request opens a report with the corresponding id and returns 400 if the user lacks view permission. It also carries a CRM_filter, so an attacker can force any user to load a report a certain way as long as he knows its id and the user can view it. The attacker can share his own report with others in the same tenant, so the id is not a problem. CRM_filter supports a partial match construct (like LIKE in SQL) on arbitrary columns in the dataset.
The action is idempotent: loading it more times does not change the report's content. The server does not let a user create a report querying a table he has no view permission on, so the obvious path was closed.
Step 4: field-level security as the boundary
Dynamics CRM supports field-level security. The example used to explain it:
- Alice is a nurse and Chris is a lab tech at the same clinic.
- Alice handles patients and needs their PII to contact them when results are out.
- Chris does not need PII and can process tests using a GUID primary key.
- The admin restricts Chris's access to fields on the
Customertable containing PII. When Chris queries the table he knows the fields exist, but the information is redacted. - Chris has read access to the table, so he can create a report.
That is a security boundary worth breaking: if Chris can leak PII when Alice opens his report, the case is convincing. The hurdles were high. Although SSRS sits underneath, a non-admin cannot pass a complete .rdl; normal users only get the Report Wizard, which accepts a custom sandboxed format and validates any permission the user carries, so there is no IDOR there. The following request to SuccessFailurePage.aspx triggers validations before generating a report definition using XSLT:
Here is the wizardPagePostData parameter in more detail:
The part outlined in green contains the report metadata. The part outlined in red contains a FetchXML query. This prevents injection, since report definitions can contain raw SQL. Because SSRS reports can also contain JavaScript, Dynamics CRM only lets the user modify some CSS parameters, none of them useful, in the part outlined in blue.
The fine print made it worse: the CSRF loads the report viewer with the specified filter but does not fetch any information itself. The data is deferred and fetched later at document.load by an AJAX request to the server, protected by a token. Chris needs an oracle to measure the timing of an XHR he cannot initiate directly cross-domain, which is why the connection-limit oracle above was developed.
Step 5: inflating the timing difference
With an oracle, the attacker only needs to inflate the difference between positive and negative queries. To zero in on the phone number of a single patient that was redacted, the report performs an outer join of the patient's dataset with itself before applying a filter based on the name of the person of interest:
This creates a report with a lot of duplicate data. The point is to return all data when a query returns true and nothing when it returns false. The attacker controls rendering at runtime through the CRM_filter parameter, so he does not need to create many reports:
In this instance, paginating and rendering a 313-page report takes around 4 seconds versus an empty one on the LAN, where Active Directory is used the most.
Step 6: the full attack path
- Chris creates the special report with the wizard, shares it with Alice, and sets up another domain with the exploit code.
- Alice visits that domain, which loads an empty report once using an impossible condition (searching for a random string against the name field). This forces all static resources to be cached client side.
- Sleep briefly after
iframe.onload, then use the impossible condition to find a point in time where no XHR is running in the background. - Test that point with a strictly true condition (searching for the person of interest's name against the name field; since all rows have the same data, all data is returned).
- If a delay is observed on the 6th request, the data XHR is running at that point, and Chris changes the filter to match the
phone_numberfield to exfiltrate data. - If no delay is observed, increase the initial delay and try again.
Root cause
The report viewer defers its data fetch to an AJAX request at document.load, and that request is protected by a token, so it cannot be issued directly cross-domain. What remains observable is timing: the browser's HTTP/1 per-host connection limit of 6 on Chrome lets a cross-origin page detect whether that fetch is in flight by watching when its own static-resource requests stall. The report POST itself needs no CSRF token and accepts a CRM_filter that supports partial matching on arbitrary columns, so the attacker controls how the report is loaded, though the data fetch itself is deferred and token-protected. NTLM/Kerberos authentication puts the credential in a header rather than a cookie, so SameSite offers no protection, and NTLM's incompatibility with HTTP/2 on IIS keeps the connection limit in play. Field-level security redacts values in the response, and the oracle measures how long the deferred query takes when the filter matches.
Impact
An attacker with a normal account in the tenant can share a crafted report with another user and, when that user visits the attacker's page, learn whether a filtered query returns data. By iterating the filter, the attacker can leak field values that field-level security redacts, such as PII, from a user who can view them. The attack requires the victim to stay on the attacker's page for the duration, without navigating away in another tab, and it depends on the target running HTTP/1 and on the static resource timing staying reasonably constant. Jitter can produce false negatives, so results need repeated sanity checks. Microsoft accepted the issue as Information disclosure of Important severity and paid a bounty, with no CVE assigned.
Fix
The vendor announced the issue fixed on 14/01/2022. The report does not describe the change itself.
Variants to test
- Any endpoint that starts a slow, attacker-influenced query from a deferred, token-protected XHR: check whether a cross-origin page can detect the fetch through the 6-connection stall on a static resource. A positive result is the 6th request stalling by roughly the query duration, reproducibly across runs.
- Report or export features that accept a filter supporting partial matching on arbitrary columns: try to make a true filter return a large result set and a false filter return nothing, then measure the difference.
- Deployments using header-based authentication (NTLM, Kerberos, bearer tokens) rather than cookies: SameSite will not apply, so cross-site requests reach the endpoint; confirm the request succeeds without a CSRF token.
- Hosts that cannot negotiate HTTP/2 (for example IIS with NTLM): confirm the per-host limit of 6 is enforced, which is the precondition for the oracle.
- Field-level security or column redaction: check whether a redacted column can still influence response time through filters or joins, which would let the oracle recover the redacted value.
What happened, in plain words
A security researcher found a way to read data that a business system was deliberately hiding from some of its users. The system is Microsoft Dynamics CRM, a product companies use to keep track of customers, patients, sales leads and so on. It has a feature that builds reports, and some fields in those reports can be hidden from certain staff members. The researcher showed that a normal user could trick another user into opening a web page, and from that page slowly work out the hidden values, one guess at a time, by measuring how long the browser takes to load ordinary images.
The trick does not break any password or exploit a bug in the report itself. It abuses two ordinary facts about browsers: a browser will only open a small number of connections to the same website at once, and a page on one website can still make the browser load pictures from another website. By watching when those picture loads get held up, the attacker learns whether the victim's browser is busy fetching a report in the background. A slow report means the victim's browser is busy fetching a report in the background; a fast one means it is not.
This is a beginner's walkthrough of the whole story: the idea, the failed first attempt, the working timing trick, the report feature that made it possible, and how the attack was put together end to end.
Background ideas you need first
Before the details, a handful of everyday concepts. None of them require any security knowledge.
A website and its origin. A web page is served by a server. The browser labels every page with an origin, which is the combination of protocol (http or https), host name and port. Pages from the same origin can freely read each other's data. Pages from different origins are kept apart by a rule called the Same-Origin Policy, usually shortened to SOP. Think of it as two offices in the same building: employees can walk around their own office freely, but the door to the other office is locked. SOP is the lock. Most of the time it protects you: a page you visit cannot read your webmail in another tab.
Cross-origin requests. Even with the door locked, a page is allowed to ask another origin for things like images, scripts and stylesheets. It just cannot read the response. So an attacker's page can cause your browser to fetch a picture from your bank's website; it simply cannot see the picture's contents. This distinction, being able to trigger a request but not read the answer, is the seed of the whole attack.
XHR and AJAX. XHR stands for XMLHttpRequest, a browser feature that lets a page fetch data from a server in the background without reloading. People often call this AJAX. When a page says "fetch this data and tell me when it arrives", that is an XHR. The important part here is that the page can observe when the request finishes, even if it cannot read the response.
Cookies, tokens and headers. When you log in, a server usually gives your browser a small piece of data to send back with every later request, so the server knows who you are. The classic version is a cookie. A newer version is a token placed in an HTTP header, which is a small labelled line of text attached to each request. Headers are how browsers and servers exchange metadata: what type of content is wanted, what language, whether the user is logged in, and so on.
SameSite. Because cookies are sent automatically, a malicious page could otherwise make your browser send your bank cookie to the bank. The SameSite cookie attribute was introduced to stop that: it tells the browser not to attach the cookie to requests that come from another site. It only applies to cookies. If a system authenticates with a header instead, SameSite has nothing to act on.
HTTP/1 and HTTP/2. HTTP is the language browsers and servers speak. The older version, HTTP/1, opens a separate connection for each request and a browser will only open a limited number of connections to one host at a time. The newer HTTP/2 can send many requests over a single connection, so the limit stops mattering. This difference is central to the attack.
NTLM and Kerberos. These are authentication methods common in corporate Windows networks. Instead of a cookie, the browser proves who you are by adding an authentication header to each request. Because the credential travels in a header, SameSite does not apply, and because NTLM does not work over HTTP/2 on Microsoft's web server IIS, the target keeps using HTTP/1 and its connection limit.
Active Directory. Microsoft's directory service for companies: it stores user accounts and groups and is what NTLM and Kerberos authenticate against. Dynamics CRM on-premise is typically deployed inside one.
CSRF. Cross-Site Request Forgery is an attack where a malicious page makes your browser send a request to another site using your logged-in session. The usual defence is a CSRF token: a random value the page must include, which the attacker's page cannot know. A request that changes something and has no CSRF token is a red flag.
XS-Leaks. Cross-site leaks. A family of techniques that do not read data directly but infer it from side effects: timing, error messages, cache behaviour, and so on. The attack in this story is one of them.
Oracle. In security, an oracle is anything that answers a yes/no question for the attacker. A timing oracle answers "is this request running right now?" by how long something else takes.
Idempotent. An action that gives the same result no matter how many times you repeat it. Loading a report is idempotent: opening it twice does not change it.
PII. Personally Identifiable Information: names, phone numbers, addresses, anything that identifies a real person.
GUID. A long random-looking identifier, used as a unique key for a record.
RBAC and field-level security. Role-Based Access Control means permissions are granted by role. Field-level security is finer: it hides individual columns of a table from certain users while letting them see the rest of the row.
SSRS and RDL. SQL Server Reporting Service is Microsoft's report engine. A report definition is a file, usually with the extension .rdl, describing what data to fetch and how to lay it out.
FetchXML. Microsoft's XML-based query language for Dynamics data. It is the safe alternative to writing raw SQL.
XSLT. A language for transforming one XML document into another. Dynamics uses it to turn the wizard's input into a report definition.
IDOR. Insecure Direct Object Reference: changing an identifier in a request to reach someone else's data. The report wizard was checked for this and did not have it.
Jitter. Small random variation in timing. In networking it is the noise that makes measurements unreliable.
Timing-Allow-Origin. An HTTP response header that lets a page from another origin see detailed timing information about a request. Without it, the attacker cannot see exactly where time was spent.
Waterfall. The chart in a browser's developer tools that shows each request as a bar, so you can see when it started, how long it waited and how long it took.
Cache busting. Adding a changing value to a URL so the browser cannot reuse a previously downloaded copy. Without it, the second request never reaches the network and the measurement is meaningless.
Tenant. One organisation's isolated instance of a cloud or hosted service.
CVE. A public catalogue number for a known vulnerability. Not every reported bug gets one.
The starting point: a global connection pool
The researcher began by reading the XSLeaks Wiki, a catalogue of cross-site leak techniques, and building a small practice lab: a PHP page that calls sleep to pretend to be a slow database, plus some JavaScript. One section, called Connection Pool, caught his attention because it linked to a Chromium bug report marked won't fix and containing a proof of concept.
The idea in that bug is that browsers keep one shared pool of connections for everything. The steps were:
- A user opens a page on a domain the attacker controls.
- The attacker's page sends an AJAX request to the victim domain, with some control over how the data is loaded.
- Suppose the shared pool holds 256 connections. While the request to the victim is running, the attacker's page fetches resources from 256 other domains the attacker controls.
- The attacker watches when the 256th connection happens. If the victim's request is slow, the 256th connection is delayed; if it is fast, it is not. That timing reveals whether the victim's request took a long or short time.
This is attractive because other techniques have been fixed, or need special page markup or response headers, or only work when the data comes back directly in the response rather than in a later background fetch. The researcher fixed up the proof of concept and ran it against his lab, but got no meaningful results. Reading the wiki more closely, he found that Mozilla had confirmed mitigations in Firefox. Even if it had worked, he would not have submitted it: the exploit only works if the victim does nothing at all, does not navigate in another tab, and sits watching it run for the whole duration. That is not a realistic scenario.
Looking further into connection pools did turn up something useful. In the HTTP/1 era there was a technique called Domain Sharding: because browsers limit how many connections they open to one host, sites spread their resources across several host names to get more connections in parallel. HTTP/2 made that obsolete, since it multiplexes many requests over one connection. But the limit itself still exists on HTTP/1: on Chrome it is 6 connections per host. And that limit can be used to leak request timing across domains.
The working idea: the HTTP/1 connection limit
The attacker's goal is to find out whether an XHR to victim.domain/resource has finished, given that he knows roughly when it started. In this case the start can be observed at iframe.load, the moment a frame finishes loading, which a page can detect even when the frame belongs to another origin.
Suppose the target request takes about 1.5 seconds. The attacker tricks the victim into visiting a page he controls. That page asynchronously requests a static resource, something that never changes, such as victim.domain/static.png, in blocks of 6 at a time. Cache busting values must be added to the URLs so the browser does not serve them from its cache, which would ruin the measurement. An iframe, or any element that loads resources asynchronously such as script, works, so the victim site's frame options are not an obstacle.
Because the static resource is always the same size, six parallel requests for it should take about the same time, as long as nothing else is running. When victim.domain/resource is also running, the waterfall in Chrome's developer tools looks like this, assuming each static resource request takes about 1 second:
What the waterfall shows:
- The first 5 requests for
victim.domain/static.pnggo through normally and take about 1 second, as expected. - The 6th request is stalled for about 1 second. The browser has to wait for one of the first 5 to finish before it can start the 6th, because the request to
victim.domain/resourceis still occupying a connection for another 0.5 seconds. - Since the first 5 all finish after about 1 second, requests 6 to 10 for
victim.domain/static.pngall take about 2 seconds. - At the 1.5 second mark the target request finishes, which unblocks the 11th request. That request completes 2.5 seconds after the initial
iframe.loadevent.
So, provided the target host runs HTTP/1 and the static resource timing stays roughly constant during the attack, an attacker can tell at any single moment whether cross-domain requests are running.
When the real world interferes: jitter
In a real environment, timing varies. The researcher's exploit ran into exactly this:
Chrome's developer tools showed the 6th request in the block stalling, which is the sign that an XHR is running cross-domain. But then the fetch sped up dramatically on that particular request, so its total time ended up about the same as the previous five. Without the Timing-Allow-Origin header, there is no way to see how much of a cross-domain request's time was spent stalled, so the attacker draws the wrong conclusion: no XHR is running.
Two things guard against this:
- Lower the sensitivity. The 6th request taking 133% longer than the average of the last 5 turned out to be a good enough signal, both on a local network and over the internet (a VPN connection from Vietnam to India and back), to conclude that an XHR is running in the background.
- Run several sanity checks. Multiple test runs must give the same result before any conclusion is drawn.
Finding the report request
The timing idea was revised around December 2020, while the researcher was going through the report generation features of Dynamics CRM on-premise. He came across a POST request that did not include a CSRF token but still returned 200.
What this request does, in plain terms:
- It opens a report identified by the
idparameter. - It returns 400 if the user does not have permission to view that report.
- It carries a
CRM_filterparameter, which means an attacker can force any user to load a report in a particular way, as long as the attacker knows the report'sidand the user is allowed to view it. - The attacker can share his own report with other people in the same tenant, so getting a valid
idis not a problem. CRM_filtersupports a partial match construct, the equivalent ofLIKEin SQL, on arbitrary columns in the dataset.
Why the missing CSRF token matters: normally a request should require a token that only the real page knows, so a malicious page cannot forge it. Here there is no such token, so a page on another site can send this request on the victim's behalf, though it only loads the viewer.
Why SameSite did not help: Dynamics CRM on-premise is normally deployed inside an Active Directory environment, so it authenticates with NTLM or Kerberos. That puts the credential in an Authenticate: NTLM header rather than a cookie, and SameSite only governs cookies. On top of that, NTLM authentication is incompatible with HTTP/2, at least on IIS, so the target stays on HTTP/1 and the 6-connection limit applies.
The action is idempotent: loading the report again does not change its content. The researcher then thought about how to leak the content. The obvious idea, creating a report that queries a table the attacker has no permission to view, did not work: the server refuses. He noted that and moved on, and only came back later when he learned about field-level security.
The security boundary: field-level security
Dynamics CRM supports field-level security, a fine-grained form of role-based access control. The researcher's example:
- Alice is a nurse and Chris is a lab technician at the same clinic.
- Alice deals with patients and needs their personal information to contact them when results are ready.
- Chris does not need that information and can process tests perfectly well. Results can be matched to patients using a GUID primary key.
- The administrator therefore restricts Chris's access to the fields on the
Customertable that hold personal information. When Chris queries the table, he can see that those fields exist, but their values are redacted. - Because Chris has read access to the table, he can create a report.
This is a real security boundary, and breaking it would be a convincing finding: if Chris can leak the hidden values when Alice opens his report, that is a serious problem. But the hurdles were high.
Even though Dynamics CRM uses SSRS underneath, a normal user cannot supply a complete .rdl report definition; only an administrator can. Normal users go through the Report Wizard, which accepts only a custom, sandboxed format. The wizard also checks every permission the user holds, so there is no IDOR trick to play. The following request to SuccessFailurePage.aspx triggers those validations before generating a report definition using XSLT:
Here is the wizardPagePostData parameter in more detail:
What the highlighted parts mean:
- The part outlined in green contains the report's metadata.
- The part outlined in red contains a FetchXML query. This is the defence against injection: report definitions can contain raw SQL, so the wizard uses a FetchXML query instead.
- Because SSRS reports can also contain JavaScript, Dynamics CRM only lets the user modify a few CSS parameters, none of which are useful. Those are in the part outlined in blue.
Then came the detail that made things worse. The CSRF request loads the report viewer with the specified filter, but it does not fetch any information itself. The data is deferred: it is fetched later, at document.load, by an AJAX request to the server, and that request is protected by a token. So the attacker cannot simply read the response. Chris needs an oracle that measures the timing of an XHR he cannot start directly from another domain. That is exactly why the connection-limit oracle described earlier was developed.
Making the difference big enough to see
With an oracle in hand, the attacker only needs to make the gap between a true query and a false query large. For example, to pin down the phone number of a single patient whose value is redacted, the report performs an outer join of the patient's dataset with itself before applying a filter based on the name of the person of interest:
Why this works: the join multiplies the rows, so a query that matches returns a huge amount of data, while a query that does not match returns nothing. The attacker controls the rendering at runtime through the CRM_filter parameter, so he does not need to create a new report for every guess:
In this instance, paginating and rendering a 313-page report takes around 4 seconds, compared with an empty report, on the local network where Active Directory is used most.
The full attack, step by step
- Chris creates the special report with the wizard, shares it with Alice, and sets up another domain with the exploit code.
- Alice visits that domain. It loads an empty report once using an impossible condition, for example searching for a random string against the name field. This forces all the static resources to be cached on Alice's machine.
- The page sleeps briefly after
iframe.onload, then uses the impossible condition to find a moment when no XHR is running in the background. - It tests that moment with a strictly true condition, for example searching for the person of interest's name against the name field. Since all rows contain the same data, all the data is returned.
- If a delay is observed on the 6th request, the data XHR is running at that moment, and Chris changes the filter to match the
phone_numberfield to exfiltrate data. - If no delay is observed, he increases the initial delay and tries again.
Why it worked
The report viewer defers its data fetch to an AJAX request at document.load, and that request is protected by a token, so it cannot be issued directly from another site. What remains observable is timing: Chrome's HTTP/1 limit of 6 connections per host lets a page on another origin detect whether that fetch is in flight, by watching when its own static resource requests stall. The report POST itself needs no CSRF token and accepts a CRM_filter that supports partial matching on arbitrary columns, so the attacker controls what the deferred query does. NTLM and Kerberos put the credential in a header rather than a cookie, so SameSite offers no protection, and NTLM's incompatibility with HTTP/2 on IIS keeps the connection limit in play. Field-level security redacts the values in the response, but it does not stop the query from being slow when it matches, and that slowness is what the oracle measures.
What an attacker could do with it
An attacker with an ordinary account in the tenant can share a crafted report with another user. When that user visits the attacker's page, the attacker learns whether a filtered query returns data. By iterating the filter, the attacker can recover field values that field-level security is supposed to hide, such as personal information, from a user who is allowed to see them. The attack depends on the target running HTTP/1 and on the static resource timing staying reasonably constant. Jitter can produce false negatives, so results need repeated sanity checks. Microsoft accepted the issue as Information disclosure of Important severity and paid a bounty, with no CVE assigned.
The vendor's response
Microsoft accepted the issue as Information disclosure of Important severity and paid out a bounty. No CVE was designated. The researcher noted that a good old reflected XSS could have done far more with far less effort, and found the judgment extremely generous on Microsoft's part. It took a year, but he got paid.
Timeline:
- 13/01/2021: reported the vulnerability to the vendor
- 13/10/2021: the vendor accepted the report
- 14/01/2022: the vendor announced the issue had been fixed
The report does not describe what the fix changed.
Other places to look for the same pattern
- Any endpoint that starts a slow, attacker-influenced query from a deferred, token-protected XHR: check whether a page on another origin can detect the fetch through the 6-connection stall on a static resource. A positive result is the 6th request stalling by roughly the query duration, reproducibly across runs.
- Report or export features that accept a filter supporting partial matching on arbitrary columns: try to make a true filter return a large result set and a false filter return nothing, then measure the difference.
- Deployments using header-based authentication (NTLM, Kerberos, bearer tokens) rather than cookies: SameSite will not apply, so cross-site requests reach the endpoint; confirm the request succeeds without a CSRF token.
- Hosts that cannot negotiate HTTP/2, for example IIS with NTLM: confirm the per-host limit of 6 is enforced, which is the precondition for the oracle.
- Field-level security or column redaction: check whether a redacted column can still influence response time through filters or joins, which would let the oracle recover the redacted value.
Glossary
- Active Directory: Microsoft's directory service that stores company user accounts and groups, and is what NTLM and Kerberos authenticate against.
- AJAX: fetching data from a server in the background without reloading the page.
- Cache busting: adding a changing value to a URL so the browser cannot reuse a cached copy.
- Cookie: a small piece of data a site stores in your browser and that your browser sends back automatically with later requests.
- Cross-origin request: a request a page makes to a different origin (protocol, host and port) than its own.
- CSRF: Cross-Site Request Forgery, an attack where a malicious page makes your browser send a request to another site using your logged-in session.
- CSRF token: a random value a page must include in a request, which an attacker's page cannot know, used to block CSRF.
- CVE: a public catalogue number assigned to a known vulnerability.
- Domain Sharding: an old HTTP/1 technique of spreading resources across several host names to get around the browser's per-host connection limit.
- Field-level security: a permission setting that hides individual columns of a table from certain users while letting them see the rest of the row.
- Header: a small labelled line of text attached to an HTTP request or response, carrying metadata such as authentication or content type.
- HTTP/1 and HTTP/2: versions of the language browsers and servers speak; HTTP/1 opens a separate connection per request and is limited per host, HTTP/2 multiplexes many requests over one connection.
- Idempotent: an action that gives the same result however many times it is repeated.
- iframe: a frame inside a page that loads another page or resource.
- IIS: Microsoft's web server software.
- Jitter: small random variation in timing that makes measurements unreliable.
- Kerberos: a network authentication method common in corporate Windows environments.
- NTLM: an older Microsoft authentication method that proves identity with a header on each request.
- Oracle: in security, anything that answers a yes/no question for an attacker, such as a timing difference.
- Origin: the combination of protocol, host name and port that identifies where a page came from.
- Outer join: a database operation that combines two tables and keeps rows even when there is no match, which can multiply the number of rows returned.
- PII: Personally Identifiable Information, such as names, phone numbers and addresses.
- RBAC: Role-Based Access Control, granting permissions by role.
- RDL: the file format for an SSRS report definition.
- Same-Origin Policy (SOP): the browser rule that stops pages from different origins reading each other's data.
- SameSite: a cookie attribute that stops the browser sending the cookie with requests coming from another site.
- SQL: the standard language for querying databases.
- SSRS: SQL Server Reporting Service, Microsoft's report engine.
- Static resource: a file such as an image that never changes, so its download time is predictable.
- Tenant: one organisation's isolated instance of a hosted service.
- Timing-Allow-Origin: a response header that lets a page from another origin see detailed timing information about a request.
- Token: a piece of data, often random, used to prove identity or authorise a request.
- Waterfall: the chart in browser developer tools showing when each request started, waited and finished.
- XHR: XMLHttpRequest, the browser feature for fetching data in the background.
- XS-Leaks: cross-site leaks, techniques that infer data from side effects such as timing rather than reading it directly.
- XSS: Cross-Site Scripting, an attack that injects script into a page so it runs in a victim's browser.