Skip to content
Account takeover Disclosed report Intermediate

SAML Response Reuse on hackerone.com/users/saml/auth

HackerOne accepted the same SAML response repeatedly, issuing a new session cookie each time until the assertion expired. An attacker who captured a valid SAML response could replay it to log in as the user who generated it.

samtink Follow

Originally disclosed on HackerOne

  • Triaged in 27 hours
  • Fixed in 23 days
  • Paid in 11 days
  • Disclosed after 53 days

Summary: When logging in with SAML, the user's IDP authenticates the user and generates a SAML response. The IDP then redirects the user's browser back to HackerOne to submit the SAML response. Upon receiving the SAML response, HackerOne validates it, sets a session cookie in the user's browser, and logs the user in. The SAML response can be captured and resubmitted to H1 repeatedly until it expires. Every time H1 receives the captured SAML response it sets a new session cookie and logs the user in.

Description:

Steps To Reproduce

  1. Make sure your email address is set to use your organization's SSO provider. Make sure you can capture and replay traffic using Burp suite or some other proxy.
  2. Go to the H1 login screen and enter your email. Press the login button to be sent to your organization's SAML provider (IDP).
  3. Log into your org's IDP and capture the SAML response from the IDP. The request that needs to be captured is the POST request to hackerone.come/users/saml/auth. In the message body you can find the SAML response. The easiest way to capture and replay is to send it to the repeater tab in Burp.
  4. Resend the POST request with the SAML response to H1 and observe the successful response with a new session identifier. Send 4-5 more times and observe the successful responses and new session id's.

Your Environment (Browser version, Device, etc)

  • Burp Version: ████████
  • Browser: █████████
  • SSO Provider: █████████
  • SAML Response TTL: ██████████.

Remediation:

After a SAML response is used store the assertion ID and it's expiration in a list. When a SAML response has been received and validated, check the assertion ID against the previously mentioned list. If the ID is in the list, throw an error and do not log the user in. Once an ID in the list is past it's expiration then remove it from the list (since it will fail anyway for being expired).

Impact

Likelihood: There is a fairly high barrier of entry to be able to use this flaw. An attacker would have to obtain a valid SAML response. This could be done via MITM, phishing, XSS, etc. None of which are super easy but none are impossible. The likelihood of an attacker being able to obtain a SAML response varies greatly between different organizations and their respective security postures. The likelihood increases the longer the SAML response is valid for. It can be set to as little as a few minutes or up to several weeks. The organization's IDP is responsible for setting how long a SAML response is valid.

Impact: If an attacker would successfully capture and use a SAML response they would log into H1 as the user who generated the SAML response. Depending on which user they log in as they could have full control over an organizations H1 program or they could have only read only permissions. This could allow the attacker to see undisclosed vulnerabilities and full instructions on how to exploit them. The attacker could also pose as a member of the organization and tarnish relations with security researchers. The attacker could lock members of the organization out by removing permissions. So ultimately, the attacker would inherit whatever permissions from the user they stole the SAML response from.

The original report as published on HackerOne, by samtink. Images and videos are our own copies; raw HTML is shown as text. View it on HackerOne.

Written with AI from the full original report and checked against it passage by passage; anything it could not back up was removed or toned down. The original is the record. 5 min read.

Context

HackerOne's login flow supports SAML single sign-on. When a user whose email address is tied to an organisation's SSO provider signs in, HackerOne redirects the browser to that organisation's identity provider (IDP). The IDP authenticates the user and generates a SAML response, then redirects the browser back to HackerOne, which submits the response to the endpoint hackerone.com/users/saml/auth. HackerOne validates the response, sets a session cookie in the browser and logs the user in.

The report is about what happens when that same SAML response is submitted more than once. It was filed against hackerone.com, rated low severity, and disclosed on 24 July 2020. The weakness is classified as improper authentication (generic).

Setup

To reproduce, the researcher needed:

  1. An account whose email address is set to use the organisation's SSO provider.
  2. A proxy capable of capturing and replaying traffic; the report uses Burp Suite and its Repeater tab.
  3. Access to the organisation's IDP so a real SAML response can be generated.

The environment section lists the Burp version, browser, SSO provider and SAML response TTL, but all four values are redacted in the published report, so the specific versions and the TTL used are not disclosed.

Finding it

The observation is simple: the SAML response that the IDP hands back to the browser is a bearer credential, and HackerOne accepted it repeatedly. Each time the captured response was posted to hackerone.com/users/saml/auth, the server validated it, issued a new session cookie and logged the user in, until the response expired. Nothing in the flow tied a given response to a single use.

That is wrong because a SAML response is meant to be a one-time assertion of an authentication event. Once it has been consumed to establish a session, replaying it should not mint another session.

Exploitation

Step 1: Prepare the account and the proxy

Set the account's email address to use the organisation's SSO provider, and make sure traffic can be captured and replayed with Burp Suite or another proxy.

Step 2: Start the login

Go to the HackerOne login screen, enter the email address and press the login button. The browser is sent to the organisation's SAML provider (IDP).

Step 3: Capture the SAML response

Log into the organisation's IDP and capture the SAML response from it. The request to capture is the POST to hackerone.come/users/saml/auth (spelled that way in the report). The SAML response is in the message body. The easiest way to capture and replay it is to send the request to Burp's Repeater tab.

Step 4: Replay the response

Resend the POST request carrying the SAML response to HackerOne. The response is successful and contains a new session identifier. Send it four or five more times: each response is successful and each carries a new session ID.

That is the whole proof. The same captured assertion, replayed from Repeater, produced a fresh authenticated session each time.

Root cause

HackerOne validated the SAML response but did not track that a particular assertion had already been consumed. A valid, unexpired response therefore remained usable as a login credential for its entire lifetime.

The report's remediation section points at the missing control directly: after a SAML response is used, store the assertion ID and its expiration in a list; when a response is received and validated, check the assertion ID against that list; if the ID is present, throw an error and do not log the user in; once an ID is past its expiration, remove it from the list, since it would fail anyway for being expired.

Impact

The report is explicit that the barrier to entry is fairly high: an attacker first has to obtain a valid SAML response. Possible routes it names are MITM, phishing and XSS. None of these is described as easy, but none is described as impossible either. How feasible the attack is depends heavily on the organisation and its security posture, and the likelihood rises with the lifetime of the response. That lifetime is set by the organisation's IDP and can range from a few minutes to several weeks.

If an attacker does capture and replay a response, they log in as the user who generated it and inherit that user's permissions. Depending on who that is, the attacker could have full control over an organisation's HackerOne program or only read-only access. With those permissions they could see undisclosed vulnerabilities and the full instructions on how to exploit them, pose as a member of the organisation and damage relations with security researchers, or lock members of the organisation out by removing permissions.

Fix

The report proposes server-side tracking of consumed assertions, as described under root cause: keep a list of assertion IDs with their expirations, reject any response whose ID is already in the list, and prune entries once they expire. The report does not say what HackerOne actually changed.

Variants to test

  1. Replay against other SAML service providers. Capture a response at the SP's assertion consumer service and resend it several times. A positive result is more than one successful login with a new session each time, from the same assertion.
  2. Replay after logout. Log in with a captured response, log out, then replay the same response. A positive result is a new authenticated session after the logout, which shows the assertion is not invalidated by session termination.
  3. Replay from a different client. Submit the captured response from another browser or IP address. A positive result is a session issued to the second client, showing no binding between the assertion and the original client.
  4. Long-lived assertions. Where the IDP allows configuring the response TTL, set it long and check whether the response remains replayable for the whole window. A positive result is successful replay late in the TTL.
  5. Concurrent replay. Send the same response in parallel. A positive result is multiple successful sessions from simultaneous submissions, which suggests the check (if any) is not atomic.
  6. Assertion ID handling. If the SP exposes any error on replay, check whether it is keyed on the assertion ID or on something weaker such as the whole response body or a timestamp; a positive result is a replay that succeeds after trivial modification of fields the signature does not cover.

Written with AI from the full original report and checked against it passage by passage; anything it could not back up was removed or toned down. The original is the record. 11 min read.

What happened, in plain words

HackerOne is a website where companies run bug bounty programmes: security researchers find flaws in the companies' software and report them, and the companies pay for the useful reports. To get into that website, many people do not type a password on HackerOne at all. Their employer uses a separate login system, and HackerOne trusts that system to say who the person is. That arrangement is called single sign-on, or SSO: one login gets you into many services.

The report is about a flaw in that login handover. When you sign in through your organisation's login system, that system sends a signed message back to HackerOne saying "this person is who they claim to be". HackerOne reads the message, believes it, and gives your browser a session cookie, which is a small piece of data that keeps you logged in as you move around the site. The researcher found that the same signed message could be sent to HackerOne again and again, and each time HackerOne handed out a fresh session cookie and logged the person in. A message that should work once kept working until it expired.

The report was filed against hackerone.com, rated low severity, and disclosed on 24 July 2020. The weakness is classified as improper authentication (generic), which simply means the login process did not check something it should have checked.

Background: the pieces involved

Before the steps make sense, here are the parts of the flow, explained from scratch.

  • SAML is a standard way for two websites to exchange login information. Think of it as a sealed letter: one system writes "this person logged in successfully at this time", signs the letter so it cannot be forged, and hands it to the other system. The second system checks the seal and trusts the contents.
  • Identity provider (IDP) is the system that actually checks your password, usually your employer's login page. It is the one that writes and signs the SAML letter.
  • Service provider (SP) is the website you are trying to reach, here HackerOne. It receives the letter and, if the seal is good, lets you in.
  • SAML response is the letter itself. It is a block of text that travels in the body of an HTTP request. It contains an assertion: a statement that authentication happened, plus an identifier for that statement (the assertion ID) and an expiry time.
  • Session cookie is what the website gives your browser after a successful login so it recognises you on the next page. Without it you would have to log in for every click.
  • Bearer credential is any secret that grants access to whoever holds it, with no further checks. A cinema ticket is a good comparison: whoever holds it gets in, regardless of who bought it.
  • Replay means capturing a valid message and sending it again later. If the receiving system cannot tell a copy from the original, the replay succeeds.
  • Proxy is a tool that sits between your browser and the website and lets you look at, pause and resend the traffic. Burp Suite is one such tool; its Repeater tab lets you send the same request over and over and watch each response.
  • TTL (time to live) is how long something stays valid before it expires.

Context

HackerOne's login flow supports SAML single sign-on. When a user whose email address is tied to an organisation's SSO provider signs in, HackerOne redirects the browser to that organisation's identity provider (IDP). The IDP authenticates the user and generates a SAML response, then redirects the browser back to HackerOne, which submits the response to the endpoint hackerone.com/users/saml/auth. HackerOne validates the response, sets a session cookie in the browser and logs the user in.

The report is about what happens when that same SAML response is submitted more than once. It was filed against hackerone.com, rated low severity, and disclosed on 24 July 2020. The weakness is classified as improper authentication (generic).

Setup

To reproduce, the researcher needed:

  1. An account whose email address is set to use the organisation's SSO provider.
  2. A proxy capable of capturing and replaying traffic; the report uses Burp Suite and its Repeater tab.
  3. Access to the organisation's IDP so a real SAML response can be generated.

The environment section lists the Burp version, browser, SSO provider and SAML response TTL, but all four values are redacted in the published report, so the specific versions and the TTL used are not disclosed.

Finding it

The observation is simple: the SAML response that the IDP hands back to the browser is a bearer credential, and HackerOne accepted it repeatedly. Each time the captured response was posted to hackerone.com/users/saml/auth, the server validated it, issued a new session cookie and logged the user in, until the response expired. Nothing in the flow tied a given response to a single use.

That is wrong because a SAML response is meant to be a one-time assertion of an authentication event. Once it has been consumed to establish a session, replaying it should not mint another session. The comparison is a paper ticket with a stub: the venue tears the stub off on first entry, so the same ticket cannot be used again. Here the stub was never torn off.

Exploitation

Step 1: Prepare the account and the proxy

Set the account's email address to use the organisation's SSO provider, and make sure traffic can be captured and replayed with Burp Suite or another proxy.

This step is preparation. The email address is what tells HackerOne to send you to your organisation's login system instead of asking for a HackerOne password. The proxy is needed because the interesting message passes through your browser only once, in a fraction of a second; without a tool to hold on to it, you cannot send it a second time.

Step 2: Start the login

Go to the HackerOne login screen, enter the email address and press the login button. The browser is sent to the organisation's SAML provider (IDP).

This is the normal start of any SSO login. Nothing unusual happens yet; the point is to reach the moment where the IDP produces the signed letter.

Step 3: Capture the SAML response

Log into the organisation's IDP and capture the SAML response from it. The request to capture is the POST to hackerone.come/users/saml/auth (spelled that way in the report). The SAML response is in the message body. The easiest way to capture and replay it is to send the request to Burp's Repeater tab.

Line by line:

  • POST is the HTTP method used when a browser sends data to a server, as opposed to simply asking for a page. Here the browser is delivering the SAML response.
  • hackerone.come/users/saml/auth is the address the request goes to. It is written exactly as it appears in the report, including the trailing e in hackerone.come; the endpoint that handles SAML logins is the one under /users/saml/auth.
  • The SAML response itself is not in the address line; it sits in the message body, the part of the request that carries data. That is why the researcher says to look in the body.
  • Sending the request to Burp's Repeater tab means parking a copy of it in a window where it can be fired off again at will, which is exactly what the next step needs.

Step 4: Replay the response

Resend the POST request carrying the SAML response to HackerOne. The response is successful and contains a new session identifier. Send it four or five more times: each response is successful and each carries a new session ID.

That is the whole proof. The same captured assertion, replayed from Repeater, produced a fresh authenticated session every time, with no error and no indication that the assertion had already been used. If the server had been tracking use, the second attempt would have been refused; instead every attempt succeeded.

Root cause

HackerOne validated the SAML response but did not track that a particular assertion had already been consumed. A valid, unexpired response therefore remained usable as a login credential for its entire lifetime.

In plain terms: the server checked that the letter was genuine and still in date, but never checked whether it had seen that letter before. A signature proves who wrote a message; it says nothing about how many times the message has been read.

The report's remediation section points at the missing control directly: after a SAML response is used, store the assertion ID and its expiration in a list; when a response is received and validated, check the assertion ID against that list; if the ID is present, throw an error and do not log the user in; once an ID is past its expiration, remove it from the list, since it would fail anyway for being expired.

Impact

The report is explicit that the barrier to entry is fairly high: an attacker first has to obtain a valid SAML response. Possible routes it names are MITM, phishing and XSS. None of these is described as easy, but none is described as impossible either.

  • MITM (man in the middle) means an attacker positioned between the victim and the website, able to read or alter traffic that passes through them.
  • Phishing means tricking a person into handing over information or credentials through a fake page or message.
  • XSS (cross-site scripting) means getting a website to run an attacker's code in a victim's browser, which can then read what the browser holds.

How feasible the attack is depends heavily on the organisation and its security posture, and the likelihood rises with the lifetime of the response. That lifetime is set by the organisation's IDP and can range from a few minutes to several weeks. A letter that stays valid for weeks is far more useful to an attacker than one that dies in minutes.

If an attacker does capture and replay a response, they log in as the user who generated it and inherit that user's permissions. Depending on who that is, the attacker could have full control over an organisation's HackerOne program or only read-only access. With those permissions they could see undisclosed vulnerabilities and the full instructions on how to exploit them, pose as a member of the organisation and damage relations with security researchers, or lock members of the organisation out by removing permissions.

Fix

The report proposes server-side tracking of consumed assertions, as described under root cause: keep a list of assertion IDs with their expirations, reject any response whose ID is already in the list, and prune entries once they expire. The report does not say what HackerOne actually changed.

Variants to test

  1. Replay against other SAML service providers. Capture a response at the SP's assertion consumer service and resend it several times. A positive result is more than one successful login with a new session each time, from the same assertion.
  2. Replay after logout. Log in with a captured response, log out, then replay the same response. A positive result is a new authenticated session after the logout, which shows the assertion is not invalidated by session termination.
  3. Replay from a different client. Submit the captured response from another browser or IP address. A positive result is a session issued to the second client, showing no binding between the assertion and the original client.
  4. Long-lived assertions. Where the IDP allows configuring the response TTL, set it long and check whether the response remains replayable for the whole window. A positive result is successful replay late in the TTL.
  5. Concurrent replay. Send the same response in parallel. A positive result is multiple successful sessions from simultaneous submissions, which suggests the check (if any) is not atomic.
  6. Assertion ID handling. If the SP exposes any error on replay, check whether it is keyed on the assertion ID or on something weaker such as the whole response body or a timestamp; a positive result is a replay that succeeds after trivial modification of fields the signature does not cover.

Glossary

  • Assertion: the statement inside a SAML response that a user authenticated, carrying an identifier and an expiry.
  • Assertion consumer service: the endpoint on the service provider that receives SAML responses.
  • Bearer credential: a secret that grants access to whoever holds it, with no further checks.
  • Burp Suite: a proxy tool for inspecting, pausing and resending web traffic; Repeater is the tab that resends a request on demand.
  • Cookie: a small piece of data a website stores in your browser to recognise you between requests.
  • Cross-site scripting (XSS): getting a website to run an attacker's code in a victim's browser.
  • Endpoint: a specific address on a server that handles a particular kind of request.
  • HTTP: the protocol browsers and servers use to exchange requests and responses.
  • Identity provider (IDP): the system that checks a user's credentials and vouches for them to other sites.
  • Improper authentication: a weakness where a login process fails to verify something it should.
  • Man in the middle (MITM): an attacker positioned between two parties, able to read or alter their traffic.
  • Phishing: tricking a person into giving up information or credentials through a fake page or message.
  • POST: the HTTP method used to send data to a server.
  • Proxy: a tool or server that sits between your browser and a website and can inspect and modify the traffic.
  • Replay: sending a captured valid message again to see whether the receiver accepts it a second time.
  • SAML: a standard for exchanging signed login statements between an identity provider and a service provider.
  • SAML response: the signed message an IDP sends to a service provider to confirm a user's login.
  • Service provider (SP): the website a user is trying to reach, which trusts an IDP's statement.
  • Session: the period during which a website treats you as logged in, usually maintained by a cookie.
  • Single sign-on (SSO): one login that grants access to multiple services.
  • Time to live (TTL): how long something remains valid before it expires.

More from HackerOne

View all

The newest disclosed reports for this program.

Similar reports

View all

Same bug class and techniques, clearest first.

Account takeover

The lesson behind this report.

Getting into someone else's account through a flaw in sign-in, password reset, second factor, single sign-on or session handling.