Secure Coding & OWASP Top 10 for Backend · บทเรียน

การยืนยันตัวตนหลายปัจจัยและการกู้คืนบัญชี

เพิ่มความแข็งแกร่งให้การยืนยันตัวตนนอกเหนือจากรหัสผ่านด้วย MFA และออกแบบขั้นตอนการกู้คืนบัญชีที่ปลอดภัยโดยไม่เปิดช่องให้กลายเป็นประตูหลังผ่านระบบป้องกัน

บทเรียน 4 จาก 413 ขั้นตอน

การยืนยันตัวตนหลายปัจจัยและการกู้คืนบัญชี เป็นบทเรียน Secure Coding & OWASP Top 10 for Backend ฟรีบน CoddyKit นี่คือบทเรียนที่ 4 จากทั้งหมด 4 บทเรียน คุณสามารถอ่านบทเรียนทั้งหมดด้านล่างฟรี — จากนั้นลองปฏิบัติด้วยตัวคุณเองในเบราว์เซอร์พร้อมตัวแก้ไขโค้ดในตัวและติวเตอร์ AI ตลอด 24/7 บทเรียนนี้เป็นส่วนหนึ่งของเส้นทางการเรียน 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
เริ่มต้นได้ฟรี

เรียนรู้ Secure Coding & OWASP Top 10 for Backend ด้วย AI tutor — ฟรี

เขียนและเรียกใช้โค้ดจริงในเบราว์เซอร์ของคุณ รับความช่วยเหลือทันทีจาก AI tutor 24/7 และเรียนรู้ต่อจากที่คุณหยุดบนเว็บหรือในแอป

คอร์ส
12
บทเรียน
48

คำถามที่พบบ่อย

บทเรียน “การยืนยันตัวตนหลายปัจจัยและการกู้คืนบัญชี” ฟรีหรือไม่

ใช่ — ข้อความเต็มของ “การยืนยันตัวตนหลายปัจจัยและการกู้คืนบัญชี” ฟรีให้อ่านที่นี่บนเว็บ เพื่อปฏิบัติแบบโต้ตอบ (ตัวแก้ไขโค้ดในตัวและติวเตอร์ AI ตลอด 24/7) และปลดล็อคส่วนที่เหลือของคอร์ส 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 ด้วยโค้ดที่ใช้งานได้จริงที่คุณเรียกใช้โดยตรงในเบราว์เซอร์ และติวเตอร์ AI ตลอด 24/7 ตอบคำถามของคุณขณะที่คุณไปผ่านบทเรียน

คุณต้องมีประสบการณ์ก่อนที่จะเริ่มเรียน Secure Coding & OWASP Top 10 for Backend หรือไม่

ไม่จำเป็นต้องมีประสบการณ์มาก่อน Secure Coding & OWASP Top 10 for Backend บน CoddyKit ออกแบบมาสำหรับผู้เริ่มต้นไปจนถึงผู้เรียนขั้นสูง คุณสามารถเริ่มต้นที่นี่หรือเริ่มจากตัวแรกและเรียนด้วยความเร็วของคุณเอง นี่คือบทเรียนที่ 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