Computer >> บทช่วยสอนคอมพิวเตอร์ >  >> ระบบเครือข่าย >> ความปลอดภัยเครือข่าย

CHAP (Challenge-Handshake Authentication Protocol) ในความปลอดภัยเครือข่ายคืออะไร?

CHAP (Challenge-Handshake Authentication Protocol) คืออะไร?

CHAP เป็นโปรโตคอลยืนยันตัวตน (Authentication Protocol) ที่ใช้ร่วมกับ PPP (Point-to-Point Protocol) ใช้ในการเชื่อมต่อ Dial-up, VPN, DSL, และ Serial Links โดยมีกลไก Challenge-Response ที่ไม่ส่ง Password (Secret) ผ่านสายตรงๆ

CHAP ทำงานอย่างไร? (3-Way Handshake)

  1. Challenge: Authenticator (Server/NAS) ส่ง Random Challenge String ไปยัง Peer (Client)
  2. Response: Peer คำนวณ MD5(Challenge + Secret) ส่งผลลัพธ์ (Hash) กลับพร้อม Name/ID
  3. Verify: Authenticator คำนวณ MD5(Challenge + Secret) เอง เปรียบเทียบกับ Response → Match = Success

จุดสำคัญ: Secret (Password) ไม่เคยส่งผ่าน Network มีแต่ Hash เท่านั้น

CHAP vs PAP (Password Authentication Protocol)

คุณสมบัติPAPCHAP
กลไกส่ง Username/Password แบบ Plaintext (Base64 encoded)Challenge-Response with MD5 Hash
ความปลอดภัยต่ำมาก (Sniffing ได้ง่าย)สูงกว่า (Secret ไม่ส่งผ่านสาย)
Replay Attackเปราะบางป้องกันได้ (Challenge สุ่มทุกครั้ง)
การตรวจสอบซ้ำเฉพาะตอน ConnectPeriodic Re-authentication (Re-challenge)
Mutual Authไม่รองรับรองรับ (Two-way CHAP)

MS-CHAP (Microsoft CHAP) v1 และ v2

เวอร์ชันลักษณะสถานะ
MS-CHAP v1ใช้ DES-based, 1-way authentication, Weak❌ Deprecated (RFC 4249, 2012)
MS-CHAP v2Mutual Auth, Stronger Hash (SHA-1 based), Peer Challenge⚠️ Vulnerable (Dictionary/Brute-force feasible) → ไม่แนะนำใช้ใหม่

หมายเหตุ: MS-CHAP v2 ใช้ใน PPTP VPN, WPA2-Enterprise (PEAP-MSCHAPv2) - ควรย้ายไป EAP-TLS, EAP-TEAP, หรือ Certificate-based Auth

ข้อดีและข้อจำกัดของ CHAP

ข้อดีข้อจำกัด
Secret ไม่ส่งผ่าน Network (Plaintext)ต้องเก็บ Secret แบบ Plaintext/Reversible Encryption บน Server (เพื่อคำนวณ Hash เปรียบเทียบ)
ป้องกัน Replay Attack (Challenge สุ่ม)MD5 ถูก Broken (Collision) - ไม่ควรใช้ในระบบใหม่
Periodic Re-authenticationไม่มี Forward Secrecy
รองรับ Mutual AuthenticationSusceptible to Dictionary Attack (หาก Secret อ่อน)
Simple, Lightweight, Widely Supportedไม่ป้องกัน Man-in-the-Middle โดยตรง (ต้องผสมกับ TLS/VPN)

CHAP ในบริบทสมัยใหม่ (Modern Context)

  • PPP/Dial-up: ล้าสมัย (Legacy) - เหลือในบาง ISP/Enterprise Legacy
  • PPTP VPN: ใช้ MS-CHAP v2 Deprecated/Insecure → ใช้ IPsec IKEv2, WireGuard, OpenVPN, SSTP แทน
  • RADIUS/802.1X: ใช้ EAP-MSCHAPv2 (PEAP) ยังพบได้ แต่ แนะนำ EAP-TLS (Cert-based) หรือ EAP-TEAP
  • iSCSI: ใช้ CHAP สำหรับ Authentication ระหว่าง Initiator และ Target (ยังใช้อยู่)
  • PPP over Ethernet (PPPoE): ISP บางแห่งยังใช้ CHAP สำหรับ Broadband Authentication

ตัวเลือกที่ดีกว่า (Modern Alternatives)

ProtocolUse Caseข้อดี
EAP-TLS802.1X, VPN, RADIUSCertificate-based, Mutual Auth, Forward Secrecy, Strongest
EAP-TEAP802.1X (Windows 10+, Cisco ISE)TLS Tunnel + Inner EAP, Machine + User Auth, Posture Check
IKEv2 + Cert/EAPIPsec VPNStandard, Fast Reconnect, MOBIKE, Strong Crypto
WireGuardModern VPNSimple, Fast, Noise Protocol, Formal Verification
OAuth 2.0 / OIDCApplication/API AuthToken-based, Delegated Auth, Industry Standard

สรุป

CHAP เป็นโปรโตคอล Authentication แบบ Challenge-Response ที่ ดีกว่า PAP มาก (Secret ไม่ส่ง Plaintext, ป้องกัน Replay) แต่ ล้าสมัยและมีข้อจำกัด (MD5 Broken, ต้องเก็บ Secret Plaintext, No Forward Secrecy) ในระบบใหม่ ควรใช้ EAP-TLS, IKEv2, WireGuard, หรือ Certificate-based Authentication แทน