Briefing · Article · source · published · Boston Identity
Macaroons, 2014: bearer tokens any holder can narrow but not widen, checkable only by the service that minted them
In this 2014 NDSS paper, four Google researchers and two university co-authors propose macaroons, bearer credentials with a chained HMAC signature. Any holder can add caveats that narrow what the token allows, and nobody can take one away. The authors concede the main cost themselves: only the service that minted a macaroon can verify it. Their prototype added 470 microseconds a request on 2013 hardware.
NDSS Symposium 2014 (Google Research) · Arnar Birgisson, Joe Gibbs Politz, Úlfar Erlingsson, Ankur Taly, Michael Vrable, Mark Lentczner · February 23, 2014 · read
What's happening
Finding4Any macaroon holder can add caveats to narrow it and pass it on without asking the issuer, but cannot remove one, because its signature is a chain of HMACs.
A macaroon is a bearer credential whose signature is a chain of HMACs: each caveat added to it is signed with the signature before it, and only the last signature travels with the token. So any holder can narrow a macaroon (to a range of storage chunks, to reads only, to one client IP) and pass it on without asking the issuer, but cannot remove a caveat. A third-party caveat goes further: it needs a separate discharge macaroon from another service, which the authors require to be bound to the authorizing macaroon before it is sent, so it cannot be replayed elsewhere.
Figure steps
- The storage service mints the macaroon from a random nonce and signs it with its own secret key.
- A holder adds a caveat limiting it to chunks 100 to 500. The new signature is an HMAC over the old one, and the old one is dropped.
- A second caveat limits it to reads. Only the last signature, 0a..9f, is sent with the token.
- The storage service rebuilds the chain from its key and checks it against 0a..9f. No one without that key can check it.
Each caveat is signed with the signature before it, and only the last signature travels, so a holder can narrow a macaroon but cannot strip a caveat back off.
Drawn from the paper's figure 3Source dated February 23, 2014Passage: Section 2
Swipe for the full figure →
Only the service that minted a macaroon can check it, the authors say, because verifying needs the secret root key, and that key can also rewrite the macaroon.
The authors name the design's main limit themselves: only the target service that minted a macaroon can check it, because verifying needs the secret root key, and that key can rewrite the macaroon. Against public-key systems such as SPKI/SDSI, they write that macaroons "have no real advantage other than their efficiency and ease of adoption." They sketch a public-key variant but judge it costly, citing 54 milliseconds to generate an RSA key pair against under 3 microseconds for an HMAC.
Also reported in +1 briefing
flag a problem with BI-FIND-2014-0002
Verifying a macaroon took 69 to 359 microseconds on 2013 hardware, depending on the runtime, and the paper reports no production use.
On 2013 hardware, verifying a macaroon took 69 to 359 microseconds depending on the runtime. In the authors' own image-sharing web app on a local network, checking a macaroon with four caveats added an average of 470 microseconds a request, and discharging third-party login caveats in a browser frame added about 3 milliseconds per image. The app also passed authority down a chain of shrinking lifetimes: one year for the forum service, 15 minutes for the user's browser, 2 seconds for an image-editor frame. The paper reports no production use.
flag a problem with BI-FIND-2014-0003
The authors say cloud authorization in 2014 rested almost wholly on unconditional bearer tokens, and propose re-issuing cookies and OAuth tokens as macaroons.
The paper's starting point is that cloud authorization in 2014 rested "near exclusively" on pure bearer tokens, secrets that grant unconditional authority: session cookies, API keys, OAuth tokens, SAML or OpenID assertions and unlisted URLs. Public-key certificate systems that could do better had seen little use. The authors propose re-issuing cookies and OAuth 2.0 tokens as macaroons, so a client could bind a cookie to its IP address or a short lifetime and OAuth security guidance could become mandatory caveats. None of these proposals is deployed in the paper.
flag a problem with BI-FIND-2014-0004
Section by section
6showing 6 of 6
[1]Why bearer tokens fall short and what macaroons add
Arnar Birgisson et al., Google; Chalmers; Brown
Standards
Why bearer tokens fall short and what macaroons add
Arnar Birgisson et al., Google; Chalmers; Brown
The authors argue that cloud authorization rests almost entirely on pure bearer tokens such as cookies, API keys and OAuth tokens, while public-key credentials like SPKI/SDSI have seen little use. Macaroons keep the simplicity of a bearer token and add caveats: attenuation, confinement to a context the target checks, and caveats a third party must discharge. Against SPKI/SDSI they claim no advantage beyond efficiency and ease of adoption.
technical artifactfrom published text + figures
[2]Chained-HMAC construction, caveats and operations
Arnar Birgisson et al., Google; Chalmers; Brown
Standards
Chained-HMAC construction, caveats and operations
Arnar Birgisson et al., Google; Chalmers; Brown
A macaroon is an identifier, caveat list and a terminal HMAC signature chained over each caveat, so a holder can add caveats but not remove them. Third-party caveats embed an encrypted root key; a discharge macaroon proves holder-of-key and must be bound to the authorizing macaroon to stop replay to other services. Pseudocode gives Create, AddCaveat, PrepareForRequest, Verify.
technical artifactfrom published text + figures
[3]Security and expressiveness, limits of HMAC
Arnar Birgisson et al., Google; Chalmers; Brown
Standards
Security and expressiveness, limits of HMAC
Arnar Birgisson et al., Google; Chalmers; Brown
Security of the chained MAC is sketched from HMAC unforgeability, with outside proofs (López-Alt) cited and the need for authenticated encryption on caveat identifiers noted. Macaroons are claimed at least as expressive as SPKI/SDSI. Main limit: only the minting target can verify, since verification needs the root key.
technical artifactfrom published text
[4]Implementation concerns: key ids, root keys, revocation, local discharge
Arnar Birgisson et al., Google; Chalmers; Brown
Standards
Implementation concerns: key ids, root keys, revocation, local discharge
Arnar Birgisson et al., Google; Chalmers; Brown
Practical guidance from prototypes: encode key identifiers by database index or encryption, derive caveat root keys unpredictably (e.g. HMAC of the signature and a nonce), avoid root-key reuse across targets, discharge caveats locally in browser frames, revoke by short lifetimes, version targets, and consider disjunctive caveats. Negation is advised only at predicate level.
technical artifactfrom published text
[5]Applications: sharing, cookies, OAuth2
Arnar Birgisson et al., Google; Chalmers; Brown
Standards
Applications: sharing, cookies, OAuth2
Arnar Birgisson et al., Google; Chalmers; Brown
The authors propose three uses. Unlisted sharing URLs would carry a third-party caveat naming a group. Cookies issued as macaroons would let a client bind a cookie to its IP address or a short lifetime, so a stolen one is worth less. OAuth 2.0 tokens recast as macaroons would turn security guidelines into mandatory caveats. The paper reports no deployment of any of them.
opinionfrom published text
[6]Measurements and discussion
Arnar Birgisson et al., Google; Chalmers; Brown
Standards
Measurements and discussion
Arnar Birgisson et al., Google; Chalmers; Brown
The authors timed their code on a 2.33 GHz Core2 machine with Python 2.7, Chrome 27 and Node 0.10. A native HMAC-SHA-256 took under 3 microseconds, against 458 microseconds to sign with RSA and 54 milliseconds to make an RSA key pair, and verifying a macaroon took 69 to 359 microseconds. Their image-sharing prototype added 470 microseconds a request on a local network and about 3 milliseconds for third-party discharges. They contrast this with OAuth 2.0's coarse, long-lived tokens.
technical artifactfrom published text + figures