benclmnt / papers

Summary of my readings
1 stars 0 forks source link

Scaling Backend Authentication At Facebook (Lewi, RWC 2018) #14

Open benclmnt opened 11 months ago

benclmnt commented 11 months ago

Paper, Presentation (YouTube)

Note to self: focus of this paper is on scaling. There might be other approaches to the same problem.

Problem

image

Motivation: TLS is good enough for point-to-point authentication.

But how do we handle request-level authentication between trusted services that communicate through less-trusted intermediary hosts, or "proxies".

Solution

image

If we do TLS-based authentication as is, authZ will fail. We can circumvent this by letting "proxy" act as "client". However, this approach suffers from a larger surface of attack, as we need to trust and secure both proxy and client equally. So, this is not scalable.

image

This leads us to token-based authentication. Basically, we pass an unforgeable token from client to server.

Assumption: Proxy is assumed not to have malicious code that actively change user request.

Public-Key variant

As each host is already associated with a certificate, which contains client's public key and other info, we can create a token based on this certificate.

The idea is token = host_cert || req_metadata || sig where sig is Sign(secret key, host_cert || req_metadata). request metadata includes information about proxies used, resources requested, actions to-be-done and timestamp.

(Yes, we don't sign over the request data. Here's where the assumption plays into part. But at least the sig part of the token is unforgeable without the client's secret key)

The verifier will first validate the host_cert presented using the master public key. Then it will extract the client public key info from host_cert and recalculate sig to see if it matches.

Some notes:

Upsides:

Downsides:

Symmetric Key variant, i.e. Crypto Auth Token (CATs)

Using asymmetric key works. However, it's 4 orders of magnitude slower than symmetric key. And for facebook's scale, that's not gonna make it. So can we use symmetric key?

image

It makes use of a pseudo-random function (PRF).

There are 3 keys:

  1. master_key msk: secret random string that can only be accessed by key distribution server.
  2. service_key: issued to the service. This is PRF(k=master_key, m=server_info)
  3. session_key: issued for each (client, service) pair. This is PRF(k=service_key, m=client_info)

CAT is (client_info, mac(k=session_key, m=data)). Given this CAT, server can verify, by locally generating session_key from its own service_key and client_info, and then calculating and comparing mac.

Implication:

Some notes: