0Pricing
Secure Coding & OWASP Top 10 for Backend · 강의

안전한 비밀번호 저장 및 자격 증명 복구

비밀번호를 올바르게 해시하고 자격 증명 공격을 방어하며, 안전한 비밀번호 재설정과 계정 복구 흐름을 구축하는 방법을 익혀 보세요.

안전한 비밀번호 저장 및 자격 증명 복구은(는) CoddyKit의 무료 Secure Coding & OWASP Top 10 for Backend 강의입니다. 이것은 4개 중 4번째 강의입니다. 아래에서 전체 강의를 무료로 읽을 수 있으며, 내장 코드 에디터와 24/7 AI 튜터와 함께 브라우저에서 직접 실습할 수 있습니다. 이 강의는 Secure Coding & OWASP Top 10 for Backend 학습 경로의 일부이며, 진행 상황이 웹과 CoddyKit 앱에 동기화됩니다. Secure Coding & OWASP Top 10 for Backend 강의에는 총 4개의 강의가 포함되어 있습니다.

이 강의의 일부는 아직 번역되지 않았으며 영어로 표시됩니다.

Why Hashing Matters

Storing passwords in plaintext or with weak encoding means a single database breach exposes every user. Passwords must be stored as salted hashes using a slow, purpose-built algorithm.

This lesson covers correct hashing and secure recovery flows.

Hash, Do Not Encrypt

Passwords should be hashed, not encrypted. Encryption is reversible; if the key leaks, all passwords are exposed. Hashing is one-way: you verify by hashing the input and comparing.

  • Never use reversible encryption for passwords
  • Never use fast hashes like MD5 or SHA-1 alone

Salting

A salt is a unique random value added to each password before hashing. Salts ensure two users with the same password get different hashes, defeating precomputed rainbow tables.

Modern algorithms generate and store the salt for you.

Choosing an Algorithm

Use a deliberately slow, memory-hard algorithm: Argon2 (preferred), bcrypt, or scrypt. Their cost factor makes brute-force attacks expensive even with stolen hashes.

Hashing in Code

Here is a conceptual hashing and verification flow using a bcrypt-style API.

import bcrypt

def hash_password(plain):
    return bcrypt.hashpw(plain.encode(), bcrypt.gensalt(rounds=12))

def verify(plain, stored_hash):
    return bcrypt.checkpw(plain.encode(), stored_hash)

h = hash_password('s3cret')
print(verify('s3cret', h))

Tuning the Cost Factor

The cost factor (rounds) controls how slow hashing is. Set it so a single hash takes around 100-300ms on your hardware: slow enough to deter attackers, fast enough for login. Re-tune it as hardware improves.

Defending Against Credential Stuffing

Attackers reuse leaked credentials across sites. Defend with rate limiting, account lockout with backoff, and checks against known-breached password lists.

  • Throttle failed logins per account and per IP
  • Reject passwords found in breach corpuses
  • Alert users of logins from new devices

Constant-Time Comparison

Comparing secrets must take the same time regardless of how many characters match, or attackers can infer values via timing. Hashing libraries provide constant-time verify functions; use them instead of plain equality.

Secure Password Reset Tokens

Reset flows are a frequent weak point. Generate a high-entropy random token, store only its hash, set a short expiry, and invalidate it after one use.

import secrets, hashlib, time

def create_reset_token():
    raw = secrets.token_urlsafe(32)
    record = {
        'token_hash': hashlib.sha256(raw.encode()).hexdigest(),
        'expires_at': time.time() + 900,
        'used': False,
    }
    return raw, record  # email raw to user, store record

Avoiding Account Enumeration

Reset and login responses should not reveal whether an email exists. Return the same message regardless, and send the reset email only if the account exists. This prevents attackers from harvesting valid accounts.

Rehashing on Login

When you upgrade algorithms or cost factors, rehash a user's password on their next successful login using the new parameters. This migrates your store gradually without forcing resets.

Quick Check

Test your understanding of secure password storage.

Recap

You learned to hash with salt using Argon2 or bcrypt, tune the cost factor, defend against credential stuffing with rate limiting, compare in constant time, and build single-use expiring reset tokens that avoid account enumeration. Proper credential handling protects users even when the database is breached.

자주 묻는 질문

“안전한 비밀번호 저장 및 자격 증명 복구” 강의는 무료인가요?

네 — “안전한 비밀번호 저장 및 자격 증명 복구” 전체 내용을 이 웹사이트에서 무료로 읽을 수 있습니다. 인터랙티브하게 실습하려면(내장 코드 에디터와 24/7 AI 튜터), CoddyKit PRO로 업그레이드하면 Secure Coding & OWASP Top 10 for Backend 강의 전체를 잠금 해제할 수 있습니다. Secure Coding & OWASP Top 10 for Backend 강의에는 총 4개의 강의가 포함되어 있습니다.

“안전한 비밀번호 저장 및 자격 증명 복구”에서 뭘 배우나요?

비밀번호를 올바르게 해시하고 자격 증명 공격을 방어하며, 안전한 비밀번호 재설정과 계정 복구 흐름을 구축하는 방법을 익혀 보세요. 브라우저에서 직접 실행하는 실습 코드로 Secure Coding & OWASP Top 10 for Backend을(를) 배우며, 24/7 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. 다중 요소 인증(MFA)
  2. OAuth 2.0과 OpenID Connect
  3. JWT 보안과 모범 사례
  4. 안전한 비밀번호 저장 및 자격 증명 복구
← Secure Coding & OWASP Top 10 for Backend(으)로 돌아가기