0Pricing
Secure Coding & OWASP Top 10 for Backend · レッスン

多要素認証とアカウントリカバリ

MFAによってパスワードだけに依存しない強固な認証を実現し、保護を迂回するバックドアにならない安全なアカウントリカバリフローを設計する方法を学びます。

「多要素認証とアカウントリカバリ」はCoddyKit上の無料Secure Coding & OWASP Top 10 for Backendレッスンです。 これはレッスン4/4です。 下記で完全なレッスンを無料で読むことができます。その後、ブラウザ内の組み込みコードエディタと24時間対応のAIチューターでハンズオン演習できます。 これはSecure Coding & OWASP Top 10 for Backend学習パスの一部であり、ウェブとCoddyKitアプリ全体で進捗が同期されます。 Secure Coding & OWASP Top 10 for Backendコースには全4レッスンが含まれています。

このレッスンの一部はまだ翻訳されておらず、英語で表示されています。

Beyond the Password

Strong access control and good session management still rest on one assumption: the user is who they claim. Passwords alone are weak. Multi-factor authentication adds layers so a stolen password is not enough.

The Three Factors

Authentication factors fall into categories:

  • Something you know — password, PIN
  • Something you have — phone, hardware key
  • Something you are — fingerprint, face

MFA combines two or more different categories.

TOTP Authenticator Apps

Time-based One-Time Passwords generate a 6-digit code from a shared secret and the current time. The server computes the same code to verify.

import pyotp
totp = pyotp.TOTP(user_secret)
is_valid = totp.verify(submitted_code)

Why SMS Is Weaker

SMS codes are better than nothing but vulnerable to SIM swapping and interception. Prefer TOTP apps or hardware keys; reserve SMS as a last-resort option.

Hardware Keys and WebAuthn

WebAuthn uses public-key cryptography with a hardware or platform authenticator. There is no shared secret to phish — the strongest widely available MFA.

Backup Codes

What if a user loses their phone? Issue one-time backup codes at enrollment. Store them hashed, just like passwords, and invalidate each after use.

stored = hash(backup_code)
# on use: verify then mark consumed

Recovery Is an Attack Surface

Account recovery often bypasses MFA. If recovery only needs an email link, an attacker who controls the inbox owns the account. Recovery must be as strong as login.

Secure Recovery Tokens

Recovery links should use a high-entropy, single-use, short-lived token, stored hashed and invalidated on use or password change.

token = secrets.token_urlsafe(32)
store(hash(token), expires_in=900)  # 15 minutes

Avoid Recovery Pitfalls

  • Do not reveal whether an email exists (enumeration)
  • Rate-limit recovery requests
  • Notify the user when recovery is initiated
  • Require re-enrollment of MFA after a full reset

Step-Up Authentication

For sensitive actions — changing email, large transfers — require a fresh factor even within an active session. This step-up limits the damage of a hijacked session.

Rate-Limiting the MFA Step

The MFA code entry is itself a target. A six-digit code has only a million possibilities, so without limits an attacker can brute-force it. Rate-limit and lock out after a few wrong codes, and expire each code quickly.

Quick Check

Test your MFA and recovery knowledge.

Recap

You strengthened authentication:

  • MFA combines factors from different categories
  • Prefer TOTP and WebAuthn over SMS
  • Provide hashed backup codes
  • Make recovery as strong as login with single-use, expiring tokens
  • Use step-up auth for sensitive actions

よくある質問

「多要素認証とアカウントリカバリ」レッスンは無料ですか?

はい。「多要素認証とアカウントリカバリ」の完全なテキストはこのウェブで無料で読めます。インタラクティブに演習し(組み込みコードエディタと24時間対応のAIチューター)、Secure Coding & OWASP Top 10 for Backendコースの残りをアンロックするには、CoddyKit PROにアップグレードしてください。 Secure Coding & OWASP Top 10 for Backendコースには全4レッスンが含まれています。

「多要素認証とアカウントリカバリ」で何を学びますか?

MFAによってパスワードだけに依存しない強固な認証を実現し、保護を迂回するバックドアにならない安全なアカウントリカバリフローを設計する方法を学びます。 ブラウザで直接実行するハンズオンコードでSecure Coding & OWASP Top 10 for Backendを演習し、24時間対応のAIチューターがレッスンを進める中での質問に答えます。

Secure Coding & OWASP Top 10 for Backendを始めるのに経験は必要ですか?

事前経験は必要ありません。CoddyKitのSecure Coding & OWASP Top 10 for Backendは初級者から上級者向けに構成されているため、ここから始めるか最初から始めて、自分のペースで進むことができます。 これはレッスン4/4です。

「多要素認証とアカウントリカバリ」レッスンにはどのくらい時間がかかりますか?

ほとんどのCoddyKitレッスンは約5~10分かかります。各レッスンはコンパクトでインタラクティブなので、着実に進歩し、ウェブとアプリ全体で正確に前回の場所から再開できます。

このSecure Coding & OWASP Top 10 for Backendレッスンでコードを書いて実行できますか?

はい。すべてのSecure Coding & OWASP Top 10 for Backendレッスンに組み込みコードエディタが含まれているため、ブラウザでリアルコードを書いて実行し、即座のAIフィードバックを取得できます。ローカル設定は不要です。

このコースのすべてのレッスン

  1. 強固なアクセス制御の実装
  2. 安全なユーザー認証メカニズム
  3. セッション管理のベストプラクティス
  4. 多要素認証とアカウントリカバリ
← Secure Coding & OWASP Top 10 for Backendに戻る