Skip to content
Account takeover Disclosed report Intermediate

Insecure Zendesk SSO implementation by generating JWT client-side

The Zendesk SSO JWT signing secret was hardcoded in client-side JavaScript, allowing anyone to mint tokens for arbitrary users. An attacker could impersonate any customer in Zendesk and access their support tickets.

xh3n1 Follow

Originally disclosed on HackerOne

High 8.1 View original
  • Triaged in 10 days
  • Fixed in 30 days
  • Disclosed after 2 months

Summary:

app.trint.com implements SSO to Zendesk, it does this by using JWT as described at https://support.zendesk.com/hc/en-us/articles/203663816-Enabling-JWT-JSON-Web-Token-single-sign-on

This functionality has not been implemented securely because the JWT generation happens in the client-side. This is done by the Zendesk secret being hardcoded in the JavaScript code. The secret is used to create JSON Web Tokens and then you can use the generated token to impersonate any customer in Zendesk. (therefore potentially getting access to their support tickets)

Whilst support.trint.com is marked as out of scope for the program, the described vulnerability isn't caused by Zendesk. The vulnerable component is in app.trint.com.

Assessment

The JavaScript source map files are available next to the minified production files. This significantly makes analyzing this issue easier.

Looking at some of the UI views, I stumbled upon static/js/modules/auth/pages/ZendeskLoadingPage.js. I've attached a stripped version which shows the JWT generation:

JavaScript
[snip]
import { ZENDESK_DOMAIN } from 'modules/core/constants/index';

const { REACT_APP_ZENDESK_SECRET } = process.env;

[snip]

function RedirectToZendesk(props) {
  const { user, history } = props;

  function generateZendeskTokenAndRedirect() {
    const TIME_NOW_OBJECT = moment(Date.now());
    try {
      const payload = {
        iat: TIME_NOW_OBJECT.unix(),
        jti: uuid.v4(),
        name: `${user.profile.firstName} ${user.profile.lastName}`,
        email: user.username,
      };

      // encode zendesk token
      const zendeskToken = jwt.sign(payload, REACT_APP_ZENDESK_SECRET);
      window.location = `${ZENDESK_DOMAIN}/access/jwt?jwt=${zendeskToken}`;
    } catch (err) {
      history.push('/error');
    }
  }

  useEffect(
    () => {
      generateZendeskTokenAndRedirect(user);
    },
    [user],
  );

  return <Loader />;
}

[snip]

export default ZendeskLoadingPage;

Searching for REACT_APP_ZENDESK_SECRET in the sourcemap will show the JWT secret:

JavaScript
var REACT_APP_ZENDESK_SECRET = "oq1HJ4jXo99Wt41bwvLh9BXBVdgpi52CjkXbThow7UhWQGtJ";

Generating the JWT on the client-side like this allows anyone to mint an arbitrary JWT. It would probably be better to generate this on the server-side.

Reproduction steps

  • As logged-in user press "Support" on https://app.trint.com
  • Intercept the traffic and see the call to https://trintsupport.zendesk.com/access/jwt?jwt=[JWT_TOKEN]
  • Logout of Zendesk
  • Put the JWT token from above URI into https://jwt.io and decode it.

Example:

eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpYXQiOjE1NjI3MDk2NTksImp0aSI6IjIxZDAyOTg3LWU3YWItNDQ5MC05N2Q3LTc2YTBmMzJhOTVjOCIsIm5hbWUiOiJUZXN0IFRlc3QiLCJlbWFpbCI6ImIzODcxNjk0QHVyaGVuLmNvbSJ9.mnnx7dbpXbvU7xr5Bp5pad2eHVN01mSsXApmZoFj73c
{
  "iat": 1562709659,
  "jti": "21d02987-e7ab-4490-97d7-76a0f32a95c8",
  "name": "Test Test",
  "email": "[email protected]"
}
  • Now we can continue with tampering the JWT
    • Change IAT to the current Unix timestamp
    • Change JTI to a random UUID v4
    • Change email to the victim email address
    • Insert oq1HJ4jXo99Wt41bwvLh9BXBVdgpi52CjkXbThow7UhWQGtJ as HMAC secret.
  • Use the resulting JWT in a call to https://trintsupport.zendesk.com/access/jwt?jwt=[JWT_TOKEN]. You will be logged in as the victim.

Impact

Access to the Zendesk account of Trint customers. This includes potentially the support history of said user.

I haven't verified whether the same SSO flow can also be used against Zendesk administrators. If so, the risk would be higher.

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

Not written yet. The AI write-up for this report has not been written yet. The Original tab links to the source.

How it worked

Root cause

The JWT signing secret was embedded in client-side JavaScript, so token generation could be performed by anyone rather than only by a trusted server.

Impact

An attacker could access the Zendesk account of Trint customers, including potentially their support history; the report did not verify whether Zendesk administrators could also be impersonated.

What the attacker needed

A logged-in user account

The fix

The JWT should be generated on the server side so the signing secret is never exposed to the browser.

How it was found

  1. As a logged-in user, press Support on the main app.
  2. Intercept the traffic and observe the call to the Zendesk JWT endpoint.
  3. Log out of Zendesk.
  4. Decode the captured JWT to see its claims.
  5. Tamper with the token: update the issued-at time, use a new random identifier, change the email to the victim's address, and sign with the exposed secret.
  6. Use the resulting token in a call to the Zendesk JWT endpoint to be logged in as the victim.

Explained by bugbounty.wiki with AI from the original and checked against quotes from it; it can still be wrong. Read the original before relying on a detail.

Not written yet. The AI write-up for this report has not been written yet. The Original tab links to the source.

Single sign-on lets a user log in to one site using another site's account. Here the app created a signed token in the browser to prove who the user was, but the secret used to sign it was visible in the JavaScript. Anyone who read that secret could create a valid token for any email address and be logged in as that person.

What is Account takeover?

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

More from Trint Ltd

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.