HOTP-- 反价值安全

HOTP - counter value security

关于安全问题,我有两个关于“(H)OTP 算法”的问题。

我们都知道 "TOTP" 是如何工作的,我们扫描一个二维码,每 30 秒显示一个新的 6-8 位代码,几乎没有魔法。

现在回到 "HOTP",除了来自 "TOTP" 的有效负载之外,我们还得到了一个 "counter" 值。

在客户端显示计数器值安全吗?或者它会导致任何安全问题吗?

还有一个一般性问题:"secret" 值总是 16 位吗? (我问是因为我看到 mfa-applications 接受少于 16 位数字)

谢谢!

第一个问题: 在客户端显示计数器值安全吗?

"counter" 不是秘密。虽然 "secret-key" 仍然是秘密,但知道当前或最近的 "counter" 值对对手没有用。如果 "secret-key" 被泄露,那么你就有麻烦了。 RFC4226 说了很多关于保持 "secret-key" 秘密的内容,但根本没有关于保持 "counter" 秘密的内容。 (对于 TOTP,显然不是!)

如果对手确实学习了 "secret key" 和 "counter",他们就会进入。如果他们必须猜测,并且 8 字节 "counter" 是随机播种的,那么这开始看起来像蛮力攻击。 RFC 的第 7.1 节给出了身份验证协议 P 的要求,包括:

RP2 - P SHOULD NOT be vulnerable to brute force attacks. This implies that a throttling/lockout scheme is RECOMMENDED on the validation server side.

因此 "counter" 安全地保持一些额外的安全性,但是 客户端和服务器都不需要这样做。即使客户端这样做,服务器也可能不会。这 不是 正式安全分析的一部分。

(RFC 的)"E.4. A Counter-Based Resynchronization Method" 要求客户端发送他们的 "counter",我们有:

RP3 - P SHOULD be implemented over a secure channel in order to protect users’ privacy and avoid replay attacks.

...没有提及安全发送 "counter",除非作为副作用。

因此,您第一个问题的简短答案是 "yes"、"yes it is safe to display the counter value on the client side" -- "safe" 是指 "safe while the secret-key remains secret"。

第二个问题: "secret"的值总是16位吗?

我猜这指的是 "secret-key",也称为 "shared secret" -- 所以 位数 你的意思是 字节 ?

RFC 第 4 节 "Algorithm Requirements" 包括:

R6 - The algorithm MUST use a strong shared secret. The length of the shared secret MUST be at least 128 bits. This document RECOMMENDs a shared secret length of 160 bits.

因此 "secret" 小于 16 字节是不符合的。