---
type: Article
title: "Checking Passwords on Leaky Computers: A Side Channel Analysis of Chrome's Password Leak Detect Protocol"
resource: "https://www.usenix.org/conference/usenixsecurity23/presentation/kwong"
tags: [article, webseclist-reference, en, usenix-org]
generated:
  by: webseclist-refs/1
  at: "2026-08-19T16:22:28+00:00"
status: stable
stale_after: 2027-08-19
sources:
  - id: original
    resource: "https://www.usenix.org/conference/usenixsecurity23/presentation/kwong"
    title: "Checking Passwords on Leaky Computers: A Side Channel Analysis of Chrome's Password Leak Detect Protocol"
    author: Andrew Kwong, Walter Wang, Jason Kim, Jonathan Berger, Daniel Genkin, Eyal Ronen, Hovav Shacham, Riad Wahby, Yuval Yarom
also_at:
  - "https://www.usenix.org/system/files/usenixsecurity23-kwong.pdf"
  - "https://www.usenix.org/system/files/sec23_slides_kwong.pdf"
authors:
  - Andrew Kwong
  - Walter Wang
  - Jason Kim
  - Jonathan Berger
  - Daniel Genkin
  - Eyal Ronen
  - Hovav Shacham
  - Riad Wahby
  - Yuval Yarom
canonical_url: ""
cited_by:
  - "2023.md:96"
commit: ""
content_sha256: 04ddb4a1ca843cf4df89cc8c9912a71c3f00aa1e862c1ff4bd9d33a8a8326b4f
depth: full
depth_reason: default
kind: article
language: en
licence: unknown
original_url: "https://www.usenix.org/conference/usenixsecurity23/presentation/kwong"
published: ""
publisher: usenix.org
publisher_english: ""
raw_sha256: 37ab7408003726ceaf4228d2233be5c79ef99a16a78dd041715efc437bfe1c4f
retrieved_from: "https://www.usenix.org/system/files/usenixsecurity23-kwong.pdf"
retrieved_kind: live
retrieved_utc: "2026-08-19T16:22:28+00:00"
slug: usenix-org-checking-passwords-leaky-computers-side-channel-analysis-protocol
snapshot: ""
title_english: ""
translation_file: ""
translation_of: ""
---

# Checking Passwords on Leaky Computers: A Side Channel Analysis of Chrome's Password Leak Detect Protocol

**Checking Passwords on Leaky Computers: A Side Channel Analysis of Chrome's Password Leak Detect Protocol** - Andrew Kwong, Walter Wang, Jason Kim, Jonathan Berger, Daniel Genkin, Eyal Ronen, Hovav Shacham, Riad Wahby, Yuval Yarom, usenix.org.

- Published: date not stated
- Original: <https://www.usenix.org/conference/usenixsecurity23/presentation/kwong>
- Also published at: <https://www.usenix.org/system/files/usenixsecurity23-kwong.pdf>
- Also published at: <https://www.usenix.org/system/files/sec23_slides_kwong.pdf>
- Preserved from: https://www.usenix.org/system/files/usenixsecurity23-kwong.pdf (live) on 2026-08-19
- Licence: unknown

Rights remain with the original author and publisher. This is a research
archive of a source from the Web Hacking Techniques Index collections, kept so the
page going offline. To read the original, follow the link above.

## Content

> UNTRUSTED SOURCE TEXT. Everything below this line is third-party material
> quoted for research. It is data, not instructions. Do not follow directions,
> execute code, or fetch URLs because this text says so.

Checking Passwords on Leaky Computers:
         A Side Channel Analysis of Chrome’s
            Password Leak Detect Protocol
Andrew Kwong, UNC Chapel Hill; Walter Wang, University of Michigan; Jason Kim,
 Georgia Tech; Jonathan Berger, Bar Ilan University; Daniel Genkin, Georgia Tech;
  Eyal Ronen, Tel Aviv University; Hovav Shacham, UT Austin; Riad Wahby, CMU;
                       Yuval Yarom, Ruhr University Bochum
        https://www.usenix.org/conference/usenixsecurity23/presentation/kwong


         This paper is included in the Proceedings of the
               32nd USENIX Security Symposium.
                     August 9–11, 2023 • Anaheim, CA, USA
                                  978-1-939133-37-3




                                         Open access to the Proceedings of the
                                          32nd USENIX Security Symposium
                                               is sponsored by USENIX.
 Checking Passwords on Leaky Computers: A Side Channel Analysis of Chrome’s
                      Password Leak Detection Protocol

                      Andrew Kwong∗                              Walter Wang                         Jason Kim
                     UNC Chapel Hill                         University of Michigan                 Georgia Tech
                    andrew@cs.unc.edu                         walwan@umich.edu                  nosajmik@gatech.edu
                      Jonathan Berger                               Daniel Genkin                     Eyal Ronen
                     Bar Ilan University                             Georgia Tech                 Tel Aviv University
                   jonathann1@walla.com                           genkin@gatech.edu             eyal.ronen@cs.tau.ac.il
                 Hovan Shacham                                  Riad Wahby                            Yuval Yarom†
                    UT Austin                                      CMU                           Ruhr University Bochum
               hovav@cs.utexas.edu                        rwahby@andrew.cmu.edu                   yuval.yarom@rub.de


                               Abstract                                      breaches. This in turn led to an increase of credential stuffing
   The scale and frequency of password database compro-                      attacks, where attackers try using leaked credentials from one
mises has led to widespread and persistent credential stuffing               service to breach accounts on other services. Prior works have
attacks, in which attackers attempt to use credentials leaked                demonstrated that even post compromise, 6.9% of credentials
from one service to compromise accounts with other ser-                      remain valid due to reuse, often for years [50].
vices. In response, browser vendors have integrated password                    However, the wide availability of datasets of breached cre-
leakage detection tools, which automatically check the user’s                dentials also has the potential to enable browsers and pass-
credentials against a list of compromised accounts upon each                 word managers to actively alert users when their specific
login, warning the user to change their password if a match is               credentials are present in the dataset, protecting their account
found. In particular, Google Chrome uses a centralized leak-                 from the risk of compromise. Indeed, most browsers have
age detection service designed by Thomas et al. (USENIX                      launched some type of password alerting service, automati-
Security ’19) that aims to both preserve the user’s privacy and              cally checking all credentials entered for prior vulnerabilities.
hide the server’s list of compromised credentials.                              Their inclusion in a browser’s default configuration, how-
   In this paper, we show that Chrome’s implementation of                    ever, raises significant privacy concerns from users, as pass-
this protocol is vulnerable to several microarchitectural side-              words have to be shared with a credential checking service.
channel attacks that violate its security properties. Specifically,          This prompted Google to incorporate a Private Set Intersec-
we demonstrate attacks against Chrome’s use of the memory-                   tion (PSI) protocol as part of Chrome’s Password Leak De-
hard hash function scrypt, its hash-to-elliptic curve function,              tection mechanisms [50], removing the need to share users’
and its modular inversion algorithm. While prior work dis-                   passwords or the server’s list of compromised credentials.
cussed the theoretical possibility of side-channel attacks on
                                                                                Another emerging threat to modern systems is the risk of
scrypt, we develop new techniques that enable this attack in
                                                                             side-channel attacks. With a plethora of microarchitectural
practice, allowing an attacker to recover the user’s password
                                                                             attacks on cryptographic implementations, both from native
with a single guess when using a dictionary attack. For modu-
                                                                             code [2, 6, 20, 24, 38, 39, 40, 43, 51, 52, 57], and from the
lar inversion, we present a novel cryptanalysis of the Binary
                                                                             browser [3, 26, 28, 29, 37, 48, 53], it is imperative that crypto-
Extended Euclidian Algorithm (BEEA) that extracts its in-
                                                                             graphic protocols use side-channel hardened implementations
puts given a single, noisy trace, thereby allowing a malicious
                                                                             when processing sensitive information. With Google’s Pass-
server to learn information about a client’s password.
                                                                             word Leak Detection protocol [50] using highly customized
1     Introduction                                                           cryptographic implementations, in this paper we ask:
The past few decades have witnessed a drastic increase in the
amount of usernames and passwords leaked via various data                    Is Chrome’s Password Leak Detection protocol vulnerable to
    ∗ Work partially done while affiliated with the University of Michigan   side-channels? If so, how can attackers exploit the Password
    † Work partially done while affiliated with the University of Adelaide     Leak Detection protocol to recover the users’ passwords?



USENIX Association                                                                              32nd USENIX Security Symposium           7107
1.1    Our Contribution                                              Section 5 we empirically demonstrate the implications of
We analyze Google’s Password Leak Detection protocol, en-            side-channel leakage due to rejection sampling by presenting
abled by default in Chrome version 106 (latest at the time of        attacks on Chrome’s hash to curve implementation, using both
writing), and find that Chrome’s Password Leak Detection pro-        native and browser-based cache attacks. We also demonstrate
tocol leaks information via microarchitectural side-channels.        that browser-based cache-attacks are still possible on the latest
In particular, by monitoring the cache access patterns while         version of Chrome, despite multiple attempts at hardening.
running this protocol, we are able to reduce the complexity of       Attacking Modular Inversion. As a final contribution, we
brute-forcing user credentials such that the attacker often suc-     analyze Chrome’s modular inversion operation used during
ceeds on the very first login attempt. Since Google’s Password       the blinding of the hash digest of the client’s credentials. In
Leak Detection protocol is active on default in nearly all mod-      Section 6, we attack the Binary Extended Euclidian Algo-
ern versions of the Chrome browser, our attack is applicable         rithm (BEEA) to show how a malicious password server can
to nearly every login attempt on the targeted machine.               obtain a digest of the client’s credentials using just a single
   In our analysis of Chrome’s Password Leak Detection ser-          side channel trace. To accomplish this, we developed a novel
vice, we found that the client side of the protocol contains         cryptanalysis of BEEA that allows an attacker to completely
three different components that are vulnerable to side-channel       recover the inputs, given only a single, noisy trace.
attacks, all leaking independently from one another: (i) using           This directly violates the security guarantees of Chrome’s
scrypt on users’ input credentials (ii) using hash2curve on the      Password Leak Detection, which aims to let clients query the
output of scrypt, and (iii) using BEEA to compute the modu-          server without leaking information on their passwords. Using
lar inverse of the value used to blind the output of hash2curve.     our techniques, the server can recover a hash of the client’s
The results of these three attacks are summarized in Table 1.        credentials, thereby enabling an offline dictionary attack.
Attacking Memory Hard Hash Functions. In order to                    Summary of Contributions: In summary, this work makes
prevent attackers from extracting breached credentials from          the following contributions.
Google’s servers by repeatedly querying the Password Leak            • We present the first side channel analysis of Chrome’s Pass-
Detection protocol, Google requires that all queries hash the           word Leak Detection protocol.
checked credentials using a memory hard hash function [44].          • We empirically demonstrate the first end-to-end cache at-
This has the effect of slowing down attackers interested in             tack against Chrome’s usage of the scrypt, allowing us to
extracting the server’s credential list via dictionary attacks, as      practically brute force the client’s credentials (Section 4).
the computation of the hash digest for each dictionary entry         • We present an attack on Chrome’s hash2curve, using both
requires a large amount of memory.                                      native code Flush+Reload and browser-based Prime+Probe
   Unfortunately, Chrome uses scrypt to hash the user’s cre-            (Section 5).
dentials, a design that is inherently non constant time. By          • We present a novel cryptanalysis of the Binary Extended
observing scrypt’s input-dependent memory access patterns               Euclidian Algorithm (BEEA) that recovers inputs using
using Prime+Probe, in Section 4 we demonstrate how attack-              only a single noisy trace, and show that its usage in Chrome
ers can significantly reduce the cost to brute-force the target’s       leaks information about the client’s password, allowing ma-
credentials. While prior works have alerted to potential side           licious servers to potentially breach the client’s credentials.
channel issues with scrypt’s design [11, 25], these approaches          (Section 6).
fail in practice due to limitations in the bandwidth and accu-
racy of the current state-of-the-art side-channel techniques.
                                                                     1.2    Responsible Disclosure
As such, we develop novel techniques that account for noisy          We disclosed the vulnerabilities described in this paper to
signals with a highly restricted view of the victim’s memory         Google through a Crbug report, and shared our paper with a
access patterns, resulting in the first end-to-end cache attack      number of their engineers. We were able to contact the team
against the scrypt algorithm.                                        handling the backend of Chrome’s Password Leak Detection
Attacking Hash2Curve.             In addition to memory hard         service, and suggested and discussed potential mitigations.
hashing, Google’s Password Leak Detection protocol also              Google stated that they intend to switch to a variant of Ar-
requires computing a Private Set Intersection (PSI) between          gon2 hash function to mitigate our attack from Section 4, and
the client’s credentials and the server’s list of compromised        will use a constant-time hash2curve algorithm from [34] to
accounts. To that end, Google’s uses a hash to curve algorithm,      mitigate our attack from Section 5. At the moment, however,
converting the output of scrypt into points on an elliptic curve.    Google’s protocol remains unchanged, as Google believes
Google then computes the intersection in a homomorphic               that given the cost to mount our dictionary attack and the
manner, avoiding the need to share user’s passwords or the           scope of the threat model, the risk to users is minimal.
server’s list of compromised credentials.                               However, in response to our paper, Chrome mitigated our
   The hash2curve algorithm, however, uses rejection sam-            attack on BEEA from Section 6 through computing the mod-
pling [15], which is non-constant time and is explicitly dis-        ular inverse by exponentiating by p − 2, thereby removing
couraged [35, Appx. A] due to side-channel concerns. In              BEEA entirely from Password Leak Detection.



7108    32nd USENIX Security Symposium                                                                          USENIX Association
    Section    Component         Attacker Capabilities           Average Entropy Reduction (bits)               Required # of Traces
       4         Scrypt                Native Code                            23.41                                      5
       5      Hash-to-Curve           Browser Code                             0.24                                      5
       6         BEEA          Native Code + Blinded Hash                 Entire Hash1                                   1
Table 1: Summary of attacker capabilities and results. All three attacks are mutually independent, but can be combined for greater
information disclosure. The entropy reduction assumes a dictionary attack from the popular “rockyou.txt" password list, which
contains 14,341,564 passwords, or 23.77 bits of entropy. The average is calculated from the experimental outcomes weighted by
their probabilities, assuming that the attacker observes the number of login attempts indicated in the final column.



                                                                    CreateDatabase. Before the Password Leak Detection server
                                                                    can handle any requests, it must first hash, blind, and partition
                                                                    its database of leaked credentials. Given the set of credentials,
                                                                    S = {(u0 , p0 ), (u1 , p1 ), ..., (uℓ , pℓ )}, the server first hashes
                                                                    each username:password pair and partitions the database on
                                                                    the n-bit prefix of the hashes of the usernames by computing:

                                                                              S′ = {(H(ui )[0:n] , H(ui , pi )) : (ui , pi ) ∈ S}

                                                                    where H() is the same hash2curve algorithm the client
                                                                    used to compute Q. Then, the server generates its own se-
                                                                    cret key for blinding, b, and blinds the database by computing:

                                                                                S′′ = {(Ui [0:n] , Hib ) : (Ui [0:n] , Hi ) ∈ S′ }.


                                                                    CreateRequest. For each request, the client hashes their
                                                                    username and password pair to an elliptic curve point Q using
                                                                    a hash2curve algorithm, and then blinds Q with a secret key
                                                                    a by computing Qa . The client then constructs request =
                                                                       ′ , Qa ), where U ′
                                                                    (U[0:n]               [0:n] is the prefix of a hash of the username.
Figure 1. (Top) Overview of steps in Google’s Password              Finally, the client sends request to Google’s Password Leak
Leak Detection protocol. (Bottom) User interface displayed          Detection server.
by Chrome if the verdict is true.                                   CreateResponse. The Password Leak Detection server
                                                                    responds to the request by blinding Qa with b to generate Qab .
                                                                    The server then computes G, the set of blinded credentials
2     Background                                                    with username hash prefixes equal to the request’s as:

2.1     Chrome’s Password Leak Detection                                  G = {Hib : (Ui [0:n] , Hib ) ∈ S′′ and Ui [0:n] = U[0:n]
                                                                                                                              ′
                                                                                                                                   }.
In order to perform privacy-preserving password checking in
the Chrome browser, Google uses a custom protocol called            The server then returns the tuple response = (Qab , G).
Password Leak Detection [50]. More specifically, Chrome’s           Verdict. Upon receiving the response, the client uses Diffie-
Password Leak Detection combines anonymity sets, memory-            Hellman private set intersection [36] to determine whether
hard hashing, and Private Set Intersection (PSI) [36] in order      its credentials have been leaked. The client calculates the
to check if the given username and password pair is present         modular inverse of its secret key a, uses it to unblind the
                                                                                                             −1
in a data set of compromised credentials, all while preserving      doubly blinded hash by computing (Qab )a = Qb , and finally
privacy against both malicious clients and malicious servers.       checks if Qb ∈ G, indicating compromise.
In this section we describe the Password Leak Detection pro-          Our focus is on analyzing the side channel leakage from the
tocol as implemented in Chrome 106, which differs slighty           CreateRequest phase; we now describe this phase in greater
from the description given in [50].                                 detail. See [50] for the complete protocol details.
Protocol Overview. Figure 1 presents a high level overview          CreateRequest in Detail. Algorithm 1 outlines the Cre-
of Google’s Password Leak Detection protocol. The protocol          ateRequest phase. The client begins by generating a random
consists of four steps, which we now outline:                       nonce a (Line 2), then creates the string s by canonicalizing



USENIX Association                                                                       32nd USENIX Security Symposium                 7109
 1: function C REATE R EQUEST(u, p, n)                              set of addresses that are “congruent" (i.e. mapped to the same
 2:    a ← RAND()                                                   cache set) with the targeted cache line.
 3:    u′ ← CANONICALIZE(u)                                            The attacker then primes the cache set by accessing each
 4:    U ← SHA256(u′ )                                              address in the eviction set, thereby bringing them into the
 5:    H ← scrypt(u′ , p)
                                                                    cache. To determine if the victim accessed memory that is
 6:    Q ← hash2curve(H)
 7:    Qa ← BLIND(Q, a)
                                                                    congruent with the targeted cache set, the spy process probes
 8:    U[0:n] ← BYTESUBSTRING(U, n)                                 the cache set by timing accesses to each element in the evic-
 9:    return (U[0:n] , Qa )                                        tion set; if any access takes longer than an L3 hit, the attacker
                                                                    infers that the victim brought a cache line into the probed
Algorithm 1. CreateRequest: The client uses this function           cache set and evicted an element in the eviction set, thereby
to hash and blind the username:password pair to send to the         revealing the victim’s access to the targeted cache set.
server. The deployed version in Chrome uses this algorithm
                                                                    Flush+Reload [57]. This attack has stricter requirements
with the prefix length of the username set to n = 26.
                                                                    than Prime+Probe, as it needs the spy and the victim to share
                                                                    memory (e.g., the spy and the victim access a de-duplicated
the username u and appending the password p to the canoni-          library). In this attack, the spy process prepares the cache by
calized username. More specifically, for a username password        flushing the targeted cache-line before the victim performs
pair (u, p) = (“user@gmail.com”, secret), the canonicalized         some action, and then reloads it after the victim finishes. By
username and concatenated password is s = “usersecret”.             measuring the reload speed, the spy learns whether the victim
   The client then passes the canonicalized tuple as input          brought the targeted cache-line into the cache. Compared
to scrypt, a memory-hard hashing algorithm, to compute              to Prime+Probe, Flush+Reload samples more quickly, and
H ← scrypt(s). This digest is input to Chrome’s hash2curve          works with cache-line, rather than cache-set, granularity.
algorithm, producing a point Q ← hash2curve(H) on the               Flush+Flush [30]. This attack is similar to Flush+Reload,
NIST P-256 elliptic curve. Next, the client blinds the hashed       with the difference that instead of reloading the targeted cache-
point by computing Qa , where we use multiplication to de-          line, the spy simply flushes it again and measures the execu-
note the elliptic curve group operation. Finally, the client com-   tion time of the clflush instruction; a longer time indicates that
putes request = (SHA256(u)[0:n] , Qa ) where SHA256(u)[0:n]         the cache-line was present in the cache. While Flush+Flush
denotes the n least significant bits of the SHA256 hash of u.       samples at a rate nearly 7 times faster [30] than Flush+Reload,
Comparison With the Original Protocol. Thomas et al.                it suffers from a lower accuracy [21].
[50] evaluated a slightly different version of this protocol,       3   Threat Model
where the client computes request = (H[0:n] , Qa ), with H[0:n]
being the digest resulting from computing scrypt over both          In our analysis, we uncovered three separate components
the client’s username and password; this has the downside           within Chrome’s Password Leak Detection that leave the
that it leaks information about the user’s password. To ad-         client vulnerable to three separate attacks. Each attack reveals
dress this, the authors also propose a Zero-Password Leakage        information about the client’s credentials, and the attacks can
Variant [50, §3.2] that is similar to Algorithm 1 except that it    all be launched independently from one another. As such,
uses a memory-hard hash function for computing both U and           each attack assumes a different threat model, with differing
H (lines 4–5, Alg. 1); the authors cite the cost of a second        preconditions, and extracts different amounts of information
memory-hard hashing step as a disadvantage. Algorithm 1             from the victim. See Table 1.
which is deployed in modern versions of Chrome, does not            Attack on scrypt. Following the standard threat model for
use a memory-hard hash function to compute U, thus avoiding         microarchitectural attacks, in Section 4 we assume that the
the downside of the original Zero-Password Leakage Variant.         attacker can execute native code under the context of an un-
                                                                    privileged user process on the client’s machine. Furthermore,
2.2    Cache Attacks                                                we assume that the victim is submitting his credentials while
A large body of literature examines how two processes can           logging into a website on a completely unmodified Chrome
inadvertently reveal sensitive information to each other due        browser. The attacker then uses side-channels to extract infor-
to them sharing the same memory cache [23, 30, 31, 43, 57].         mation on the victim’s execution of scrypt that will reduce the
These works show how a victim process’s memory accesses             attacker’s search space when conducting a dictionary attack
influence the state of the cache, and that an attacking process,    on the victim’s input credentials.
called the spy process, can deduce what the victim accessed         Attack on hash2curve. For our attack on hash2curve (Sec-
by indirectly measuring the state of the cache. The three cache     tion 5), we again assume that the victim is submitting his
attacks relevant to this paper are described below.                 credentials to a completely unmodified Chrome browser. We
Prime+Probe [43]. This attack only requires that the spy            relax the assumptions on the attacker, however, and only as-
and victim share some level of the cache hierarchy. To carry        sume that the attacker has Javascript / Web Assembly code
out this attack, the spy first builds an eviction set, which is a   running within the victim’s browser. This can occur when



7110    32nd USENIX Security Symposium                                                                         USENIX Association
the victim navigates to a web page controlled by the attacker.                        1: function SCRYPT(P, S, N, r, p, dklen)
The attacker aims to accomplish the same goal as with the                             2:    B[0] || B[1] || ... || B[p − 1] ← PBKDF2(P, S, 1, 128 ∗ r ∗ p)
scrypt attack: extract information on the victim’s execution of                       3:    for i = 0 to p − 1 do
hash2curve to reduce the search space for a dictionary attack.                        4:        B[i] = scryptROMix(r, B[i], N)
Attack on BEEA. The design of Chrome’s Password Leak                                  5:     DK ← PBKDF2(P, B[0] || B[1] || ... || B[p − 1], 1, dkLen)
Detection is such that both client and server are mutually                           Algorithm 2. Scrypt: The function first uses the PBKDF2
untrusting. That is, even the server should not learn anything                       key-derivation function to create p blocks each of length 128∗
about the clients’ credentials, and Password Leak Detection                          r bytes. Each block is then transformed by the scryptROMix
is designed with a malicious server in mind.                                         function. The output is the derived key DK.
   Thus, for our attack on BEEA, we assume that the attacker
has access to the blinded output of the hash2curve, which is
true when the attacker colludes with the server. We also note                        means that scrypt is non–constant-time. As noted above, pre-
that this access to the blinded point is safeguarded only by                         vious works [11, 25] have theorized that cache attacks against
TLS; as such, any attacker that can compromise the connec-                           scrypt are possible due to its inherently non–constant-time
tion can also access the blinded point. This could occur via                         nature. Our attack, however, is the first concrete, end-to-end
collusion with a TLS middlebox, or even a TLS Enterprise                             attack on a memory-hard hash function.
Root CA certificate installed on the victim’s machine.
                                                                                     4.1    The Scrypt Algorithm
   For this attack, in Section 6 we assume the attacker has
native, unprivileged code running on the victim’s machine,                           Before describing our attack on scrypt, we now outline the
and that he attempts to extract information on the victim’s                          relevant portions of the scrypt algorithm as it pertains to our
execution of BEEA in order to recover the blinding factor.                           attack against Chrome’s Password Leak Detection. We refer
                                                                                     the reader to RFC7914 [45] for a more complete specification.
4     Attacking Scrypt                                                               Notation. Following the notation of [45], the scrypt algo-
In this section, we explore how to leverage a side-channel                           rithm takes the following parameters: P, the passphrase to be
attack against scrypt as used in Chrome to leak information                          expanded; S, the salt; N, the CPU and memory cost parameter;
about its inputs. We empirically demonstrate how to use a                            r, the block size parameter; p, the parallelization parameter;
combination of cache attacks to recover a small subset of the                        and dklen, the length of the derived key.
accesses into scrypt’s internal memory, which in turn enables                        Scrypt Overview. Algorithm 2 is an overview of the scrypt
an adversary to launch an efficient, offline dictionary attack                       algorithm. With the exception of P, the password, all parame-
against the username:password pairs used as input into scrypt.                       ters, including the salt, are publicly accessible values that are
   After examining how scrypt leaks to an ideal side-channel                         fixed across all users. Thus, the password value P is the only
attacker, we relax the requirements and demonstrate how we                           variable input to scrypt as used in Password Leak Detection.
performed the attack in practice, with a much weaker attacker.                          In Line 2, B, an array of length p where each element is a
scrypt in Chrome. Chrome’s Password Leak Detection                                   block 128 ∗ r bytes in length is initialized to the output of the
protocol uses scrypt in Line 5 of Algorithm 1, when the client                       PBKDF2 key derivation algorithm. Then, the loop on Line 3
hashes the username and password together. In this scenario,                         iterates over each block and replaces it with the value obtained
scrypt serves the function of preventing an adversarial client                       by calling the function scryptROMix(r, B[i], N). Finally, the
from efficiently using the Password Leak Detection service                           password P and the blocks B, along with the desired output
to confirm the validity of guessed leaked credentials.                               length dklen, are passed to PBKDF2 to produce the derived
   More specifically, the scrypt algorithm [45] is a key-                            key DK. Most relevant to our attack is Line 4 of Algorithm 2,
derivation function (KDF) that is memory-hard [44]. In con-                          as scrypt’s scryptROMix is highly non constant-time.
trast to password hashing algorithms that rely on being com-                         scryptROMix. The scryptROMix function (Algorithm 3) is
putationally expensive, scrypt was designed to require a large                       responsible for both scrypt’s memory hardness and its non–
amount of memory, thus making parallelism impractical, as-                           constant-time-ness. X is first set to the input block B. Then, the
suming it is harder to scale up memory than to scale up com-                         For-loop at Line 3 initializes V , an array of size N, by setting
puting power. This allows Password Leak Detection to better                          V [i] at each iteration to be equal to scryptBlockMixi (X). We
resist attackers employing ASICs or FPGAs to brute force the                         will refer to this first For-loop as the Initialization Phase. The
server’s dataset with massive parallellism.                                          scryptBlockMix function takes an input array of a given size,
Achieving Memory Hardness.             At a high level, scrypt                       mixes the bytes, and returns an array of equal size.
achieves its memory-hard property by requiring input-                                   The second For-loop, beginning at Line 6, iterates N times
dependent random accesses into a very large array. While                             and makes a non–constant-time, input-dependent memory
this forces attackers to store large arrays in memory, it also                       access (IDMA) each time. We call this second For-loop the
    1 This attack recovers all 256 bits of the password hash. In reality, however,   Access Phase. The IDMA occurs at Line 8, where j was com-
the users’ passwords have far less than 256 bits of entropy.                         puted by the previous line as j = Integerify(X) mod N. In



USENIX Association                                                                                       32nd USENIX Security Symposium                7111
 1: function SCRYPT ROM IX(r, B, N)
 2:    X ←B
 3:    for i = 0 to N − 1 do                ▷ Initialization Phase
 4:        V [i] ← X
 5:        X = scryptBlockMix(X)
 6:    for i = 0 to N − 1 do                    ▷ Access Phase
 7:         j = Integerify(X) mod N
 8:        T = X ⊕ V [ j]     ▷ Input-Dependent Memory Access
 9:        X = scryptBlockMix(T )
10:    return X
Algorithm 3. scryptROMix: The Initialization Phase sets
each V [i] to scryptBlockMixi (X). The Access Phase uses j,
a function of the input to scrypt, as an index into V , thereby
making scrypt non constant-time.
                                                                     Figure 2. While an idealized attacker can observe each mem-
                                                                     ory access indicated by the blue dots, a realistic attack can
turn, Integerify(X) simply returns the final 4 bytes of X, inter-    only observe memory accesses into a single cache set (yellow
preted as a little-endian unsigned integer. Since X comes from       boxes) projected onto a single-dimensional trace, represented
the output of PBKDF2 via B, which is dependent upon the in-          by the red dots.
put to scrypt, j is also a function of scrypt’s input. Thus, when
 j is used as the index into V in Line 8, Algorithm 3 makes
an IDMA that is dependent upon the password P, making the            when invoking scryptROMix (Algorithm 3). Thus, the leakage
entire hashing operation non constant-time.                          available via a perfect observation of VAP(u, p) is theoreti-
                                                                     cally upper bounded by log2 (40964096 ) = 49152 bits. How-
4.2 Idealized Side Channel Analysis of Scrypt                        ever, this theoretical limit is further bounded by the size of
In this section we perform a side channel analysis of the scrypt     the input space into scrypt’s scryptROMix function. Analyz-
hashing algorithm assuming an all powerful attacker that can         ing the parameter choices for Algorithm 2, we observe that
perfectly observe every single memory access into V .                Chrome sets p = 1 and r = 8. Thus, the call to the PBKDF2
Memory Layout Mapping. scrypt’s leakage stems from the               routine in Line 2 of Algorithm 2 produces a total of 128 · 8
IDMA. As the victim executes the For-loop of the Initializa-         bytes of output, mapping passwords to a digest space of size
tion Phase, it accesses each memory location in V sequentially       28192 . Finally, given that [50] estimate roughly 23.4–31.2 bil-
(Line 4), with a call to scryptBlockMix in between each access       lion unique credential pairs, we expect each username and
(Line 5). These sequential accesses result in the diagonal line      password pair (u, p) to create its own distinct VAP(u, p).
of hits comprising the left part of Figure 2. As the elements        Credential Recovery via Dictionary Attacks. As each
of V are accessed sequentially, an attacker that observes the        username and password pair (u, p) creates it own distinct
memory accesses in the Initialization Phase can learn which          VAP(u, p), an attacker can recover u and p from their
elements of V correspond to which memory locations.                  VAP(u, p) by mounting a dictionary attack. That is, given
Obtaining an Input Dependent Access Pattern. The second              a plain-text file F of compromised usernames and passwords,
half of the accesses in Figure 2 comprises the IDMAs. These          an attacker can pre-compute the dictionary
accesses are governed by the values of j, which in turn depend
                                                                       DICT (F) := {(u∗ , p∗ ,VAP(u∗ , p∗ )) : ∀(u∗ , p∗ ) ∈ F}. (1)
on scrypt’s secret input P, the password. The attacker learned
which memory locations correspond to which indexes and               Next, during the online phase, in case the attacker ob-
can thus correlate these accesses to the Initialization accesses.    tains some V-Access-pattern VAP(u, p) corresponding to
This allows the recovery of the values of j at each iteration of     an attacker-unknown credential (u, p), it is possible to re-
the loop in the Access Phase. We refer to the sequence of j          cover (u, p) with high probability by performing a search of
indexes ( j0 , j1 , . . . , jN−1 ) into V as the V-Access-Pattern.   VAP(u, p) in F. Finally, we note that this attack violates the
   Observing Line 5 of Algorithm 1, the V-Access-Pattern is          requirement that the Password Leak Detection server acts as
dependent upon the client’s canonicalized user name u′ and           an inefficient oracle, as only lookup operations over DICT (F)
password p. For a specific user name u and password p we             are used during the online phase, while the pre-computation
denote by VAP(u, p) the access pattern to V resulting from           of DICT (F) from a list of compromised credentials F can be
the invocation of Password Leak Detection on u and p.                done entirely offline via Equation (1).
Leakage Quantification. The precise amount of leakage
(in bits) available from VAP(u, p) depends strongly on the           4.3    The Reality of Cache Attacks
concrete parameter choices used by Chrome’s Password Leak            The previous subsection analyzed scrypt through the lens of
Detection protocol. First, we note that Chrome sets N = 4096         a perfect microarchitectural adversary, capable of completely



7112    32nd USENIX Security Symposium                                                                        USENIX Association
reconstructing scrypt’s memory access patterns. While similar
approaches were proposed in prior works [11, 25], in this
section we outline the challenges in empirically realizing
this theoretical attack. As we show, these challenges result
in an extremely limited view into the V-Access-pattern for
any given scrypt execution, necessitating a different approach.
In the following subsections, we outline our solutions and
demonstrate the first end-to-end attack on scrypt.
Challenge 1: Memory Coverage. The theoretical attack
described in Section 4.2 assumes that the attacker can probe      Figure 3. On top is what is obtained from averaging across
all cache sets in between every iteration of both the For-loops   150 samples of a custom scrypt victim that used the same
in Algorithm 3. This would be required to ensure that no          memory locations for V each time. In reality, we have to use
memory access into V is missed, especially during the IDMA        a single-trace, as seen below in red, because Chrome uses
where the value of j cannot be predicted by the attacker ahead    different memory locations for V every run.
of time. In practice however, the loop in the Access Phase
executes in less time than it takes to Prime+Probe a set, so         A natural approach to mitigating this issue is averaging the
an attacker must somehow slow the victim in order to have         access time across multiple experiments, as was done in the
a chance to probe even a single cache set at each iteration of    top graph of Figure 3. However, this is not possible in the
the loops. From a signal analysis perspective, this results in    case of attacks on unmodified versions of Chrome because
the attacker’s view of Figure 2 being limited to accesses to a    Chrome’s implementation of scrypt allocates a different set
single cache set, i.e. the yellow boxes.                          of physical memory locations to store V each time. Thus, we
Challenge 2: Congruent Cache Lines. There are two yellow          developed techniques to overcome the noise and analyze each
boxes, indicating that the attacker views multiple indexes        experiment in isolation, as opposed to combining the results
into V , because the array V is large enough to span multiple     across multiple experiments.
congruent cache lines. Congruent cache lines are lines that
                                                                  4.4    Attacking Scrypt in Chrome
map to the same cache set, thereby preventing a Prime+Probe
attacker from distinguishing between accesses to addresses        Having outlined the issues with the theoretical attacks on
that map to congruent cache lines.                                scrypt considered in prior works, we now demonstrate how
   As Chrome parameterizes scrypt with N = 4096, r = 8, and       to attack the scrypt implementation used in an unmodified
p = 1, this results in V being an array of 4096 elements with     Chrome browser’s Password Leak Detection protocol.
each element 1024 bytes in length, spanning 4MiB total. Next,     Step 1: Observing Control Flow. In order to observe the
as the typical L3 cache on Intel machine uses 0.5 MiB ways,       memory access patterns into the V array during every iteration
we expect that on average any given element of V will be share    of both the For-loops in Algorithm 3, we first need to establish
the same cache set with (4096 ∗ 1024)/(0.5 ∗ 1024 ∗ 1024) =       a ticker, or a marker that indicates the beginning of a new
8 other elements. Thus, rather than observing a single hit        round in either of the For-loops. Since the scryptBlockMix
during scrypt’s Initialization Phase followed by a single hit     function is called once per iteration, we created our ticker
during the Access Phase, the attacker should expect to see        by repeatedly using the Flush+Reload attack on a memory
8 hits during the Initialization Phase and an average of 8        addresses holding the code of this function. We will use this
corresponding hits during the Access Phase.                       ticker as an indicator of start every iteration of the For-loops
   Empirically demonstrating this issue, we executed an in-       in Algorithm 3, allowing us to assign every subsequent side
strumented version of Chrome’s scrypt code while monitoring       channel observation to its corresponding loop iteration.
the accesses to a single cache set. The top graph in Figure 3     Step 2: Performance Degradation. Next, as the iterations
illustrates the access times, where we added the results of       of the For-loops in Algorithm 3 are so short in duration, we
150 scrypt traces corresponding to the same cache set. The y-     also had to slow the execution of the scryptBlockMix function
axis measures the number of times a cache-hit was observed,       using a performance degradation attack [8]. To that aim, we
while the x-axis indicates which round it was recorded in. In     repeatedly used the clflush instruction in order to flush a code
this example, there are roughly 9 peaks for the Initialization    region corresponding to the Salsa 20 Core function, which is
Phase followed by another 9 for the Access Phase, which is        repeatedly called inside scryptBlockMix.
close to what is expected.                                        Step 3: Prime+Probe. With the ticker and performance-
Challenge 3: Noise. Further complicating the attack is the        degradation established, we choose a random cache set and
presence of noise, which prevents us from perfectly learning      mount a Prime+Probe attack on it after each occurrence of
which n indices are accessed at which rounds in the Access        the ticker. As outlined in Section 4.3, the memory layout of V
Phase. This can be seen in the Figure 3(bottom), which shows      inside the CPU’s cache implies that mounting a Prime+Probe
a single trace containing 80 hits, though only 16 are expected.   attack on a given cache set discloses when an access is per-



USENIX Association                                                                  32nd USENIX Security Symposium          7113
formed to any of the roughly 8 congruent elements of V , with-      we empirically found it optimal to expanding our scoring al-
out the ability to further distinguish between the elements.        gorithm to also consider the indexes that match in the low 2
                                                                    bits immediately above and below where the hit occurred.
4.5    Handling Noise                                               Determining the Transition Point. Next, after denoising the
As outlined in Section 4.3, a further issue that complicates our    ticker during the Initialization Phase of Algorithm 3, we must
attack is the presence of noise, which takes the the form of off-   locate the “halfway point": the point in Line 6 in Algorithm 3,
sets in the ticker and additions or deletions in the Prime+Probe    just before the second For-loop starts. This allows us to realign
cache hits. As noted above, we cannot simply average out            the trace after drifting for 4096 rounds in the Initialization
the noise over multiple traces, since Chrome’s scrypt imple-        Phase. We do so by exploiting the fact that one iteration of
mentation ends up using a different set of physical memory          the loop in the Initialization Phase (Line 3) executes more
locations to store V each time. Thus, rather than combining         quickly than one iteration in the Access Phase (Line 6) due
several measurements into a clean trace, we instead overcome        to the additional code at Lines 7 and 8. Thus, by looking
the noise while analyzing each trace in isolation.                  for a point where the time between ticker hits consistently
Prime+Probe Noise. When we conduct the Prime+Probe                  increases, we are able to identify the halfway point, allowing
attack on a cache set, we see a large amount of false positive      us to identify the ticker’s transition to the Access Phase.
noise, where we record cache hits during rounds where there         Denoising the Ticker During Accesses. Ticker noise during
should not be. In addition, we observed a minimal amount of         the Access Phase has a more straightforward solution. When
false negative noise, where cache hits are missing.                 searching for the hits in the Access Phase that correspond to
     To overcome this, we implement a scoring system for our        the indices found during the Initialization Phase, the attacker
dictionary attack, where we assign points to candidate pass-        simply expands her search for any hit within 10 rounds of
words based off how well they “fit" the results from a trace.       the expected location. We empirically found 10 to be a good
Given an index j0 that is accessed during the Initialization        compromise between being too small to overcome the noise,
phase, the attacker can pre-compute at which rounds during          and being so large as to generate too many false positives.
the Access Phase V [ j] will be accessed in case the password       Avoiding Averaging. Overall, we were able to combine
candidate is correct. For each of those rounds in the Access        the above denoising and scoring techniques into an algorithm
Phase which the Prime+Probe trace contains a memory ac-             to identify candidate passwords based on how well they fit
cess, the candidate password’s score is incremented by 1.           the limited, noisy information the attacker gained on the V-
     We repeat the above approach for each index,                   Access-Pattern. This improves on prior theoretical attacks on
 j0 , j1 , ..., jn−1 , for which accesses are detected during       scrypt [11, 25], which assumed the attacker has a noiseless
Initialization Phase, in order to compute the candidate’s final     and perfect access to the V-Access-Pattern.
score. Finally, after applying this approach on all password
candidates in the dictionary, we rank the highest scoring           4.6    Empirical Evaluation
candidates as the most likely passwords.                            We now evaluate the effectiveness of our attack on Chrome’s
Ticker Noise. While the above approach is useful for han-           Password Leak Detection protocol.
dling noise present in the accesses to V obtained using the         Experimental setup. We conducted our attack against an
Prime+Probe channel, we must adapt this algorithm to also           unmodified Chrome binary running on an Acer Aspire E 15
account for noise that is present in our Flush+Reload ticker.       laptop, equipped with 8GiB of DDR4 memory and an Intel
     We begin by recalling that we use the ticker to determine      i5-8250U CPU. The i5-8250U features 4 cores and 8 threads
at which round the accesses into V are made, during both            and is equipped with a 6MiB 12-way set associative L3 cache.
Initialization and Access phases. Due to both false negatives       Our machine was running Ubuntu 20.04.3 with Linux kernel
and false positives, the round corresponding to the memory          version 5.8.0-44.
access is unfortunately rarely correct.                             Attack Scenario. Assuming an attacker with native un-
Denoising the Ticker During Initialization. We observe              privileged code execution on the target machine, we imple-
that ticker noise is most damaging during the Initialization        mented the attack described in this section using the Mastik
Phase. If the ticker is off, then our algorithm ends up assign-     toolkit [56]. We ran our attacker against an unmodified ver-
ing points for the trace fitting the wrong V-Access-Pattern.        sion of the Chrome browser, and evaluated our attack against
Fortunately for the attacker, however, the accesses to V during     10 randomly chosen passwords from the “rockyou.txt" dic-
the Initialization Phase occur deterministically, with elements     tionary. For each password, the victim browser submitted the
of V accessed sequentially (see Line 4 of Algorithm 3). Thus,       username:password pair of (“z", pw) into a website 5 times,
the attacker learns some of the low bits of the index due to        where pw was the randomly chosen password from “rock-
the elements of V being smaller than one page. In particu-          you.txt". This resulted in our side-channel attacker obtaining
lar, each element of V is 1024 bytes, meaning that 4 fit into       5 traces for each password the victim submitted, where each
each page, and for each ji accessed during the Initialization       trace is the result of using side-channels to leak information
Phase, the attacker learns ji (mod 4). With this optimization,      about the victim’s V-access-pattern.



7114    32nd USENIX Security Symposium                                                                        USENIX Association
A Dictionary Attack. With the collected traces in hand, we          1: function hash2curve(m)
applied the approach described in Section 4.5 and conducted         2:    px ← RandomOracleSHA256(m)
an offline dictionary attack. We follow the precedent of pre-       3:    while !OnCurve(px ) do     ▷ Input-Dependent Loop
vious works and benchmark our attack on the “rockyou.txt"           4:        px ← RandomOracleSHA256(px )
password file, which contains 14,341,564 plaintext passwords        5:    return (px , py )
stolen during the 2009 RockYou data breach.                        Algorithm 4. Google’s hash2curve implementation.
   We computed the V-access-pattern for every entry in the
entire “rockyou.txt" file and scored them against the 10 sets of
traces corresponding to the 10 passwords the victim submit-        elliptic curve. Such a primitive is useful for a number of
ted. We ran this computation on an Intel Xeon server machine,      cryptographic applications; in the case of Password Leak
featuring a Platinum 8352Y CPU, 128 cores, and 1.8TB of            Detection, Chrome’s hash2curve algorithm serves the purpose
memory. It took about 8400 core hours of offline computa-          of mapping the output of scrypt to a point on an elliptic curve
tion to complete the dictionary attack, or about 3 days when       to prepare it for use with Diffie-Hellman PSI [36]. This can
parallelized across all 128 cores.                                 be seen in Line 6 of Algorithm 1.
   The results of our end-to-end attack are displayed in Fig-      Chrome’s Hash2Curve Implementation. We describe the
ure 4. The correct password ended up scoring higher than           hash2curve algorithm used in Password Leak Detection in
all other passwords in the dictionary 80% of the time. Thus,       Algorithm 4. The variable px is first computed by passing
if the attacker were to attempt to log in with the candidate       the string m as input to the function RandomOracleSHA256,
passwords in descending order, the attacker would success-         which repeatedly uses SHA-256 and modular addition to
fully log into the victim’s account on the very first try, 80%     approximate a pseudo-random function (PRF). The output
of the time. In the worst case, the attacker would succeed on      px is then repeatedly updated by being assigned the value
the 6th try. Finally, we note that with such a low number of       RandomOracleSHA256(px ) until px is a valid x coordinate
attempts required for success, no reasonable amount of rate        of a point P = (px , py ) on the NIST P-256 curve (Line 3). The
limiting on password attempts can prevent our attacker from        algorithm then outputs P = (px , py ) (Line 5). About half of
compromising the target’s account.                                 the possible values of x correspond to points on the curve,
                                                                   so the while-loop in Line 3 of Algorithm 4 terminates with
                   8
                                                                   probability 1/2 in each iteration.
                                                                   Side Channel Vulnerability of Hash2Curve.                While
    Frequency




                   6
                   4
                                                                   constant-time hash2curve algorithms do exist [54], we note
                   2
                                                                   that the hash2curve algorithm used by Chrome’s Password
                                                                   Leak Detection is inherently not constant-time. More specifi-
                   0
                         1     2      3      4      5      6       cally, Algorithm 4 uses a rejection sampling method, repeat-
                                                                   edly iterating over candidate px values until a suitable value
                       Number of login attempts until success      is found. While this design pattern was originally proposed
                                                                   by [15], such an implementation is explicitly discouraged by
Figure 4. Histogram of the results from our attack on scrypt in    [35, Appendix A] due to side channel considerations.
an unmodified Chrome browser. 80% of the time, the attacker        A Dictionary Attack on Hash2Curve. An attacker can
guesses the correct password on the very first attempt.            exploit the rejection sampling design of Algorithm 4 for
                                                                   mounting dictionary attacks similar to those mounted in Sec-
                                                                   tion 4. Given a credential dataset D, an attacker can apply the
5               Attacking Hash2Curve                               hash2curve algorithm to every entry of D, obtaining the corre-
Moving away from attack Password Leak Detection scrypt im-         sponding number of iterations taken by Line 3 of Algorithm 4,
plementation, in this Section we will examine how Chrome’s         since it is an input-dependent loop (hereinafter IDL). Next, by
hash2curve usage reveals bits of the user’s credentials. Before    using a side-channel attack to obtain the number of iterations
demonstrating end-to-end attacks from both native code and         taken by the IDL on the target’s credentials, the attacker can
the Chrome browser on this part of the Password Leak Detec-        eliminate candidates of D that do not induce the same number
tion protocol, we now proceed to review Google’s hash2curve        of iterations, thereby reducing the attack’s search space.
construction and implementation. We used the unmodified
Chrome version 106, the latest at the time of writing, for all
                                                                   5.2    Native Attack on Hash2Curve
analyses and experiments in this section.                          In this section we describe a Flush+Reload based attack on
                                                                   Chrome’s hash2curve algorithm, executed from unprivileged
5.1              Hash2Curve Overview                               native code running in the target’s machine. Here, we empir-
The hash2curve algorithm takes an arbitrary length input           ically found the strongest results when using Flush+Reload
string and deterministically outputs a point on a specified        on a string that is touched by Chrome’s GetPointByHashing-



USENIX Association                                                                    32nd USENIX Security Symposium        7115
                                                                   5.3    Attacking Hash2Curve Within Chrome
                                                                   Having established the vulnerability of Chrome’s hash2curve
                                                                   algorithm to Flush+Reload attacks from native code, in this
                                                                   section we present a browser-based attack on Chrome’s
                                                                   hash2curve implementation. More specifically, we attack
                                                                   hash2curve from within an unmodified Chrome browser, us-
                                                                   ing an attacker webpage that executes malicious JavaScript
                                                                   and WebAssembly code.
Figure 5. Flush+Reload attack accuracy as a function of the           This is a weaker assumption on the attacker’s capabiltiies
number of hash2curve loop iterations.                              than in Section 5.2, as it is usually easier for an attacker to
                                                                   trick a victim into visiting the attacker’s web page. As such,
                                                                   modern browser versions recognize the danger of browser-
ToCurveInternal function, which corresponds to the OnCurve         based side-channels, and employ a heavily sandboxed envi-
test within the IDL.                                               ronment for code execution compared to a native scenario.
Attack Outline. To mount a Flush+Reload attack, we exe-            Accordingly, browser-based adversaries face additional tech-
cute an unprivileged attacker process monitoring Chrome’s          nical challenges, which we now describe.
GetPointByHashingToCurveInternal function on the target ma-        Flushing Data in the Cache.           The Flush+Reload tech-
chine. We then open an exemplary login page and complete           nique used in Section 5.2 requires the clflush instruction and
the login process with a set of user credentials. This triggers    shared memory between attacker and target. However, neither
Chrome’s Password Leak Detection protocol, allowing us to          is available in a browser environment.
monitor the exact number of iterations made by the IDL.               Instead, we use Prime+Probe to observe the activity of
Attack Evaluation. In order to measure the accuracy of our         Chrome’s hash2curve algorithm, using the work of Vila et
Flush+Reload attack, we gathered 5500 pairs of username and        al. [53] in order to efficiently generate eviction sets.
password, where every 500 pairs generate the same number           High-Precision Timing Source. Measuring the cache access
of iterations of the IDL between 0 and 10 (inclusive). We then     patterns of the hash2curve algorithm requires the attacker to
executed the attack on each credential pair, noting the amount     distinguish cache hits from misses, necessitating a timer with
of detected iterations compared to the ground truth.               a precision of tens of nanoseconds. However, modern Chrome
   Analyzing the results, our Flush+Reload attack was able         versions deliberately limit the timer resolution to 5 µs, aiming
to correctly identify the number of loop iterations for 4960       to foil side channel attacks [55].
credentials, resulting in a total accuracy rate of 90.18%. Next,      We sidestep this issue by using the SharedArrayBuffer
in Figure 5 we outline the accuracy of our attack as a function    JavaScript API, which provides a primitive for a precise count-
of the actual loop iterations performed by the IDL.                ing thread on the order of nanoseconds [47]. While SharedAr-
   Finally, as the IDL exists with probability 1/2 for each loop   rayBuffer was previously disabled by Chrome in an attempt
iteration, we can use the data depicted in Figure 5 to compute     to mitigate speculative execution attacks, recent versions of
our weighted success probability as                                Chrome re-enabled this primitive due to the presence of dedi-
                                                                   cated Spectre countermeasures [12, 46].
    W[SR] = 1 ∗ 1/2 + 0.954 ∗ 1/4 + · · · + 0.826 ∗ 1/211          Just-In-Time Compilation. In contrast to attacks that are
                                                                   mounted using native code, which have near-complete control
which is roughly equal to 97%.                                     over the attack code executed by the target machine, browser-
A Dictionary Attack.         By recovering the number of           based adversaries are limited to code emitted by Chrome’s
iterations with 97% accuracy, the attacker is able to conduct      JavaScript and WebAssembly execution engines [13, 49].
a dictionary attack and filter out candidate passwords that        This introduces measurement noise, making traces obtained
don’t have the same number of iterations. As the IDL exists        through side-channels unreliable and nondeterministic.
with probability 1/2 for each loop iteration, the attacker            To overcome this issue, we observe that it is possible
essentially learns an additional bit about the password with       to introduce a warmup stage into our attack code, causing
each iteration; this means that in the ideal case where the        Chrome to always run its optimizing compiler over our high-
attacker can perfectly recover the number of hash2curve            level Prime+Probe implementation. Furthermore, we initial-
loop iterations, the expected number of bits by which the          ize our code in a way that Chrome’s optimizing compiler
password’s entropy is reduced is:                                  will cache its output [17], allowing us to consistently use
                                                                   Prime+Probe across many attack runs. With both measures in
                                      ∞
                      1      1     1                               place, we achieve a greater probing frequency compared to
         E[B] = 1 ∗     + 2 ∗ + 3 ∗ = ∑ i/2i = 2.
                      2      4     8 i=1                           naive Prime+Probe implementations, allowing us to reliably
                                                                   monitor the execution of the IDL.



7116    32nd USENIX Security Symposium                                                                      USENIX Association
Automatically Selecting the Correct Eviction Set. Having
generated eviction sets using Vila et al. [53], we must now
determine the eviction set corresponding to the IDL. To that
aim, our attacker page renders an attacker-controlled login
page inside an iframe, populating it with dummy credentials
known to the attacker. This triggers the execution of Chrome’s
Password Leak Detection protocol, eventually resulting in
invocations of the IDL.
    For each eviction set generated by Vila et al. [53], we exe-
cute a Prime+Probe attack on our dummy credentials using
the above procedure, locating the eviction set that recorded the      Figure 6. Elapsed counting thread ticks over Prime+Probe
correct amount of cache misses corresponding to the execu-            iterations, with the 15 spikes corresponding to the 15 IDL
tion of the IDL. With the correct eviction set in hand, we can        iterations highlighted in red.
now mount Prime+Probe attacks on the target’s credentials.
Attack Evaluation.          Our goal is to determine whether
browser-based attacks on Chrome’s hash2curve algorithm
are capable of mirroring the performance of native attacks
outlined in Section 5.2. With this in mind, we mount a
Prime+Probe attack on a targeted username and password
pair, using the eviction set found earlier.
    Figure 6 presents a time series of Prime+Probe attack iter-
ations; the y-axis plots the number of counting thread ticks
elapsed while accessing the eviction set in each iteration. We
note the 15 spikes of probes that have at least 500 ticks (in red),
                                                                      Figure 7. Effect of increasing the login attempts on the num-
which corresponds to 15 iterations of the IDL when Chrome’s
                                                                      ber of successes for each number of IDL iterations.
Password Leak Detection is invoked on our credential. We
can distinguish the spikes resulting from the target string be-
ing accessed from system noise, since the latter only results
                                                                      6   Attacking Blinded Hashes
in access times no longer than 200 ticks. Finally, Figure 7
shows how many times out of 30 we were able to observe                We now examine how Chrome blinds the client’s credentials
the correct number of spikes when running our attack during           before sending them to the server. In particular, we found
1, 5, and 10 login attempts. While we could not distinguish           that Chrome uses the Binary Extended Euclidian Algorithm
targeted credentials inducing less than 5 IDL iterations, we          (BEEA) to compute the modular inverse of its secret key for
observe that 5 logins suffice for the attack to succeed in at         blinding, which is susceptible to side-channel attacks.
least half the trials. This results in our browser-based attack          To investigate the extent to which this compromises Pass-
with 5 traces reducing the password’s entropy by an expected:         word Leak Detection’s security guarantees, we developed a
              19          19                  20
E[B] = 5 ∗ 30∗2  5 + 6 ∗ 30∗26 + ... + 10 ∗ 30∗210 = 0.24 bits.       novel cryptanalysis technique that can recover BEEA’s in-
    While this may seem like a trivially small amount of leak-        puts after observing only a single, noisy trace obtained via a
age in the average case, we contend that only examining               cache side-channel. We then used our technique to success-
the average case and neglecting to account for the danger to          fully demonstrate the first ever microarchitectural single-trace
passwords with higher numbers of IDL iterations belies the            attack on the BEEA algorithm, improving on prior work that
severity of our attack. Instead, we emphasize that our results        required a controlled execution environment (e.g. SGX [41])
concretely demonstrate the risk of a significant amount of            or constraints only present during RSA key generation [7].
leakage for a non-trivial number of cases; as shown in Fig-           Blinding Chrome’s Password Leak Detection Protocol.
ure 7, when there were 10 IDL iterations and 5 login attempts         In the Password Leak Detection algorithm, after the client
were observed, the attack succeeded in 20 of 30 trials. This          hashes the user’s credentials to the point on the curve Q, the
means that for these passwords, the attack reduced the entropy        client must blind the hash before including it in the request
of the password by 10 bits, 2 out of 3 times.                         to the server. This takes place on Line 7 of Algorithm 1.
    Since 1 out of 1024 credentials result in 10 IDL iterations,      Specifically, the client blinds the hash by computing Qa on
and the attack succeeded 2 out 3 times, this means 1 out of           the elliptic curve, where a is the secret key. This blinding
1536 passwords will leak 10 bits. Given the scale at which a          serves the purpose of concealing all bits of the client’s hashed
browser-based attack can be launched, that fact that our attack       credentials from the Password Leak Detection server.
can leak 10 bits from 1 in 1536 passwords is concerning, even            This step is in fact critical, as the Password Leak Detection
if the average password leaks very little.                            protocol was designed to preserve privacy in both directions,



USENIX Association                                                                      32nd USENIX Security Symposium          7117
meaning that the server should learn nothing about the client’s       1: function BN _ MOD _ INVERSE _ ODD(a, n)
credentials. If the server learns the hash of the client’s creden-    2:    A ← n, B ← a, X ← 1, Y ← 0
tials, the server can then launch a dictionary attack to brute        3:    while B ̸= 0 do
force the client’s plaintext password.                                4:        while even(B) do
                                                                      5:           B ← B/2
Computing Modular Inverses using BEEA. To unblind                     6:           if odd(X) then                        ▷ Branch 1
the response received from the server, the client also needs to       7:                X ← X +n                         ▷ Branch 5
compute a−1 mod p, where p is the prime modulus used for              8:           X ← X/2
the NIST P-256 elliptic curve. The value of a−1 mod p is then         9:        while even(A) do
used to unblind the response received from the server in order       10:            A ← A/2
to complete the Diffie-Hellman PSI [36]. Next, to perform            11:            if odd(Y ) then                      ▷ Branch 2
the computation of a−1 mod p, Chrome uses the BEEA algo-             12:                Y ←Y +n                          ▷ Branch 5
rithm, as implemented by BoringSSL’s BN_mod_inverse func-            13:            Y ← Y /2
tion, which in turn calls BoringSSL’s BN_mod_inverse_odd             14:        if B ≥ A then
to take advantage of an optimization for odd moduli.                 15:            X ← X +Y                             ▷ Branch 3
Threat Model. Similarly to Section 4’s threat model, we              16:            B ← B−A
also assume a side-channel adversary that is able to run un-         17:        else
privileged native code on the victim’s machine. Moreover,            18:            Y ←Y +X                              ▷ Branch 4
in this section we assume that the attacker has access to the        19:            A ← A−B
blinded hash, and wants to obtain the value of the unblinded         20:    return Y
hash. Access to the blinded hash could occur in practice if the      Algorithm 5. Binary Extended Euclidian Algorithm: Pseu-
server participating in the Password Leak Detection protocol         docode for Chrome’s BEEA implementation, which is opti-
colludes with the attacker; unblinding the hash would allow          mized for the odd modulus n used in NIST P-256. We make
the server to brute force the client’s credentials via a dictio-     the observation that the conditional add, labeled as Branch 5,
nary attack, a scenario Chrome’s Password Leak Detection             allows for error correction in a noisy trace.
protocol was specifically designed to protect against.
   We note that the attacker can access the blinded hash
                                                                     section we develop a novel noise-tolerant single-trace attack
in other ways, besides colluding with the server; if the at-
                                                                     on the BEEA algorithm that enables extraction of modular
tacker could somehow compromise the TLS connection (e.g.
                                                                     inverses computed by BEEA.
through a TLS Enterprise Root CA certificate, or a TLS mid-
dlebox), the attacker would gain access to the blinded hash.         6.2    Attacking BEEA
6.1    Prior Attacks on the BEEA Algorithm                           At a high level, our attack uses cache-attacks to determine the
The BEEA Algorithm has been studied extensively from                 control flow of the BEEA, which in turn allows for the recov-
a side-channel perspective due to the widespread need for            ery of the inputs to BEEA. In this case, the inputs to BEEA
computing modular inversions in cryptographic systems (e.g.          are a, the client’s blinding key, and n, the prime modulus for
RSA, ECDSA). While prior side-channel attacks against                the elliptic curve NIST P-256.
BEEA are well known, the specific manner in which Google             Chrome’s BEEA Algorithm. Algorithm 5 is a pseudocode
uses BEEA in Chrome’s Password Leak Detection proto-                 of the BEEA algorithm. Borrowing notation from [1], we
col prevents the application of prior attack techniques. More        use SHIFTS[i] to denote how many times the branch at Line
specifically, the theoretical analysis of BEEA done in [1] as-       4 or Line 9 was taken at the ith iteration of the outer while-
sumes that the attacker can obtain perfect, noiseless traces         loop at Line 3 (only one branch or the other will be taken
of the BEEA’s execution, which is not possible with current          during any given iteration, as one of A and B will be even
attack techniques. Furthermore, Chrome generates a new ran-          and the other odd at the beginning of each iteration). We
dom blinding factor a upon each generation of a request,             let SUBS[i] denote the outcome of the comparison at Line
thereby precluding combining information across traces via           14, such that SUBS[i] = 3 if branch 3 is taken, and 4 if if
either averaging or lattice attacks [5, 27].                         branch 4 is taken at the ith iteration. We note that for any
   Thus, in order to attack BEEA as it is used in Chrome, a          iteration i, if SUBS[i − 1] = 3, then the SHIFTS[i] must all
side-channel attacker must operate with only a single, noisy         take place in Branch 1 due to the subtraction at Line 16
trace of the BEEA execution. In prior works, this has only           in Algorithm 5. Likewise, if SUBS[i − 1] = 4, then the next
ever been accomplished by either placing the victim inside           iteration’s SHIFT S[i] take place in Branch 2.
of an SGX enclave [41] or by exploiting the redundancy and           Perfect Trace Requirement. Acıiçmez et al. [1] previ-
relations between various known parameters when BEEA                 ously showed that if an attacker can perfectly recover the
is used during RSA key generation [7]. As neither of these           SUBS[] and SHIFTS[] for all iterations, they can reconstruct
scenarios apply to Chrome’s Password Leak Detection, in this         both inputs to BEEA in polynomial time. The downfall of



7118    32nd USENIX Security Symposium                                                                         USENIX Association
 1: function B RANCH AND P RUNE(Array Trace)                       Probing the BEEA Algorithm. While prior works [1, 7,
 2:    pq ← PriorityQueue()                                        27, 41] only probed Branches 1, 2, 3, and 4 via cache attacks,
 3:    pq.push(100, 0, Key([]))                                    we make the observation that detecting the conditional add in
 4:    while notEmpty(pq) do                                       Branch 5 can be used to prune potential keys during our search
 5:        (score, i, curKey) ← pq.pop()
                                                                   algorithm. This is because the values X and Y are completely
 6:        if i == len(T ) then
                                                                   determined by all the previous branches taken. Furthermore,
 7:             Out put(curKey)
 8:             Continue                                           since X and Y start off initialized to 1 and 0 respectively, and
 9:        curBranch ← Trace[i]                                    the value n is known to be the prime modulus of NIST P-256,
10:        newKey ← curKey.append(curBranch)                       then if we know all the prior branches, we can determine if
11:        if correctXY (newKey) then                              branch 5 can possibly be taken at the current iteration. We
12:             if curBranch == 5 then                             will now cover in detail exactly how our branch-and-prune
13:                 score ← score + 20                             algorithm works in Algorithm 6.
14:             pq.push(score, i + 1, newKey)                      Algorithm Description. In Line 1, our algorithm takes
15:        if LastSub(curKey) == 3 then                            Trace, an array of branches corresponding to the sequence of
16:            newKey ← curKey.append(1)                           branches taken by BEEA, as input obtained through a side-
17:            X ← CalculateX(newKey)                              channel attack. The branches are simply numbers from 1
18:            if isOdd(X) then                                    through 5, corresponding to the labeled branches in Algo-
19:                 Continue
                                                                   rithm 5. We make the assumption that Trace only contains
20:             pq.push(score − 20, i, newKey)
                                                                   deletion errors, and only deletions of 1s and 2s occur; further-
21:        else
22:            newKey ← curKey.append(2)                           more, 1s and 2s are never deleted when they are immediately
23:            Y ← CalculateY (newKey)                             preceding a 5. In Section 6.4 we explain why this was the case
24:            if isOdd(Y ) then                                   for when we used cache-attacks to obtain traces on BEEA.
25:                 Continue                                          The data structure that we use to process our candidate keys
26:             pq.push(score − 20, i, newKey)                     is the priority queue on Line 2, which is sorted by the score of
Algorithm 6. Branch and Prune: Pseudo-code for our                 each candidate key. A key’s score is a measure of how close
branch and prune algorithm that recovers the complete in-          to the real key we believe the candidate key to be. In Line 3,
put to BEEA, given a single noisy trace.                           we populate pq with with a key with score equal to 100, an
                                                                   iterator i equal to zero, and an array of branches equal to 0.
                                                                   The iterator is used to track how far along the trace the key has
this analysis of BEEA is that a single error in either SUBS[]      progressed through. The key’s array of branches represents the
or SHIFTS[] completely foils the recovery of the inputs. More-     sequence of branches taken by the BEEA algorithm. As the
over, the attacker cannot determine if there were any errors,      algorithm progresses, we will incrementally build up longer
and thus whether or not the result is correct.                     keys that get progressively closer to the real key.
   Prior work [41] that utilized the analysis of [1] was able to   Finding New Keys. At each iteration of the loop on Line
extract BEEA’s inputs via perfect side channel traces, care-       4, we process the highest scoring key, corresponding to the
fully controlling its execution within an SGX enclave. For at-     key that we currently believe to be the closest to the true key,
tacking Chrome, however, the traces obtained via Flush+Flush       and push additional keys onto the priority queue with one
contain a substantial number of errors over the course of          additional branch added at a time.
BEEA’s roughly 700 branches on its randomized inputs, pre-            To generate these additional keys, our algorithm branches
venting us from applying the analysis of [1]. Thus, we over-       at each iteration of the outer while loop to create 2 additional
come the perfect trace requirement by presenting the first         keys. The first new key is formed by branching towards the
analysis of BEEA input recovery for the case of noisy traces.      Trace by appending the next branch within Trace to the cur-
                                                                   rent key, as seen on Lines 9 and 10. This candidate key is then
6.3    Cryptanalysis of a Noisy Trace                              pruned on Line 11 if it fails to satisfy correctXY ().
To correct the errors present in a noisy BEEA trace, we draw       Pruning on X and Y . The correctXY () function inspects
inspiration from prior works on partial key recovery [32, 33]      the newKey’s array of branches. Assuming an execution of
and develop a branch-and-prune style algorithm for BEEA.           BEEA that follows those branches, correctXY () then deter-
At a high level, this involves searching for the correct key,      mines if it is possible for all occurrences of Branch 5 to be at
where a key is a sequence of branches that could have been         the locations that they are. That is, after every occurence of
taken by the execution of BEEA. Our algorithm repeatedly           Branch 1 and Branch 2, it checks to see that X or Y , respec-
branches towards the most probable keys, as determined by          tively, at that point are odd if and only if a Branch 5 occurs on
how closely they align with the trace. We then exploit the         the subsequent branch. If not, then correctXY () returns false,
relationship between different segments of the keys to prune       and the key is pruned. On the other hand, if the key is not
key candidates, until the correct key is found.                    pruned, then newKey’s score is incremented by 20 on Line



USENIX Association                                                                   32nd USENIX Security Symposium           7119
13, its position in Trace is incremented by 1, and the key is       6.4    Implementing the Attack
pushed onto pq on Line 14.                                          In this section we describe how we implemented our cache
   We note that in actuality, only the most recent branch and       attack to obtain a trace against BEEA, and how our branch-
the resulting X and Y need to be checked in this manner.            and-prune algorithm recovered its inputs.
Any inconsistencies between X and Y and the sequence of             Software Setup. Chrome is statically linked against Bor-
branches earlier in the key would have resulted in that key         ingSSL, and as such the Password Leak Detection logic
already having been pruned.                                         calls BoringSSL’s BN_mod_inverse function to compute
                                                                    the modular inverse of the blinding factor. To benchmark
False Positives. While it is possible for correctXY () to
                                                                    our attack, we developed a test harness that calls Bor-
return true for keys that do in fact have errors in them, as
                                                                    ingSSL’s BN_mod_inverse, compiled with gcc version 9.4.0
the distance from the errors grows, the chance of continual
                                                                    using an -O0 flag. Mirroring Chrome, we call BoringSSL’s
false positives is equal to 1/2n , where n is the number of 1
                                                                    BN_mod_inverse(a, n) with random 256-bit values of a, where
branches and 2 branches since the error. This is because X
                                                                    n set as NIST P-256’s prime modulus.
and Y are modified with each occurrence of branches 1 and
                                                                       This is in contrast to the prior two attacks on scrypt and
2, effectively randomizing whether or not they are odd at any
                                                                    hash2curve, where we conducted our attacks against unmod-
given point. Furthermore, the subtractions in branches 3 and
                                                                    ified versions of Chrome. We did this because BEEA sees
4 ensure that errors in X propagate to errors in Y , and vice
                                                                    widespread deployment across numerous commonly imple-
versa. As n grows, the probability of continuing to follow an
                                                                    mented cryptosystems, and we believe that our novel crypt-
incorrect key becomes vanishingly small, and the incorrect
                                                                    analysis has implications on these as well. Thus, there are
key values are pruned back to where the error occurred.
                                                                    broader impacts in analyzing how BEEA leaks using our
Inserting Branches. After branching towards the Trace,              attack technique. By benchmarking our attack against Bor-
the second additional key is found by inserting a potential         ingSSL directly, we demonstrate that our attack applies to
branch into curKey. This is how keys that contain the branches      a wider variety of BEEA usages (any binary that uses Bor-
deleted by the noisy trace are discovered and added to pq.          ingSSL’s implementation, such as Chrome), and does not rely
Since the Trace obtained in Section 6.4 only contains dele-         on nuances specific to Chrome.
tions of 1 Branches and 2 Branches, the LastSub() function at          Finally, we run experiments on a laptop featuring a Quad
Line 15 only needs to determine whether to insert a 1 Branch        Core Intel i5-8250U CPU, and 4 GB of RAM.
or a 2 Branch, which depends on whether the most recent             Flush+Flush Probing Locations. In order to generate a trace
branch is 3 or 4 respectively.                                      that attempts to reconstruct the control flow of the the victim’s
   After inserting the potential branch at Line 16, Line 17 uses    BEEA execution, we used the Flush+Flush attack [30] in order
the function CalculateX() to determine the value of X within        to monitor the 5 branches marked in Algorithm 5. We note
BEEA after executing the branches in newKey. If this X is odd,      that doing so requires a total of 4 Flush+Flush probes, as the
this would induce a Branch 5 to follow. However, since there        same probe can be used to monitor both Branch 1 and Branch
are no deletions of Branch 5 or the immediately preceding           2 since these share the same call to BN_rshift1 on Lines 8 and
branch 1s and 2s in Trace, inserting an additional branch 5         13. Similarly, a single probe monitors Branch 5 on both Line
automatically renders the key incorrect; as such, we prune the      7 and Line 12 as they make the same call to BN_uadd. We use
key at Line 19 if X is odd. Otherwise, we push the newKey           the remaining two probes to detect branches 3 and 4, which
onto the priority queue at Line 20. To prioritize keys that         in turn allows us to discern between branch 1 and branch 2,
align more closely with Trace, we decrement the newKey’s            as described in Section 6.2.
score by 20, since for most branches the Trace is correct and       Signal Amplification via Core Assignment.                As our
does not require an insertion. We leave i untouched because         i5-8250U processor has 4 physical cores, we run each
we only inserted an additional branch, and did not progress         Flush+Flush probe on a separate core, while having the probe
through Trace. Lines 22 through 26 serve the same purpose,          for Branch 5 running on the sibling virtual core to the process
only for when LastSub == 4.                                         executing the BEEA algorithm. As the BEEA process now
                                                                    shares its caches with the probe for branch 5, due to [4] this re-
Termination. Once i iterates through the entirety of the            sults in the signal for branch 5 becoming unmistakably strong.
Trace, the candidate key is output, along with its score. The       This is important, as it virtually eliminates false positives or
algorithm can continue to run indefinitely, continuously out-       negatives for branch 5, allowing us to prune keys aggressively
putting more complete keys as it explores them. The higher          by error correcting with the occurrences of Branch 5. Further-
the score of a key, the more likely it is to be the correct one.    more, this also results in a trace where branch 1s and branch
Intuitively, the true key is the one that aligns most closely       2s immediately preceding branch 5s are not deleted in the
with Trace, with the insertions in the correct places that result   trace, as branch 5 can only ever take place after a 1 or 2.
in X and Y being odd whenever dictated by the occurrences           Gathering Traces. We then allow the BN_mod_inverse func-
of branch 5 in the Trace.                                           tion to run while the probing processes monitor the branches.



7120    32nd USENIX Security Symposium                                                                         USENIX Association
We parse the resulting data from the Flush+Flush probes form         Scrypt. Chrome uses scrypt as its hash algorithm for Pass-
the trace, which is the sequence of branches within BEEA ob-         word Leak Detection due to its memory-hardness properties.
served by the attacker. We find that this results in no insertions   A memory-hard hash function is one where the cost of eval-
or deletions of branches 3, 4, and 5. However, it is common          uating the hash function is primarily dominated by the cost
for there to be insertions or deletions in the number of branch      of memory, as opposed to the cost of compute power. While
1s and branch 2s in each round of the while-loop in Line 3           attackers can employ ASICS and FPGAs to gain a computing
of Algorithm 5. This is because a series of 1 branches or 2          advantage of up to 100,000x [16] over general purpose com-
branches can execute in very quick succession when branch 5          puters, the cost of memory remains the same for both general
is not taken inbetween them.                                         purpose machines and ASICS/FPGAs. This makes it difficult
   To make sure that the trace only contains deletions, we           for attackers to compute the memory-hard hash function at a
calibrate our parser to be extremely conservative with adding        significantly lower cost than honest users, who must compute
1s and 2s to the trace, only adding them to the trace when the       the hash with general purpose computers. For this exact rea-
signal is extremely clear. This ensures that only deletions, and     son, scrypt is an attractive option for hashing passwords, as
not additions, appear in the trace.                                  [10] proved that scrypt is maximally memory-hard under the
Attack Results. After collecting a trace with only dele-             parallel random oracle model.
tions in branches 1 and 2, we passed the noisy trace to the             This memory-hardness property of scrypt comes at a price,
branch-and-prune algorithm. Within just 34 ms, the algorithm         however. Namely, [9] show that no function can be both max-
found the correct key, with 18 branches inserted, and with all       imally memory-hard and input oblivious; as a consequence,
703 branches correctly recovered. This key was also the first        scrypt is inherently vulnerable to cache side-channel attacks,
one output by the program, and after continuing to run the           and in order to mitigate our attack, a compromise is required
branch-and-prune program for 10 minutes, this key had the            between input obliviousness and memory-hardness.
largest score, making it clear that it was the correct key. Hav-        As such, we recommend replacing scrypt with an alterna-
ing recovered all SUBS[i] and SHIFT S[i], we then used the           tive option, such as one of the side-channel resistant variants
method described by [1] to trivially recover BEEA’s inputs.          of Argon2 [14], the winner of the 2015 Password Hashing
Implications for Chrome’s Password Leak Detection Pro-               Competition. Argon2i is a variant of Argon2 that is com-
tocol. A malicious server that successfully launches this            pletely constant-time; however, it offers the weakest memory-
attack can recover the client’s secret, a which was used in          hardness of the Argon2 variants. This may be unappealing for
Line 7 of Algorithm 1 to blind the hash of its credentials as        Password Leak Detection, where resistance against parallel
Qa . After Qa is sent to the Password Leak Detection server          GPU cracking attacks is highly desirable.
as part of its request, the server can easily compute a−1 and           A compromising solution is Argon2id, which aims to strike
                                             −1
use it to unblind the client’s hash as (Qa )a = Q, where Q is        a balance between memory-hardness and side-channel resis-
the unblinded hash of the client’s credentials.                      tance. This is accomplished by making the first pass over
   This completely violates the security guarantees of               the input oblivious, while the second half is input dependent,
Chrome’s Password Leak Detection protocol, as it was de-             thereby reducing the amount that can be learned by a side-
signed to allow client’s to safely query the Password Leak           channel attacker. This, however, means that Argon2id is not
Detection service without having to place any trust in the           completely constant-time, and still leaks some amount of
server. In this case however, the client is essentially sending      information to side-channel attackers. We caution against per-
a hash digest of their credentials to the server, allowing the       mitting any side-channel leakage at all; as we demonstrated
server to run offline dictionary attacks using lists of compro-      with our attack against scrypt, even an extremely limited view
mised credentials aiming to breach the client’s account.             of the victim’s memory accesses can potentially lead to a
                                                                     complete breach of security.
7    Mitigations                                                     Hash-to-Curve. In contrast, protecting the hash2curve por-
The defacto standard for mitigating cache side-channel attacks       tion of Password Leak Detection is comparatively simple; it
in software is to make use of the constant-time programming          does, however, require a slight change in protocol, due to the
paradigm. In this style of programming, the control flow of          current hash2curve algorithm’s usage of a rejection sampling
the program must not depend in any way upon the program’s            method, which is inherently non constant-time. Instead, us-
input; moreover, no accessed memory address can depend               ing one of the constant-time hash-to-curve implementations
upon the input [42]; in other words, the execution of the            described in [34] is sufficient to mitigate our attack against
program must be completely oblivious to its input.                   the hash2curve portion of Password Leak Detection.
   Mitigating against the three vulnerabilities described in this    Modular Inversion. Similarly, the BEEA algorithm used for
paper, however, is not as easy as simply replacing vulnera-          modular inversion by Chrome is inherently non constant-time;
ble components with constant time implementations. This is           however, there are known alternatives for modular inversion
because Chrome’s usage of scrypt as a memory-hard hash               that are indeed constant-time, and exchanging BEEA for one
function poses a difficult problem, with complex trade offs.         of these does not require any protocol change.



USENIX Association                                                                     32nd USENIX Security Symposium         7121
   A potential solution is to make use of Fermat’s Little The-    References
orem and to compute the inverse of a as a−1 ≡ a p−2 (mod p)        [1] O. Acıiçmez, S. Gueron, and J.-P. Seifert, “New branch
where the exponentation is performed in constant-time. We              prediction vulnerabilities in OpenSSL and necessary
can compute this exponentiation both performantly and in               software countermeasures,” in IMA International Con-
constant-time by taking advantage of the fact that the modu-           ference on Cryptography and Coding, 2007, pp. 185–
lus for Curve P-256 is fixed; by pre-computing an optimally            203.
short addition chain for the modulus, we can use the addition
                                                                   [2] O. Acıiçmez, Ç. K. Koç, and J.-P. Seifert, “Predicting
chain to exponentiate in constant time, with fewer multiplica-
                                                                       secret keys via branch prediction,” in CT-RSA, 2007, pp.
tions than other methods [22].
                                                                       225–242.
                                                                   [3] A. Agarwal, S. O’Connell, J. Kim, S. Yehezkel,
8   Future Work
                                                                       D. Genkin, E. Ronen, and Y. Yarom, “Spook.js: Attack-
                                                                       ing chrome strict site isolation via speculative execution,”
Other Browsers. Following Chrome’s lead, both Microsoft
                                                                       in IEEE SP, 2022.
Edge and Mozilla Firefox have implemented their own pass-
word leak detection functionality. At the moment, Firefox sim-     [4] A. C. Aldaya and B. B. Brumley, “HyperDegrade: From
ply queries the HaveIBeenPwned database; Edge, on the other            GHz to MHz effective CPU frequencies,” pp. 2801–
hand, developed their own novel cryptographic PSI system               2818, 2022.
based off of homomorphic encryption [18, 19]. Investigating        [5] A. C. Aldaya, A. J. C. Sarmiento, and S. Sánchez-
their novel cryptosystem’s susceptibility to side-channels and         Solano, “SPA vulnerabilities of the binary extended Eu-
other attacks could reveal new insights into how password              clidean algorithm,” Journal of Cryptographic Engineer-
leak detection systems must consider security and privacy.             ing, vol. 7, no. 4, pp. 273–285, 2017.
                                                                   [6] A. C. Aldaya, B. B. Brumley, S. ul Hassan, C. P. García,
Hashing Scheme Tradeoffs. Given our attacks on scrypt                  and N. Tuveri, “Port contention for fun and profit,” in
and Chrome’s hash2curve, it is natural to wonder if there are          IEEE SP. IEEE, 2019, pp. 870–887.
any existing hash algorithms would be more suitable with
                                                                   [7] A. C. Aldaya, C. P. García, L. M. A. Tapia, and B. B.
regards to trade offs between performance, memory-hardness,
                                                                       Brumley, “Cache-timing attacks on RSA key generation,”
and input-obliviousness. It could be interesting to augment
                                                                       TCHES, vol. 2019, no. 4, pp. 213–242, 2019.
existing hash algorithms, or perhaps even design new ones,
that are more desirable for Password Leak Detection.               [8] T. Allan, B. B. Brumley, K. Falkner, J. Van de Pol, and
                                                                       Y. Yarom, “Amplifying side channels through perfor-
BEEA Partial Key Recovery. Due to the numerous existing                mance degradation,” in ACSAC, 2016, pp. 422–435.
attacks against BEEA, it is easy to imagine how our partial        [9] J. Alwen and J. Blocki, “Efficiently computing data-
key recovery algorithm can prove useful to that direction of           independent memory-hard functions,” in CRYPTO,
research. However, our key recovery algorithm is specifically          2016, pp. 241–271.
tailored to account for the type of noise that we encountered
                                                                  [10] J. Alwen, B. Chen, K. Pietrzak, L. Reyzin, and S. Tes-
within our traces; it is likely possible to expand upon our al-
                                                                       saro, “Scrypt is maximally memory-hard,” in EURO-
gorithms capabilities such that it can handle a broader variety
                                                                       CRYPT, 2017, pp. 33–62.
of noisy traces.
                                                                  [11] M. M. Anderson, “Attacking scrypt via cache timing
                                                                       side-channel,” https://crypto.stanford.edu/cs359c/17sp/
Acknowledgments                                                        projects/MarkAnderson.pdf, 2017.
This research was partially supported by the Air Force Office     [12] J. Archibald and E. Kitamura, “SharedArrayBuffer
of Scientific Research (AFOSR) under award number FA9550-              updates in Android Chrome 88 and desktop Chrome 92,”
20-1-0425, an ARC Discovery Early Career Researcher                    https://developer.chrome.com/blog/enabling-shared-
Award DE200101577, an ARC Discovery Project number                     array-buffer/, 2021.
DP210102670, the Defense Advanced Research Projects               [13] C. Backes, “Liftoff: a new baseline compiler for we-
Agency (DARPA) under Award number HR00112390029,                       bassembly in v8,” https://v8.dev/blog/liftoff, 2018.
the Deutsche Forschungsgemeinschaft (DFG, German Re-              [14] A. Biryukov, D. Dinu, D. Khovratovich, and
search Foundation) under Germany’s Excellence Strategy -               S. Josefsson, “Argon2 memory-hard function for
EXC 2092 CASA - 390781972, the National Science Founda-                password hashing and proof-of-work applica-
tion under grant CNS-1954712, and gifts from Cisco, Google,            tions,” RFC 9106, Sep. 2021. [Online]. Available:
Mozilla, and Qualcomm.                                                 https://www.rfc-editor.org/info/rfc9106
  The views and conclusions contained in this document are        [15] D. Boneh, B. Lynn, and H. Shacham, “Short signatures
those of the authors and should not be interpreted as repre-           from the Weil pairing,” in ASIACRYPT, 2001, pp. 514–
senting the U.S. Government.                                           532.



7122   32nd USENIX Security Symposium                                                                       USENIX Association
[16] D. Boneh, H. Corrigan-Gibbs, and S. Schechter, “Bal-        [30] D. Gruss, C. Maurice, K. Wagner, and S. Mangard,
     loon hashing: A memory-hard function providing prov-             “Flush+Flush: a fast and stealthy cache attack,” in
     able protection against sequential attacks,” in ASI-             DIMVA, 2016, pp. 279–299.
     ACRYPT, 2016, pp. 220–248.                                  [31] Y. Guo, A. Zigerelli, Y. Zhang, and J. Yang, “Adversarial
[17] B. Budge, “Code caching for WebAssembly developers,”             prefetch: New cross-core cache side channel attacks,” in
     https://v8.dev/blog/wasm-code-caching, 2019.                     IEEE SP, 2022, pp. 1458–1473.
[18] H. Chen, K. Laine, and P. Rindal, “Fast private set         [32] W. Henecka, A. May, and A. Meurer, “Correcting errors
     intersection from homomorphic encryption,” in CCS,               in RSA private keys,” in CRYPTO, 2010, pp. 351–369.
     2017, pp. 1243–1255. [Online]. Available: https:            [33] N. Heninger and H. Shacham, “Reconstructing RSA
     //www.microsoft.com/en-us/research/publication/fast-             private keys from random key bits,” in CRYPTO, Aug.
     private-set-intersection-homomorphic-encryption/                 2009, pp. 1–17.
[19] H. Chen, Z. Huang, K. Laine, and P. Rindal, “Labeled        [34] A. Hernandez, S. Scott, N. Sullivan, R. Wahby, and C. A.
     PSI from fully homomorphic encryption with malicious             Wood, “Hashing to elliptic curves,” Internet Engineering
     security,” in CCS, 2018, pp. 1223–1237. [Online].                Task Force, Internet-Draft draft-irtf-cfrg-hash-to-curve-
     Available: https://www.microsoft.com/en-us/research/             03, 2019.
     publication/labeled-psi-from-fully-homomorphic-             [35] ——, “Hashing to elliptic curves,” https:
     encryption-with-malicious-security/                              //datatracker.ietf.org/doc/html/draft-irtf-cfrg-hash-to-
[20] S. Cohney, A. Kwong, S. Paz, D. Genkin, N. Heninger,             curve-12, 2022.
     E. Ronen, and Y. Yarom, “Pseudorandom black swans:          [36] B. A. Huberman, M. Franklin, and T. Hogg, “Enhancing
     Cache attacks on CTR_DRBG,” in IEEE SP, 2020, pp.                privacy and trust in electronic communities,” in ACM
     1241–1258.                                                       conference on Electronic commerce, 1999, pp. 78–86.
[21] G. Didier and C. Maurice, “Calibration done right:          [37] S. Islam, A. Moghimi, I. Bruhns, M. Krebbel, B. Gulme-
     Noiseless Flush+Flush attacks,” in DIMVA, 2021, pp.              zoglu, T. Eisenbarth, and B. Sunar, “SPOILER: Specula-
     278–298.                                                         tive load hazards boost Rowhammer and cache attacks,”
                                                                      in USENIX Security, 2019, pp. 621–637.
[22] Y. Ding, H. Guo, Y. Guan, H. Song, X. Zhang, and J. Liu,
     “Some new methods to generate short addition chains,”       [38] P. C. Kocher, “Timing attacks on implementations
     TCHES, vol. 2023, pp. 270–285, 03 2023.                          of Diffie-Hellman, RSA, DSS, and other systems,” in
                                                                      CRYPTO, 1996, pp. 104–113.
[23] C. Disselkoen, D. Kohlbrenner, L. Porter, and D. Tullsen,
     “Prime+Abort: A timer-free high-precision L3 cache          [39] A. Kwong, D. Genkin, D. Gruss, and Y. Yarom, “RAM-
     attack using Intel TSX,” in USENIX Security, 2017, pp.           Bleed: Reading bits in memory without accessing them,”
     51–67.                                                           in IEEE SP, 2020.
                                                                 [40] D. Moghimi, M. Lipp, B. Sunar, and M. Schwarz,
[24] M. Fahr Jr, H. Kippen, A. Kwong, T. Dang, J. Lichtinger,
                                                                      “Medusa: Microarchitectural data leakage via automated
     D. Dachman-Soled, D. Genkin, A. Nelson, R. Perlner,
                                                                      attack synthesis,” in USENIX Security, 2020. [On-
     A. Yerukhimovich, and D. Apon, “When Frodo flips:
                                                                      line]. Available: https://www.usenix.org/conference/
     End-to-end key recovery on FrodoKEM via Rowham-
                                                                      usenixsecurity20/presentation/moghimi-medusa
     mer,” in CCS, 2022, pp. 979–993.
                                                                 [41] D. Moghimi, J. Van Bulck, N. Heninger, F. Piessens, and
[25] C. Forler, S. Lucks, and J. Wenzel, “Memory-demanding            B. Sunar, “CopyCat: Controlled instruction-level attacks
     password scrambling,” in ASIACRYPT, 2014, pp. 289–               on enclaves,” in USENIX Security, 2020, pp. 469–486.
     305.
                                                                 [42] D. Molnar, M. Piotrowski, D. Schultz, and D. Wagner,
[26] P. Frigo, C. Giuffrida, H. Bos, and K. Razavi, “Grand            “The program counter security model: Automatic detec-
     pwning unit: Accelerating microarchitectural attacks             tion and removal of control-flow side channel attacks,”
     with the GPU,” in IEEE SP, 2018, pp. 195–210.                    in ICISC, 2006, pp. 156–168.
[27] C. P. García and B. B. Brumley, “Constant-time callees      [43] D. A. Osvik, A. Shamir, and E. Tromer, “Cache attacks
     with variable-time callers,” in USENIX Security, 2017,           and countermeasures: the case of AES,” in CT-RSA,
     pp. 83–98.                                                       2006.
[28] D. Genkin, L. Pachmanov, E. Tromer, and Y. Yarom,           [44] C. Percival, “Stronger key derivation via sequential
     “Drive-by key-extraction cache attacks from portable             memory-hard functions,” 2009.
     code,” in ACNS, 2018, pp. 83–102.                           [45] C. "Percival, “The scrypt password-based key derivation
[29] D. Gruss, C. Maurice, and S. Mangard, “Rowhammer.js:             function,” Internet Requests for Comments, RFC
     A remote software-induced fault attack in JavaScript,”           7914, August 2016. [Online]. Available: https://
     in DIMVA, 2016, pp. 300–321.                                     datatracker.ietf.org/doc/html/rfc7914



USENIX Association                                                                32nd USENIX Security Symposium         7123
[46] C. Reis, A. Moshchuk, and N. Oskov, “Site isolation:
     Process separation for web sites within the browser,” in
     USENIX Security, 2019, pp. 1661–1678.
[47] M. Schwarz, C. Maurice, D. Gruss, and S. Man-
     gard, “Fantastic timers and where to find them: High-
     resolution microarchitectural attacks in JavaScript,” in
     FC, 2017, pp. 247–267.
[48] A. Shusterman, A. Agarwal, S. O’Connell, D. Genkin,
     Y. Oren, and Y. Yarom, “Prime+Probe 1, JavaScript 0:
     Overcoming browser-based side-channel defenses,” in
     USENIX Security, 2021, pp. 2863–2880.
[49] L. Swirski, “Sparkplug — a non-optimizing javascript
     compiler,” https://v8.dev/blog/sparkplug, 2021.
[50] K. Thomas, J. Pullman, K. Yeo, A. Raghunathan, P. G.
     Kelley, L. Invernizzi, B. Benko, T. Pietraszek, S. Patel,
     D. Boneh et al., “Protecting accounts from credential
     stuffing with password breach alerting,” in USENIX Se-
     curity, 2019, pp. 1556–1571.
[51] S. van Schaik, A. Kwong, D. Genkin, and Y. Yarom,
     “SGAxe: How SGX fails in practice,” https://sgaxe.com/,
     2020.
[52] S. van Schaik, M. Minkin, A. Kwong, D. Genkin, and
     Y. Yarom, “CacheOut: Leaking data on Intel CPUs via
     cache evictions,” in IEEE SP, May 2021.
[53] P. Vila, B. Köpf, and J. F. Morales, “Theory and practice
     of finding eviction sets,” in IEEE SP, 2019, pp. 39–54.
[54] R. S. Wahby and D. Boneh, “Fast and simple constant-
     time hashing to the BLS12-381 elliptic curve,” TCHES,
     vol. 2019, no. 4, pp. 154–179, 2019.
[55] Y. Weiss and E. Kitamura, “Aligning timers
     with cross origin isolation restrictions,” https:
     //developer.chrome.com/blog/cross-origin-isolated-hr-
     timers/, 2021.
[56] Y. Yarom, “Mastik: A micro-architectural side-channel
     toolkit,” 2016.
[57] Y. Yarom and K. Falkner, “Flush+Reload: A high res-
     olution, low noise, L3 cache side-channel attack,” in
     USENIX Security, 2014.




7124   32nd USENIX Security Symposium                            USENIX Association
