|
|
Subscribe / Log in / New account

TOTP authentication with free software

By Jonathan Corbet
April 14, 2023
One-time passwords (OTPs) are increasingly used as a defense against phishing and other password-stealing attacks, usually as a part of a two-factor authentication process. Perhaps the most commonly used technique is sending a numeric code to a phone via SMS, but SMS OTPs have security problems of their own. An alternative is to use time-based one-time passwords (TOTPs). The normal TOTP situation is to have all of the data locked into a proprietary phone app, but it need not be that way.

The TOTP approach is simple enough; it starts with a secret shared between the client and server sides. The algorithm used to generate an OTP starts by looking at the current time, usually quantized to a 30-second interval. That time is combined with the secret, hashed, and used to generate a six-digit code that is used as the password. Both the client and server sides will generate a code at authentication time; if the client can provide the same code that the server calculates, then authentication succeeds. The code can only be used once and, in any case, is only valid for a short period.

TOTP can thus be used to prove possession of the shared secret at a specific point in time. It is convenient because it requires no special hardware; anything with a CPU and an accurate clock can generate a TOTP. On the client side, one program can be used to manage TOTPs for any number of sites. Users tend to default to proprietary phone apps like Google Authenticator, but there are some clear downsides to doing so. Among those are the unwise nature of trusting proprietary code with identity information and the pain that comes with losing the device running the app. In the free-software world, there should be a better way.

TOTP apps

A quick look on F-Droid turns up a number of free TOTP apps. Your editor gave two of them a try.

Editor's note: unfortunately, there are no screenshots of these apps, for the simple reason that they both (reasonably) set the Android flag that prevents screenshotting, and even the scrcpy tool cannot overcome that anymore. Rather than inflict ugly photographs on readers, we'll refer you to the web sites for the apps, which do have screenshots.
The first of those is Aegis, a fairly complete app for TOTP authentication. At the outset, Aegis wants to configure authentication — to the app itself. TOTP secrets are stored encrypted and are not accessible without providing a password to the app every time it starts. Aegis can also use the fingerprint sensor for authentication, which speeds the process considerably, but it will annoyingly ask for the password anyway sometimes ("so you don't forget it"), usually when the user is in a hurry to log in somewhere and get something done.

TOTP secrets are arbitrary base32 strings and, thus, not much fun to type on a handset keyboard. Happily, most sites implementing TOTP have the ability to generate a QR code with the secret, and Aegis can use the camera to read them. As a result, adding new sites is easily done.

By default, Aegis will show a screen with all known sites, displaying the current OTP for each. Tapping on a given site will copy the code for pasting into a form somewhere else. It is possible to assign sites to groups, providing a single level of organization that can be useful when the number of sites gets large. There are also facilities for searching for sites, but if that is required just to obtain an access code the usability battle has already been lost.

Aegis has various features for importing and exporting of its data. The import screen is a wonder to behold, with support for a large number of other apps. There are a few formats available for export, including an Aegis-specific JSON format and plain text. The export file will be encrypted unless the user taps past a couple of warnings about how dangerous that can be — and another warning that an unencrypted export has been made endures on the main screen.

Another popular TOTP app is FreeOTP+, which is a fork of the FreeOTP app originally released (under the Apache2 license) by Red Hat. Superficially, FreeOTP+ is similar to Aegis, in that it presents a screen full of known accounts. It does not actually display the code for any given account until it has been tapped on, though. This app seemingly does not encrypt its secrets data; it can be configured to require authentication at startup before providing any codes, but does not do so by default.

Like Aegis, FreeOTP+ can read TOTP secrets from a QR code, easing the process of setting up new sites. The import and export options for FreeOTP+ are more limited than those supported by Aegis, but they will suffice to get data into or out of the app. There is no support for organizing accounts into groups. In the end, FreeOTP+ comes across as being less well developed than Aegis but, in truth, it is more than good enough to get this simple job done.

TOTP on the desktop

Authenticator apps are convenient, but some of us still use real computers and often want to access sites that way. Your editor, unlike his offspring, does not have a phone surgically implanted, so logging into a site can lead to a scramble to figure out where the damn phone is so that the code can be produced. It sure would be nice to be able to generate the code directly on the system that is used to access a site.

The pass password manager has a number of nice features, including its command-line orientation, use of GnuPG, and use of Git to store password information. It turns out that there is also an extension called pass-otp that can be used to generate TOTP codes for a site. Once the extension is installed, using it is just a matter of adding an otpauth://totp/ line to the file for the site in question; this line is most easily obtained from a plain-text export from one of the above-mentioned apps.

The new line can be anywhere in the file, so it can coexist with the existing (reusable) password that must be the first line. The pass otp command will generate the code at any given time, likely requiring the entry of the user's GnuPG key passphrase to do it; there is an option to copy it to the clipboard for easy pasting into a web form. One thing pass otp lacks is an indication of how long the generated code will be valid.

[KeePassXC] Pass provides everything that many of us need, but for people who are more graphically inclined, KeePassXC can also manage TOTPs. Enabling TOTP for a site is a matter of going into the edit screen, hitting "Advanced", then entering the otpauth://totp/ line in the provided place. After that, the application will show a little clock face that, when clicked on, will calculate and show the code. The application's documentation recommends storing TOTP data in a separate database from the one containing passwords, "possibly even on a different computer". Your editor would guess that this advice is not often followed.

Summary

Given the number of options available, there is almost no reason to use a proprietary TOTP app if one does not want to. Using free-software for this purpose makes TOTP authentication available on more systems and allows the user to keep the sensitive identity information under their own control. The ease of backing up data from these applications and importing it into to others means that the loss of a phone need not cause the loss of access to important accounts on the net. This is one area where free-software users are well provided for.



to post comments

TOTP authentication with free software

Posted Apr 14, 2023 16:50 UTC (Fri) by mbunkus (subscriber, #87248) [Link] (3 responses)

A very nice article. Thanks.

I've been a very satisfied Aegis users for several years now. Two additions to the points you already made:

1. Yes, Aegis will ask for the password from time to time. While I consider it annoying, the screen asking for the password also contains a link you can click to log in with biometrics this time, effectively bypassing the password question. Next time you open Aegis, it will ask for the password again, of course, but still allowing you to bypass with another click on said link. This is quick enough for me for the situations in which I don't have the patience to enter the full password, making this a nag, not the end of the world.

2. The search function is really nice to have. I've accumulated over 70 entries (personal & work combined), and even though I'm very good and naming all entries consistently, searching is often times still a lot faster than scrolling. Don't knock it 'til you've drowned in tokens 😁

FreeOTP+ is an app that I haven't used myself, but I have colleagues that like & endorse it a lot.

Last but not least if anyone is curious what type of bad things a lot of other TOTP apps do & why you should use OSS ones such as the two tested here, there's a nice video from Naomi Brockwell on this topic from about a month ago that includes an interview with security researchers which tested some of the extremely popular ones such as Microsoft's TOTP app and Authy. Both Aegis & FreeOTP+ are recommended in said video, both by the researchers as well as by Naomi, due to not including any kind of tracking among other things. If you're interested: https://youtu.be/JHIAIzOPz3I

TOTP authentication with free software

Posted Apr 14, 2023 18:59 UTC (Fri) by jkingweb (subscriber, #113039) [Link] (2 responses)

> Yes, Aegis will ask for the password from time to time. While I consider it annoying, the screen asking for the password also contains a link you can click to log in with biometrics this time, effectively bypassing the password question.

The prompt can also be disabled altogether in the "Security" section of its settings.

TOTP authentication with free software

Posted Apr 14, 2023 19:02 UTC (Fri) by mbunkus (subscriber, #87248) [Link] (1 responses)

Ooooh I hadn't been aware of that. The last time I looked for such an option was quite some time ago. Maybe it was added somewhat recently? Or I've just been blind, which is totally a possibility.

TOTP authentication with free software

Posted Apr 20, 2023 11:49 UTC (Thu) by jsegitz (subscriber, #102650) [Link]

yes, it's a rather recent addition. I ran into this when I switched to Aegis and they changed it shortly afterwards

oathtool, anyone?

Posted Apr 14, 2023 17:56 UTC (Fri) by somlo (subscriber, #92421) [Link] (5 responses)

for those grumpy, command-line wielding types among us? :)

oathtool, anyone?

Posted Apr 14, 2023 19:04 UTC (Fri) by brunowolff (guest, #71160) [Link]

I use oathtool with Office 365 at work. I have a hard token as a backup, as one time oathtool
stopped working. (My theory on that is that Microsoft was tracking time skew for that entry and when I fixed the time skew I was too far away from what Microsoft had for it to work and no easy way to discover what value they might have had for the skew.) Currently if you have multiple entries of this type set up, codes are checked against each of them, so I don't need to indicate whether I'm using oathtool or my backup hard token when supplying a code.

oathtool, anyone?

Posted Apr 14, 2023 19:35 UTC (Fri) by dskoll (subscriber, #1630) [Link] (1 responses)

I second the oathtool suggestion. I keep my TOTP secrets in an encrypted file system, and have a little Perl wrapper that I use when I need to respond to a challenge. Way more convenient than hunting down my phone.

oathtool, anyone?

Posted Apr 15, 2023 4:39 UTC (Sat) by pabs (subscriber, #43278) [Link]

That sounds almost exactly the same as pass + pass-otp, except with an encrypted filesystem instead of OpenPGP encryption. It might be worth adding support for the encrypted filesystem option to pass.

oathtool, anyone?

Posted Apr 15, 2023 8:40 UTC (Sat) by rcampos (subscriber, #59737) [Link]

Use bash-otp

oathtool, anyone?

Posted Apr 16, 2023 12:08 UTC (Sun) by gbailey (subscriber, #58) [Link]

Another command-line tool I like is gauth (https://github.com/pcarrier/gauth), a self-contained go executable that just prints the TOTP for a list of secrets stored in a protected (and optionally encrypted) csv file.

TOTP authentication with free software

Posted Apr 14, 2023 19:05 UTC (Fri) by flussence (guest, #85566) [Link] (3 responses)

I've used almost all of these (except KeePass). A properly configured pass-otp with passff in the browser makes this stuff effortless - except for Google's nonstandard login flow which breaks password autofill. But that's arguably a good thing, as it prevents their services becoming too easy to fall into…

I used to use Aegis on my phone until they replaced the straightforward QR code scanner with some horrific "machine learning" bloat that caused the entire device to grind to a halt and OOM on every attempt to use it. They seemed quite proud of that despite many users' protests, so I went to FreeOTP+ and never looked back.

TOTP authentication with free software

Posted May 4, 2023 12:48 UTC (Thu) by alexbakker (guest, #164910) [Link] (2 responses)

> I used to use Aegis on my phone until they replaced the straightforward QR code scanner with some horrific "machine learning" bloat

Aegis does not and has never used "machine learning" for scanning QR codes.

TOTP authentication with free software

Posted May 9, 2023 12:56 UTC (Tue) by hummassa (subscriber, #307) [Link]

And there shouldn't be any reason to...

TOTP authentication with free software

Posted May 24, 2023 19:04 UTC (Wed) by flussence (guest, #85566) [Link]

I retract that statement then.

It may have been prompted by various comments in https://github.com/beemdevelopment/Aegis/issues/802 , alongside the fact that opening up the QR scanner reliably caused my phone to freeze and reboot.

TOTP authentication with free software

Posted Apr 14, 2023 19:38 UTC (Fri) by huntears (subscriber, #160524) [Link] (6 responses)

I currently use Bitwarden for all my 2FA codes which is really handy, it just puts it in my clipboard when I autofill password and I can just get the OTP by just clicking one button if I don't need to autofill the password.
It also allows me to selfhost an instance which allows me to sync all my 2FA codes over multiple devices including computers.

TOTP authentication with free software

Posted Apr 14, 2023 22:00 UTC (Fri) by denials (subscriber, #3413) [Link] (5 responses)

I've used BitWarden, and it's very user friendly. But BitWarden code falls under one of two licenses: GPL 3.0, and the BitWarden 1.0 license (used for "commercial modules").

I strongly suspect the BitWarden 1.0 licensed code doesn't qualify as free software. I haven't delved deeply enough into the code base to determine how crucial that code is to the app overall.

It also requires contributors to sign a CLA agreeing to assign their copyright to BitWarden Inc., which is heavy handed, although the CLA does grant a broad license back to the contributor.

TOTP authentication with free software

Posted Apr 19, 2023 23:38 UTC (Wed) by gdamjan (subscriber, #33634) [Link] (4 responses)

There's also Vaultwarden (previously bitwarden_rs), which is AGPL-3.0

https://github.com/dani-garcia/vaultwarden

TOTP authentication with free software

Posted Apr 24, 2023 7:14 UTC (Mon) by hickinbottoms (subscriber, #14798) [Link] (3 responses)

There is, but that is an implementation of the server component (API) only. You still end up needing a client, such as the official Bitwarden browser plugins or phone apps. I think most of the service smarts are sadly in the client.

TOTP authentication with free software

Posted Apr 24, 2023 10:35 UTC (Mon) by zdzichu (subscriber, #17118) [Link] (2 responses)

For VaultWarden all you need is just a plain web browser as a "client". Am I missing something?

TOTP authentication with free software

Posted Apr 25, 2023 6:35 UTC (Tue) by hickinbottoms (subscriber, #14798) [Link] (1 responses)

It's been a while since I used it but I believe you either point that web browser at Bitwarden's web site (in which case you wouldn't be using your self-hosted Vaultwarden server), or use a browser plugin/extension which, while you can point it to your Vaultwarden instance, I believe the only such plugins are the ones from Bitwarden. The other option is a mobile phone client app. That still seems true according to their project introduction paragraph (https://github.com/dani-garcia/vaultwarden).

The Bitwarden clients do seem to be free software (https://github.com/bitwarden/clients/tree/master/apps/bro... and https://github.com/bitwarden/mobile).

TOTP authentication with free software

Posted Apr 25, 2023 7:17 UTC (Tue) by zdzichu (subscriber, #17118) [Link]

Vaultwarden's list of features starts with:

Vaultwarden implements the Bitwarden APIs required for most functionality, including:
- Web interface (equivalent to https://vault.bitwarden.com/)
[…]

In my experience, using Vaultwarden's web interface one can organise, create, see and copy all the credentials. It is usable without any other clients, mobile apps or browser extensions. They may provide some additional features (like autofill? I'm not sure), but Vaultwarden is certainely usable with a web browser only.

TOTP authentication with free software

Posted Apr 14, 2023 19:52 UTC (Fri) by jhoblitt (subscriber, #77733) [Link] (6 responses)

Are their any open hardware "key fobs" that support NFC yet? I am still using an old yubikey for TOTP as it is usable for both desktops via USB and android via NFC.

TOTP authentication with free software

Posted Apr 15, 2023 1:47 UTC (Sat) by NYKevin (subscriber, #129325) [Link] (2 responses)

The economics are difficult here. Any device you use as a means of authentication needs to be both designed and manufactured by people or companies you trust. Open hardware does help with trusting the design (at least to a point), but that's useless if you have an insecure supply chain (they can just backdoor it at the factory). My employer (Google) was able to set up their own trusted supply chain (and the resulting "Titan" keys are both used internally and sold to the public*), but as far as I can tell, they're not open hardware. Unfortunately, I don't know of anyone in this space who is manufacturing open-hardware keys *and* has a plausible "our keys are not backdoored at the factory" story *and* is available at retail to "normal people." I'm not sure the market is able to support that niche.

* Fair warning to prospective buyers: Titan keys are compatible with WebAuthn/FIDO/U2F/whatever-we're-calling-it-this-week, but they are intentionally incompatible with TOTP and similar OTP-based protocols, because OTPs are insufficiently phishing-resistant (in comparison to WebAuthn/etc.). So don't buy a Titan key expecting it to replace your TOTP app.

TOTP authentication with free software

Posted Apr 17, 2023 6:07 UTC (Mon) by smurf (subscriber, #17840) [Link] (1 responses)

*Sigh*. Another case of "no security is better than not-strong-enough security"?

There's lots of sites out there that support TOTP but not (yet?) WebAuthn.

TOTP authentication with free software

Posted Apr 17, 2023 16:26 UTC (Mon) by NYKevin (subscriber, #129325) [Link]

From Google's perspective, that's totally irrelevant. The by-design purpose of these keys is for Google employees to log into google.com with their corporate accounts, and OTPs are strictly prohibited for that purpose because they are vulnerable to phishing. The fact that the keys can also be sold to the general public is a bonus.

TOTP authentication with free software

Posted Apr 15, 2023 5:37 UTC (Sat) by dxld (subscriber, #90530) [Link] (2 responses)

I use a SoloKey (https://solokeys.com). Open hardware, free software and the v2 has NFC support. One problem I've had is that my bank refuses to allow provisioning anything other than a Yubikey but that's a fault of the spec.

I just saw that Nitrokey 3 also uses the same Rust based firmware as the Solo v2 so that could also be worth a look.

TOTP authentication with free software

Posted Apr 15, 2023 18:42 UTC (Sat) by NYKevin (subscriber, #129325) [Link]

> my bank refuses to allow provisioning anything other than a Yubikey but that's a fault of the spec.

I disagree. This is a fault of your bank. You should complain to them.

The spec allows the remote site to restrict keys on the basis of manufacturer, so that employers can force employees to use keys that were provisioned by the employer (usually on the basis of "we don't trust anyone else's supply chain" and/or "we have agreed to comply with [spec], and [spec] says our security keys have to [satisfy some arbitrary requirement]"). It is not intended to function as a general-purpose security boundary for public log-ins, and your bank shouldn't be deploying it in that way.

TOTP authentication with free software

Posted Apr 17, 2023 6:14 UTC (Mon) by smurf (subscriber, #17840) [Link]

Consider yourself lucky. Banks hereabouts support their own harebrained "secure" apps, requiring non-rooted "secure" phones, or sell their own more-or-less-broken hardware.

At the same time, most still allow you to use a simple keyfile, locally encrypted with whichever password you choose, if you ask them nicely and promise that the file is on an encrypted stick and your network is firewalled off and all that.

Bottom line, their threat model is severely out of touch with reality.

TOTP authentication with free software

Posted Apr 14, 2023 20:14 UTC (Fri) by hjb (subscriber, #25523) [Link]

Just a few days ago I installed otpclient which is a free desktop application that does its job well. When clicking on an entry it copies the OTP to the clipboard. It can also import the data from FreeOTP+. I leave it permanently running in some dark corner on the 8th virtual screen.

TOTP authentication with free software

Posted Apr 14, 2023 20:26 UTC (Fri) by mss (subscriber, #138799) [Link]

For pass(1) there exists a multi-platform GUI called QtPass.

It also supports the pass-otp extension and QR code generation (but it has no TOTP QR code recognition capability yet).

TOTP authentication with free software

Posted Apr 14, 2023 22:54 UTC (Fri) by kop316 (guest, #152169) [Link] (2 responses)

Numberstation and GNOME Authenticator are also very good TOTP/HOTP apps for Linux:

https://sr.ht/~martijnbraam/numberstation/

https://gitlab.gnome.org/World/Authenticator

TOTP authentication with free software

Posted Apr 15, 2023 5:59 UTC (Sat) by linmob (guest, #156617) [Link]

There's even more, e.g.,

- OTPClient github.com/paolostivanin/OTPClient
- Keysmith https://apps.kde.org/keysmith/

Reading this article and seeing the small number of desktop apps mentioned made me wonder whether I should bring LinuxPhoneApps to the attention of desktop users, too.
The apps relevant to this article can be found under https://linuxphoneapps.org/categories/multi-factor-authen...

TOTP authentication with free software

Posted Apr 15, 2023 14:23 UTC (Sat) by pothos (subscriber, #116075) [Link]

Also worth mentioning that the password manager app GNOME Secrets gained support for TOTP secrets, meaning you have password and 2FA stuff at one place which might be violating the principles but on the other hand it's also nice.

https://flathub.org/apps/details/org.gnome.World.Secrets

TOTP authentication with free software

Posted Apr 14, 2023 22:56 UTC (Fri) by NUXI (subscriber, #70138) [Link]

Here is another desktop TOTP app: https://github.com/yitsushi/totp-cli

TOTP authentication with free software

Posted Apr 15, 2023 4:24 UTC (Sat) by pabs (subscriber, #43278) [Link]

I note that for users of the pass tool, the browserpass WebExtension allows filling in TOTP fields in web browsers like Firefox. You do have to enable an option though, it doesn't do that by default.

https://github.com/browserpass/browserpass-extension/

TOTP authentication with free software

Posted Apr 15, 2023 4:44 UTC (Sat) by pabs (subscriber, #43278) [Link] (10 responses)

I wonder when TOTP will be fully obsoleted by WebAuthn passkeys and hardware tokens. When that happens there are a few projects that could lead to FOSS/FOSSish WebAuthn passkeys. Probably the FOSS OpenPGP key hardware could also run FOSS WebAuthn stuff too.

https://github.com/bulwarkid/virtual-fido
https://github.com/psanford/tpm-fido
https://git.kernel.org/pub/scm/linux/kernel/git/jejb/fido...
https://news.ycombinator.com/item?id=33943008

TOTP authentication with free software

Posted Apr 15, 2023 10:44 UTC (Sat) by mbunkus (subscriber, #87248) [Link] (9 responses)

I'm pretty sure that the "when" is "never". For one, looking at my list of TOTP-enabled websites I have zero trust they're all going to upgrade. For some I seem to have to be extremely grateful they've decided to implement any type of 2FA after quite a long time. Tech dinosaurs simply won't die out.

Second, WebAuthn has the serious disadvantage of requiring additional hardware whereas TOTP can be installed for free on any existing device. It's a hurdle a lot of people aren't going to want to take.

TOTP authentication with free software

Posted Apr 15, 2023 11:14 UTC (Sat) by Wol (subscriber, #4433) [Link] (1 responses)

At work, I'm not sure what it's called, but we have a biometric (fingerprint) authorisation app on our phone. Simples.

And to prevent "exhaustion" attacks (where the attacker just tries repeatedly until the victim gives in), the login screen displays a number that has to be typed in to the phone along with the fingerprint. I *hope* that the authorisation app refuses to deal with subsequent requests until the first one has been processed, so if the victim simply ignores their phone the attack is blocked.

Cheers,
Wol

TOTP authentication with free software

Posted Apr 15, 2023 12:05 UTC (Sat) by tialaramex (subscriber, #21167) [Link]

One (but I'm not sure if the only) way to do this is effectively equivalent to WebAuthn.

In WebAuthn, our "Relying Party ID" is a DNS name under an eTLD, so e.g. "customer-login.bigcorp.example"

With the custom phone biometric APIs they're both doing the same thing but the Relying Party ID is some arbitrary app-specific platform value so e.g. maybe it's "android::example.bigcorp.auth-app-1234"

So you can use the same backend code for all of them by making this a parameter, the web code passes "customer-login.bigcorp.example", the Android code checks that android ID, the iOS code does the same for Apple's

So long as all these IDs are designed so you can't e.g. make an iPhone app that has the same rpIDs as google.com, or an Android app owned by you which mimics Apple apps from somebody else, which I believe was easy, this allows you to leverage the same technology for different applications.

For WebAuthn the phone operating systems have to actually bless a browser to let it pick rpIDs, if it betrays you it could cause serious problems. On iOS this is not a big deal because there's really only one browser, Apple's, but on Android phone vendors, Mozilla, and Google all ship browsers, so they're all blessed specially. Mozilla actually needs to get each release build of Firefox blessed by Google (as de facto Android OS owner) to make this work. For non-WebAuthn, they just lock every app down to only get the single rpID that relates to its own unique ID.

This means "Addictive New Game" on your phone can't add a "fun" challenge where you perform biometric authentication and it sends them to bad guys, since all authentications it performs have a unique rpID for the game and that's not an rpID that anybody else has any reason to trust.

TOTP authentication with free software

Posted Apr 15, 2023 14:18 UTC (Sat) by Rigrig (subscriber, #105346) [Link] (4 responses)

WebAuthn is just an authentication protocol, it doesn't require hardware storage. For example the KeePassXC people are already working on supporting it: https://github.com/keepassxreboot/keepassxc/pull/8825
(Which is good, because keeping hardware-token backups for every site is not something I look forward to…)

I sadly agree that all sites upgrading is not going to happen, but I'm at least hopeful that it will improve things on the sites that *do*: WebAuthn should "just work" for auto-fill extensions, instead of having to detect login fields hidden in some javascript-of-the day framework mess.

TOTP authentication with free software

Posted Apr 15, 2023 20:52 UTC (Sat) by mbunkus (subscriber, #87248) [Link] (3 responses)

You're right, of course. I really didn't remember correctly what I read a couple of weeks ago about WebAuthn. I remedied that, and hopefully the following isn't completely wrong:

• WebAuthn is nice in principal, but has the serious drawback of being tied to a device. Multi-device WebAuthn (meaning you register one device & can authenticate on a different device) is in the works, or there are thoughts about it, but no real solution.
• That realization led to yet another development called Passkeys, which are authentication tokens that can be synced between devices (e.g. Google Chrome on your desktop & mobile devices will all use the same tokens). The huge drawback is that in order for it to work the actual authentication information isn't only stored on your devices but on with a third party (with Google Chrome: on Google's servers), meaning you have to trust those providers with your credentials.

What my point is in all of that is how it'll mesh with the vast majority of the population which simply is neither very tech-savvy nor security-conscious and oftentimes lazy. When I argued that the day will "never come", this is what I had in mind I fear that WebAuthn will never really gain traction with the general public because it's simply way too much hassle to implement compared to TOTP 2FA (the general public often enough doesn't even want to use that).

And for Passkeys my fear is that the general public will simply chose the most convenient implementation, which means that the vast majority of them will have their passkeys stored with Apple or Google, depending on the eco system they're part of. Furthermore if Chrome is the sync mechanism of choice in the Google world I question how other apps will gain access to synced Passkeys — on mobile via the embedded Chrome thingy or Play services or such, and on desktop? I have doubts.

Now us more tech-savvy people will probably like WebAuthn for its properties, rejoice about Passkeys & set up our own storage and sync solution. For the whole world as such I'm not optimistic that this shift is a net positive.

TOTP authentication with free software

Posted Apr 17, 2023 6:51 UTC (Mon) by Cyberax (✭ supporter ✭, #52523) [Link] (2 responses)

> meaning you have to trust those providers with your credentials.

You don't have to. The cloud sync service can use opaque blobs encrypted by the key you enter locally. I believe that's how Apple's implementation works, it just rides on top of Keychain synchronization that is encrypted by your iCloud password in the cloud.

TOTP authentication with free software

Posted Apr 17, 2023 7:19 UTC (Mon) by zdzichu (subscriber, #17118) [Link] (1 responses)

That would require trusting Apple's proprietary OS not to send local key to the mothership.

JK, there are limits to paranoia.

TOTP authentication with free software

Posted Apr 17, 2023 16:53 UTC (Mon) by Cyberax (✭ supporter ✭, #52523) [Link]

There are several OpenSource password managers working on Passkeys. I believe, the requisite API in Android will land in the next version around mid-summer. iOS is on a similar timetable.

TOTP authentication with free software

Posted Apr 15, 2023 22:38 UTC (Sat) by MarcB (guest, #101804) [Link]

In some industries this could happen relatively fast. Phishing kits able to bypass TOTP, even in untargeted mass phishing, are a thing nowadays. So TOTP is already partially failing the most relevant use-case (for us) and the cost-benefit-ratio should soon become smaller than 1.

It will still protect against credential stuffing, it can still partially compensate for weak passwords, but that is about it. On the negative side, there is the complicated and expensive reset process.

A proper authentication system absolutely must enforce two-way authentication. This is a lesson we supposedly learned decades ago, yet we are still deploying a solution were one part of the authentication literally is "the users must ensure that they are entering their credentials on the correct web page".

TOTP authentication with free software

Posted Apr 15, 2023 23:47 UTC (Sat) by pabs (subscriber, #43278) [Link]

As my comment implied and the other comments said, it is incorrect that WebAuthn requires hardware. You can use virtual-fido to get a fully software-only solution, however if websites require attestation then you won't be able to use those. However, because of how Big Tech are doing passkeys, websites probably won't require attestation.

The worst thing about WebAuthn for me is that authenticating with a website *requires* that you have JavaScript enabled because there is simply no common HTTP based protocol/headers for that. That may eventually be defined, but in the interim, folks who don't run JavaScript are going to need to reverse engineer every website and write a WebExtension that does the authentication protocols for them.

TOTP authentication with free software [Other desktop and Commandline Tools]

Posted Apr 15, 2023 14:49 UTC (Sat) by jejb (subscriber, #6654) [Link]

I use this on the command line:

https://www.nongnu.org/oath-toolkit/

It's available on every distribution as a simple install. Its oathtool can generate both HOTP and TOTP verification. It requires the secret on the command line, so I tend to script its use (remembering to secure the script location). For HOTP, you have to implement your own counter system, but this is the one I use:

#!/bin/bash
count=`cat $HOME/.rhcounter`
oathtool --hotp -c $count -b <secret>
count=$[$count+1]
echo $count > $HOME/.rhcounter

HOTP is annoying in that if you use the above script *and* a phone app, you have to keep them in sync.

For we pages, if you use Nextcloud, the passman password manager has the ability to store TOTP (but not HOTP) secrets and make them available on the web page (it can't recognize a TOTP request, like it can a password request, so it's mostly cut and paste)

TOTP authentication with free software

Posted Apr 15, 2023 17:28 UTC (Sat) by mb (subscriber, #50428) [Link] (1 responses)

The good thing about TOTP is that the algorithm is so simple that it's possible to implement it in just a couple of lines of Python code.
There's no reason to use or trust any proprietary app, if you can write the TOTP tool yourself or if you can review an open source application's TOTP implementation.

I integrated TOTP into my password manager tool a couple of years ago:
https://bues.ch/cgit/pwman.git/tree/libpwman/otp.py
I use that daily and it works flawlessly for me.

TOTP authentication with free software

Posted Apr 16, 2023 4:56 UTC (Sun) by gutschke (subscriber, #27910) [Link]

Not just a couple of lines of Python. Even in Javascript, it's easy to do. As a proof-of-concept, I implement TOTP in a bookmarklet, when Google first rolled it out as a 2FA. It's not particularly secure and I don't recommend doing this. But it works fine.

It's been years though and I lost the code. Shouldn't take long to reproduce if anybody gave it a try. Maybe, it's even easier these days. The biggest issue was that JavaScript lacked a small number of the required crypto primitives

The relevant xkcd

Posted Apr 16, 2023 15:15 UTC (Sun) by droundy (subscriber, #4559) [Link]

Regarding storing the two factor authentication secrets on a desktop computer...

https://m.xkcd.com/2677/

TOTP authentication with free software

Posted Apr 17, 2023 6:53 UTC (Mon) by tchernobog (guest, #73595) [Link]

I would like to add to the list Authenticator Pro: https://github.com/jamie-mh/AuthenticatorPro

I really like its import/export features and smooth appearance.

TOTP authentication with free software

Posted Apr 17, 2023 9:50 UTC (Mon) by madhatter (subscriber, #4665) [Link] (2 responses)

> The code can only be used once and, in any case, is only valid for a short period

The second part of that is true, but I'm not so sure about the first part. For HOTP OATH, the stored counter increments on successful authentication, so the code is implicitly non-reusable; for TOTP OATH, I don't think the protocol requires the authenticating site to keep a record of recently-used codes, so if a second attempt is made with the same code inside the configured window of code acceptability, I would expect it to succeed.

I tried it with one site that uses TOTP OATH, and a single code was indeed usable for two successive logins within a 30-second window.

TOTP authentication with free software

Posted Apr 17, 2023 14:17 UTC (Mon) by mricon (subscriber, #59252) [Link] (1 responses)

If you can use the same TOTP code twice within the same 30-second window, something is wrong and broken. This is expressly not allowed by the standard:

Note that a prover may send the same OTP inside a given time-step window multiple times to a verifier. The verifier MUST NOT accept the second attempt of the OTP after the successful validation has been issued for the first OTP, which ensures one-time only use of an OTP.

TOTP authentication with free software

Posted Apr 17, 2023 14:31 UTC (Mon) by madhatter (subscriber, #4665) [Link]

Well, that's me told! Thank you for that, though; I take it that's s5 of RFC6238 you're quoting?

I might drop a quick email to the provider who accepted the same code twice, though. Considering they're a big wheel in the internet infrastructure business, it's a bit poor that they've done that.

Push dual factor

Posted Apr 17, 2023 13:53 UTC (Mon) by Aissen (subscriber, #59976) [Link] (5 responses)

TOTP is nice and standard, but it's already being replaced in some places by push-based MFA, like Duo's, Google's or the one in Microsoft Authenticator.

AFAIU those aren't open source nor based on inter-operable protocols. I'm wondering if it isn't yet another domain where open source is falling behind.

Push dual factor

Posted Apr 17, 2023 13:59 UTC (Mon) by pizza (subscriber, #46) [Link] (1 responses)

> AFAIU those aren't open source nor based on inter-operable protocols. I'm wondering if it isn't yet another domain where open source is falling behind.

You're conflating _services_ with _software_. "Open Source" can only ever provide the latter, whereas multi-factor authentication is a _service_ that is itself bolted onto another service.

You or I could write the bestest MFA authentication system evar, and release it under the most liberal of F/OSS licenses, but unless service providers adopt and deploy it en masse, it might as well not exist for all the good it will do end-users.

Push dual factor

Posted Apr 18, 2023 8:24 UTC (Tue) by Aissen (subscriber, #59976) [Link]

> You're conflating _services_ with _software_. "Open Source" can only ever provide the latter, whereas multi-factor authentication is a _service_ that is itself bolted onto another service.

I'm talking about protocols and software. Whether services use any of the two is orthogonal. I'm saying there are neither right now. If I want an MFA solution for my org that has mobile push notifications, there is neither an open protocol one, nor open clients and servers.

Otherwise I agree with your points about the biggest identity providers having the most power. Doesn't mean there can't be alternatives.

Push dual factor

Posted Apr 17, 2023 15:03 UTC (Mon) by MarcB (guest, #101804) [Link] (2 responses)

MFA essentially is not a software problem. Software is the smallest part of a MFA service and even then most of the software work is integration into the existing infrastructure. So Open Source doesn't really offer much here, but also is not really falling behind.

The major problems of MFA are convenience of usage and recovery. TOTP really sucks at recovery. To provide some numbers: our worst-case costs are ~3-6€ per case, depending on market.

If you can simply tie your MFA to another account that is worth a lot.

Push dual factor

Posted Apr 18, 2023 8:26 UTC (Tue) by Aissen (subscriber, #59976) [Link] (1 responses)

I agree, MFA implementation cost could be dominated by support costs; and that's for organizations to solve.
But I was just lamenting the lack of push-based open (even partial) solutions.

Push dual factor

Posted Apr 18, 2023 18:15 UTC (Tue) by MarcB (guest, #101804) [Link]

They exist, https://unifiedpush.org/, for example. But the same applies: Software is the smallest part of the problem and relatively uninteresting.

The huge advantage of using a service operate by "someone else" for your MFA is, that "someone else" has to deal with the tricky parts of MFA(*). Open Source will never be able to compete with that. The value is in the complete service i.e. software + infrastructure + support processes (in reverse order of cost).

(*) Obviously you become depended one "someone else", but it might be a good deal for a while.

TOTP authentication with free software

Posted Apr 17, 2023 17:46 UTC (Mon) by patrakov (subscriber, #97174) [Link]

I use a browser extension: https://authenticator.cc

It stores data encrypted if the encryption password is set, and on Chromium with keys, synchronizes the secrets using Google as the intermediary. Also, it can scan QR codes from the screen.

TOTP authentication with free software

Posted Apr 19, 2023 17:47 UTC (Wed) by vjanelle (subscriber, #44943) [Link]

https://github.com/mattrubin/Authenticator

Matt Rubin's authenticator for ios is OSS, and stores the tokens in encrypted iphone backups so you can migrate them between devices if necessary.

TOTP authentication with free software

Posted Apr 24, 2023 1:13 UTC (Mon) by ssmith32 (subscriber, #72404) [Link] (1 responses)

For the paranoid, or the those with a little extra free time, the TOTP RFC actually has fully functional BSD licensed code at the bottom.

https://www.rfc-editor.org/rfc/rfc6238

Years ago I was writing up a TOTP client for whatever reason, and was slowly working through, reading the RFC and typing out code snippets as I went.. then I got to the bottom, and realized I can just copy and paste it in.

Imagine my joy when my code was in sync with Google's authenticator on the first run! (The only way I could think if verifying it was to load the key into both apps..)

Given the code in the RFC. It's definitely a nice "straightforward, eminently doable, but genuinely useful" project to work on. Surprised there aren't more examples.

Of course, kind of transitioning to Yubikeys wherever I can now, but there's something to be said for running code you actually understand, with respect to security..

Let alone not understanding the code, I actually didn't realize PINs were optional in non-BIO Yubikeys, which was sort of disconcerting.. With TOTP, I like that someone can't just steal my phone, and simply plug it in as the second factor, which you could do with a non-BIO one.

TOTP authentication with free software

Posted Apr 24, 2023 11:20 UTC (Mon) by farnz (subscriber, #17727) [Link]

Yubikeys without PINs make sense to me; a PIN is just a password, and when I'm using the Yubikey as a second factor, I've already entered one password (the account password) to get access. A second password is not materially harder for the attacker to get hold of than the first password; whereas keeping my Yubikey on my keyring with my house keys etc means that I'm going to be aware very early on that the Yubikey has been lost or stolen, and go to get my backup key out of the safe.

TOTP authentication with free software

Posted Apr 27, 2023 12:41 UTC (Thu) by turistu (guest, #164830) [Link]

The TOTP algorithm is trivial and could be implemented in a couple of javascript lines.

And no, that wouldn't have been much bigger even if I had to implement the HMAC/SHA1 by hand instead of using the browser's API.

There's actually no reason to use any extra "app" at all, open source or proprietary. This is an example where a problem (and a market for solving it) was artificially created.

Substituting open/standard TOTP authenticators for proprietary apps

Posted Apr 27, 2023 21:44 UTC (Thu) by moxfyre (guest, #13847) [Link] (1 responses)

Behind the scenes, many proprietary/closed-source authenticator apps are actually based on TOTP.

The Symantec VIP Access app is a rather commonly-deployed example of such: many companies require their employees to use it for 2FA for access to VPNs and other corporate systems.

Symantec VIP Access turns out to be entirely based on standard TOTP. This means that if you can intercept the TOTP secret/key from the HTTPS-based provisioning process, you can use it with a standard TOTP-based authenticator app. Happily, we’ve known how to do this since ~2014, when the Symantec VIP Access provisioning process was first studied and reimplemented in Python.

I'm now the maintainer of python-vipaccess, which will allow you to provision a Symantec VIP Access soft-token using a simple command line tool. If you need to use Symantec VIP Access but don't want to use the proprietary app, simply run python-vipaccess as follows to provision and test a new soft-token. Then take the otpauth:// URL from the output and load it into any TOTP authenticator app (perhaps via QR code), and register the credential ID with whatever company is telling you to use Symantec VIP Access for 2FA:

$ vipaccess provision -p -t SYDC
Generating request...
Fetching provisioning response from Symantec server...
Getting token from response...
Decrypting token...
Checking token against Symantec server...
Credential created successfully:
	otpauth://totp/VIP%20Access:SYDC94595813?secret=HBRXYG6HH64VPFLMTSV57GSGGK6QY6I6&digits;=6&algorithm;=SHA1ℑ=https%3A%2F%2Fraw.githubusercontent.com%2Fdlenski%2Fpython-vipaccess%2Fmaster%2Fvipaccess.png.=30
This credential expires on this date: 2026-04-26T21:38:53.998Z

You will need the ID to register this credential: SYDC94595813

You can use oathtool to generate the same OTP codes
as would be produced by the official VIP Access apps:

    oathtool    -b --totp HBRXYG6HH64VPFLMTSV57GSGGK6QY6I6  # output one code
    oathtool -v -b --totp HBRXYG6HH64VPFLMTSV57GSGGK6QY6I6  # ... with extra information

It should be possible to reimplement other proprietary 2FA apps in a similar way. We have an outstanding feature request (issue #58) to do so for Fortitoken. Similar contributions would be most welcome :-)

Substituting open/standard TOTP authenticators for proprietary apps

Posted Apr 27, 2023 21:46 UTC (Thu) by moxfyre (guest, #13847) [Link]

Looks like some of the characters in the demo output here got XML-mangled, resulting in an invalid otpauth:// URI, but go ahead and test it out for yourself and it should create a functional URI.


Copyright © 2023, Eklektix, Inc.
This article may be redistributed under the terms of the Creative Commons CC BY-SA 4.0 license
Comments and public postings are copyrighted by their creators.
Linux is a registered trademark of Linus Torvalds