4

“iViewed your API Keys”: Aussie state media publishes env vars

 2 years ago
source link: https://wale.id.au/posts/iviewed-your-api-keys/
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.
neoserver,ios ssh client

iView, a streaming service for the ABC, Australia’s state media broadcaster, has been plagued with security issues since at least mid-2021, which include the wholesale leak of the production server’s environment variables on the client-side that we are discussing in this article.

Key findings

  • Specific DRM algorithms (e.g. Fairplay, for Apple devices) are utilised on iView with expired DRM keys.
  • Tokens and license keys for services that were used on the iView site (e.g. Algolia, which is used for search and New Relic, for program analytics) were also included in this set.
  • Every past revision of the relevant JSON string is shown on the Wayback Machine, and has been the case since at least October 2021.

The dataset

Accessing critical tokens used in the iView site is rather trivial, using the “View Source” function on all major desktop browsers.

The ‘how’

Since the iView application uses the React framework, it leverages a feature called “states”, which are sets of data that mutate and change inside React. The iView site specifically uses the “initial state”, which stores default data, as well as data stored globally on the site, to store the configuration for the application.

The ‘what’

The dataset originally contained the environment variables of the application, which included the following:

  • the IP and PATH variables of the AWS server that iView runs on,
  • the app ID and token for Algolia, which powers iView’s search function,
  • Widevine DRM validation, secrets and license generation endpoints,
  • iView DRM authentication IDs,
  • FairPlay DRM certificate URL,
  • Seesaw (ABC’s internal API) API URL,
  • ABC recommendations API URL and token,
  • License keys for New Relic, an application logging and tracing service.
  • Gigya (third party login provider) tokens for client-side JavaScript libraries.

An example of this JSON is provided below:

iView appConfiguration JSON

A deeper dive

Let’s look at the other practices that iView might have taken based on the dataset provided, starting with the FairPlay certificate.

The alleged FairPlay certificate is stored at a public-facing URL, so it was trivial to grab it and review the certificate. Once downloaded, I saw that the certificate, seemingly generated by Apple’s certificate authority, expired two years ago, on September 2019.

iView FairPlay DRM certificate

Continuing on the subject of DRM, Widevine DRM secrets, as well as endpoints were also implicated in the dataset, although since ABC uses L3 encryption, not much can be done with it, except retrieving DRM signatures for shows and streams, which are XML-formatted, but base64 encoded. A proof of concept is located here.

The result

I had reported this to an ABC engineer back in December, after they reached out to me through an open call thanks to someone important. They have since been progressively removing most of the sensitive configuration keys and values, but there are still some available, which are seemingly used for client-side functions. A lot of the original environment variables have been removed, though the only ones that remain are all prefixed with IVIEW_ in the key.

Can this be mitigated in the future?

Yes, through offloading a lot of services that currently are on the client side, as well as avoiding putting environment variables on client-facing scripts.


About Joyk


Aggregate valuable and interesting links.
Joyk means Joy of geeK