Lousy Phish— Relay Attacks on Visual Code Authentication Schemes
Total Page:16
File Type:pdf, Size:1020Kb
I bought a new security token and all I got was this lousy phish| Relay attacks on visual code authentication schemes Graeme Jenkinson, Max Spencer, Chris Warrington, Frank Stajano fgraeme.jenkinson, max.spencer, chris.warrington, [email protected] University of Cambridge Computer Laboratory, Cambridge, UK Abstract. One recent thread of academic and commercial research into web authentication has focused on schemes where users scan a visual code with their smartphone, which is a convenient alternative to password- based login. We find that many schemes in the literature (including, previously, our own) are, unfortunately, vulnerable to relay attacks. We explain the inherent reasons for this vulnerability and offer an architec- tural fix, evaluating its trade-offs and discussing why it has never been proposed by other authors. 1 Introduction We consider a relatively new class of web authentication schemes, currently at- tracting significant academic and commercial interest, which we refer to as visual code authentication schemes. A user may log into a website which supports such an authentication scheme by scanning a visual code, such as a Quick Response (QR) code [1], using their hand-held authenticator device, henceforth scanner. The scanner is generally a smartphone, but might be a dedicated hardware gad- get. The user carries their scanner at all times, or at least whenever they might want to authenticate to a website; the scanner may have a mechanism to prevent its misuse if lost or stolen. Our own Pico system [2] is of course in this class too. Such schemes are interesting because they have some important usability benefits which passwords do not; specifically, there is nothing for users to remem- ber or type1. Furthermore these schemes are resilient to conventional phishing2 because the long-term secrets never leave the scanner and so an attacker can- not trick the victim into revealing them. However, visual code authentication schemes present a new risk. Because the information in a visual code is not human-readable, and visual codes are easily relayed, a user may be tricked into scanning a visual code displayed outside its intended context. 1 Cfr. definitions of Memoryless, Scalable-for-Users and Nothing-to-Type in the Us- ability, Deployability and Security (UDS) framework of Bonneau et al. [3]. 2 As defined in the UDS framework [3] Authors' preprint. In B. Christianson et al. (eds), Proceedings of Security Protocols Workshop 2014, Springer LNCS. We have surveyed a range of schemes currently in the literature, some com- mercial [4,5] and some academic [2,6,7]. We find there are significant structural similarities between the schemes and that they all are3 susceptible to attacks in which the victim inadvertently authenticates a session for the attacker. This paper makes the following contributions: { We show that the architecture of many visual authentication schemes cur- rently in the literature leaves them inherently vulnerable to attacks that relay the visual code, allowing an attacker to gain control of sessions authenticated by other users. { We present our proposed solution, session delegation, now adopted by Pico, which uses an additional communication channel to prevent the aforemen- tioned relay attacks, and discuss why no other scheme has adopted anything similar. { We discuss extensions to our session delegation protocol and some alternative means of mitigating these attacks, while considering their impact on the usability, deployability and security of the system. 2 Visual code authentication schemes All of the schemes surveyed offer a similar user experience and share some crucial architectural features. In this section we describe these commonalities and then review the individual schemes in more detail. 2.1 User experience when authenticating When a user visits a website in their web browser, the login page includes a visual code, possibly alongside a traditional username and password login form. In order to login, the user scans the code with their scanner, which authenticates to the website identified by the visual code. After the scanner has authenticated on the user's behalf, the web browser receives a session cookie which grants access to the user's account through their browser. The scanner is responsible for the generation and retention of all keys and secrets. As a result, using the scanner with arbitrarily many accounts and services does not require additional cognitive (and in particular memory) effort on the part of the user. 2.2 Protocol Crucially, these authentication schemes must also be able to authorise a web browser running on a different host than the scanner. We call this process browser authorisation. Without this ability users would be restricted to logging into, and using, websites only on their scanner. But it is this crucial feature, and the 3 Or were, in the case of Pico. common approach taken by the surveyed schemes to provide it, that leads to the security vulnerabilities we describe in section3 below. The schemes surveyed use differing protocols for the actual authentication between the scanner and the website. However, we found extensive similarities between the mechanisms used to perform the browser authorisation and, be- low, we show a generalised version of the overall protocol, to which the concrete implementations can all broadly be mapped4. Fig.1 shows the sequence of mes- sages sent between the user's web browser, B, their scanner, S, and the website, W . Website website identifier, 1 browser nonce 4 browser nonce browser nonce 3 5 session cookie auth protocol via visual code Web Browser 2 Scanner website identifier, browser nonce Fig. 1. Generalisation of the flawed browser authorisation protocol used by the re- viewed visual code authentication schemes. The figure shows how a session cookie, cU , for user U is installed into their browser B. 1. The user navigates to the login page of a website W in their web browser B. The login page returned by the website includes a visual code containing the website's address (or identifier) W and a fresh browser nonce, nB. Note that the request and response are performed over HTTPS and therefore encrypted under a TLS session key, KBW . W ! B : fW; nBgKBW 4 At least as far as we can infer|some schemes have not openly published a complete specification. 2. The website address W and browser nonce nB are transfered to the scanner, S, when the user scans the visual code on the website's login page. B ! S : W; nB (visual channel) 3. The scanner authenticates to the website using a scheme-specific authenti- cation protocol. The website looks up the user account, U, associated with the identity authenticated by the scanner. Subsequently, or as part of the authentication protocol itself, the scanner securely sends the browser nonce to the website. S ! W : fnBgKSW The website is then able to associate the nonce nB with the account U. 4. The browser makes another request to the website, again over HTTPS, which includes the browser nonce nB, with the intention of \trading in" this nonce for a session cookie. B ! W : fnBgKBW 5. After looking up the user account U associated with nB, the website W returns a session cookie cU . This cookie grants access to user U's account, as if the user had authenticated using a typical username-and-password-based scheme. W ! B : fcU gKBW If the browser had sent its second request (4) before the scanner had validated the nonce in (3) with the authentication protocol, the website would not have granted a session cookie in this step. 2.3 Schemes in the class Method and System for Authenticating a User by Means of a Mobile Device (2009) This patent [4], held by GMV Soluciones Globales Internet S.A., describes a visual code authentication scheme in which users authenticate to remote services with a trusted application running on a mobile phone. In this scheme the user selects the service to authenticate to by acquiring a visual code displayed by an untrusted device. The visual code contains both a random challenge and an identifier of the service to authenticate to. On scanning the visual code the mobile device creates a response to the challenge by signing it with a private key. The scheme uses Identity Based Encryption (IBE) allowing the response to be verified using the user's public identity such as an email address. In common with the other schemes described here, the scheme links the login session on the untrusted device with the scanner's response using the random challenge contained in the visual code. Thus, this random challenge is directly equivalent to the browser nonce shown in Fig.1. Snap2Pass Snap2Pass [8] is a visual code authentication system for web appli- cations in which users authenticate using a smartphone application. In this scheme the user selects the service to authenticate to by acquiring a visual code displayed by an untrusted device. The visual code contains both a random challenge and an identifier of the service (the relying party) to authenti- cate to. On scanning the visual code, the mobile device creates a response to the challenge comprising of the HMAC-SHA1 hash of the entire challenge message using a pre-shared secret as a key. The provider verifies this responds and, if successful, the browser session is authenticated with the appropriate account. The challenge nonce (sometimes referred to as a session key) in the visual code is directly equivalent to the browser nonce. Snap2Pass explicitly acknowledges that it does not mitigate active man in the middle attacks such as those discussed in this paper. Pico (2011) Stajano's Pico [2] is a visual code authentication scheme intended for a dedicated hardware device, although it could also be implemented, trading off security for convenience, as an application running on a smartphone5.