This document is the threat model and deployment checklist for the sqrl-* gems. The
protocol-level requirements are enforced in sqrl-core; the items under "Deployment" are
the operator's responsibility.
SQRL replaces passwords with per-site Ed25519 key pairs derived from one master secret. A site never receives anything it could replay against another site, there is nothing to phish in the usual sense, and a breach of the site's database yields public keys only.
SQRL does not protect against malicious software on the user's own device, nor against a user who is tricked into authenticating a login page they did not open. The second case is the one the server-side design works hardest on; see "Login binding".
Every request to the SQRL endpoint goes through SQRL::Server::Handler#handle, which
checks, in this order and before any state change:
- The nut exists, has not expired, and has not been used. Consumption is atomic in every
store implementation (compare-and-set in memory,
UPDATE … WHERE used_at IS NULLin ActiveRecord,GETDELor Lua in Redis). - The form carries
client,serverandids;serverequals, byte for byte, the value this server issued for that nut (the originalsqrl://URL or the previous response). clientdecodes, declares a supported version, a known command and a 32-byteidk.idsverifies underidkoverclient || server; whenpidkis present,pidsmust be present and verify too.- The identity matches the one bound to this transaction (
BAD_ID_ASSOCIATIONotherwise). - The request IP equals the IP that requested the login page, unless the client sent
noiptest; a mismatch withoutnoiptestanswers a bareCOMMAND_FAILED. - The identity is not superseded by a re-key (
IDENTITY_SUPERSEDEDotherwise).
Only then is the command executed. urs is verified under the stored VUK (or the previous
identity's VUK during a re-key) for enable, remove and re-keying. All comparisons of
secrets and signatures are constant time.
On the client side (SQRL::Session and sqrl-client): TIF bits outside protocol version 1
abort the transaction; qry must be a server-relative path; the CPS url= and any
can= must point at the site's host over HTTPS; ask button URLs are forced onto the
site's origin. Plain HTTP is refused unless the caller opts into the loopback-only
insecure testing mode (see "Plain HTTP" below).
A pending login is created when a login page is rendered. Its id lives only in the browser's session cookie. The SQRL client never sees it; the nut maps to it server-side.
Completing a login requires one of two things:
- CPS (same device). The server hands the client a one-time, 32-byte random token in
url=; the client sends the browser there. The token is claimed exactly once, expires aftercps_token_ttl(60 s), and must belong to the pending login in that browser's session. A token stolen from one browser cannot log in another. A login the client flaggedcpsis never completed through the poll below: the specification says the server "MUST NOT authenticate the browser session" in that case, because the page that showed the login link may be a spoof. Only the browser the client redirects to the token gets in. - Poll (other device). The browser's script polls a cookie-bound status endpoint. The
pending login completes once, from the browser that owns it. The protocol's own IP check
applies (
require_ip_match: a client whose IP differs from the browser's is refused unless it sendsnoiptest). The pending login also records whether the IPs matched (ip_matched); the optionalpoll_requires_ip_match: truerefuses poll completions when they did not, which blocks a relayed-QR attack against anoiptestclient but also blocks legitimate phone logins from another network. It is off by default.
Unknown identities follow on_unknown_identity: :create an account (SQRL's default
story), :link to the already signed-in user, or :refuse.
The three store interfaces (NutStore, IdentityStore, PendingLoginStore) carry the
single-use guarantees. Implementations must make consume and claim_cps_token atomic
under concurrency; the shared store-contract spec in sqrl-core exercises exactly that.
The in-memory stores are for development and tests only: they are per process and lose
every association on restart.
- Set
hostexplicitly in production. It is the string every identity key is derived from; a change (or a spoofedHostheader) breaks or misdirects associations. - Serve the site over HTTPS. SQRL URLs are always
sqrl://, which means HTTPS; the gems never derive a scheme from the request. - Use a persistent, atomic store (ActiveRecord, Redis, or an
ActiveSupport::Cachestore with atomic delete). Never the memory stores. - Keep
require_ip_matchon (it is the protocol's check). Turnpoll_requires_ip_matchon only if your users log in from the same network as their browser. - Prune: run
sqrl:prune(Rails) orHandler#prune!regularly, or setprune_every. - Rate-limit the login page and the SQRL endpoint (
before_issue/before_handlehooks, Railsrate_limit, or Rack::Attack). Each login page view creates a nut and a pending login. - The SQRL endpoint is exempt from CSRF protection by design (it is authenticated by signatures). Keep every other route protected.
- When a user's identity requested
sqrlonlyorhardlock, disable password login and password recovery for that account (see the Rails and Devise guides). The client sends these flags because the user asked for them. - Log protocol failures (TIF values are safe to log); never log nuts, tokens,
server=echoes or key material. The gems'inspectoutput is redacted for that reason.
Final SQRL has one scheme, sqrl://, and it means HTTPS. Early drafts also had qrl://
for plain HTTP; that was dropped, and GRC's client does not honour it. The gems keep a
loopback-only testing mode for the browser extension's local flow: insecure_http: true
on the server (issues qrl:// for localhost/127.0.0.1 only, logs a warning, refuses any
other host) and insecure: true on the client. Nothing enables it implicitly. The example
applications and the integration suite run over HTTPS with a self-signed certificate.
Security issues: open a private report to the repository owner rather than a public issue.