-
-
Notifications
You must be signed in to change notification settings - Fork 1.4k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Make the invitation code longer to prevent brute force attacks. #11156
Comments
Bot認証で十分では? |
CAPTCHAを有効にしていればプログラムで自動で試行したりができないから問題ないと思われる |
This comment was marked as off-topic.
This comment was marked as off-topic.
ほむ |
これ、新規登録試みるのレートリミットあるから別に長くしなくてもいいのではと思ったり思わなかったり。 |
This comment was marked as off-topic.
This comment was marked as off-topic.
招待コードは事前に用意するものではなくユーザー(またはアドミン)が要請した時発行されるので、通常は総当たりされても問題ないです。 |
こちらについてはもし対応が必要であればどっちかというと招待コードの使用期限を設定したほうがよさそうです |
使用期限設定は賛成だわ🙂 |
This comment was marked as off-topic.
This comment was marked as off-topic.
長くするのには賛成ですが、102文字はさすがに長すぎるかと |
文字数を増やす、というよりはMisskeyのAdminやモデレーターが招待コードを管理できる画面を用意するだけで十分な気がします |
招待コードの管理画面があった方が良いのは確かだと思います |
もう少し現実を見て利便性を考えてほしい |
手打ちではなくコピペで使われる場合が多いとしてもまあ16文字程度が上限かな |
んーーこの提案で招待コードのセキュリティ高められるとして・・・ |
今の8文字が短いのであれば10文字くらいで良いんじゃねと思った |
This comment was marked as abuse.
This comment was marked as abuse.
招待コードの管理画面の実装だけで充分だと思う |
This comment was marked as off-topic.
This comment was marked as off-topic.
なんとですね、クレカのCVCは3桁の数字なんですよ・・・ |
まぁioには招待コード総当たりページがあるからセキュリティー上げる必要なさそうなの |
招待コードを長くした場合、招待コードを当てるより既存のユーザーのパスワード当てて乗っ取る方が簡単そう |
有効期限を先に決めてから、その期間内には総当たり攻撃で破られないであろう文字数に変更するのが良いと思います。 |
Summary
misskey/packages/backend/src/server/api/endpoints/invite.ts
Lines 45 to 47 in d5c4e77
Currently, the invitation code space is only$32^8 = 2^{40} = 1,099,511,627,776$ .
$$\frac{\binom{K}{k}\binom{N-K}{n-k}}{\binom{N}{n}}$$
$$n\times \frac{K}{N}$$
$$\frac{N}{K}$$ $240,000*16=3,840,000$ of valid invitation codes.
$$\frac{1,099,511,627,776}{3,840,000}=286,331.1530666... $$
Let us consider generating random invitation codes by pseudo-random numbers that allow non-reciprocal extraction, such as LCG in 40-bit state, to obtain valid invitation codes.
The probability that there are exactly k valid invitation codes out of n generated invitation codes is by hypergeometric distribution,
K is the number of valid invitation codes and N is the total number of possible invitation codes.
Also, the expected number of valid invitation codes if n invitation codes are generated,
And the expected value of the number of generation times required to obtain one valid invitation code is,
As the number of valid invitation codes increases, the number of required generations decreases.
For example, Misskey.io has 240,000 users. If all of them created 16 invitation codes each without using it, there would be
The expected number of invitation codes to generate before one valid invitation code is obtained is
and that means that at most 290,000 attempts will yield one valid invitation code.
290,000 is a lot of attempts for a single person to get an invitation code. However, if more than one person performs a random attempt with a script or other means, and even one successful attempt is made, the successful experience will be spread. As a result, more people may try random invitation code generation, resulting in many people being able to create accounts through fraudulent means.
To avoid this situation, I think the invitation code needs to be longer, e.g., 16 characters.$32^{16}=1,208,925,819,614,629,174,706,176$ , and the expected number of random attempts required to illegally obtain one valid invitation code out of $3,840,000$ valid invitation codes is $3.148244321913096809130666... × 10^{17}$ .
With 102 characters, the invitation code space would be
The text was updated successfully, but these errors were encountered: