Skip to content

2-Factor Authentication spec#610

Open
ValwareIRC wants to merge 1 commit into
ircv3:masterfrom
ValwareIRC:patch-22
Open

2-Factor Authentication spec#610
ValwareIRC wants to merge 1 commit into
ircv3:masterfrom
ValwareIRC:patch-22

Conversation

@ValwareIRC
Copy link
Copy Markdown
Contributor

Implemented and in use by ObsidianIRC and ObbyIRCd

vidya-2026-05-04_05.30.58.webm

Comment thread extensions/account-2fa.md

This specification adds the `draft/account-2fa` capability.

Servers advertising this capability accept the `2FA` command described
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

IRC grammar does not allow numbers inside of command names (with exception of numerics, which must be exactly 3 numbers). You need to pick a different command name. I suggest MFA since this could in theory be used for more than 2 factors as well with the introduction of biometric authentication types (e.g. passkeys).

Other aspects of this spec should be similarly edited to update "2fa" with the other chosen string for consistency.

Comment thread extensions/account-2fa.md

`<id>` values returned by `2FA LIST` and consumed by `2FA REMOVE` are
opaque ASCII strings, MUST contain only `A-Z a-z 0-9 - _`, MUST be at
most 32 characters, MUST NOT contain whitespace, and MUST be unique per
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

"MUST NOT contain whitespace" is superfluous as that is already forbidden by the specified set of allowed characters.

Comment thread extensions/account-2fa.md
account.

`<name>` values supplied by clients to `2FA ADD` are user-chosen labels.
They MUST contain only printable non-whitespace characters and MUST be at
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

"printable" is vague and there is no solid definition of that outside of the ASCII space. Specify precisely which characters are allowed here (or, more easily, which characters are forbidden and allow everything else)

Comment thread extensions/account-2fa.md
format as the corresponding step-up SASL mechanism (see [Two-Factor SASL
Flow](#two-factor-sasl-flow)). In particular:

* For `totp`, `<data>` is the 6-digit one-time password (no Base64).
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

"No base 64" is superfluous and should be removed.

Comment thread extensions/account-2fa.md

The server MUST reject the request with
`FAIL 2FA INVALID_CHALLENGE_RESPONSE` if the proof does not verify. This
prevents disabling 2FA with only the password.
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is already prevented because if 2-factor auth is enabled, they won't be able to fully authenticate without passing it. This entire section should be reworked tbh as it seems more like a footgun than anything else. A server may choose to not allow a user to remove their final second authentication factor (that is, require 2FA in some fashion). But if a server doesn't choose to allow that, we shouldn't be requiring the user to validate that they have precisely the thing they want to remove.

If you want to have an extra challenge on removal for additional assurance, allow them to authenticate using any of their registered secondary factors in order to remove them from the list.

Comment thread extensions/account-2fa.md
single-factor login in this state, as that would defeat the purpose of
2FA when the credential store has been tampered with.

### Step-up SASL Mechanisms
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This entire section should be removed, since we shouldn't be using SASL for this. The previous registry can be used for both enrollment and authentication.

Comment thread extensions/account-2fa.md
replies with `NOTE 2FA REGISTRATION_CHALLENGE` (see
[Responses](#responses)). The challenge SHOULD be valid for at most 120
seconds and SHOULD be invalidated after a successful `2FA ADD` of the
same type.
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I touch more on this below, but this command should be used for actual authentication. For enrollment, just use ADD for the entire process (even if it requires multiple back and forth messages).

Comment thread extensions/account-2fa.md
No Registered Credentials](#account-with-no-registered-credentials))
rather than degrading to single-factor. Treating credential loss as
"2FA effectively off" would let an attacker who can write to the
credential store bypass 2FA.
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If an attacker can write to the credential store, they can either disable the 2FA flag entirely or inject their own credentials that they are in possession of, so this isn't a particularly compelling reason. Come up with something better or omit the explanation.

Comment thread extensions/account-2fa.md
```

## Security Considerations

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This section appears to be normative given the proliferation of MUST. I recommend that all of these notes be rolled into the actual specification text instead of living at the bottom of the document. This section should instead be moved into non-normative prose explaining security considerations in a human-understandable manner.

Comment thread extensions/account-2fa.md
* `external` - a TLS client-certificate fingerprint, used as the
second factor via the standard
[`EXTERNAL`](https://datatracker.ietf.org/doc/html/rfc4422#appendix-A)
SASL mechanism.
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I would remove this listing from this section as it's just an additional place to (forget to) update as other mechs are added. The introduction section is more for human-readable prose to let people understand why the spec exists and what problems it solves. Diving into implementation details this early mostly serves to raise more questions than it answers.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants