Page MenuHomePhabricator

FreeOTP refuses to add MediaWiki's 2FA details, because "token is unsafe"
Closed, ResolvedPublicBUG REPORT

Description

Steps to replicate the issue (include links if applicable):

  • Install FreeOTP on your phone (verified via an Android device)
  • From an OATH-enabled account, go to Special:OATHManage and enable TOTP-based 2FA
  • Scan the QR code on FreeOTP

What happens?:

FreeOTP claims that:

Token is unsafe!
The token you are attempting to add contains weak cryptographic parameters. Use of this token is strongly discouraged! Please alert your token provider.

What should have happened instead?:

FreeOTP adds the 2FA details and starts generating TOTPs.

Other information (browser name/version, screenshots, etc.):

I'd love to provide a screenshot, but FreeOTP's security policy prohibits me from taking one. The error message (verbatim) is provided above.

This is fairly important to fix on our side, as FreeOTP is high on the list of recommended apps in our official manual. This means users who are unfamiliar with TOTP apps are quite likely to land on FreeOTP specifically, and then be confused/discouraged by the warning they see.

Creating this ticket, as I was approached by @OJJ (a Czech Wikipedia checkuser) with a request for advice.

Event Timeline

@EMill-WMF For your awareness. This causes issues with the mandatory 2FA rollout we're currently working on. Would you mind flagging this to the appropriate subteam, please?

Reedy subscribed.

See also: https://github.com/freeotp/freeotp-android/issues/287

https://github.com/freeotp/freeotp-android/issues/287#issuecomment-1404846857

It looks like freeOTP requires that tokens have at least 128bit (26 base32 coded digis). Otherwise it is considered unsecure.
It would be very helpful to show this hint. 80 bits (16 base32 digits) were accepted before and are still by the ios app.

Change #1158541 had a related patch set uploaded (by Reedy; author: Reedy):

[mediawiki/extensions/OATHAuth@master] TOTPKey: Use 26 random bytes

https://gerrit.wikimedia.org/r/1158541

Might be worth bearing this (September 2023) comment from another GitHub issue in mind — I don't know whether/to what extent it's still an issue, but it seemed worth flagging here just in case:

https://github.com/freeotp/freeotp-android/issues/334#issuecomment-1711954232:

👋 GitHub PM for Identity here. We use an 80 bit secret for compatibility with Google Authenticator, which had a bug for a very long time around longer secrets. It's unclear if they've since fixed it since it was abandonware for so long - now that they've updated it to support sync, maybe they fixed that too.

Change #1158541 merged by jenkins-bot:

[mediawiki/extensions/OATHAuth@master] TOTPKey: Use 26 byte secret for increase security

https://gerrit.wikimedia.org/r/1158541

Change #1158585 had a related patch set uploaded (by Reedy; author: Reedy):

[mediawiki/extensions/OATHAuth@REL1_44] TOTPKey: Use 26 byte secret for increase security

https://gerrit.wikimedia.org/r/1158585

Change #1158586 had a related patch set uploaded (by Reedy; author: Reedy):

[mediawiki/extensions/OATHAuth@REL1_43] TOTPKey: Use 26 byte secret for increase security

https://gerrit.wikimedia.org/r/1158586

Change #1158587 had a related patch set uploaded (by Reedy; author: Reedy):

[mediawiki/extensions/OATHAuth@REL1_42] TOTPKey: Use 26 byte secret for increase security

https://gerrit.wikimedia.org/r/1158587

Change #1158588 had a related patch set uploaded (by Reedy; author: Reedy):

[mediawiki/extensions/OATHAuth@REL1_39] TOTPKey: Use 26 byte secret for increase security

https://gerrit.wikimedia.org/r/1158588

Change #1158587 merged by jenkins-bot:

[mediawiki/extensions/OATHAuth@REL1_42] TOTPKey: Use 26 byte secret for increase security

https://gerrit.wikimedia.org/r/1158587

Change #1158585 merged by jenkins-bot:

[mediawiki/extensions/OATHAuth@REL1_44] TOTPKey: Use 26 byte secret for increase security

https://gerrit.wikimedia.org/r/1158585

Change #1158586 merged by jenkins-bot:

[mediawiki/extensions/OATHAuth@REL1_43] TOTPKey: Use 26 byte secret for increase security

https://gerrit.wikimedia.org/r/1158586

Might be worth bearing this (September 2023) comment from another GitHub issue in mind — I don't know whether/to what extent it's still an issue, but it seemed worth flagging here just in case:

https://github.com/freeotp/freeotp-android/issues/334#issuecomment-1711954232:

👋 GitHub PM for Identity here. We use an 80 bit secret for compatibility with Google Authenticator, which had a bug for a very long time around longer secrets. It's unclear if they've since fixed it since it was abandonware for so long - now that they've updated it to support sync, maybe they fixed that too.

I tested this locally (with the increased token length) and I can add the account to both FreeOTP and Google Authenticator.

Thanks @Reedy for fixing this so quickly!

Change #1158588 merged by Gergő Tisza:

[mediawiki/extensions/OATHAuth@REL1_39] TOTPKey: Use 26 byte secret for increase security

https://gerrit.wikimedia.org/r/1158588

Reedy added a parent task: Restricted Task.Jun 24 2025, 8:35 PM
Reedy claimed this task.
Reedy renamed this task from FreeOTP refuses to add Wikimedia's 2FA details, because "token is unsafe" to FreeOTP refuses to add MediaWiki's 2FA details, because "token is unsafe".Oct 1 2025, 8:59 PM